From 81b0612a47295afce1ce41376b26d290f23dcfcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=AA=E6=80=9D=E5=A5=87?= Date: Mon, 25 Jan 2021 14:16:12 +0800 Subject: [PATCH 01/61] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Dmvnw=E5=8F=AF=E6=89=A7=E8=A1=8C=E6=9D=83=E9=99=90?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20*=20fix=20maven=20wrapper=20permission=20i?= =?UTF-8?q?ssue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mvnw | 0 mvnw.cmd | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 mvnw mode change 100644 => 100755 mvnw.cmd diff --git a/mvnw b/mvnw old mode 100644 new mode 100755 diff --git a/mvnw.cmd b/mvnw.cmd old mode 100644 new mode 100755 -- Gitee From c0bb62b4825fb5b0361f298cc7b3a9ed74955501 Mon Sep 17 00:00:00 2001 From: bugu <837948266@qq.com> Date: Wed, 27 Jan 2021 13:59:10 +0800 Subject: [PATCH 02/61] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E8=B0=83?= =?UTF-8?q?=E6=95=B4BE=E3=80=81VO=E9=83=A8=E5=88=86=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E9=A3=8E=E6=A0=BC=EF=BC=8C=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=20*=20=E4=BC=98=E5=8C=96:=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4BE=E3=80=81VO=E9=83=A8=E5=88=86=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E9=A3=8E=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../be/definition/GspBizEntityElement.java | 2 +- .../be/definition/GspBizEntityObject.java | 24 +- .../be/definition/GspBusinessEntity.java | 11 +- .../model/be/definition/common/BEConst.java | 32 +- .../common/OperationConvertUtils.java | 4 +- .../be/definition/common/SysnDboUtils.java | 8 +- .../json/model/BizEntitySerializer.java | 4 +- .../json/object/BizObjectSerializer.java | 4 +- .../operation/BizOperationSerializer.java | 12 +- .../definition/operation/BizActionBase.java | 8 +- .../be/definition/operation/BizOperation.java | 6 +- .../operation/BizOperationCollection.java | 2 +- .../definition/operation/Determination.java | 16 +- .../be/definition/operation/Validation.java | 45 +- .../collection/BizActionCollection.java | 31 +- .../collection/BizMgrActionCollection.java | 36 +- .../collection/DeterminationCollection.java | 35 +- .../collection/ValidationCollection.java | 32 +- .../componentbase/BizParameterCollection.java | 16 +- .../definition/cef/IGspCommonDataType.java | 2 +- .../definition/cef/IGspCommonField.java | 2 +- .../definition/cef/collection/BaseList.java | 125 +-- .../GspAssociationKeyCollection.java | 40 +- .../collection/GspEnumValueCollection.java | 32 +- .../cef/collection/GspFieldCollection.java | 1 + .../cef/element/GspAssociationKey.java | 4 +- .../definition/cef/element/GspEnumValue.java | 5 +- .../cef/entity/GspCommonDataType.java | 17 +- .../definition/cef/entity/GspCommonField.java | 79 +- .../cef/entity/MappingRelation.java | 37 +- .../common/definition/cef/json/CefNames.java | 4 - .../definition/cef/json/SerializerUtils.java | 51 +- .../cef/json/element/CefFieldSerializer.java | 16 +- .../element/GspAssociationSerializer.java | 8 +- .../object/GspCommonDataTypeDeserializer.java | 4 +- .../object/GspCommonDataTypeSerializer.java | 28 +- .../variable/CommonVariableCollection.java | 1 + .../cef/variable/CommonVariableEntity.java | 23 - .../commonmodel/IGspCommonElement.java | 3 +- .../commonmodel/IGspCommonModel.java | 4 +- .../collection/GspElementCollection.java | 9 +- .../collection/GspObjectCollection.java | 4 +- .../GspUniqueConstraintCollection.java | 12 +- .../commonmodel/entity/GspCommonElement.java | 49 +- .../commonmodel/entity/GspCommonModel.java | 44 +- .../commonmodel/entity/GspCommonObject.java | 22 +- .../entity/element/GspCommonAssociation.java | 4 +- .../entity/object/GspColumnGenerate.java | 4 +- .../entity/object/GspUniqueConstraint.java | 4 +- .../json/element/CmElementSerializer.java | 12 +- .../json/model/CommonModelSerializer.java | 8 +- .../json/object/CmObjectSerializer.java | 8 +- .../ubml/model/framework/api/FileService.java | 12 +- .../model/vo/definition/GspViewModel.java | 734 ++++++++---------- .../vo/definition/GspViewModelElement.java | 606 +++++++-------- .../model/vo/definition/GspViewObject.java | 51 +- .../action/ActionFormatParameter.java | 132 ++-- .../vo/definition/action/MappedBizAction.java | 64 +- .../vo/definition/action/MappedCdpAction.java | 66 +- .../action/MappedCdpActionBase.java | 127 ++- .../vo/definition/action/VMActionResult.java | 76 +- .../vo/definition/action/ViewModelAction.java | 385 +++++---- .../collection/VMActionCollection.java | 31 +- .../collection/VMElementCollection.java | 188 ++--- .../collection/ValueHelpConfigCollection.java | 127 ++- .../vo/definition/common/ConvertUtils.java | 48 +- .../vo/definition/common/LinkBeUtils.java | 24 +- .../vo/definition/common/ValueHelpConfig.java | 17 +- .../dataextendinfo/VoDataExtendInfo.java | 3 - .../model/ValueHelpConfigDeserizlizer.java | 2 +- .../json/model/ValueHelpConfigSerizlizer.java | 2 +- .../json/model/ViewModelSerializer.java | 8 +- .../json/operation/VmActionDeserializer.java | 2 +- .../json/operation/VmActionSerializer.java | 2 +- 74 files changed, 1585 insertions(+), 2116 deletions(-) diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityElement.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityElement.java index a5218bf..bcab516 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityElement.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityElement.java @@ -39,7 +39,7 @@ import org.openatom.ubml.model.common.definition.commonmodel.entity.element.GspC public class GspBizEntityElement extends GspCommonElement implements Cloneable { private transient RequiredCheckOccasion requiredCheckOccasion = RequiredCheckOccasion.All; - // region 属性 + // 属性 /** * 是否默认为空值 */ diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityObject.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityObject.java index d54619a..d954aaf 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityObject.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityObject.java @@ -57,7 +57,7 @@ import org.openatom.ubml.model.common.definition.commonmodel.entity.object.GspCo @JsonSerialize(using = BizObjectSerializer.class) public class GspBizEntityObject extends GspCommonObject implements Cloneable { - // region 私有属性 + // 私有属性 private DeterminationCollection determinations; private ValidationCollection validations; private BizActionCollection bizActions; @@ -151,7 +151,7 @@ public class GspBizEntityObject extends GspCommonObject implements Cloneable { super.setParentObject(value); } - // // region 权限 + // // 权限 // private java.util.ArrayList authFieldInfos; // /** @@ -164,9 +164,9 @@ public class GspBizEntityObject extends GspCommonObject implements Cloneable { // void setAuthFieldInfos(java.util.ArrayList value) - // endregion - // region CommonDataType + + // CommonDataType /** * [保存前]联动计算 @@ -258,11 +258,11 @@ public class GspBizEntityObject extends GspCommonObject implements Cloneable { // throw new RuntimeException("业务实体中无法赋值属性[ValAfterModify]"); } - // endregion - // endregion - // region 方法 + + + // 方法 /** * 克隆 @@ -302,7 +302,7 @@ public class GspBizEntityObject extends GspCommonObject implements Cloneable { return new GspBizEntityElement(); } - // region 依赖实体 + // 依赖实体 public final void mergeWithDependentObject(GspBizEntityObject dependentObject, boolean isInit) { if (!getIsRef()) { return; @@ -473,7 +473,7 @@ public class GspBizEntityObject extends GspCommonObject implements Cloneable { } } - // endregion + public final void initMainObject() { setObjectType(GspCommonObjectType.MainObject); @@ -482,7 +482,7 @@ public class GspBizEntityObject extends GspCommonObject implements Cloneable { getBizActions().add(new RetrieveBEAction()); } - // region 创建BE子节点 + // 创建BE子节点 /** * 根据BE父节点生成子节点 @@ -567,7 +567,7 @@ public class GspBizEntityObject extends GspCommonObject implements Cloneable { return idElement; } - // endregion - // endregion + + } \ No newline at end of file diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBusinessEntity.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBusinessEntity.java index 114ce1a..9004eb7 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBusinessEntity.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBusinessEntity.java @@ -47,7 +47,7 @@ import org.openatom.ubml.model.common.definition.entity.IMetadataContent; @JsonSerialize(using = BizEntitySerializer.class) @JsonDeserialize(using = BizEntityDeserializer.class) public class GspBusinessEntity extends GspCommonModel implements IMetadataContent { - // region 属性 + // 属性 boolean isUsingTimeStamp; boolean enableCaching = false; @@ -70,7 +70,7 @@ public class GspBusinessEntity extends GspCommonModel implements IMetadataConten private String cacheConfiguration = ""; private BizMgrActionCollection beMgrActions; - // region Ctor + // Ctor public GspBusinessEntity() { getBizMgrActions().add(new QueryMgrAction()); getBizMgrActions().add(new RetrieveDefaultMgrAction()); @@ -98,6 +98,7 @@ public class GspBusinessEntity extends GspCommonModel implements IMetadataConten /** * BE根节点 */ + @Override public final GspBizEntityObject getMainObject() { return (GspBizEntityObject)super.getMainObject(); } @@ -219,7 +220,7 @@ public class GspBusinessEntity extends GspCommonModel implements IMetadataConten return enableTreeDtm; } - // endregion + public void setEnableTreeDtm(boolean value) { enableTreeDtm = value; @@ -354,9 +355,7 @@ public class GspBusinessEntity extends GspCommonModel implements IMetadataConten * * @return */ - // C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // ORIGINAL LINE: public new object clone() + @Override public GspBusinessEntity clone() { GspBusinessEntity be = (GspBusinessEntity)super.clone(); if (be == null) { diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BEConst.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BEConst.java index 902ecdb..62799b6 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BEConst.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BEConst.java @@ -25,7 +25,7 @@ package org.openatom.ubml.model.be.definition.common; */ public final class BEConst { - //#region ElementName + //ElementName /** * BOEntity */ @@ -171,12 +171,12 @@ public final class BEConst { */ public static final String BE_EXTIONSION_ITEM = "BOExtionsionItem"; - //#endregion - //#region AttributeNames - //#region Common + //AttributeNames + + //Common public static final String ID = "ID"; public static final String CODE = "Code"; public static final String NAME = "Name"; @@ -185,10 +185,10 @@ public final class BEConst { public static final String ORDER = "Order"; public static final String GENCOMP = "IsGenerateComponent"; - //#endregion - //#region BE + + //BE /** * BEDataLockType */ @@ -199,10 +199,10 @@ public final class BEConst { */ public static final String BE_CMP_SSEMBLY_NAME = "ComponentAssemblyName"; - //#endregion - //#region Element + + //Element /** * BEElementExpression */ @@ -210,19 +210,19 @@ public final class BEConst { public static final String BE_EXPRESS_TARGET_ELEMENT = "ExpressionTargetElement"; - //#endregion - //#region Object + + //Object /** * BEObjectIsRootNode */ public static final String BE_OBJECT_IS_ROOT_NODE = "IsRootNode"; - //#endregion - //#region Operation + + //Operation /** * MethodId */ @@ -323,10 +323,10 @@ public final class BEConst { public static final String BE_OP_VALIDATIONTRIGGERPOINT_KEY = "ValidationTriggerPointKey"; public static final String BE_OP_VALIDATIONTRIGGERPOINT_VALUE = "ValidationTriggerPointValue"; - //#endregion - //#region Authority + + //Authority public static final String BE_AUTH_INFOS = "AuthorizationInfos"; public static final String BE_AUTH_INFO = "AuthorizationInfo"; @@ -345,8 +345,8 @@ public final class BEConst { public static final String BE_AUTH_ACTION_OP_NAME = "AuthActionOpName"; - //#endregion - //#endregion + + } \ No newline at end of file diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/OperationConvertUtils.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/OperationConvertUtils.java index 46a1e8d..e4cc69d 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/OperationConvertUtils.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/OperationConvertUtils.java @@ -74,7 +74,7 @@ public class OperationConvertUtils { return cVals; } - // region 私有方法 + // 私有方法 public static CommonDetermination convertToCommonDtm(Determination dtm) { CommonDetermination cDtm = new CommonDetermination(); convertToCommonOperation(cDtm, dtm); @@ -138,5 +138,5 @@ public class OperationConvertUtils { commonOp.setComponentName(bizOp.getComponentName()); commonOp.setComponentPkgName(bizOp.getComponentPkgName()); } - // endregion + } \ No newline at end of file diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/SysnDboUtils.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/SysnDboUtils.java index 919bc2b..122d4e9 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/SysnDboUtils.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/SysnDboUtils.java @@ -37,7 +37,7 @@ package org.openatom.ubml.model.be.definition.common; // */ //public class SysnDboUtils { // -// //region createDbo +// //createDbo // public static DatabaseObjectTable createDbo(GspBizEntityObject bizObject, String boId, Boolean isUsingTimeStamp){ // DatabaseObjectTable table = generateDboFromBizObject(bizObject, boId, bizObject.getRefObjectName(), isUsingTimeStamp); // bizObject.setRefObjectName(table.getId()); @@ -84,9 +84,9 @@ package org.openatom.ubml.model.be.definition.common; // return false; // } // -// //endregion // -// //region addBboColumn +// +// //addBboColumn // public static void addDboColumn(GspBizEntityElement beElement, DatabaseObjectTable table, String primaryKeyID) { // String refEleID = Guid.newGuid().toString(); // beElement.setColumnID(refEleID); @@ -226,5 +226,5 @@ package org.openatom.ubml.model.be.definition.common; // this.scale = scale; // } // } -// //endregion +// //} diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/model/BizEntitySerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/model/BizEntitySerializer.java index a9fff89..81bb8fe 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/model/BizEntitySerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/model/BizEntitySerializer.java @@ -37,7 +37,7 @@ import org.openatom.ubml.model.common.definition.commonmodel.json.object.CmObjec */ public class BizEntitySerializer extends CommonModelSerializer { - //region BaseProp + //BaseProp @Override protected void writeExtendModelProperty(IGspCommonModel commonModel, JsonGenerator writer) { GspBusinessEntity be = (GspBusinessEntity)commonModel; @@ -71,7 +71,7 @@ public class BizEntitySerializer extends CommonModelSerializer { private BizMgrActionCollectionSerializer getMgrActionsConverter() { return new BizMgrActionCollectionSerializer(); } - //endregion + @Override protected void writeExtendModelSelfProperty(IGspCommonModel iGspCommonModel, JsonGenerator jsonGenerator) { diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/object/BizObjectSerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/object/BizObjectSerializer.java index 4583a2e..4c08e54 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/object/BizObjectSerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/object/BizObjectSerializer.java @@ -46,7 +46,7 @@ public class BizObjectSerializer extends CmObjectSerializer { private ValCollectionSerializer valCollectionSerializer = new ValCollectionSerializer(); private BizActionCollectionSeriallizer actionCollectionSeriallizer = new BizActionCollectionSeriallizer(); - //region BaseProp + //BaseProp @Override protected void writeExtendObjectBaseProperty(JsonGenerator writer, IGspCommonObject commonObject) { GspBizEntityObject bizObject = (GspBizEntityObject)commonObject; @@ -110,7 +110,7 @@ public class BizObjectSerializer extends CmObjectSerializer { // SerializerUtils.WriteEndArray(writer); // } - //endregion + @Override diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationSerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationSerializer.java index 94f180e..659cd62 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationSerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationSerializer.java @@ -44,7 +44,7 @@ public abstract class BizOperationSerializer extends Jso SerializerUtils.writeEndObject(gen); } - //region BaseProp + //BaseProp private void writeBaseProperty(BizOperation op, JsonGenerator writer) { SerializerUtils.writePropertyValue(writer, CommonModelNames.ID, op.getID()); @@ -63,9 +63,9 @@ public abstract class BizOperationSerializer extends Jso } return false; } - //endregion - //region SelfProp + + //SelfProp private void writeSelfProperty(BizOperation op, JsonGenerator writer) { SerializerUtils.writePropertyValue(writer, CommonModelNames.CODE, op.getCode()); SerializerUtils.writePropertyValue(writer, CommonModelNames.NAME, op.getName()); @@ -87,11 +87,11 @@ public abstract class BizOperationSerializer extends Jso writeExtendOperationSelfProperty(writer, op); } - //endregion - //region 抽象方法 + + //抽象方法 protected abstract void writeExtendOperationBaseProperty(JsonGenerator writer, BizOperation op); protected abstract void writeExtendOperationSelfProperty(JsonGenerator writer, BizOperation op); - //endregion + } diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizActionBase.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizActionBase.java index 824ec0b..f909993 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizActionBase.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizActionBase.java @@ -28,7 +28,7 @@ import org.openatom.ubml.model.be.definition.operation.componentinterface.IBizPa */ public abstract class BizActionBase extends BizOperation implements Cloneable { - // region 属性 + // 属性 private java.util.ArrayList opIdList = new java.util.ArrayList(); // private AuthType authType = AuthType.TransAuth; @@ -67,9 +67,9 @@ public abstract class BizActionBase extends BizOperation implements Cloneable { privateReturnValue = value; } - // endregion - // region 方法 + + // 方法 public java.util.ArrayList getOpIdList() { return (opIdList != null) ? opIdList : (opIdList = new java.util.ArrayList()); @@ -97,5 +97,5 @@ public abstract class BizActionBase extends BizOperation implements Cloneable { } } - // endregion + } \ No newline at end of file diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizOperation.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizOperation.java index db13757..a7a3503 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizOperation.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizOperation.java @@ -186,9 +186,9 @@ public abstract class BizOperation implements Cloneable { this.customizationInfo = customizationInfo; } - // endregion - // region ���� + + // ���� /** * Equals���� @@ -310,5 +310,5 @@ public abstract class BizOperation implements Cloneable { setIsVisible(dependentOperation.getIsVisible()); } - // endregion + } \ No newline at end of file diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizOperationCollection.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizOperationCollection.java index 5e99630..95ecc30 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizOperationCollection.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizOperationCollection.java @@ -37,7 +37,7 @@ public class BizOperationCollection extends BaseList implements Cl public BizOperationCollection() { } - // endregion + @Override public boolean add(BizOperation op) { return super.add(op); } diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/Determination.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/Determination.java index 199abc9..c4334e3 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/Determination.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/Determination.java @@ -32,24 +32,24 @@ import org.openatom.ubml.model.be.definition.collection.DtmElementCollection; */ public class Determination extends BizOperation implements Cloneable { - // region 字段 + // 字段 private DtmElementCollection rqtElements; private java.util.HashMap requestChildElements; // private java.util.HashMap preDtmId; - // endregion - // region 构造函数 + + // 构造函数 /** * Determination类型 */ private BEDeterminationType privateDeterminationType = BEDeterminationType.forValue(0); - // endregion - // region 属性 + + // 属性 /** * 触发时机的类型 */ @@ -136,9 +136,9 @@ public class Determination extends BizOperation implements Cloneable { // return preDtmId; // } - // endregion - // region 方法 + + // 方法 /** * 判断是否相等 @@ -216,6 +216,6 @@ public class Determination extends BizOperation implements Cloneable { // } } - // endregion + } \ No newline at end of file diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/Validation.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/Validation.java index 1bc818f..964cca4 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/Validation.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/Validation.java @@ -103,38 +103,6 @@ public class Validation extends BizOperation implements Cloneable { validationTriggerPoints = value; } - // endregion - - // //#region Private Methods - - // private java.util.List InitSucceedings() - // { - - // succeedings = InitValidationsById(getSucceedingIds()); - // return succeedings; - // } - - // private java.util.List InitPrecedings() - // { - // precedings = InitValidationsById(getPrecedingIds()); - // return precedings; - // } - - // private java.util.List InitValidationsById(java.util.List - // idList) - // { - // //������� - // Object tempVar = getOwner().getValidations().firstOrDefault(item { return - // item.getID(id.equals())); - // //C# TO JAVA CONVERTER TODO TASK: Lambda expressions and anonymous methods - // are not converted by C# to Java Converter: - // return idList.select(id { return (Validation)((tempVar instanceof Validation) - // ? tempVar : null)).toList(); - // } - - // //#endregion - - // region ���� /** * �ж���� @@ -149,10 +117,10 @@ public class Validation extends BizOperation implements Cloneable { } /** - * ��дEquals + * Equals * - * @param other �����뵱ǰУ�����Ƚϵ�У������� - * @return ��ȷ���true + * @param other + * @return true */ protected final boolean equals(Validation other) { // return super.equals(other) && getOrder() == other.getOrder() && @@ -162,7 +130,7 @@ public class Validation extends BizOperation implements Cloneable { } /** - * ��д GetHashCode + * GetHashCode * * @return */ @@ -187,7 +155,7 @@ public class Validation extends BizOperation implements Cloneable { } /** - * Clone���� + * Clone * * @param isGenerateId * @return @@ -219,10 +187,9 @@ public class Validation extends BizOperation implements Cloneable { // setPrecedingIds(dependentValidation.getPrecedingIds()); } - // endregion /** - * �������� + * */ @Override public BEOperationType getOpType() { diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/BizActionCollection.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/BizActionCollection.java index b0540ea..0602ddb 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/BizActionCollection.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/BizActionCollection.java @@ -30,6 +30,7 @@ import org.openatom.ubml.model.be.definition.operation.BizOperationCollection; public class BizActionCollection extends BizOperationCollection { private static final long serialVersionUID = 1L; + @Override public final boolean add(BizOperation operation) { if (operation instanceof BizAction) { operation.setOwner(getOwner()); @@ -38,36 +39,6 @@ public class BizActionCollection extends BizOperationCollection { throw new RuntimeException("错误的Action类型"); } - // /** - // 克隆BEAction动作集合 - - // @param isGenerateId 是否生成Id - // @return 返回动作集合 - // */ - // //C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // //ORIGINAL LINE: public new object clone(bool isGenerateId) - // public final BizActionCollection clone(boolean isGenerateId) - // { - // BizActionCollection col = new BizActionCollection(); - // //C# TO JAVA CONVERTER TODO TASK: Lambda expressions and anonymous methods - // are not converted by C# to Java Converter: - // col.addRange(this.select(item { return (BizAction)item.clone(isGenerateId))); - // return col; - // } - - // /** - // * 克隆BEAction动作集合 - // * - // * @return 返回动作集合 - // */ - // // C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s - // shadowing - // // via the 'new' keyword: - // // ORIGINAL LINE: public new object clone() - // public final Object clone() { - // return clone(false); - // } @Override public BizActionCollection clone() { return (BizActionCollection)super.clone(); diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/BizMgrActionCollection.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/BizMgrActionCollection.java index 98db55c..5832669 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/BizMgrActionCollection.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/BizMgrActionCollection.java @@ -30,9 +30,8 @@ import org.openatom.ubml.model.be.definition.operation.BizOperationCollection; public class BizMgrActionCollection extends BizOperationCollection { private static final long serialVersionUID = 1L; - // C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // ORIGINAL LINE: public new void add(BizOperation operation) + + @Override public final boolean add(BizOperation operation) { if (operation instanceof BizMgrAction) { return super.add(operation); @@ -40,37 +39,6 @@ public class BizMgrActionCollection extends BizOperationCollection { throw new RuntimeException("错误的Action类型"); } - // /** - // 克隆BEMgrAction动作集合 - - // @param isGenerateId 是否生成Id - // @return 返回动作集合 - // */ - // //C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // //ORIGINAL LINE: public new object clone(bool isGenerateId) - // public final Object clone(boolean isGenerateId) - // { - // BizMgrActionCollection col = new BizMgrActionCollection(); - // //C# TO JAVA CONVERTER TODO TASK: Lambda expressions and anonymous methods - // are not converted by C# to Java Converter: - // col.addRange(this.select(item { return - // (BizMgrAction)item.clone(isGenerateId))); - // return col; - // } - - // /** - // * 克隆BEMgrAction动作集合 - // * - // * @return 返回动作集合 - // */ - // // C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s - // shadowing - // // via the 'new' keyword: - // // ORIGINAL LINE: public new object clone() - // public final Object clone() { - // return clone(false); - // } @Override public BizMgrActionCollection clone() { return (BizMgrActionCollection)super.clone(); diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/DeterminationCollection.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/DeterminationCollection.java index 37ca1e0..d317fcc 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/DeterminationCollection.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/DeterminationCollection.java @@ -32,9 +32,7 @@ import org.openatom.ubml.model.be.definition.operation.Determination; public class DeterminationCollection extends BizOperationCollection { private static final long serialVersionUID = 1L; - // C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // ORIGINAL LINE: public new void add(BizOperation operation) + @Override public final boolean add(BizOperation operation) { if (operation instanceof Determination) { operation.setOwner(getOwner()); @@ -43,37 +41,6 @@ public class DeterminationCollection extends BizOperationCollection { throw new RuntimeException("错误的Determination类型"); } - // /** - // 克隆BE Determinations动作集合 - - // @param isGenerateId 是否生成Id - // @return 返回动作集合 - // */ - // //C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // //ORIGINAL LINE: public new object clone(bool isGenerateId) - // public final DeterminationCollection clone(boolean isGenerateId) - // { - // DeterminationCollection col = new DeterminationCollection(); - // //C# TO JAVA CONVERTER TODO TASK: Lambda expressions and anonymous methods - // are not converted by C# to Java Converter: - // col.addRange(this.select(item { return - // (Determination)item.clone(isGenerateId))); - // return col; - // } - - // /** - // 克隆BE Determinations动作集合 - - // @return 返回动作集合 - // */ - // //C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // //ORIGINAL LINE: public new object clone() - // public final Object clone() - // { - // return clone(false); - // } @Override public DeterminationCollection clone() { diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/ValidationCollection.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/ValidationCollection.java index bc44c08..d10772f 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/ValidationCollection.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/ValidationCollection.java @@ -30,6 +30,7 @@ import org.openatom.ubml.model.be.definition.operation.Validation; public class ValidationCollection extends BizOperationCollection { private static final long serialVersionUID = 1L; + @Override public final boolean add(BizOperation operation) { if (operation instanceof Validation) { operation.setOwner(getOwner()); @@ -38,37 +39,6 @@ public class ValidationCollection extends BizOperationCollection { throw new RuntimeException("错误的Validation类型"); } - // /** - // 克隆BE Validations动作集合 - - // @param isGenerateId 是否生成Id - // @return 返回动作集合 - // */ - // //C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // //ORIGINAL LINE: public new object clone(bool isGenerateId) - // public final Object clone(boolean isGenerateId) - // { - // ValidationCollection col = new ValidationCollection(); - // //C# TO JAVA CONVERTER TODO TASK: Lambda expressions and anonymous methods - // are not converted by C# to Java Converter: - // col.addRange(this.select(item { return - // (Validation)item.clone(isGenerateId))); - // return col; - // } - - // /** - // 克隆BE Validations动作集合 - - // @return 返回动作集合 - // */ - // //C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // //ORIGINAL LINE: public new object clone() - // public final Object clone() - // { - // return clone(false); - // } @Override public ValidationCollection clone() { diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/componentbase/BizParameterCollection.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/componentbase/BizParameterCollection.java index b883903..e9ce0d0 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/componentbase/BizParameterCollection.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/componentbase/BizParameterCollection.java @@ -35,7 +35,7 @@ public class BizParameterCollection extends ArrayList -1 && index < getCount()) { return compParameters.get(index); @@ -110,20 +110,20 @@ public class BizParameterCollection extends ArrayList GetEnumerator() // { // for (IBizParameter item : compParameters) @@ -137,7 +137,7 @@ public class BizParameterCollection extends ArrayList extends java.util.ArrayList implements java.util.Lis private static final long serialVersionUID = 1L; - /** - * 操作的数组 - */ -// protected ArrayList _list = new ArrayList(); /** * 构造一个新的列表 @@ -41,8 +37,6 @@ public class BaseList extends java.util.ArrayList implements java.util.Lis public BaseList() { } - // region IList 成员 - /** * 获取、设置指定位置的项目 */ @@ -114,51 +108,13 @@ public class BaseList extends java.util.ArrayList implements java.util.Lis * @param value * @return */ + @Override public boolean contains(Object value) { return super.contains(value); } -// /** -// * 清除所有的内容 -// * -// */ -// public void clear() { -// _list.clear(); -// } - - /** - * 返回指定项目的索引 - * - * @param value 当前列表的任意一项 - * @return 位置 - */ -// public int indexOf(Object value) { -// for (int i = 0; i < _list.size(); i++) { -// if (_list.get(i) == value) { -// return i; -// } -// } -// return -1; -// } - - /** - * 添加新项目 - * - * @param value 新项目 - * @return 添加到的位置 - */ -// public void add(T value) { -// _list.add(value); -// } - - /** - * 是否固定尺寸 - */ - // public boolean IsFixedSize => _list.IsFixedSize; - - // endregion - // region ICollection 成员 + // ICollection 成员 public final boolean getIsSynchronized() { // TODO: 添加 BaseList.IsSynchronized getter 实现 return false; @@ -168,84 +124,9 @@ public class BaseList extends java.util.ArrayList implements java.util.Lis return super.size(); } - // public final void CopyTo(ArrayList array, int index) { - // _list.subList(array, index); - // } - - // public Object getSyncRoot(){ _list.SyncRoot;} - - // endregion - - // region IEnumerable 成员 - - // public final Iterable getEnumerator() { - // return _list.iterator(); - // } - - // endregion - - // /** - // * 列表的枚举器类 - // * - // */ - // // C# TO JAVA CONVERTER TODO TASK: The interface type was changed to the - // closest - // // equivalent Java type, but the methods implemented will need adjustment: - // public static class ListEnumerator implements java.util.Iterable { - // public BaseList _base = null; - // private int index = -1; - - // public ListEnumerator(BaseList list) { - // _base = list; - // } - - // // region IEnumerator 成员 - - // /** - // * 重置 - // * - // */ - // public final void reset() { - // index = -1; - // } - - // /** - // 获取当前项 - - // */ - // public Object Current - // { - // return _base._list[index]; - // } - - // /** - // * 是否有下一个项目 - // * - // * @return - // */ - // public final boolean moveNext() { - // return (++index) < _base.size(); - // } - - // @Override - // public boolean hasNext() { - // return false; - // } - - // @Override - // public Object next() { - // return null; - // } - - // // C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: - // // endregion - - // } - - // region Clonenable + @Override @SuppressWarnings("unchecked") public BaseList clone() { return (BaseList)super.clone(); } - //// endregion } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspAssociationKeyCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspAssociationKeyCollection.java index 0e511c4..8249f98 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspAssociationKeyCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspAssociationKeyCollection.java @@ -59,6 +59,7 @@ public class GspAssociationKeyCollection extends BaseList imp * * @param index */ + @Override public void removeAt(int index) { remove(index); } @@ -69,46 +70,9 @@ public class GspAssociationKeyCollection extends BaseList imp * @param index * @param associationKey */ + @Override public final void insert(int index, GspAssociationKey associationKey) { super.insert(index, associationKey); } - /** - * Index - * - */ - // C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // ORIGINAL LINE: public new GspAssociationKey this[int index] => - // (GspAssociationKey)((_list[index] instanceof GspAssociationKey) ? - // _list[index] : null); - // public GspAssociationKey this[int index] => - // (GspAssociationKey)((_list.get(index) instanceof GspAssociationKey) ? - // _list.get(index) : null); - - // //C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: - // //#region ICloneable Members - - // /** - // 克隆 - - // @return - // */ - // public Object clone() - // { - // Object tempVar = Memberwiseclone(); - // GspAssociationKeyCollection newObj = (GspAssociationKeyCollection)((tempVar - // instanceof GspAssociationKeyCollection) ? tempVar : null); - // newObj._list = new java.util.arrayList(); - // for (GspAssociationKey item : this) - // { - // Object tempVar2 = item.clone(); - // newObj.add((GspAssociationKey)((tempVar2 instanceof GspAssociationKey) ? - // tempVar2 : null)); - // } - // return newObj; - // } - - // //C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: - // //#endregion } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspEnumValueCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspEnumValueCollection.java index 22227bb..f9390e0 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspEnumValueCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspEnumValueCollection.java @@ -63,6 +63,7 @@ public class GspEnumValueCollection extends BaseList implements Cl * * @param index */ + @Override public void removeAt(int index) { remove(index); } @@ -73,38 +74,11 @@ public class GspEnumValueCollection extends BaseList implements Cl * @param index * @param element */ + @Override public final void insert(int index, GspEnumValue element) { super.insert(index, element); } - /** - * Index[int] - * - */ - // C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // ORIGINAL LINE: public new GspEnumValue this[int index] => - // (GspEnumValue)((_list[index] instanceof GspEnumValue) ? _list[index] : null); - // public GspEnumValue this[int index] => (GspEnumValue)((_list.get(index) - // instanceof GspEnumValue) ? _list.get(index) : null); - - // /// - // /// Index[string] - // /// - // public Element this[string id] - // { - // get - // { - // foreach(Element _elem in _list) - // { - // if(id.equals(_elem.ID)) - // return _elem; - // } - // return null; - // } - // } - - // region ICloneable Members /** * 克隆 @@ -115,5 +89,5 @@ public class GspEnumValueCollection extends BaseList implements Cl return (GspEnumValueCollection)super.clone(); } - // endregion + } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspFieldCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspFieldCollection.java index 2e81559..bbaa70c 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspFieldCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspFieldCollection.java @@ -132,6 +132,7 @@ public class GspFieldCollection extends BaseList implements IFi } } + @Override public IGspCommonField getItem(int index) { return super.get(index); } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspAssociationKey.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspAssociationKey.java index 61ae966..8eced0f 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspAssociationKey.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspAssociationKey.java @@ -100,14 +100,13 @@ public class GspAssociationKey implements Cloneable { refdataModelName = value; } - /// region ICloneable Members - /** * 克隆 * * @return * @throws CloneNotSupportedException */ + @Override public final GspAssociationKey clone() { Object tempVar; try { @@ -124,5 +123,4 @@ public class GspAssociationKey implements Cloneable { return newAssKey; } - /// endregion } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspEnumValue.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspEnumValue.java index 74d4313..1bc5a07 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspEnumValue.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspEnumValue.java @@ -118,14 +118,13 @@ public class GspEnumValue implements Cloneable { privateI18nResourceInfoPrefix = value; } -//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: - //#region ICloneable Members /** * 克隆 * * @return */ + @Override public final GspEnumValue clone() { GspEnumValue newEnumValue = new GspEnumValue(); newEnumValue.val = this.val; @@ -137,6 +136,4 @@ public class GspEnumValue implements Cloneable { return newEnumValue; } -//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: - //#endregion } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonDataType.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonDataType.java index 6eb932f..b9b7361 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonDataType.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonDataType.java @@ -33,9 +33,8 @@ import org.openatom.ubml.model.common.definition.cef.util.Guid; * @Version: V1.0 */ public abstract class GspCommonDataType implements IGspCommonDataType { - // region 私有属性 + // 私有属性 private String id = Guid.newGuid().toString(); - ; private String code = ""; private String name = ""; private CommonDtmCollection dtmBeforeSave = new CommonDtmCollection(); @@ -49,20 +48,20 @@ public abstract class GspCommonDataType implements IGspCommonDataType { private List bizTagIds; private Boolean bigNumber; - // endregion + /** * 是否引用对象 */ private boolean privateIsRef; - // endregion - // region 公共属性 + + // 公共属性 /** * 国际化项前缀 */ private String privateI18nResourceInfoPrefix; - // region 构造函数 + // 构造函数 protected GspCommonDataType() { setContainElements(new GspFieldCollection()); // DynamicPropSerializerComps = new List(); @@ -247,14 +246,14 @@ public abstract class GspCommonDataType implements IGspCommonDataType { public void setCustomizationInfo(CustomizationInfo customizationInfo) { this.customizationInfo = customizationInfo; } - // endregion - // region 方法 + + // 方法 public abstract IGspCommonField findElement(String id); public abstract ClassInfo getGeneratedEntityClassInfo(); - // endregion + /** * 根据标签获取字段列表 diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonField.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonField.java index 71dd35a..72863c7 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonField.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonField.java @@ -42,7 +42,7 @@ import org.openatom.ubml.model.common.definition.cef.util.Guid; * @Version: V1.0 */ public class GspCommonField implements IGspCommonField { - // region 私有属性 + // 私有属性 @JsonProperty(CefNames.ID) private String id = Guid.newGuid().toString(); @JsonProperty(CefNames.CODE) @@ -104,7 +104,7 @@ public class GspCommonField implements IGspCommonField { private boolean bigNumber = false; private boolean privateIsRef; - // region 公共属性 + // 公共属性 /** * 是否启用业务字段 */ @@ -135,25 +135,29 @@ public class GspCommonField implements IGspCommonField { */ private DynamicPropSetInfo privateDynamicPropSetInfo = new DynamicPropSetInfo(); - // endregion + public GspCommonField() { setIsRef(false); setCollectionType(FieldCollectionType.None); setEnumIndexType(EnumIndexType.Integer); } + @Override public String getID() { return id; } + @Override public void setID(String value) { id = value; } + @Override public String getCode() { return code; } + @Override public void setCode(String value) { code = value; } @@ -170,10 +174,12 @@ public class GspCommonField implements IGspCommonField { return labelId; } + @Override public void setLabelID(String value) { labelId = value; } + @Override public List getBeLabel() { if (beLabel == null) { beLabel = new ArrayList(); @@ -182,10 +188,12 @@ public class GspCommonField implements IGspCommonField { return beLabel; } + @Override public void setBeLabel(List value) { beLabel = value; } + @Override public List getBizTagIds() { if (this.bizTagIds == null) { bizTagIds = new ArrayList(); @@ -194,22 +202,27 @@ public class GspCommonField implements IGspCommonField { return bizTagIds; } + @Override public void setBizTagIds(List value) { bizTagIds = value; } + @Override public GspElementDataType getMDataType() { return dataType; } + @Override public void setMDataType(GspElementDataType value) { dataType = value; } + @Override public String getDefaultValue() { return defaultValue; } + @Override public void setDefaultValue(String value) { defaultValue = value; } @@ -229,54 +242,67 @@ public class GspCommonField implements IGspCommonField { return objectType; } + @Override public void setObjectType(GspElementObjectType value) { objectType = value; } + @Override public int getLength() { return length; } + @Override public void setLength(int value) { length = value; } + @Override public int getPrecision() { return precision; } + @Override public void setPrecision(int value) { precision = value; } + @Override public boolean getIsVirtual() { return isVirtual; } + @Override public void setIsVirtual(boolean value) { isVirtual = value; } + @Override public boolean getIsRequire() { return isRequire; } + @Override public void setIsRequire(boolean value) { isRequire = value; } + @Override public boolean getIsMultiLanguage() { return isMultilLanguage; } + @Override public void setIsMultiLanguage(boolean value) { isMultilLanguage = value; } + @Override public boolean getIsRef() { return privateIsRef; } + @Override public void setIsRef(boolean value) { privateIsRef = value; } @@ -284,14 +310,17 @@ public class GspCommonField implements IGspCommonField { /** * bigNumber */ + @Override public boolean isBigNumber() { return this.bigNumber; } + @Override public void setIsBigNumber(boolean value) { this.bigNumber = value; } + @Override public IGspCommonDataType getBelongObject() { if (this.getIsRefElement() && belongObject == null) { return this.getParentAssociation().getBelongElement().getBelongObject(); @@ -299,10 +328,12 @@ public class GspCommonField implements IGspCommonField { return belongObject; } + @Override public void setBelongObject(IGspCommonDataType value) { belongObject = value; } + @Override public GspFieldCollection getChildElements() { if (childElements == null) { childElements = new GspFieldCollection(); @@ -314,6 +345,7 @@ public class GspCommonField implements IGspCommonField { childElements = value; } + @Override public MappingRelation getMappingRelation() { if (mappingRelation == null) { mappingRelation = new MappingRelation(); @@ -328,14 +360,17 @@ public class GspCommonField implements IGspCommonField { /** * /////关联引用 */ + @Override public GspAssociationCollection getChildAssociations() { return childAssociations; } + @Override public void setChildAssociations(GspAssociationCollection value) { childAssociations = value; } + @Override public final boolean getHasAssociation() { if (getChildAssociations() == null || getChildAssociations().size() == 0) { return false; @@ -343,107 +378,133 @@ public class GspCommonField implements IGspCommonField { return true; } + @Override public GspEnumValueCollection getContainEnumValues() { return enumValueCollection; } + @Override public void setContainEnumValues(GspEnumValueCollection value) { enumValueCollection = value; } + @Override public boolean getIsRefElement() { return isRefElement; } + @Override public void setIsRefElement(boolean value) { isRefElement = value; } + @Override public String getRefElementId() { return refelementId; } + @Override public void setRefElementId(String value) { refelementId = value; } + @Override public GspAssociation getParentAssociation() { return parentAssociation; } + @Override public void setParentAssociation(GspAssociation value) { parentAssociation = value; } + @Override public boolean getIsUdt() { return privateIsUdt; } + @Override public void setIsUdt(boolean value) { privateIsUdt = value; } + @Override public String getUdtPkgName() { return privateUdtPkgName; } + @Override public void setUdtPkgName(String value) { privateUdtPkgName = value; } + @Override public String getUdtID() { return privateUdtID; } + @Override public void setUdtID(String value) { privateUdtID = value; } + @Override public final String getUdtName() { return privateUdtName; } + @Override public final void setUdtName(String value) { privateUdtName = value; } + @Override public FieldCollectionType getCollectionType() { return privateCollectionType; } + @Override public final void setCollectionType(FieldCollectionType value) { privateCollectionType = value; } + @Override public final boolean getIsFromAssoUdt() { return privateIsFromAssoUdt; } + @Override public final void setIsFromAssoUdt(boolean value) { privateIsFromAssoUdt = value; } + @Override public final String getI18nResourceInfoPrefix() { return privateI18nResourceInfoPrefix; } + @Override public final void setI18nResourceInfoPrefix(String value) { privateI18nResourceInfoPrefix = value; } + @Override public final DynamicPropSetInfo getDynamicPropSetInfo() { return privateDynamicPropSetInfo; } + @Override public final void setDynamicPropSetInfo(DynamicPropSetInfo value) { privateDynamicPropSetInfo = value; } + @Override public CustomizationInfo getCustomizationInfo() { return customizationInfo; } + @Override public void setCustomizationInfo(CustomizationInfo customizationInfo) { this.customizationInfo = customizationInfo; } @@ -451,18 +512,21 @@ public class GspCommonField implements IGspCommonField { /** * 索引类型 */ + @Override public final EnumIndexType getEnumIndexType() { return enumIndexType; } + @Override public final void setEnumIndexType(EnumIndexType value) { enumIndexType = value; } - // endregion - // region 方法 + + // 方法 + @Override public final boolean hasNoneRefElementInAssociation() { - if (getHasAssociation() == false) { + if (!getHasAssociation()) { return false; } @@ -474,6 +538,7 @@ public class GspCommonField implements IGspCommonField { * * @return */ + @Override public final boolean containRefElementNotFromAssoUdt() { if (!getIsUdt() || getObjectType() != GspElementObjectType.Association) { throw new RuntimeException("#GspBefError#" + "字段" + getCode() @@ -520,10 +585,12 @@ public class GspCommonField implements IGspCommonField { return newObj; } + @Override public boolean isEnableRtrim() { return enableRtrim; } + @Override public void setEnableRtrim(boolean value) { this.enableRtrim = value; } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/MappingRelation.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/MappingRelation.java index 591f8cc..1e8ca20 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/MappingRelation.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/MappingRelation.java @@ -51,20 +51,6 @@ public class MappingRelation implements Iterable, Cloneable { return new ArrayList(dic.values()); } - // public final java.util.Iterable GetEnumerator() - // { - // //C# TO JAVA CONVERTER TODO TASK: There is no equivalent to implicit typing - // in Java: - // for (var item : dic) - // { - // MappingInfo tempVar = new MappingInfo(); - // tempVar.setKeyInfo(item.getKey()); - // tempVar.setValueInfo(item.getValue()); - // //C# TO JAVA CONVERTER TODO TASK: Java does not have an equivalent to the C# - // 'yield' keyword: - // yield return tempVar; - // } - // } public final void clear() { dic.clear(); @@ -111,12 +97,6 @@ public class MappingRelation implements Iterable, Cloneable { return dic.containsKey(key); } - // public final String getItem(String key) { - // } - - // public final void setItem(String key, String value) { - // } - public final Object clone() { MappingRelation mappingRelation = new MappingRelation(); if (dic.size() > 0) { @@ -139,20 +119,23 @@ public class MappingRelation implements Iterable, Cloneable { } return list.iterator(); } -// -// @Override -// public Iterable iterator() { -// return null; -// } + @Override public boolean equals(Object obj) { MappingRelation relation = (MappingRelation)obj; boolean equals = super.equals(obj); - if (equals) + if (equals) { return equals; - if ((dic == null || dic.size() < 1) && (relation.dic == null || relation.dic.size() < 1)) + } + if ((dic == null || dic.size() < 1) && (relation.dic == null || relation.dic.size() < 1)) { return true; + } return false; } + + @Override + public int hashCode() { + return super.hashCode(); + } } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/CefNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/CefNames.java index 9d67b27..a52c050 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/CefNames.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/CefNames.java @@ -153,7 +153,6 @@ public class CefNames { //原节点上的动态属性-已废弃 public static final String DYNAMIC_PROP_SERIALIZER_COMPS = "DynamicPropSerializerComps"; - //region Increment public static final String INCREMENT_TYPE = "IncrementType"; public static final String ADDED_DATA_TYPE = "AddedDataType"; public static final String DELETED_ID = "DeletedId"; @@ -168,8 +167,5 @@ public class CefNames { public static final String CHILD_INCREMENTS = "ChildIncrements"; public static final String ELEMENT = "Element"; public static final String CHILD_INCREMENT = "ChildIncrement"; - public static final String CustomizationInfo = "CustomizationInfo"; - //endregion - } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/SerializerUtils.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/SerializerUtils.java index 7d1a442..94a3c05 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/SerializerUtils.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/SerializerUtils.java @@ -50,7 +50,7 @@ import static com.fasterxml.jackson.core.JsonToken.VALUE_TRUE; * @Version: V1.0 */ public class SerializerUtils { - //#region 读取Token + //读取Token public static void readStartObject(JsonParser parser) { JsonToken tokenType = parser.getCurrentToken(); try { @@ -132,9 +132,9 @@ public class SerializerUtils { } return false; } - //#endregion - //#region 读取基本类型 + + //读取基本类型 public static String readPropertyName(JsonParser parser) { JsonToken tokenType = parser.getCurrentToken(); if (tokenType != FIELD_NAME) { @@ -299,40 +299,7 @@ public class SerializerUtils { } return propValue; } - //#endregion - -// public static > EnumSet readEnumSet(JsonParser parser, Class type) { -// EnumSetDeserializer der = new EnumSetDeserializer(SimpleType.constructUnsafe(type), new CefEnumDeserializer(type)); -// -// EnumSet propValue = EnumSet.noneOf(type); -// try { -// EnumSet result = der.deserialize(parser, null); -// Object[] array = result.(); -// for (int i = 0; i < array.length; i++) { -// propValue.add(Array); -// } -// propValue = der.deserialize(parser, null); -// } catch (IOException e) { -// e.printStackTrace(); -// } -// return propValue; -// } -// -// EnumSet反序列化供参考,json中存int - -// private EnumSet readGetExecutingDataStatus(JsonParser jsonParser) { -// EnumSet result = EnumSet.noneOf(ExecutingDataStatus.class); -// int intValueSum = SerializerUtils.readPropertyValue_Integer(jsonParser); -// ExecutingDataStatus[] values = ExecutingDataStatus.values(); -// for (int i = values.length - 1; i >= 0; i--) { -// ExecutingDataStatus value = values[i]; -// if (intValueSum > value.getValue()) { -// result.add(value); -// intValueSum -= value.getValue(); -// } -// } -// return result; -// } + public static ArrayList readStringArray(JsonParser parser) { StringDeserializer der = new StringDeserializer(); @@ -341,11 +308,11 @@ public class SerializerUtils { return propValue; } - public static > void readArray(JsonParser parser, JsonDeserializer deserializer, tArray array) { + public static > void readArray(JsonParser parser, JsonDeserializer deserializer, A array) { readArray(parser, deserializer, array, false); } - public static > void readArray(JsonParser parser, JsonDeserializer deserializer, tArray array, boolean next) { + public static > void readArray(JsonParser parser, JsonDeserializer deserializer, A array, boolean next) { if (readNullObject(parser)) { return; } @@ -366,11 +333,11 @@ public class SerializerUtils { readEndArray(parser); } - //#region 私有方法 + //私有方法 private static void throwJsonTokenException(String validateType, String currentType) { throw new RuntimeException(String.format("当前JsonToken应为'$1%s',实际为'$1%s'", validateType, currentType)); } - //#endregion + /** * 序列化:写数组开始 @@ -545,7 +512,7 @@ public class SerializerUtils { } } - public static > void writeArray(JsonGenerator jsonGenerator, JsonSerializer serializer, tList list) { + public static > void writeArray(JsonGenerator jsonGenerator, JsonSerializer serializer, TList list) { //void writeArray(JsonGenerator jsonGenerator, JsonSerializer serializer, TArray array){ SerializerUtils.WriteStartArray(jsonGenerator); for (T item : list) { diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/CefFieldSerializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/CefFieldSerializer.java index 4e2dd4f..2f4266e 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/CefFieldSerializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/CefFieldSerializer.java @@ -43,7 +43,7 @@ public class CefFieldSerializer extends JsonSerializer { SerializerUtils.writeEndObject(jsonGenerator); } - //region BaseProp + //BaseProp public void writeBaseProperty(JsonGenerator writer, IGspCommonField value) { GspCommonField field = (GspCommonField)value; SerializerUtils.writePropertyValue(writer, CefNames.ID, field.getID()); @@ -94,13 +94,13 @@ public class CefFieldSerializer extends JsonSerializer { SerializerUtils.WriteEndArray(writer); } - //region 抽象方法 + //抽象方法 protected void writeExtendFieldBaseProperty(JsonGenerator writer, IGspCommonField field) { } - //endregion - //endregion - //region SelfProp + + + //SelfProp public void writeSelfProperty(JsonGenerator writer, IGspCommonField value) { GspCommonField field = (GspCommonField)value; SerializerUtils.writePropertyValue(writer, CefNames.CODE, field.getCode()); @@ -168,9 +168,9 @@ public class CefFieldSerializer extends JsonSerializer { SerializerUtils.WriteEndArray(writer); } - //region 抽象方法 + //抽象方法 protected void writeExtendFieldSelfProperty(JsonGenerator writer, IGspCommonField field) { } - //endregion - //endregion + + } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/GspAssociationSerializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/GspAssociationSerializer.java index 5bc4320..a1d096b 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/GspAssociationSerializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/GspAssociationSerializer.java @@ -53,7 +53,7 @@ public class GspAssociationSerializer extends JsonSerializer { } - //region BaseProp + //BaseProp private void writeBaseProperty(GspAssociation value, JsonGenerator writer) { SerializerUtils.writePropertyValue(writer, CefNames.ID, value.getId()); SerializerUtils.writePropertyValue(writer, CefNames.I18N_RESOURCE_INFO_PREFIX, value.getI18nResourceInfoPrefix()); @@ -74,9 +74,9 @@ public class GspAssociationSerializer extends JsonSerializer { protected void writeExtendAssoBaseProperty(GspAssociation association, JsonGenerator writer) { } - //endregion - //region SelfProp + + //SelfProp private void writeSelfProperty(GspAssociation association, JsonGenerator writer) { SerializerUtils.writePropertyValue(writer, CefNames.REF_MODEL_ID, association.getRefModelID()); SerializerUtils.writePropertyValue(writer, CefNames.REF_MODEL_NAME, association.getRefModelName()); @@ -106,5 +106,5 @@ public class GspAssociationSerializer extends JsonSerializer { protected void writeExtendAssoSelfProperty(JsonGenerator writer, GspAssociation bizElement) { } - //endregion + } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/object/GspCommonDataTypeDeserializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/object/GspCommonDataTypeDeserializer.java index 6a64de7..1573208 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/object/GspCommonDataTypeDeserializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/object/GspCommonDataTypeDeserializer.java @@ -66,7 +66,7 @@ public abstract class GspCommonDataTypeDeserializer extends JsonDeserializer dicElements; /** * 元数据Entity程序集 */ @@ -45,28 +44,6 @@ public class CommonVariableEntity extends GspCommonDataType { */ private DataTypeAssemblyInfo privateParentCoreAssemblyInfo; - // Jban迁移,原在FindElement()中使用,有必要创建字典吗? - // private void createDictionary() { - // // _dicElements = new Dictionary(); - // java.util.HashMap tempDict = new java.util.HashMap(); - - // // 查找当前的元素是否包含 - // for (int i = 0; i < getContainElements().size(); i++) { - // createDictionary()(getContainElements().getItem(i), tempDict); - // } - // dicElements = tempDict; - // } - - // private void createDictionary()(CommonVariable element, java.util.HashMap dict) { - // try { - // dict.put(element.getID(), element); - // } catch (java.lang.Exception e) { - // if (dict.containsKey(element.getID())) { - // throw new RuntimeException(String.format("变量实体%1$s上面存在多个id为%2$s的变量", this.getName(), element.getID())); - // } - // throw e; - // } - // } public CommonVariableEntity() { setContainElements(new CommonVariableCollection(this)); diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IGspCommonElement.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IGspCommonElement.java index 862d8ff..0b4a01c 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IGspCommonElement.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IGspCommonElement.java @@ -70,6 +70,7 @@ public interface IGspCommonElement extends IGspCommonField { /** * @return Belong Object Of The Element */ + @Override IGspCommonObject getBelongObject(); /** @@ -107,6 +108,6 @@ public interface IGspCommonElement extends IGspCommonField { * @return The Enum Type Name Of The Element */ String getEnumTypeName(); - // endregion + } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IGspCommonModel.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IGspCommonModel.java index dad7861..9c351c8 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IGspCommonModel.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IGspCommonModel.java @@ -161,7 +161,7 @@ public interface IGspCommonModel extends Cloneable { * @param value Wether Use Namespace Config In The Runtime */ void setIsUseNamespaceConfig(boolean value); - // endregion + /** * @param elementID The Id Of Element To Find @@ -220,6 +220,6 @@ public interface IGspCommonModel extends Cloneable { * @return The Version Control Info Of The Model */ VersionControlInfo getVersionContronInfo(); - // endregion + } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspElementCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspElementCollection.java index 6b396fd..5cb7497 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspElementCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspElementCollection.java @@ -15,8 +15,6 @@ */ package org.openatom.ubml.model.common.definition.commonmodel.collection; -// import Inspur.Ecp.Caf.Common.*; - import org.openatom.ubml.model.common.definition.cef.IGspCommonField; import org.openatom.ubml.model.common.definition.cef.collection.GspFieldCollection; import org.openatom.ubml.model.common.definition.cef.util.DataValidator; @@ -61,9 +59,6 @@ public class GspElementCollection extends GspFieldCollection implements IElement } } -// private void inneradd(IGspCommonElement element) { -// super.add(element); -// } /** * 克隆 @@ -83,11 +78,13 @@ public class GspElementCollection extends GspFieldCollection implements IElement /** * Index[string] */ + @Override public IGspCommonElement getItem(String id) { Object tempVar = super.getByID(id); return (IGspCommonElement)((tempVar instanceof IGspCommonElement) ? tempVar : null); } + @Override public final IGspCommonElement getItem(int index) { Object tempVar = super.getByIndex(index); return (IGspCommonElement)((tempVar instanceof IGspCommonElement) ? tempVar : null); @@ -96,7 +93,7 @@ public class GspElementCollection extends GspFieldCollection implements IElement /** * 所属结点 */ - // [Newtonsoft.Json.jsonIgnore()] + @Override public IGspCommonObject getParentObject() { return parentObject; diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspObjectCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspObjectCollection.java index a5aed9b..0a1fc9a 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspObjectCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspObjectCollection.java @@ -42,7 +42,7 @@ public class GspObjectCollection extends BaseList implements I this.parentObject = parentObject; } - // region ICloneable Members + // ICloneable Members /** * 克隆 @@ -58,7 +58,7 @@ public class GspObjectCollection extends BaseList implements I return newObj; } - // endregion + /** * 集合所属父节点 diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspUniqueConstraintCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspUniqueConstraintCollection.java index 89f78aa..e793d72 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspUniqueConstraintCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspUniqueConstraintCollection.java @@ -35,6 +35,7 @@ public class GspUniqueConstraintCollection extends BaseList * * @param constraint */ + @Override public final boolean add(GspUniqueConstraint constraint) { return super.add(constraint); } @@ -66,19 +67,11 @@ public class GspUniqueConstraintCollection extends BaseList * @param index 插入的索引 * @param constraint 约束定义 */ + @Override public final void insert(int index, GspUniqueConstraint constraint) { super.insert(index, constraint); } - /** - 按照索引序号访问集合中的约束 - - @param index 索引 - @return - */ -//C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing via the 'new' keyword: -//ORIGINAL LINE: public new GspUniqueConstraint this[int index] => (GspUniqueConstraint)((_list[index] instanceof GspUniqueConstraint) ? _list[index] : null); - // public GspUniqueConstraint this.setItem(int index, > (GspUniqueConstraint)((_list.get(index) instanceof GspUniqueConstraint) ? _list.get(index) : null)); /** * 根据Id访问约束 @@ -100,6 +93,7 @@ public class GspUniqueConstraintCollection extends BaseList * * @return */ + @Override public final GspUniqueConstraintCollection clone() { return clone(null); } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonElement.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonElement.java index 7f22422..b058c7c 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonElement.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonElement.java @@ -34,17 +34,11 @@ import org.openatom.ubml.model.common.definition.commonmodel.entity.element.GspC */ public class GspCommonElement extends GspCommonField implements IGspCommonElement { // 基础信息 - // private GspElementDataType mDataType = GspElementDataType.String; private transient ElementCodeRuleConfig billCodeConfig = new ElementCodeRuleConfig(); - // region 成员字段 + // 成员字段 @JsonIgnore -// private transient GspAssociationCollection childAssociations = new GspAssociationCollection(); - // private GspEnumValueCollection enumValueCollection; private transient String columnid = ""; - // private GspCommonAssociation parentAssociation; - // private IGspCommonObject belongObject; - // private String refelementId = ""; private transient String belongModelId = ""; private transient boolean readOnly; // 维护信息 @@ -57,10 +51,6 @@ public class GspCommonElement extends GspCommonField implements IGspCommonElemen setIsCustomItem(false); } - // endregion 成员字段 - - // region 公有属性 - /** * 编码规则配置 */ @@ -76,10 +66,12 @@ public class GspCommonElement extends GspCommonField implements IGspCommonElemen /** * 对应的数据对象的列ID */ + @Override public String getColumnID() { return columnid; } + @Override public void setColumnID(String value) { columnid = value; } @@ -87,22 +79,25 @@ public class GspCommonElement extends GspCommonField implements IGspCommonElemen /** * 是否自定义项 */ + @Override public boolean getIsCustomItem() { return isCustomItem; } + @Override public void setIsCustomItem(boolean value) { - + this.isCustomItem = value; } /** * 当前属性所属结点 */ - // [Newtonsoft.Json.jsonIgnore()] + @Override public IGspCommonObject getBelongObject() { return (IGspCommonObject)super.getBelongObject(); } + @Override public void setBelongObject(IGspCommonObject value) { super.setBelongObject(value); } @@ -110,42 +105,26 @@ public class GspCommonElement extends GspCommonField implements IGspCommonElemen /** * 所属数据模型metadataId */ + @Override public String getBelongModelID() { return belongModelId; } + @Override public void setBelongModelID(String value) { value = belongModelId; } + @Override public boolean getReadonly() { return readOnly; } + @Override public void setReadonly(boolean value) { readOnly = value; } - // endregion - - // region 外部方法 - // - // public bool hasNoneRefElementInAssociation() - // { - // if (HasAssociation == false) - // return false; - // foreach (var association in ChildAssociations) - // { - // foreach (var refElement in association.RefElementCollection) - // { - // if (refElement.IsRef == false) - // return true; - // } - // } - // - // return false; - // } - // /** * 克隆 @@ -154,6 +133,7 @@ public class GspCommonElement extends GspCommonField implements IGspCommonElemen * @param association * @return */ + @Override public final IGspCommonElement clone(IGspCommonObject absObj, GspCommonAssociation association) { Object tempVar = super.clone(absObj, association); GspCommonElement newObj = (GspCommonElement)((tempVar instanceof GspCommonElement) ? tempVar : null); @@ -179,6 +159,7 @@ public class GspCommonElement extends GspCommonField implements IGspCommonElemen setParentAssociation(value); } + @Override @JsonIgnore public final String getAssociationTypeName() { if (getBelongObject().getParentObject() == null) { @@ -195,5 +176,5 @@ public class GspCommonElement extends GspCommonField implements IGspCommonElemen } return getBelongObject().getCode() + getLabelID() + "Enum"; } - // endregion + } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java index 04bfcd6..5e4f4a8 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java @@ -41,21 +41,14 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo private static final String entityNamespaceSuffix = "entity"; private static final String apiNamespaceSuffix = "api"; private final java.util.HashMap extendNodeList = new java.util.HashMap(); - // region 字段和属性 -// private String recordHistoryTable = "GspDATALOG"; -// private boolean isRecord; + // 字段和属性 private boolean isVirtual; private GspCommonObject mainObject; // private java.util.ArrayList fkConstraints = new java.util.ArrayList(); private CommonVariableEntity variables; - // C# TO JAVA CONVERTER TODO TASK: Java annotations will not correspond to .NET - // attributes: - // [NonSerialized] + private java.util.Map extProperties; -// private boolean isAllowDerive; -// private boolean isAllowExtend; -// private String dimension = ""; -// private String hierarchy = ""; + private String extendType = ""; private String privateID; private String privateCode; @@ -95,41 +88,46 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo /** * 扩展成员,用于扩展方法暂存运行时临时数据 */ - // [Newtonsoft.Json.jsonIgnore()] + public java.util.Map getExtProperties() { return (extProperties != null) ? extProperties : (extProperties = new HashMap()); } + @Override public final String getID() { -// this.privateID = super.getId(); return privateID; } + @Override public final void setID(String value) { privateID = value; -// super.setId(value); } + @Override public final String getCode() { this.privateCode = super.getCode(); return privateCode; } + @Override public final void setCode(String value) { privateCode = value; super.setCode(value); } + @Override public final String getName() { this.privateName = super.getName(); return privateName; } + @Override public final void setName(String value) { privateName = value; super.setName(value); } + @Override public List getBeLabel() { if (beLabel == null) { beLabel = new ArrayList(); @@ -138,6 +136,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return beLabel; } + @Override public void setBeLabel(List value) { beLabel = value; } @@ -145,6 +144,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo /** * 是否虚拟 */ + @Override public boolean getIsVirtual() { return isVirtual; } @@ -156,6 +156,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo /** * 扩展类型 */ + @Override public String getExtendType() { return extendType; } @@ -164,6 +165,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo extendType = value; } + @Override public final String getEntityType() { return privateEntityType; } @@ -175,7 +177,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo /** * 扩展结点列表 */ - // [Newtonsoft.Json.jsonIgnore()] + @Override public java.util.HashMap getExtendNodeList() { return extendNodeList; } @@ -263,11 +265,11 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return privateVersionContronInfo; } - // endregion - // region 方法 - // region 获取字段 + // 方法 + + // 获取字段 public final void setVersionContronInfo(VersionControlInfo value) { privateVersionContronInfo = value; @@ -358,9 +360,9 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo // objectItem.getElements(); // } // } - // endregion - // region 获取节点 + + // 获取节点 private IGspCommonElement findEleInChildObject(IGspCommonObject absObject, String elementId) { if (absObject.getContainChildObjects() != null && absObject.getContainChildObjects().size() > 0) { @@ -409,7 +411,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo } return elementList; } - // endregion + /** * 使用先根方式获取素有结点 @@ -470,7 +472,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return null; } - // region Schema + // Schema // public final String getModelSchema() { // CommonModelSchemaBuilder builder = new CommonModelSchemaBuilder(this); diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java index a5bb22f..43a68d9 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java @@ -48,7 +48,7 @@ import org.openatom.ubml.model.common.definition.commonmodel.entity.object.GspCo * @Version: V1.0 */ public class GspCommonObject extends GspCommonDataType implements IGspCommonObject, Cloneable { - // region 私有变量 + // 私有变量 // private boolean logicDelete; // private String refDataObjectId = ""; private GspCommonObjectType objectType = GspCommonObjectType.MainObject; @@ -74,9 +74,9 @@ public class GspCommonObject extends GspCommonDataType implements IGspCommonObje private GspAssociationKeyCollection keys; private String belongModelId = ""; private java.util.HashMap extProperties; - // endregion - // region 构造函数 + + // 构造函数 /** * 持久化构件 */ @@ -94,9 +94,9 @@ public class GspCommonObject extends GspCommonDataType implements IGspCommonObje * //} */ - // endregion - // region 公有属性 + + // 公有属性 /** * 当前结点所属的模型 */ @@ -376,12 +376,12 @@ public class GspCommonObject extends GspCommonDataType implements IGspCommonObje public String getPropertyName() { return String.format("$1", getCode(), "s"); } - // endregion + /** * 扩展成员,用于扩展方法暂存运行时临时数据 */ - // [Newtonsoft.Json.jsonIgnore()] + public java.util.HashMap getExtProperties() { return (extProperties != null) ? extProperties : (extProperties = new java.util.HashMap()); } @@ -505,7 +505,7 @@ public class GspCommonObject extends GspCommonDataType implements IGspCommonObje public final boolean hasNoneRefElement(boolean withChild) { if (getContainElements() != null && getContainElements().size() > 0) { for (IGspCommonField element : getContainElements()) { - if (element.getIsRef() == false) { + if (!element.getIsRef()) { return true; } if (element.hasNoneRefElementInAssociation()) { @@ -542,11 +542,11 @@ public class GspCommonObject extends GspCommonDataType implements IGspCommonObje for (IGspCommonField item : getContainElements()) { IGspCommonElement element = (IGspCommonElement)item; elementList.add(element); - if (element.getHasAssociation() == false || containRef == false) { + if (!element.getHasAssociation() || !containRef) { continue; } for (GspAssociation association : element.getChildAssociations()) { - for (IGspCommonField refElement : (association).getRefElementCollection()) { + for (IGspCommonField refElement : association.getRefElementCollection()) { elementList.add((IGspCommonElement)refElement); } } @@ -629,6 +629,6 @@ public class GspCommonObject extends GspCommonDataType implements IGspCommonObje return dicElements.get(elementId); } - return (!dicElements.containsKey(elementId) ? null : dicElements.get(elementId)); + return (dicElements.getOrDefault(elementId, null)); } } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/GspCommonAssociation.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/GspCommonAssociation.java index f919dc0..02c4c4c 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/GspCommonAssociation.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/GspCommonAssociation.java @@ -46,7 +46,7 @@ public class GspCommonAssociation extends GspAssociation implements Cloneable { refModel = value; } - // region ICloneable Members + // ICloneable Members + - // endregion } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspColumnGenerate.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspColumnGenerate.java index 18b8bde..be7bb00 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspColumnGenerate.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspColumnGenerate.java @@ -60,7 +60,7 @@ public class GspColumnGenerate implements Cloneable { this.generateType = value; } - // region ICloneable Members + // ICloneable Members /** * 克隆 @@ -77,5 +77,5 @@ public class GspColumnGenerate implements Cloneable { } } - // endregion + } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspUniqueConstraint.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspUniqueConstraint.java index f85809f..5465ff5 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspUniqueConstraint.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspUniqueConstraint.java @@ -117,7 +117,7 @@ public class GspUniqueConstraint implements Cloneable { privateI18nResourceInfoPrefix = value; } - // region ICloneable Members + // ICloneable Members /** * 克隆 @@ -151,5 +151,5 @@ public class GspUniqueConstraint implements Cloneable { } return newObj; } - // endregion + } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/element/CmElementSerializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/element/CmElementSerializer.java index ed710b9..a489358 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/element/CmElementSerializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/element/CmElementSerializer.java @@ -33,7 +33,7 @@ import org.openatom.ubml.model.common.definition.commonmodel.json.CommonModelNam */ public abstract class CmElementSerializer extends CefFieldSerializer { - //region BaseProp + //BaseProp @Override protected void writeExtendFieldBaseProperty(JsonGenerator writer, IGspCommonField value) { @@ -42,9 +42,9 @@ public abstract class CmElementSerializer extends CefFieldSerializer { SerializerUtils.writePropertyValue(writer, CommonModelNames.BELONG_MODEL_ID, field.getBelongModelID()); writeExtendElementBaseProperty(writer, field); } - //endregion - //region SelfProp + + //SelfProp @Override protected void writeExtendFieldSelfProperty(JsonGenerator writer, IGspCommonField value) { IGspCommonElement field = (IGspCommonElement)value; @@ -74,12 +74,12 @@ public abstract class CmElementSerializer extends CefFieldSerializer { SerializerUtils.writePropertyValue(writer, CommonModelNames.BILL_CODE_ID, config.getBillCodeID()); SerializerUtils.writeEndObject(writer); } - //endregion - //region 抽象方法 + + //抽象方法 protected abstract void writeExtendElementBaseProperty(JsonGenerator writer, IGspCommonElement element); protected abstract void writeExtendElementSelfProperty(JsonGenerator writer, IGspCommonElement element); - //endregion + } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/model/CommonModelSerializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/model/CommonModelSerializer.java index 6e85639..1af8a6f 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/model/CommonModelSerializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/model/CommonModelSerializer.java @@ -44,7 +44,7 @@ public abstract class CommonModelSerializer extends JsonSerializer - */ - private Boolean enableStdTimeFormat = false; - - 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 - - ///#region 方法 - - ///#region 复写 - - /** - * 重载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)); - } - 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; -// } + /** + * 启用标准日期时间格式 + */ + private Boolean enableStdTimeFormat = false; -// return GetNodes(node => node.Code.equals(viewObjectCode, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); + public Boolean getEnableStdTimeFormat() { + return enableStdTimeFormat; + } + public void setEnableStdTimeFormat(Boolean enableStdTimeFormat) { + this.enableStdTimeFormat = enableStdTimeFormat; + } - /** - * 查询符合条件的节点 - *

- * // @param predict - * - * @return - * - */ + /** + * 描述 + */ + private String privateDescription; -// 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 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; + } + + /** + * 根节点 + */ + @Override + 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; + } + + + /** + * 重载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. + */ + @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 + */ + @Override + 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)); + } + 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()); + } + + + ///获取节点 + + /** + * 查找指定的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; + } // public final java.util.List GetNodes(HashMap predict) // { @@ -381,36 +334,35 @@ public class GspViewModel extends GspCommonModel implements IMetadataContent, Cl // return GetAllObjectList().Select(item => (GspViewObject)((item instanceof GspViewObject) ? item : null)).ToList(); // } - /** - * 查询当前VM所有节点的字典 - * 其中Key是节点Code - * - * @return - * - * - */ - public final java.util.HashMap getNodesDic() { + /** + * 查询当前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); + HashMap toDic = new HashMap(); + for (IGspCommonObject item : getAllObjectList()) { + toDic.put(item.getCode(), item); - } + } // return GetNodes(null).ToDictionary(item => item.Code, item => item); - return toDic; + return toDic; - } + } - ///#endregion - ///#region 联动-弃用 - /** - * 与业务实体建立连接 - *

- * // @param bizEntity - * - * @return - */ + ///联动-弃用 + /** + * 与业务实体建立连接 + *

+ * // @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)); @@ -450,7 +402,7 @@ public class GspViewModel extends GspCommonModel implements IMetadataContent, Cl //// 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); @@ -467,7 +419,7 @@ public class GspViewModel extends GspCommonModel implements IMetadataContent, Cl //// GSPBizEntityObject beObject = bizEntityObjects.get(objectItem.getMapping().getTargetObjId()); // GspBizEntityObject beObject = bizEntityObjects.get(objectItem.getMapping().getTargetObjId()); // -// ///#region 分级信息 +// ///分级信息 //// if (beObject.HirarchyInfo != null) //// { //// objectItem.HirarchyInfo = beObject.HirarchyInfo; @@ -549,9 +501,9 @@ public class GspViewModel extends GspCommonModel implements IMetadataContent, Cl //// } //// } // -// ///#endregion +// / // -// ///#region 创建人等信息 +// ///创建人等信息 //// if (elementMappings.containsKey(beObject.CreatorElementID)) //// if (elementMappings.containsKey(beObject.getCreateID())) //// { @@ -569,22 +521,22 @@ public class GspViewModel extends GspCommonModel implements IMetadataContent, Cl //// { //// 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生成规则 +// ///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) // { @@ -614,9 +566,9 @@ public class GspViewModel extends GspCommonModel implements IMetadataContent, Cl // } // objectItem.ContainConstraints.Add(viewModelConstraint); // } -// ///#endregion +// / // -// ///#region 关联信息 +// ///关联信息 // if (objectItem.getParent() != null) // { // objectItem.keySet().Clear(); @@ -643,11 +595,11 @@ public class GspViewModel extends GspCommonModel implements IMetadataContent, Cl // objectItem.keySet().Add(associationKey); // } // } -// ///#endregion +// / // } -// ///#endregion +// / // -// ///#region 联动字段上的属性 +// ///联动字段上的属性 // // for (java.util.Map.Entry item : viewElements.entrySet()) // { @@ -737,9 +689,9 @@ public class GspViewModel extends GspCommonModel implements IMetadataContent, Cl // } // } // -// ///#endregion +// / // -// ///#region 联动be带出操作 +// ///联动be带出操作 // // var mappedBeActions = getActions().Where(item=>item.Type==ViewModel.Action.ViewModelActionType.BEAction).ToList(); // VMActionCollection tranVmActions = transViewModel.getActions(); @@ -756,7 +708,7 @@ public class GspViewModel extends GspCommonModel implements IMetadataContent, Cl // } // } // -// ///#endregion +// / // return this; // } // @@ -832,21 +784,21 @@ public class GspViewModel extends GspCommonModel implements IMetadataContent, Cl // } // return null; // } - ///#endregion - ///#region manager - private static final String ItemNameTemplate = "I%1$sManager"; - public final String getMgrInterfaceName() { - return String.format(ItemNameTemplate, getCode()); - } + ///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 getChangesetClassName() { + return String.format("%1$s%2$s", getCode(), "ViewModelChange"); + } - public final String getDefaultValueClassName() { - return String.format("%1$s%2$s", getCode(), "DefaultValue"); - } + public final String getDefaultValueClassName() { + return String.format("%1$s%2$s", getCode(), "DefaultValue"); + } } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModelElement.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModelElement.java index a253d39..e927498 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModelElement.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModelElement.java @@ -18,311 +18,311 @@ import org.openatom.ubml.model.vo.definition.json.element.ViewElementDeserialize */ @JsonDeserialize(using = ViewElementDeserializer.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上 - * - */ + 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节点 + * + */ + //[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 (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() { + 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; + } + + ///帮助信息 + //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; } + //} + + + ///方法 + + /** + * 重载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((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() { + { + //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() { // 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()); - } + 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()); + } } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewObject.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewObject.java index b3c8407..56ab8cf 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewObject.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewObject.java @@ -38,8 +38,6 @@ public class GspViewObject extends GspCommonObject implements Serializable { } } - ///#region 属性 - /** * 服务器使用 * @@ -86,11 +84,12 @@ public class GspViewObject extends GspCommonObject implements Serializable { } // @Override + @Override public void setParentObject(IGspCommonObject value) { if (value != null && !(value instanceof GspViewObject)) { throw new RuntimeException("类型不兼容异常"); } - setParent((GspViewObject) value); + setParent((GspViewObject)value); } /** @@ -134,8 +133,9 @@ public class GspViewObject extends GspCommonObject implements Serializable { * 元素集合 * */ + @Override public VMElementCollection getContainElements() { - return (VMElementCollection) super.getContainElements(); + return (VMElementCollection)super.getContainElements(); } private void setContainElements(VMElementCollection value) { @@ -146,8 +146,9 @@ public class GspViewObject extends GspCommonObject implements Serializable { * 子节点集合 * */ + @Override public ViewObjectCollection getContainChildObjects() { - return (ViewObjectCollection) super.getContainChildObjects(); + return (ViewObjectCollection)super.getContainChildObjects(); } private void setContainChildObjects(ViewObjectCollection value) { @@ -184,9 +185,8 @@ public class GspViewObject extends GspCommonObject implements Serializable { public void setExtendProperties(java.util.HashMap value) { extendProperties = value; } - ///#endregion - ///#region 重载方法 + ///重载方法 /** * 重载Equals方法 @@ -207,7 +207,7 @@ public class GspViewObject extends GspCommonObject implements Serializable { return false; } - return equals((GspViewObject) obj); + return equals((GspViewObject)obj); } /** @@ -260,7 +260,7 @@ public class GspViewObject extends GspCommonObject implements Serializable { @Override public GspViewObject clone() { Object tempVar = super.clone(); - GspViewObject node = (GspViewObject) ((tempVar instanceof GspViewObject) ? tempVar : null); + GspViewObject node = (GspViewObject)((tempVar instanceof GspViewObject) ? tempVar : null); if (node == null) { throw new RuntimeException("克隆GSPViewObject失败"); } @@ -268,7 +268,7 @@ public class GspViewObject extends GspCommonObject implements Serializable { // node.Parent = Parent.Clone() as GspViewObject; if (getContainChildObjects() != null) { Object tempVar2 = getContainChildObjects().clone(); - node.setContainChildObjects((ViewObjectCollection) ((tempVar2 instanceof ViewObjectCollection) ? tempVar2 : null)); + node.setContainChildObjects((ViewObjectCollection)((tempVar2 instanceof ViewObjectCollection) ? tempVar2 : null)); for (IGspCommonObject ChildObj : node.getContainChildObjects()) { ChildObj.setParentObject(node); @@ -277,7 +277,7 @@ public class GspViewObject extends GspCommonObject implements Serializable { if (getContainElements() != null && getContainElements().size() > 0) { Object tempVar3 = getContainElements().clone(); - node.setContainElements((VMElementCollection) ((tempVar3 instanceof VMElementCollection) ? tempVar3 : null)); + node.setContainElements((VMElementCollection)((tempVar3 instanceof VMElementCollection) ? tempVar3 : null)); for (IGspCommonField BelongObj : node.getContainElements()) { BelongObj.setBelongObject(node); } @@ -287,9 +287,9 @@ public class GspViewObject extends GspCommonObject implements Serializable { //{ // node.Association = Association.Clone() as IVOAssociation; //} - if (mapping != null){ - var map = mapping.clone() ; - node.setMapping((GspVoObjectMapping) ((map instanceof GspVoObjectMapping) ? map : null)); + if (mapping != null) { + var map = mapping.clone(); + node.setMapping((GspVoObjectMapping)((map instanceof GspVoObjectMapping) ? map : null)); } @@ -306,7 +306,6 @@ public class GspViewObject extends GspCommonObject implements Serializable { return String.format("ID:%1$s,Code:%2$s,Name:%3$s", getID(), getCode(), getName()); } - ///#endregion /** * 获取符合条件的属性列表 @@ -320,14 +319,14 @@ public class GspViewObject extends GspCommonObject implements Serializable { java.util.List toList = new ArrayList(); if (predicate != null) { for (IGspCommonElement item : temp) { - if (predicate.test((GspViewModelElement) item)) { - toList.add((GspViewModelElement) item); + if (predicate.test((GspViewModelElement)item)) { + toList.add((GspViewModelElement)item); } } return toList; } for (IGspCommonElement item2 : temp) { - GspViewModelElement tempVar2 = ((item2 instanceof GspViewModelElement) ? (GspViewModelElement) item2 : null); + GspViewModelElement tempVar2 = ((item2 instanceof GspViewModelElement) ? (GspViewModelElement)item2 : null); if (tempVar2 != null) { toList.add(tempVar2); } @@ -347,22 +346,30 @@ public class GspViewObject extends GspCommonObject implements Serializable { * 排序条件` */ private String orderbyCondition; + + @Override public String getOrderbyCondition() { return orderbyCondition; } + @Override public void setOrderbyCondition(String value) { - orderbyCondition=value; + orderbyCondition = value; } + /** * 过滤条件 */ private String filterCondition; - public String getFilterCondition(){ + + @Override + public String getFilterCondition() { return filterCondition; } - public void setFilterCondition(String value){ - filterCondition=value; + + @Override + public void setFilterCondition(String value) { + filterCondition = value; } } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ActionFormatParameter.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ActionFormatParameter.java index 10f71b7..762068c 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ActionFormatParameter.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ActionFormatParameter.java @@ -10,75 +10,65 @@ import java.io.Serializable; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class ActionFormatParameter implements Cloneable, Serializable -{ - ///#region 属性 - - /** - ID - - */ - private String privateID; - public final String getID() - { - - return privateID; - } - public final void setID(String value) - { - - privateID = value; - } - - /** - Code - - */ - private String privateCode; - public final String getCode() - { - return privateCode; - } - public final void setCode(String value) - { - privateCode = value; - } - - /** - Name - - */ - private String privateName; - public final String getName() - { - return privateName; - } - public final void setName(String value) - { - privateName = value; - } - - ///#endregion - - ///#region 方法 - - /** - 克隆 - - @return Action执行参数 - */ - public final ActionFormatParameter clone() - { - Object tempVar = null; - try { - tempVar = super.clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - ActionFormatParameter obj = (ActionFormatParameter)((tempVar instanceof ActionFormatParameter) ? tempVar : null); - - return obj; - } - - ///#endregion +public class ActionFormatParameter implements Cloneable, Serializable { + /** + * ID + */ + private String privateID; + + public final String getID() { + + return privateID; + } + + public final void setID(String value) { + + privateID = value; + } + + /** + * Code + */ + private String privateCode; + + public final String getCode() { + return privateCode; + } + + public final void setCode(String value) { + privateCode = value; + } + + /** + * Name + */ + private String privateName; + + public final String getName() { + return privateName; + } + + public final void setName(String value) { + privateName = value; + } + + + /** + * 克隆 + * + * @return Action执行参数 + */ + @Override + public final ActionFormatParameter clone() { + Object tempVar = null; + try { + tempVar = super.clone(); + } catch (CloneNotSupportedException e) { + e.printStackTrace(); + } + ActionFormatParameter obj = (ActionFormatParameter)((tempVar instanceof ActionFormatParameter) ? tempVar : null); + + return obj; + } + } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedBizAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedBizAction.java index 030bd9a..beb9794 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedBizAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedBizAction.java @@ -5,10 +5,10 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import java.io.IOException; +import java.io.Serializable; import org.openatom.ubml.model.vo.definition.action.mappedbiz.MappedBizActionParameterCollection; import org.openatom.ubml.model.vo.definition.json.operation.MappedBizActionDeserializer; import org.openatom.ubml.model.vo.definition.json.operation.MappedBizActionSerializer; -import java.io.Serializable; /** * The Definition Of The Mapped Biz Action @@ -22,41 +22,37 @@ import java.io.Serializable; @JsonDeserialize(using = MappedBizActionDeserializer.class) public class MappedBizAction extends ViewModelAction implements Cloneable, Serializable { - ///#region 属性 - private MappedBizActionParameterCollection mappedBizActionParams; - /** - * 类型 - */ - //@Override - public ViewModelActionType Type = ViewModelActionType.BEAction; -// public ViewModelActionType Type => ViewModelActionType.BEAction; + private MappedBizActionParameterCollection mappedBizActionParams; + /** + * 类型 + */ + //@Override + public ViewModelActionType Type = ViewModelActionType.BEAction; - ///#endregion - public MappedBizAction() { - mappedBizActionParams = new MappedBizActionParameterCollection(); - } - ///#region 方法 + public MappedBizAction() { + mappedBizActionParams = new MappedBizActionParameterCollection(); + } + ///方法 - /** - * 克隆 - * - * @return VM节点映射 - */ - @Override - public final MappedBizAction clone() { - ObjectMapper objectMapper = new ObjectMapper(); - try { - return objectMapper.readValue(objectMapper.writeValueAsString(this), MappedBizAction.class); - } catch (JsonProcessingException e) { - throw new RuntimeException(e); - } catch (IOException e) { - throw new RuntimeException(e); + /** + * 克隆 + * + * @return VM节点映射 + */ + @Override + public final MappedBizAction clone() { + ObjectMapper objectMapper = new ObjectMapper(); + try { + return objectMapper.readValue(objectMapper.writeValueAsString(this), MappedBizAction.class); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); + } } - } - @Override - protected IViewModelParameterCollection getParameters() { - return mappedBizActionParams; - } - ///#endregion + @Override + protected IViewModelParameterCollection getParameters() { + return mappedBizActionParams; + } } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpAction.java index a5cd3f2..682984d 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpAction.java @@ -5,10 +5,10 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import java.io.IOException; +import java.io.Serializable; import org.openatom.ubml.model.vo.definition.action.mappedcdp.MappedCdpActionParameterCollection; import org.openatom.ubml.model.vo.definition.json.operation.MappedCdpActionDeserializer; import org.openatom.ubml.model.vo.definition.json.operation.MappedCdpActionSerializer; -import java.io.Serializable; /** * The Definition Of The Parameter With Component @@ -21,44 +21,40 @@ import java.io.Serializable; @JsonSerialize(using = MappedCdpActionSerializer.class) @JsonDeserialize(using = MappedCdpActionDeserializer.class) public class MappedCdpAction extends MappedCdpActionBase implements Cloneable, Serializable { - ///#region 属性 - private MappedCdpActionParameterCollection mappedCdpActionParams; + private MappedCdpActionParameterCollection mappedCdpActionParams; - /** - * 类型 - */ - @Override - public ViewModelActionType getType() { - return ViewModelActionType.VMAction; - } + /** + * 类型 + */ + @Override + public ViewModelActionType getType() { + return ViewModelActionType.VMAction; + } - ///#endregion - public MappedCdpAction() { - mappedCdpActionParams = new MappedCdpActionParameterCollection(); - } - ///#region 方法 + public MappedCdpAction() { + mappedCdpActionParams = new MappedCdpActionParameterCollection(); + } - /** - * 克隆 - * - * @return VO节点映射 - */ - @Override - public MappedCdpAction clone() { - ObjectMapper objectMapper = new ObjectMapper(); - try { - return objectMapper.readValue(objectMapper.writeValueAsString(this), MappedCdpAction.class); - } catch (JsonProcessingException e) { - throw new RuntimeException(e); - } catch (IOException e) { - throw new RuntimeException(e); + /** + * 克隆 + * + * @return VO节点映射 + */ + @Override + public MappedCdpAction clone() { + ObjectMapper objectMapper = new ObjectMapper(); + try { + return objectMapper.readValue(objectMapper.writeValueAsString(this), MappedCdpAction.class); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); + } } - } - @Override - protected IViewModelParameterCollection getParameters() { - return mappedCdpActionParams; - } - ///#endregion + @Override + protected IViewModelParameterCollection getParameters() { + return mappedCdpActionParams; + } } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpActionBase.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpActionBase.java index b32155c..bbe628f 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpActionBase.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpActionBase.java @@ -10,81 +10,70 @@ import java.io.Serializable; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public abstract class MappedCdpActionBase extends ViewModelAction implements Serializable -{ - ///#region 属性 - private String componentEntityId = ""; - /** - 对应构件实体Id - - */ - public String getComponentEntityId(){ - return componentEntityId; - } - public void setComponentEntityId(String value){ - this.componentEntityId=value; - } - /** - 对应构件实体包名 - - */ - private String privateComponentPkgName; - public String getComponentPkgName() - { - return privateComponentPkgName; - } - public void setComponentPkgName(String value) - { - privateComponentPkgName = value; - } +public abstract class MappedCdpActionBase extends ViewModelAction implements Serializable { + private String componentEntityId = ""; - private boolean privateIsGenerateComponent; - public boolean getIsGenerateComponent() - { - return privateIsGenerateComponent; - } - public void setIsGenerateComponent(boolean value) - { - privateIsGenerateComponent = value; - } + /** + * 对应构件实体Id + */ + public String getComponentEntityId() { + return componentEntityId; + } - ///#endregion + public void setComponentEntityId(String value) { + this.componentEntityId = value; + } - ///#region 方法 + /** + * 对应构件实体包名 + */ + private String privateComponentPkgName; - /** - 当前对象是否等于同一类型的另一个对象。 - - @param other 与此对象进行比较的对象。 - @return 如果当前对象等于 other 参数,则为 true;否则为 false。 - */ - @Override - public boolean equals(ViewModelAction other) - { + public String getComponentPkgName() { + return privateComponentPkgName; + } - MappedCdpActionBase cdpAction = (MappedCdpActionBase)((other instanceof MappedCdpActionBase) ? other : null); - if (cdpAction == null) - { - return false; - } - if (getID().equals(cdpAction.getComponentEntityId()) && getCode().equals(cdpAction.getCode()) && getName().equals(cdpAction.getName()) && getType() == cdpAction.getType() && getComponentPkgName().equals(cdpAction.getComponentPkgName()) && getComponentName().equals(cdpAction.getComponentName()) && getIsGenerateComponent() == cdpAction.getIsGenerateComponent() && getComponentEntityId().equals(cdpAction.getComponentEntityId())) - { - return true; - } + public void setComponentPkgName(String value) { + privateComponentPkgName = value; + } - return false; - } + private boolean privateIsGenerateComponent; - /** - 重载ToString方法 - - @return 描述 - */ - @Override - public String toString() - { - return String.format("[VM action] ID:%1$s, Code:%2$s, Name:%3$s", getID(), getCode(), getName()); - } + public boolean getIsGenerateComponent() { + return privateIsGenerateComponent; + } - ///#endregion + public void setIsGenerateComponent(boolean value) { + privateIsGenerateComponent = value; + } + + /** + * 当前对象是否等于同一类型的另一个对象。 + * + * @param other 与此对象进行比较的对象。 + * @return 如果当前对象等于 other 参数,则为 true;否则为 false。 + */ + @Override + public boolean equals(ViewModelAction other) { + + MappedCdpActionBase cdpAction = (MappedCdpActionBase)((other instanceof MappedCdpActionBase) ? other : null); + if (cdpAction == null) { + return false; + } + if (getID().equals(cdpAction.getComponentEntityId()) && getCode().equals(cdpAction.getCode()) && getName().equals(cdpAction.getName()) && getType() == cdpAction.getType() && getComponentPkgName().equals(cdpAction.getComponentPkgName()) && getComponentName().equals(cdpAction.getComponentName()) && getIsGenerateComponent() == cdpAction.getIsGenerateComponent() && getComponentEntityId().equals(cdpAction.getComponentEntityId())) { + return true; + } + + return false; + } + + /** + * 重载ToString方法 + * + * @return 描述 + */ + @Override + public String toString() { + return String.format("[VM action] ID:%1$s, Code:%2$s, Name:%3$s", getID(), getCode(), getName()); + } } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/VMActionResult.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/VMActionResult.java index f1c229f..b290b38 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/VMActionResult.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/VMActionResult.java @@ -10,46 +10,38 @@ import java.io.Serializable; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class VMActionResult implements Cloneable, Serializable -{ - ///#region 属性 - - /** - 类型名称 - - */ - private String privateTypeName; - public final String getTypeName() - { - return privateTypeName; - } - public final void setTypeName(String value) - { - privateTypeName = value; - } - - ///#endregion - - ///#region 方法 - - /** - 克隆 - - @return Action执行结果 - */ - public final VMActionResult clone() - { -// return MemberwiseClone(); - Object tempVar = null; - try { - tempVar = super.clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - VMActionResult obj = (VMActionResult) ((tempVar instanceof ActionFormatParameter) ? tempVar : null); - - return obj; - - ///#endregion -} +public class VMActionResult implements Cloneable, Serializable { + + /** + * 类型名称 + */ + private String privateTypeName; + + public final String getTypeName() { + return privateTypeName; + } + + public final void setTypeName(String value) { + privateTypeName = value; + } + + + /** + * 克隆 + * + * @return Action执行结果 + */ + @Override + public final VMActionResult clone() { + Object tempVar = null; + try { + tempVar = super.clone(); + } catch (CloneNotSupportedException e) { + e.printStackTrace(); + } + VMActionResult obj = (VMActionResult)((tempVar instanceof ActionFormatParameter) ? tempVar : null); + + return obj; + + } } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelAction.java index 1b58784..2e4be93 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelAction.java @@ -1,9 +1,9 @@ package org.openatom.ubml.model.vo.definition.action; +import java.io.Serializable; import org.openatom.ubml.model.common.definition.cef.entity.CustomizationInfo; import org.openatom.ubml.model.vo.definition.action.viewmodelbase.ViewModelReturnValue; import org.openatom.ubml.model.vo.definition.common.ViewModelMapping; -import java.io.Serializable; /** * The Definition Of The View Model Action @@ -14,215 +14,214 @@ import java.io.Serializable; * @Version: V1.0 */ public abstract class ViewModelAction implements Cloneable, Serializable { - ///#region 属性 - - /** - * 标识 - */ - private String privateID; - - public String getID() { - return privateID; - } - - public void setID(String value) { - privateID = value; - } - - /** - * 编号 - */ - private String privateCode; - - public String getCode() { - return privateCode; - } - - public void setCode(String value) { - privateCode = value; - } - - /** - * 名称 - */ - private String privateName; - - public String getName() { - return privateName; - } - - public void setName(String value) { - privateName = value; - } - - /** - * 类型 - */ - private ViewModelActionType privateType = ViewModelActionType.forValue(0); - - public ViewModelActionType getType() { - return privateType; - } - - public void setType(ViewModelActionType value) { - privateType = value; - } - - /** - * 参数列表 - */ - public IViewModelParameterCollection getParameterCollection() { - return getParameters(); - } - - /** - * 返回值 - */ - private ViewModelReturnValue privateReturnValue; - - public final ViewModelReturnValue getReturnValue() { - return privateReturnValue; - } - - public final void setReturnValue(ViewModelReturnValue value) { - privateReturnValue = value; - } - - protected abstract IViewModelParameterCollection getParameters(); - - /** - * 操作映射 - */ - private ViewModelMapping privateMapping; - public final ViewModelMapping getMapping() { - return privateMapping; - } - - public final void setMapping(ViewModelMapping value) { - privateMapping = value; - } - - /** - * 对应构件名 - */ - private String privateComponentName; - - public final String getComponentName() { - return privateComponentName; - } - - public final void setComponentName(String value) { - privateComponentName = value; - } - - private java.util.HashMap extendProperties; - - /** - * 表单拓展节点 - */ - public final java.util.HashMap getExtendProperties() { - if (extendProperties == null) { - extendProperties = new java.util.HashMap(); + /** + * 标识 + */ + private String privateID; + + public String getID() { + return privateID; + } + + public void setID(String value) { + privateID = value; + } + + /** + * 编号 + */ + private String privateCode; + + public String getCode() { + return privateCode; + } + + public void setCode(String value) { + privateCode = value; + } + + /** + * 名称 + */ + private String privateName; + + public String getName() { + return privateName; + } + + public void setName(String value) { + privateName = value; + } + + /** + * 类型 + */ + private ViewModelActionType privateType = ViewModelActionType.forValue(0); + + public ViewModelActionType getType() { + return privateType; + } + + public void setType(ViewModelActionType value) { + privateType = value; + } + + /** + * 参数列表 + */ + public IViewModelParameterCollection getParameterCollection() { + return getParameters(); + } + + /** + * 返回值 + */ + private ViewModelReturnValue privateReturnValue; + + public final ViewModelReturnValue getReturnValue() { + return privateReturnValue; + } + + public final void setReturnValue(ViewModelReturnValue value) { + privateReturnValue = value; + } + + protected abstract IViewModelParameterCollection getParameters(); + + /** + * 操作映射 + */ + private ViewModelMapping privateMapping; + + public final ViewModelMapping getMapping() { + return privateMapping; + } + + public final void setMapping(ViewModelMapping value) { + privateMapping = value; } - return extendProperties; - } - - public void setExtendProperties(java.util.HashMap value) { - extendProperties = value; - } - - private boolean privateIsAutoSave; - public final boolean getIsAutoSave() { - return privateIsAutoSave; - } + /** + * 对应构件名 + */ + private String privateComponentName; - public final void setIsAutoSave(boolean value) { - privateIsAutoSave = value; - } + public final String getComponentName() { + return privateComponentName; + } - private CustomizationInfo customizationInfo = new CustomizationInfo(); - public CustomizationInfo getCustomizationInfo() { - return this.customizationInfo; - } + public final void setComponentName(String value) { + privateComponentName = value; + } - public void setCustomizationInfo(CustomizationInfo customizationInfo) { - this.customizationInfo = customizationInfo; - } - ///#endregion - - ///#region 方法 + private java.util.HashMap extendProperties; - /** - * 重写Clone - */ - public abstract ViewModelAction clone(); + /** + * 表单拓展节点 + */ + public final java.util.HashMap getExtendProperties() { + if (extendProperties == null) { + extendProperties = new java.util.HashMap(); + } + return extendProperties; + } - /** - * 重写相等判断 - */ - @Override - public boolean equals(Object obj) { - if (obj.equals(null)) { - return false; + public void setExtendProperties(java.util.HashMap value) { + extendProperties = value; } - if (obj.equals(this)) { - return true; + + private boolean privateIsAutoSave; + + public final boolean getIsAutoSave() { + return privateIsAutoSave; } - if (obj.getClass() != getClass()) { - return false; + + public final void setIsAutoSave(boolean value) { + privateIsAutoSave = value; } - return equals((ViewModelAction) obj); - } - /** - * 强类型相等判断 - */ - public boolean equals(ViewModelAction other) { + private CustomizationInfo customizationInfo = new CustomizationInfo(); - if (other == null) { - return false; + public CustomizationInfo getCustomizationInfo() { + return this.customizationInfo; } - if (getID().equals(other.getID()) && getCode().equals(other.getCode()) && getName() - .equals(other.getName()) && getType() == other.getType() && getMapping() - .equals(other.getMapping()) && getComponentName().equals(other.getComponentName())) { - return true; + public void setCustomizationInfo(CustomizationInfo customizationInfo) { + this.customizationInfo = customizationInfo; } - return false; - } + ///方法 + + /** + * 重写Clone + */ + @Override + public abstract ViewModelAction clone(); + + /** + * 重写相等判断 + */ + @Override + public boolean equals(Object obj) { + if (obj.equals(null)) { + return false; + } + if (obj.equals(this)) { + return true; + } + if (obj.getClass() != getClass()) { + return false; + } + return equals((ViewModelAction)obj); + } + + /** + * 强类型相等判断 + */ + public boolean equals(ViewModelAction other) { + + if (other == null) { + return false; + } - /** - * 重写HashCode - */ - @Override - public int hashCode() { + if (getID().equals(other.getID()) && getCode().equals(other.getCode()) && getName() + .equals(other.getName()) && getType() == other.getType() && getMapping() + .equals(other.getMapping()) && getComponentName().equals(other.getComponentName())) { + return true; + } + + return false; + } + + /** + * 重写HashCode + */ + @Override + public int hashCode() { // unchecked - { - int hashCode = (getID() != null ? getID().hashCode() : 0); - hashCode = (hashCode * 397) ^ (getCode() != null ? getCode().hashCode() : 0); - hashCode = (hashCode * 397) ^ (getName() != null ? getName().hashCode() : 0); - hashCode = (hashCode * 397) ^ (getReturnValue() != null ? getReturnValue().hashCode() : 0); - hashCode = (hashCode * 397) ^ getType().getValue(); - hashCode = - (hashCode * 397) ^ (getComponentName() != null ? getComponentName().hashCode() : 0); - hashCode = (hashCode * 397) ^ (getMapping() != null ? getMapping().hashCode() : 0); - - return hashCode; - } - } - - /** - * 重载ToString方法 - * - * @return 描述 - */ - @Override - public String toString() { - return String - .format("[VM BizAction] ID:%1$s,Code:%2$s,Name:%3$s", getID(), getCode(), getName()); - } - ///#endregion + { + int hashCode = (getID() != null ? getID().hashCode() : 0); + hashCode = (hashCode * 397) ^ (getCode() != null ? getCode().hashCode() : 0); + hashCode = (hashCode * 397) ^ (getName() != null ? getName().hashCode() : 0); + hashCode = (hashCode * 397) ^ (getReturnValue() != null ? getReturnValue().hashCode() : 0); + hashCode = (hashCode * 397) ^ getType().getValue(); + hashCode = + (hashCode * 397) ^ (getComponentName() != null ? getComponentName().hashCode() : 0); + hashCode = (hashCode * 397) ^ (getMapping() != null ? getMapping().hashCode() : 0); + + return hashCode; + } + } + + /** + * 重载ToString方法 + * + * @return 描述 + */ + @Override + public String toString() { + return String + .format("[VM BizAction] ID:%1$s,Code:%2$s,Name:%3$s", getID(), getCode(), getName()); + } } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMActionCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMActionCollection.java index d2cd0f1..8b9e983 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMActionCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMActionCollection.java @@ -12,9 +12,7 @@ import org.openatom.ubml.model.vo.definition.action.ViewModelAction; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class VMActionCollection extends BaseList implements Cloneable, - Serializable { - ///#region 属性 +public class VMActionCollection extends BaseList implements Cloneable, Serializable { /** * 根据ID获取操作 @@ -32,21 +30,18 @@ public class VMActionCollection extends BaseList implements Clo return null; } - ///#endregion - - ///#region 方法 /** * 克隆 * * @return VO上的操作集合 */ -// public final Object clone() + @Override public final VMActionCollection clone() { VMActionCollection collections = new VMActionCollection(); for (ViewModelAction op : this) { ViewModelAction tempVar = op.clone(); - collections.add((ViewModelAction) ((tempVar instanceof ViewModelAction) ? tempVar : null)); + collections.add((ViewModelAction)((tempVar instanceof ViewModelAction) ? tempVar : null)); } return collections; @@ -71,7 +66,7 @@ public class VMActionCollection extends BaseList implements Clo return false; } - return equals((VMActionCollection) obj); + return equals((VMActionCollection)obj); } /** @@ -103,12 +98,11 @@ public class VMActionCollection extends BaseList implements Clo if (action == null) { return false; } - String id = ((ViewModelAction) action).getID(); + String id = ((ViewModelAction)action).getID(); if (id == null) { return false; } - super.removeIf(item -> - id.equals(item.getID()) + super.removeIf(item -> id.equals(item.getID()) ); return true; } @@ -123,16 +117,5 @@ public class VMActionCollection extends BaseList implements Clo ); return true; } - ///// - ///// 设置Action集合所属的结点 - ///// - ///// - //public void SetOwner(GspViewObject node) - //{ - // foreach (var item in this) - // { - // item.Owner = node; - // } - //} - ///#endregion + } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMElementCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMElementCollection.java index 7eb496d..eff9718 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMElementCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMElementCollection.java @@ -14,121 +14,97 @@ import org.openatom.ubml.model.vo.definition.GspViewObject; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class VMElementCollection extends GspElementCollection implements Serializable -{ - ///#region 构造函数 +public class VMElementCollection extends GspElementCollection implements Serializable { - /** - 字段集合构造函数 - - @param owner 所属视图对象结点 - */ -//ORIGINAL LINE: public VMElementCollection(GspViewObject owner = null) - public VMElementCollection(GspViewObject owner) - { - super(owner); - } + /** + * 字段集合构造函数 + * + * @param owner 所属视图对象结点 + */ + public VMElementCollection(GspViewObject owner) { + super(owner); + } - ///#endregion - ///#region 属性 + ///属性 - /** - 根据ID获取节点元素 - - @param id 节点元素ID - @return 节点元素 - */ - @Override//不能override final的類 - public final GspViewModelElement getItem(String id) - { - for(IGspCommonField item:this){ - if(item instanceof GspViewModelElement){ - return (GspViewModelElement)item; - } - } - return null; -// Object tempVar = this.FirstOrDefault(i => id.equals(i.ID)); -// return (GspViewModelElement)((tempVar instanceof GspViewModelElement) ? tempVar : null); - } + /** + * 根据ID获取节点元素 + * + * @param id 节点元素ID + * @return 节点元素 + */ + @Override//不能override final的類 + public final GspViewModelElement getItem(String id) { + for (IGspCommonField item : this) { + if (item instanceof GspViewModelElement) { + return (GspViewModelElement)item; + } + } + return null; + } - ///#endregion - ///#region 方法 - /** - 重载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; - } + /** + * 重载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((VMElementCollection)obj); - } + return equals((VMElementCollection)obj); + } - /** - 当前对象是否等于同一类型的另一个对象。 - - @param other 与此对象进行比较的对象。 - @return 如果当前对象等于 other 参数,则为 true;否则为 false。 - */ - protected boolean equals(VMElementCollection other) - { -// if (Count != other.size()) - if (this.size() != other.size()) - { - return false; - } - for (IGspCommonField item : this) - { - IGspCommonField otherItem = other.getItem(item.getID()); - if (otherItem == null) - { - return false; - } - if (!item.equals(otherItem)) - { - return false; - } - } + /** + * 当前对象是否等于同一类型的另一个对象。 + * + * @param other 与此对象进行比较的对象。 + * @return 如果当前对象等于 other 参数,则为 true;否则为 false。 + */ + protected boolean equals(VMElementCollection other) { + if (this.size() != other.size()) { + return false; + } + for (IGspCommonField item : this) { + IGspCommonField otherItem = other.getItem(item.getID()); + if (otherItem == null) { + return false; + } + if (!item.equals(otherItem)) { + return false; + } + } - return true; - } + return true; + } - /** - 克隆 - - @return VO节点元素集合 - */ - public final VMElementCollection clone() - { - VMElementCollection collections; - collections = new VMElementCollection((GspViewObject) getParentObject()); - -// collections.addAll(this); -// (this.Select(element => (GspViewModelElement)((tempVar instanceof GspViewModelElement) ? -// tempVar : null))); - for(IGspCommonField item:this){ -// Object item; - GspViewModelElement obj = ((GspViewModelElement)item).clone(); - GspViewModelElement tempVar = ((obj instanceof GspViewModelElement) ? obj : null); - collections.add(tempVar); - } - return collections; - } + /** + * 克隆 + * + * @return VO节点元素集合 + */ + @Override + public final VMElementCollection clone() { + VMElementCollection collections; + collections = new VMElementCollection((GspViewObject)getParentObject()); + for (IGspCommonField item : this) { + GspViewModelElement obj = ((GspViewModelElement)item).clone(); + GspViewModelElement tempVar = ((obj instanceof GspViewModelElement) ? obj : null); + collections.add(tempVar); + } + return collections; + } } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ValueHelpConfigCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ValueHelpConfigCollection.java index d24c648..aa01cd2 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ValueHelpConfigCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ValueHelpConfigCollection.java @@ -12,88 +12,69 @@ import org.openatom.ubml.model.vo.definition.common.ValueHelpConfig; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class ValueHelpConfigCollection extends BaseList implements Cloneable, Serializable -{ - ///#region 构造函数 +public class ValueHelpConfigCollection extends BaseList implements Cloneable, Serializable { - /** - 构造函数 - - */ - public ValueHelpConfigCollection() - { - super(); - } + /** + * 构造函数 + */ + public ValueHelpConfigCollection() { + super(); + } - ///#endregion - ///#region 属性 - - /** - 获取指定ID的值帮助配置 - - @param elementId Element标识 - @return 值帮助配置 - */ - public final ValueHelpConfig getItem(String elementId) - { - for(ValueHelpConfig item:this){ - if(item.getElementId().equals(elementId)){ - return item; - } - } - return null; + /** + * 获取指定ID的值帮助配置 + * + * @param elementId Element标识 + * @return 值帮助配置 + */ + public final ValueHelpConfig getItem(String elementId) { + for (ValueHelpConfig item : this) { + if (item.getElementId().equals(elementId)) { + return item; + } + } + return null; // return Items.firstOrDefault(i => elementId.equals(i.ElementId)); - } - - ///#endregion + } - ///#region 方法 - /** - 批量添加值帮助配置 - - @param items 值帮助配置集合 - */ - public final void addRange(ValueHelpConfig[] items) - { - for (ValueHelpConfig item : items) - { - add(item); - } - } + /** + * 批量添加值帮助配置 + * + * @param items 值帮助配置集合 + */ + public final void addRange(ValueHelpConfig[] items) { + for (ValueHelpConfig item : items) { + add(item); + } + } - /** - 批量添加值帮助配置 - - @param items 值帮助配置集合 - */ - public final void addRange(Iterable items) - { - for (ValueHelpConfig item : items) - { - add(item); - } - } + /** + * 批量添加值帮助配置 + * + * @param items 值帮助配置集合 + */ + public final void addRange(Iterable items) { + for (ValueHelpConfig item : items) { + add(item); + } + } - /** - 克隆 - - @return 值帮助配置集合的副本 - */ -// public final Object clone() - @Override - public final ValueHelpConfigCollection clone() - { - ValueHelpConfigCollection newCollection = new ValueHelpConfigCollection(); + /** + * 克隆 + * + * @return 值帮助配置集合的副本 + */ + @Override + public final ValueHelpConfigCollection clone() { + ValueHelpConfigCollection newCollection = new ValueHelpConfigCollection(); - for (ValueHelpConfig item : this) - { - add(item); - } + for (ValueHelpConfig item : this) { + add(item); + } - return newCollection; - } + return newCollection; + } - ///#endregion } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ConvertUtils.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ConvertUtils.java index 62bfc2b..b8332d4 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ConvertUtils.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ConvertUtils.java @@ -154,7 +154,7 @@ // vm.setMapping(tempVar); // } // -// // //#region Object +// // //Object //////ORIGINAL LINE: public static GspViewObject toObject(IGspCommonObject cmObject, string pkgName, string metadataId, string parentObjIDElementId, GspVoObjectSourceType sourceType = GspVoObjectSourceType.BeObject) // public static GspViewObject toObject(IGspCommonObject cmObject, String pkgName, String metadataId, String parentObjIDElementId, GspVoObjectSourceType sourceType) { // GspViewObject vmObject = new GspViewObject(); @@ -225,7 +225,7 @@ // } // // -// //#region 字段相关属性,需额外处理 +// //字段相关属性,需额外处理 // // /** // * vo对象转换时,更新字段相关属性 @@ -423,7 +423,7 @@ // } // throw new RuntimeException("无外键关联。"); // } -// //#endregion +// // // /** // * 更新分级信息 @@ -550,9 +550,9 @@ // } // } // -// //#endregion // -// //#region Element +// +// //Element // public static GspViewModelElement toElement(IGspCommonElement element, String pkgName, String metadataId) { // return toElement(element, pkgName, metadataId); // } @@ -681,7 +681,7 @@ // //TODO 后续UDt中集成VM属性后,需要获取UDT后赋值 // } // -// //#region 关联 +// //关联 // private static void convertAssociation(IGspCommonElement cmEle, GspViewModelElement vmEle, String pkgName, String metadataId, GspVoElementSourceType sourceType) { // // 关联带出字段,无关联信息 // if (cmEle.getIsRefElement()) { @@ -722,10 +722,10 @@ // // return vmAssociation; // } -// //#endregion -// //#endregion // -// //#region Action +// +// +// //Action // private static void buildVmActions(BizMgrActionCollection beMgrActions, GspViewModel vm, String pkgName, String metadataId) { // if (beMgrActions == null) { // return; @@ -838,16 +838,16 @@ // // // } -//////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -// //#endregion +////TODO TASK: There is no preprocessor in Java: +// //// -//////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -//// //#region Vo -//////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -//// //#endregion +////TODO TASK: There is no preprocessor in Java: +//// //Vo +////TODO TASK: There is no preprocessor in Java: //// -//////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -//// //#region Qo +//// +////TODO TASK: There is no preprocessor in Java: +//// //Qo //// //// //public static GspViewModel convertQoToViewModel(QueryObject qo, string pkgName, string metadataId, string idElementId, List eleIdList=null) //// //{ @@ -908,11 +908,11 @@ //// // }; //// //} //// -//////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -//// //#endregion +////TODO TASK: There is no preprocessor in Java: +//// //// -//////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -//// //#region Tool +////TODO TASK: There is no preprocessor in Java: +//// //Tool //// //// /** //// * 根据输入字段ID列表将co字段转换为vo字段集合 @@ -940,7 +940,7 @@ //// } //// return voElements; //// } -//////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -//// //#endregion -//// //#endregion +////TODO TASK: There is no preprocessor in Java: +//// +//// //} \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/LinkBeUtils.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/LinkBeUtils.java index dc6c82d..0234efc 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/LinkBeUtils.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/LinkBeUtils.java @@ -101,8 +101,8 @@ // } // } // -////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -// //#region 对象 +//TODO TASK: There is no preprocessor in Java: +// //对象 // // private void linkMainObj(GspViewObject viewObj) { // // 虚拟对象无映射bizObj @@ -172,9 +172,9 @@ // //ConvertUtils.UpdateViewObjectKeys(bizObject, viewObj, parentObjectElementId); // } // -// //#endregion // -// //#region 字段 +// +// //字段 // // private void linkElements(GspViewObject viewObj) { // ArrayList elementList = viewObj.getContainElements().getAllItems(item -> item.getIsVirtual() == false); @@ -416,9 +416,9 @@ // } // return null; // } -// //#endregion // -// //#region 操作 +// +// //操作 // // private void linkActions(GspViewModel vm) { // ArrayList list = vm.getActions().getAllItems(item -> item.getType() == ViewModelActionType.BEAction); @@ -450,11 +450,11 @@ // targetAction.setReturnValue(sourceAction.getReturnValue()); // } // -////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -// //#endregion +//TODO TASK: There is no preprocessor in Java: // -////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -// //#region 业务实体缓存 +// +//TODO TASK: There is no preprocessor in Java: +// //业务实体缓存 // // private GspBusinessEntity getBe(String id) { // return getBizEntity(id); @@ -520,6 +520,6 @@ //// } // } // -////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -// //#endregion +//TODO TASK: There is no preprocessor in Java: +// //} \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ValueHelpConfig.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ValueHelpConfig.java index f212762..0d939ec 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ValueHelpConfig.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ValueHelpConfig.java @@ -20,7 +20,6 @@ import org.openatom.ubml.model.vo.definition.json.model.ValueHelpConfigSerizlize @JsonSerialize(using = ValueHelpConfigSerizlizer.class) public class ValueHelpConfig implements Cloneable, Serializable { - //region 字段 /** * VM元素ID */ @@ -45,10 +44,8 @@ public class ValueHelpConfig implements Cloneable, Serializable { private CustomizationInfo customizationInfo; - //endregion - - ///#region 构造函数 + ///构造函数 public ValueHelpConfig() { } @@ -67,9 +64,6 @@ public class ValueHelpConfig implements Cloneable, Serializable { setFilterExpression(filterExpression); } - ///#endregion - - ///#region 属性 public final String getElementId() { return elementId; @@ -125,26 +119,21 @@ public class ValueHelpConfig implements Cloneable, Serializable { this.customizationInfo = customizationInfo; } - ///#endregion - - ///#region 方法 - /** * 克隆 * * @return 值帮助配置 */ + @Override public final ValueHelpConfig clone() { -// return MemberwiseClone(); Object tempVar = null; try { tempVar = super.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } - ValueHelpConfig obj = (ValueHelpConfig) ((tempVar instanceof ValueHelpConfig) ? tempVar : null); + ValueHelpConfig obj = (ValueHelpConfig)((tempVar instanceof ValueHelpConfig) ? tempVar : null); return obj; } - ///#endregion } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/dataextendinfo/VoDataExtendInfo.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/dataextendinfo/VoDataExtendInfo.java index 22f570f..7c15ac8 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/dataextendinfo/VoDataExtendInfo.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/dataextendinfo/VoDataExtendInfo.java @@ -11,7 +11,6 @@ import org.openatom.ubml.model.vo.definition.collection.VMActionCollection; * @Version: V1.0 */ public class VoDataExtendInfo { - ///#region 私有字段 private VMActionCollection dataMappingActions; private VMActionCollection beforeQueryActions; @@ -38,7 +37,6 @@ public class VoDataExtendInfo { private VMActionCollection multiDeleteActions; private VMActionCollection afterMultiDeleteActions; - ///#endregion public final VMActionCollection getBeforeMultiDeleteActions() { if (beforeMultiDeleteActions == null) { beforeMultiDeleteActions = new VMActionCollection(); @@ -298,7 +296,6 @@ public class VoDataExtendInfo { return afterCreateActions; } - // public void setAfterCreateActions(VMActionCollection value) public void setAfterCreateActions(VMActionCollection value) { this.afterCreateActions = value; } diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ValueHelpConfigDeserizlizer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ValueHelpConfigDeserizlizer.java index 00e6ee2..0f839fc 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ValueHelpConfigDeserizlizer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ValueHelpConfigDeserizlizer.java @@ -41,7 +41,7 @@ public class ValueHelpConfigDeserizlizer extends JsonDeserializer { SerializerUtils.writePropertyValue(writer, ViewModelJsonConst.FilterExpression, helpConfig.getFilterExpression()); SerializerUtils - .writePropertyValue(writer, CefNames.CustomizationInfo, helpConfig.getCustomizationInfo()); + .writePropertyValue(writer, CefNames.CUSTOMIZATION_INFO, helpConfig.getCustomizationInfo()); SerializerUtils.writePropertyName(writer,ViewModelJsonConst.EnableCustomHelpAuth); SerializerUtils.writePropertyValue_boolean(writer,helpConfig.getEnableCustomHelpAuth()); writeHelpExtend(writer, helpConfig.getHelpExtend()); diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelSerializer.java index 30191a2..f622e70 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelSerializer.java @@ -23,7 +23,7 @@ import org.openatom.ubml.model.vo.definition.json.operation.VmActionCollectionSe public class ViewModelSerializer extends CommonModelSerializer { - //region BaseProp + //BaseProp @Override protected void writeExtendModelProperty(IGspCommonModel commonModel, JsonGenerator writer) { GspViewModel vm = (GspViewModel) commonModel; @@ -94,15 +94,15 @@ public class ViewModelSerializer extends CommonModelSerializer { } - //endregion - //region SelfProp + + //SelfProp @Override protected void writeExtendModelSelfProperty(IGspCommonModel commonModel, JsonGenerator writer) { } - //endregion + @Override protected CmObjectSerializer getCmObjectSerializer() { return new ViewObjectSerializer(); diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionDeserializer.java index 300b751..3acfd6a 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionDeserializer.java @@ -77,7 +77,7 @@ public abstract class VmActionDeserializer extends Js case ViewModelJsonConst.IsAutoSave: op.setIsAutoSave(SerializerUtils.readPropertyValue_boolean(jsonParser)); break; - case CefNames.CustomizationInfo: + case CefNames.CUSTOMIZATION_INFO: op.setCustomizationInfo(SerializerUtils.readPropertyValue_Object(CustomizationInfo.class,jsonParser)); try { jsonParser.nextToken(); diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionSerializer.java index 78781b5..2588ca5 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionSerializer.java @@ -29,7 +29,7 @@ public abstract class VmActionSerializer extends Json SerializerUtils.writePropertyValue(writer, ViewModelJsonConst.ComponentName, value.getComponentName()); SerializerUtils.writePropertyValue(writer, CommonModelNames.TYPE, value.getType().toString()); SerializerUtils.writePropertyValue(writer, ViewModelJsonConst.IsAutoSave, value.getIsAutoSave()); - SerializerUtils.writePropertyValue(writer, CefNames.CustomizationInfo,value.getCustomizationInfo()); + SerializerUtils.writePropertyValue(writer, CefNames.CUSTOMIZATION_INFO,value.getCustomizationInfo()); writeParameters(writer, value); writeReturnValue(writer, value); writeMapping(writer, value); -- Gitee From 97e40d8e42afaadfc1874255741a3266000d8aec Mon Sep 17 00:00:00 2001 From: Zhibei Hao <837948266@qq.com> Date: Thu, 4 Feb 2021 18:08:49 +0800 Subject: [PATCH 03/61] docs: translate CONTRIBUTIMG.md --- CONTRIBUTING.md | 216 +++++++++++++++++++++++------------------------- 1 file changed, 105 insertions(+), 111 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a119810..a769912 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,88 +1,87 @@ -# Contributing to UBML +# 为UBML做出贡献 -It is warmly welcomed if you have interest to hack on UBML. First, we encourage this kind of willing very much. And here is a list of contributing guide for you. +首先,热烈欢迎对UBML感兴趣的你。我们非常鼓励这种意愿。这里有一份对你有帮助的指南。 -## Topics +## 主题 -* [Reporting security issues](#reporting-security-issues) -* [Reporting general issues](#reporting-general-issues) -* [Code and doc contribution](#code-and-doc-contribution) -* [Test case contribution](#test-case-contribution) -* [Engage to help anything](#engage-to-help-anything) -* [Code Style](#code-style) +* [报告安全性问题](#reporting-security-issues) +* [报告一般性问题](#reporting-general-issues) +* [贡献文档和代码](#code-and-doc-contribution) +* [贡献测试用例](#test-case-contribution) +* [参与任何有帮助的事请](#engage-to-help-anything) +* [的艾玛书写风格](#code-style) -## Reporting security issues +## 报告安全性问题 -Security issues are always treated seriously. As our usual principle, we discourage anyone to spread security issues. If you find a security issue of UBML, please do not discuss it in public and even do not open a public issue. Instead we encourage you to send us a private email to [ubml_user@groups.163.com](mailto:ubml_user@groups.163.com) or [ubml_dev@groups.163.com](mailto:ubml_dev@groups.163.com)to report this. +安全问题永远会被认真对待。按照我们一贯的原则,我们不鼓励任何人传播安全问题。如果你发现了一个UBML的安全问题,请不要公开讨论它,并且不要放到公共问题中。我们鼓励您向[ubml_user@groups.163.com](mailto:ubml_user@groups.163.com)或[ubml_dev@groups.163.com](mailto:ubml_dev@groups.163.com)发送私人电子邮件报告此事。 -## Reporting general issues +## 报告一般性问题 -To be honest, we regard every user of UBML as a very kind contributor. After experiencing UBML, you may have some feedback for the project. Then feel free to open an issue via [NEW ISSUE](http://open.inspur.com/open-igix/ubml/issues/new). +平心而论,我们认为UBML的每一个用户都是非常友善的贡献者。在体验过UBML之后,您可能会对项目有一些反馈。然后通过[新建问题](http://open.inspur.com/open-igix/ubml/issues/new)自由地创建一个问题。 -Since we collaborate project UBML in a distributed way, we appreciate **WELL-WRITTEN**, **DETAILED**, **EXPLICIT** issue reports. To make the communication more efficient, we wish everyone could search if your issue is an existing one in the searching list. If you find it existing, please add your details in comments under the existing issue instead of opening a brand new one. +因为我们是以分布式的方式协作项目UBML,所以我们青睐**写得很好的**,**详细的**,**明确的**问题报告。为了使交流更有效率,我们希望每个人都可以提问前先搜索你的问题是否存在于列表中。如果您发现它存在,请在现有问题下的评论中添加您的详细信息,而不是开一个全新的问题。 -To make the issue details as standard as possible, we setup an [ISSUE TEMPLATE](./.gitee/ISSUE_TEMPLATE) for issue - reporters. Please **BE SURE** to follow the instructions to fill fields in template. +为了使问题细节尽可能标准化,我们为问题设置了一个[问题模板](./.gitee/ISSUE_TEMPLATE) +记者。请**确保**按照说明填写模板中的字段。 -There are a lot of cases when you could open an issue: +很多情况下,你可以开启一个提问: -* bug report -* feature request -* performance issues -* feature proposal -* feature design -* help wanted -* doc incomplete -* test improvement -* any questions on project -* and so on +*错误报告 +*功能要求 +*性能问题 +*功能建议 +*功能设计 +*寻求帮助 +*文档缺失 +*测试改进 +*任何项目中的问题 +*等等 -Also we must remind that when filling a new issue, please remember to remove the sensitive data from your post. Sensitive data could be password, secret key, network locations, private business data and so on. +我们也必须提醒您,当填写一个新的问题时,请记得从您的帖子中删除敏感数据。敏感数据包含密码、密钥、网络位置、私有业务数据等等。 -## Code and doc contribution +## 贡献文档和代码 -Every action to make project UBML better is encouraged. On GitHub, every improvement for UBML could be via a PR (short for pull request). +我们鼓励每一个使UBML项目更好的行为。在GitHub上,UBML的每一个改进都可以通过一个PR (pull request的缩写)实现。 -* If you find a typo, try to fix it! -* If you find a bug, try to fix it! -* If you find some redundant codes, try to remove them! -* If you find some test cases missing, try to add them! -* If you could enhance a feature, please **DO NOT** hesitate! -* If you find code implicit, try to add comments to make it clear! -* If you find code ugly, try to refactor that! -* If you can help to improve documents, it could not be better! -* If you find document incorrect, just do it and fix that! -* ... +*如果你发现一个拼写错误,试着修复它! +*如果你发现一个bug,试着修复它! +*如果你发现一些多余的代码,试着删除它们! +*如果你发现一些测试用例缺失,尝试添加它们! +*如果您可以增强一个功能,请**不要**犹豫! +*如果你发现代码是不易理解的,试着添加注释使它更明确! +*如果你发现代码很丑,试着重构它! +*如果你能帮助改进文档,那就再好不过了! +*如果你发现文档不正确,请立刻修复它! +*…… -Actually it is impossible to list them completely. Just remember one principle: +实际上,我们不可能把它们全部列出来。只要记住一个原则: -> WE ARE LOOKING FORWARD TO ANY PR FROM YOU. +> 我们期待着你的任何PR。 -Since you are ready to improve UBML with a PR, we suggest you could take a look at the PR rules here. +既然您已经准备好用PR来改进UBML,我们建议您可以在这里查看一下PR规则。 -* [Workspace Preparation](#workspace-preparation) -* [Branch Definition](#branch-definition) -* [Commit Rules](#commit-rules) -* [PR Description](#pr-description) +*(准备工作区)(# workspace-preparation) +*(定义分支)(# branch-definition) +*(提交规则) (# commit-rules) +*(PR说明)(# pr-description) -### Workspace Preparation +### 工作区准备 -To put forward a PR, we assume you have registered a GitHub ID. Then you could finish the preparation in the following steps: +为了提一个PR,如果您已经注册了GitHub ID,那么您可以按照以下步骤进行准备: -1. **FORK** UBML to your repository. To make this work, you just need to click the button Fork in right-left of [ubml -/ubml-standard](https://gitee.com/ubml/ubml-standard) main page. Then you will end up with your repository in `https -://gitee.com//ubml-standard`, in which `your-username` is your Gitee username. +1. **FORK** UBML到你的本地代码库。要做到这一点,您只需要单击[ubml +/ubml-standard](https://gitee.com/ubml/ubml-standard)主页右侧的Fork按钮。然后您将在 `https://gitee.com//ubml-standard`获取到,其中`your-username`是你的Gitee用户名。 -1. **CLONE** your own repository to develop locally. Use `git clone git@gitee.com:/ubml-impl.git` to clone repository to your local machine. Then you can create new branches to finish the change you wish to make. +1. **克隆**到本地自己的开发仓库。使用`git clone git@gitee.com:/ubml-impl.git`将代码库克隆到本地。然后,您可以创建新的分支来完成您希望进行的更改。 -1. **Set Remote** upstream to be `git@gitee.com:ubml/ubml-impl.git` using the following two commands: +1. **设置远程仓库地址** 使用如下两条命令更新远程链接为`git@gitee.com:ubml/ubml-impl.git`: ``` git remote add upstream git@giteee.com:ubml/ubml-impl.git git remote set-url --push upstream no-pushing ``` -With this remote setting, you can check your git remote configuration like this: +完成这个远程设置,你可以像这样检查你的git远程配置: ``` $ git remote -v @@ -92,105 +91,100 @@ upstream git@gitee.com:ubml/ubml-impl.git (fetch) upstream no-pushing (push) ``` -Adding this, we can easily synchronize local branches with upstream branches. +通过添加这个功能,我们可以很容易地同步本地分支和远程分支。 -### Branch Definition +### 分支合并 -Right now we assume every contribution via pull request is for [branch develop](https://gitee.com/ubml/ubml-standard -/tree/develop) in UBML. Before contributing, be aware of branch definition would help a lot. +现在,我们假设每个通过pull请求的贡献都是为了UBML[分支发展](https://gitee.com/ubml/ubml-standard/tree/develop)。在做出贡献之前,了解分支定义将会有很大帮助。 -As a contributor, keep in mind again that every contribution via pull request is for branch develop. While in project - UBML, there are several other branches, we generally call them release branches(such as 0.9.0,0.9.1), feature branches, hotfix branches and master branch. +作为贡献者,再次记住,通过pull请求的每个提交都是为了分支开发。而在UBML项目 +,还有其他几个分支,我们通常称之为发布分支(比如0.9.0,0.9.1),特性分支,热修复分支和主分支。 -When officially releasing a version, there will be a release branch and named with the version number. +当正式发布一个版本时,会有一个发布分支并以版本号命名。 -After the release, we will merge the commit of the release branch into the master branch. +在发布之后,我们将把发布分支的提交合并到主分支中。 -When we find that there is a bug in a certain version, we will decide to fix it in a later version or fix it in a specific hotfix version. When we decide to fix the hotfix version, we will checkout the hotfix branch based on the corresponding release branch, perform code repair and verification, and merge it into the develop branch and the master branch. +当我们发现某个版本有bug时,我们会决定在以后的版本中修复它,或者在特定的热修复版本中修复它。当我们决定修复热修复版本时,我们将基于相应的发布分支检出热修复分支,执行代码修复和验证,并将其合并到开发分支和主分支中。 -For larger features, we will pull out the feature branch for development and verification. +对于更大的特性,我们将抽出特性分支进行开发和验证。 -### Commit Rules +### 提交规则 -Actually in UBML, we take two rules serious when committing: +实际上,在UBML中,我们在提交时会参考两个原则: -* [Commit Message](#commit-message) -* [Commit Content](#commit-content) +* [提交消息](#commit-message) +* [提交内容](#commit-content) -#### Commit Message +#### 提交消息 -Commit message could help reviewers better understand what is the purpose of submitted PR. It could help accelerate the code review procedure as well. We encourage contributors to use **EXPLICIT** commit message rather than ambiguous message. In general, we advocate the following commit message type: +提交消息可以帮助审稿人更好地理解提交的PR的目的。 它还可以帮助加快代码审查过程。 我们鼓励贡献者使用** EXPLICIT **提交消息而不是模棱两可的消息。 一方面,我们通常提倡以下提交消息类型: -* docs: xxxx. For example, "docs: add docs about ubml-models introduction". -* feature: xxxx.For example, "feature: support VO customization". -* bugfix: xxxx. For example, "bugfix: fix panic when input nil parameter". -* refactor: xxxx. For example, "refactor: simplify to make codes more readable". -* test: xxx. For example, "test: add unit test case for func InsertIntoArray". -* other readable and explicit expression ways. +* docs: xxxx. 例如, "docs: add docs about ubml-models introduction". +* feature: xxxx.例如, "feature: support VO customization". +* bugfix: xxxx. 例如, "bugfix: fix panic when input nil parameter". +* refactor: xxxx. 例如, "refactor: simplify to make codes more readable". +* test: xxx. 例如, "test: add unit test case for func InsertIntoArray". +* 其他可读和显式的表达方式. -On the other side, we discourage contributors from committing message like the following ways: +另一方面,我们不鼓励贡献者像以下方式提交消息: * ~~fix bug~~ * ~~update~~ * ~~add doc~~ -If you get lost, please see [How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/) for a start. +如果你现在有点懵, 请参考 [How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/) 从头开始学习^^. -#### Commit Content +#### 提交内容 -Commit content represents all content changes included in one commit. We had better include things in one single commit which could support reviewer's complete review without any other commits' help. In another word, contents in one single commit can pass the CI to avoid code mess. In brief, there are three minor rules for us to keep in mind: +提交内容表示一次提交中包含的所有内容更改。 我们最好将所有内容包含在一个提交中,这样可以在没有任何其他提交帮助的情况下支持审阅者的完整审阅。 换句话说,一次提交中的内容(应当)是可以通过CI的,以避免代码混乱。 简而言之,我们要记住三个小规则: -* avoid very large change in a commit; -* complete and reviewable for each commit. -* check git config(`user.name`, `user.email`) when committing to ensure that it is associated with your github ID. +* 一次提交避免特别大的修改; +* 每次提交均应当完整且可审查. +* 提交时,检查git配置项(`user.name`, `user.email`) ,确保它与您的github ID相匹配. -In addition, in the code change part, we suggest that all contributors should read the [code style of UBML](#code-style). +另外,在代码更改部分,我们建议所有贡献者都应阅读UBML的 [代码样式](#代码样式). -No matter commit message, or commit content, we do take more emphasis on code review. +无论提交消息还是提交内容,我们都更加注重代码审查. -### PR Description +### PR 说明 -PR is the only way to make change to UBML project files. To help reviewers better get your purpose, PR description - could not be too detailed. We encourage contributors to follow the [PR template](./.gitee/PULL_REQUEST_TEMPLATE.md - ) to finish the pull request. +PR是更改UBML项目文件的唯一方法。 为了帮助审稿人更好地达到目标,PR说明不能太详细. 我们鼓励贡献者遵循 [PR 模板](./.gitee/PULL_REQUEST_TEMPLATE.md) 完成拉取请求. -## Test case contribution +## 测试用例贡献 -Any test case would be welcomed. Currently, UBML function test cases are high priority. +欢迎任何测试用例. 当前, UBML 功能性测试的优先级是最高的. -* For unit test, you need to create a test file named `xxxTest.java` in the test directory of the same module. Recommend you to use the junit5 UT framework +* 对于单元测试,您需要在同一模块的测试目录中创建一个名为`xxxTest.java` . 推荐您使用 junit5 UT 框架 +* 对于集成测试,可以将集成测试放在测试目录或UBML-test模块中。 建议使用模仿测试框架. -* For integration test, you can put the integration test in the test directory or the UBML-test module. It is recommended to use the mockito test framework. +## 致力于帮助任何事情 -## Engage to help anything +我们选择Gitee作为UBML合作的主要场所。 所以这里是UBML最新更新的.虽然通过PR贡献是一种明确的帮助方式,我们仍然鼓励其他方式. -We choose Gitee as the primary place for UBML to collaborate. So the latest updates of UBML are always here. Although - contributions via PR is an explicit way to help, we still call for any other ways. +* 如果可以的话,回复他人的问题; +* 帮助解决其他用户的问题; +* 帮助审查他人的PR设计; +* 帮助查看PR中其他人的代码; +* 讨论有关UBML的问题,以使事情更加明确; +* 在GitHub之外倡导UBML技术; +* 在UBML上撰写博客,等等. -* reply to other's issues if you could; -* help solve other user's problems; -* help review other's PR design; -* help review other's codes in PR; -* discuss about UBML to make things clearer; -* advocate UBML technology beyond GitHub; -* write blogs on UBML and so on. +## 代码样式 -## Code Style +UBML代码样式符合阿里巴巴Java编码准则. -UBML code style Comply with Alibaba Java Coding Guidelines. - -### Guidelines +### 指导方针 [Alibaba-Java-Coding-Guidelines](https://alibaba.github.io/Alibaba-Java-Coding-Guidelines/) -### IDE Plugin Install(not necessary) +### IDE插件安装(非必须) -*It is not necessary to install, if you want to find a problem when you are coding.* +*如果要在编码时发现问题,则无需安装.* #### idea IDE @@ -200,4 +194,4 @@ UBML code style Comply with Alibaba Java Coding Guidelines. [p3c-eclipse-plugin-install](https://github.com/alibaba/p3c/blob/master/eclipse-plugin/README.md) -In a word, **ANY HELP IS CONTRIBUTION.** \ No newline at end of file +总之几句话, **任何帮助都是贡献.** \ No newline at end of file -- Gitee From 9c7fb1a5f0153912c4504b01bef0421f43cdea3e Mon Sep 17 00:00:00 2001 From: bugu <837948266@qq.com> Date: Thu, 4 Mar 2021 23:23:43 +0800 Subject: [PATCH 04/61] optimize entity definition --- .../commonmodel/entity/GspCommonModel.java | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java index 5e4f4a8..2e2f3ff 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java @@ -37,44 +37,53 @@ import org.openatom.ubml.model.common.definition.entity.AbstractMetadataContent; * @Version: V1.0 */ public class GspCommonModel extends AbstractMetadataContent implements IGspCommonModel, Cloneable { + private static final String coreNamespaceSuffix = "core"; + private static final String entityNamespaceSuffix = "entity"; + private static final String apiNamespaceSuffix = "api"; + private final java.util.HashMap extendNodeList = new java.util.HashMap(); + // 字段和属性 private boolean isVirtual; + private GspCommonObject mainObject; - // private java.util.ArrayList fkConstraints = new java.util.ArrayList(); + private CommonVariableEntity variables; private java.util.Map extProperties; private String extendType = ""; + private String privateID; + private String privateCode; + private String privateName; + /** * 标签 */ private List beLabel; + /** * 模型实体类型,表示不同模型实例的类型 */ private String privateEntityType; - /** - * 外键约束 - */ - // public java.util.ArrayList getFkConstraints() { - // return fkConstraints; - // } private String generatingAssembly = ""; + private String generatingDotnetAssembly = ""; + /** * 是否使用命名空间+编号的ConfigId 以前建的为false,保证原有代码可用 新建元数据为true,保证后续元数据ConfigId唯一 */ private boolean privateIsUseNamespaceConfig = false; + private VersionControlInfo privateVersionContronInfo; + /** * 国际化项前缀 */ -- Gitee From d89a30c1b839d3ee201a603351918ca583965362 Mon Sep 17 00:00:00 2001 From: Zhibei Hao <837948266@qq.com> Date: Thu, 4 Feb 2021 18:08:49 +0800 Subject: [PATCH 05/61] docs: translate CONTRIBUTIMG.md --- CONTRIBUTING.md | 216 +++++++++++++++++++++++------------------------- 1 file changed, 105 insertions(+), 111 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a119810..a769912 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,88 +1,87 @@ -# Contributing to UBML +# 为UBML做出贡献 -It is warmly welcomed if you have interest to hack on UBML. First, we encourage this kind of willing very much. And here is a list of contributing guide for you. +首先,热烈欢迎对UBML感兴趣的你。我们非常鼓励这种意愿。这里有一份对你有帮助的指南。 -## Topics +## 主题 -* [Reporting security issues](#reporting-security-issues) -* [Reporting general issues](#reporting-general-issues) -* [Code and doc contribution](#code-and-doc-contribution) -* [Test case contribution](#test-case-contribution) -* [Engage to help anything](#engage-to-help-anything) -* [Code Style](#code-style) +* [报告安全性问题](#reporting-security-issues) +* [报告一般性问题](#reporting-general-issues) +* [贡献文档和代码](#code-and-doc-contribution) +* [贡献测试用例](#test-case-contribution) +* [参与任何有帮助的事请](#engage-to-help-anything) +* [的艾玛书写风格](#code-style) -## Reporting security issues +## 报告安全性问题 -Security issues are always treated seriously. As our usual principle, we discourage anyone to spread security issues. If you find a security issue of UBML, please do not discuss it in public and even do not open a public issue. Instead we encourage you to send us a private email to [ubml_user@groups.163.com](mailto:ubml_user@groups.163.com) or [ubml_dev@groups.163.com](mailto:ubml_dev@groups.163.com)to report this. +安全问题永远会被认真对待。按照我们一贯的原则,我们不鼓励任何人传播安全问题。如果你发现了一个UBML的安全问题,请不要公开讨论它,并且不要放到公共问题中。我们鼓励您向[ubml_user@groups.163.com](mailto:ubml_user@groups.163.com)或[ubml_dev@groups.163.com](mailto:ubml_dev@groups.163.com)发送私人电子邮件报告此事。 -## Reporting general issues +## 报告一般性问题 -To be honest, we regard every user of UBML as a very kind contributor. After experiencing UBML, you may have some feedback for the project. Then feel free to open an issue via [NEW ISSUE](http://open.inspur.com/open-igix/ubml/issues/new). +平心而论,我们认为UBML的每一个用户都是非常友善的贡献者。在体验过UBML之后,您可能会对项目有一些反馈。然后通过[新建问题](http://open.inspur.com/open-igix/ubml/issues/new)自由地创建一个问题。 -Since we collaborate project UBML in a distributed way, we appreciate **WELL-WRITTEN**, **DETAILED**, **EXPLICIT** issue reports. To make the communication more efficient, we wish everyone could search if your issue is an existing one in the searching list. If you find it existing, please add your details in comments under the existing issue instead of opening a brand new one. +因为我们是以分布式的方式协作项目UBML,所以我们青睐**写得很好的**,**详细的**,**明确的**问题报告。为了使交流更有效率,我们希望每个人都可以提问前先搜索你的问题是否存在于列表中。如果您发现它存在,请在现有问题下的评论中添加您的详细信息,而不是开一个全新的问题。 -To make the issue details as standard as possible, we setup an [ISSUE TEMPLATE](./.gitee/ISSUE_TEMPLATE) for issue - reporters. Please **BE SURE** to follow the instructions to fill fields in template. +为了使问题细节尽可能标准化,我们为问题设置了一个[问题模板](./.gitee/ISSUE_TEMPLATE) +记者。请**确保**按照说明填写模板中的字段。 -There are a lot of cases when you could open an issue: +很多情况下,你可以开启一个提问: -* bug report -* feature request -* performance issues -* feature proposal -* feature design -* help wanted -* doc incomplete -* test improvement -* any questions on project -* and so on +*错误报告 +*功能要求 +*性能问题 +*功能建议 +*功能设计 +*寻求帮助 +*文档缺失 +*测试改进 +*任何项目中的问题 +*等等 -Also we must remind that when filling a new issue, please remember to remove the sensitive data from your post. Sensitive data could be password, secret key, network locations, private business data and so on. +我们也必须提醒您,当填写一个新的问题时,请记得从您的帖子中删除敏感数据。敏感数据包含密码、密钥、网络位置、私有业务数据等等。 -## Code and doc contribution +## 贡献文档和代码 -Every action to make project UBML better is encouraged. On GitHub, every improvement for UBML could be via a PR (short for pull request). +我们鼓励每一个使UBML项目更好的行为。在GitHub上,UBML的每一个改进都可以通过一个PR (pull request的缩写)实现。 -* If you find a typo, try to fix it! -* If you find a bug, try to fix it! -* If you find some redundant codes, try to remove them! -* If you find some test cases missing, try to add them! -* If you could enhance a feature, please **DO NOT** hesitate! -* If you find code implicit, try to add comments to make it clear! -* If you find code ugly, try to refactor that! -* If you can help to improve documents, it could not be better! -* If you find document incorrect, just do it and fix that! -* ... +*如果你发现一个拼写错误,试着修复它! +*如果你发现一个bug,试着修复它! +*如果你发现一些多余的代码,试着删除它们! +*如果你发现一些测试用例缺失,尝试添加它们! +*如果您可以增强一个功能,请**不要**犹豫! +*如果你发现代码是不易理解的,试着添加注释使它更明确! +*如果你发现代码很丑,试着重构它! +*如果你能帮助改进文档,那就再好不过了! +*如果你发现文档不正确,请立刻修复它! +*…… -Actually it is impossible to list them completely. Just remember one principle: +实际上,我们不可能把它们全部列出来。只要记住一个原则: -> WE ARE LOOKING FORWARD TO ANY PR FROM YOU. +> 我们期待着你的任何PR。 -Since you are ready to improve UBML with a PR, we suggest you could take a look at the PR rules here. +既然您已经准备好用PR来改进UBML,我们建议您可以在这里查看一下PR规则。 -* [Workspace Preparation](#workspace-preparation) -* [Branch Definition](#branch-definition) -* [Commit Rules](#commit-rules) -* [PR Description](#pr-description) +*(准备工作区)(# workspace-preparation) +*(定义分支)(# branch-definition) +*(提交规则) (# commit-rules) +*(PR说明)(# pr-description) -### Workspace Preparation +### 工作区准备 -To put forward a PR, we assume you have registered a GitHub ID. Then you could finish the preparation in the following steps: +为了提一个PR,如果您已经注册了GitHub ID,那么您可以按照以下步骤进行准备: -1. **FORK** UBML to your repository. To make this work, you just need to click the button Fork in right-left of [ubml -/ubml-standard](https://gitee.com/ubml/ubml-standard) main page. Then you will end up with your repository in `https -://gitee.com//ubml-standard`, in which `your-username` is your Gitee username. +1. **FORK** UBML到你的本地代码库。要做到这一点,您只需要单击[ubml +/ubml-standard](https://gitee.com/ubml/ubml-standard)主页右侧的Fork按钮。然后您将在 `https://gitee.com//ubml-standard`获取到,其中`your-username`是你的Gitee用户名。 -1. **CLONE** your own repository to develop locally. Use `git clone git@gitee.com:/ubml-impl.git` to clone repository to your local machine. Then you can create new branches to finish the change you wish to make. +1. **克隆**到本地自己的开发仓库。使用`git clone git@gitee.com:/ubml-impl.git`将代码库克隆到本地。然后,您可以创建新的分支来完成您希望进行的更改。 -1. **Set Remote** upstream to be `git@gitee.com:ubml/ubml-impl.git` using the following two commands: +1. **设置远程仓库地址** 使用如下两条命令更新远程链接为`git@gitee.com:ubml/ubml-impl.git`: ``` git remote add upstream git@giteee.com:ubml/ubml-impl.git git remote set-url --push upstream no-pushing ``` -With this remote setting, you can check your git remote configuration like this: +完成这个远程设置,你可以像这样检查你的git远程配置: ``` $ git remote -v @@ -92,105 +91,100 @@ upstream git@gitee.com:ubml/ubml-impl.git (fetch) upstream no-pushing (push) ``` -Adding this, we can easily synchronize local branches with upstream branches. +通过添加这个功能,我们可以很容易地同步本地分支和远程分支。 -### Branch Definition +### 分支合并 -Right now we assume every contribution via pull request is for [branch develop](https://gitee.com/ubml/ubml-standard -/tree/develop) in UBML. Before contributing, be aware of branch definition would help a lot. +现在,我们假设每个通过pull请求的贡献都是为了UBML[分支发展](https://gitee.com/ubml/ubml-standard/tree/develop)。在做出贡献之前,了解分支定义将会有很大帮助。 -As a contributor, keep in mind again that every contribution via pull request is for branch develop. While in project - UBML, there are several other branches, we generally call them release branches(such as 0.9.0,0.9.1), feature branches, hotfix branches and master branch. +作为贡献者,再次记住,通过pull请求的每个提交都是为了分支开发。而在UBML项目 +,还有其他几个分支,我们通常称之为发布分支(比如0.9.0,0.9.1),特性分支,热修复分支和主分支。 -When officially releasing a version, there will be a release branch and named with the version number. +当正式发布一个版本时,会有一个发布分支并以版本号命名。 -After the release, we will merge the commit of the release branch into the master branch. +在发布之后,我们将把发布分支的提交合并到主分支中。 -When we find that there is a bug in a certain version, we will decide to fix it in a later version or fix it in a specific hotfix version. When we decide to fix the hotfix version, we will checkout the hotfix branch based on the corresponding release branch, perform code repair and verification, and merge it into the develop branch and the master branch. +当我们发现某个版本有bug时,我们会决定在以后的版本中修复它,或者在特定的热修复版本中修复它。当我们决定修复热修复版本时,我们将基于相应的发布分支检出热修复分支,执行代码修复和验证,并将其合并到开发分支和主分支中。 -For larger features, we will pull out the feature branch for development and verification. +对于更大的特性,我们将抽出特性分支进行开发和验证。 -### Commit Rules +### 提交规则 -Actually in UBML, we take two rules serious when committing: +实际上,在UBML中,我们在提交时会参考两个原则: -* [Commit Message](#commit-message) -* [Commit Content](#commit-content) +* [提交消息](#commit-message) +* [提交内容](#commit-content) -#### Commit Message +#### 提交消息 -Commit message could help reviewers better understand what is the purpose of submitted PR. It could help accelerate the code review procedure as well. We encourage contributors to use **EXPLICIT** commit message rather than ambiguous message. In general, we advocate the following commit message type: +提交消息可以帮助审稿人更好地理解提交的PR的目的。 它还可以帮助加快代码审查过程。 我们鼓励贡献者使用** EXPLICIT **提交消息而不是模棱两可的消息。 一方面,我们通常提倡以下提交消息类型: -* docs: xxxx. For example, "docs: add docs about ubml-models introduction". -* feature: xxxx.For example, "feature: support VO customization". -* bugfix: xxxx. For example, "bugfix: fix panic when input nil parameter". -* refactor: xxxx. For example, "refactor: simplify to make codes more readable". -* test: xxx. For example, "test: add unit test case for func InsertIntoArray". -* other readable and explicit expression ways. +* docs: xxxx. 例如, "docs: add docs about ubml-models introduction". +* feature: xxxx.例如, "feature: support VO customization". +* bugfix: xxxx. 例如, "bugfix: fix panic when input nil parameter". +* refactor: xxxx. 例如, "refactor: simplify to make codes more readable". +* test: xxx. 例如, "test: add unit test case for func InsertIntoArray". +* 其他可读和显式的表达方式. -On the other side, we discourage contributors from committing message like the following ways: +另一方面,我们不鼓励贡献者像以下方式提交消息: * ~~fix bug~~ * ~~update~~ * ~~add doc~~ -If you get lost, please see [How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/) for a start. +如果你现在有点懵, 请参考 [How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/) 从头开始学习^^. -#### Commit Content +#### 提交内容 -Commit content represents all content changes included in one commit. We had better include things in one single commit which could support reviewer's complete review without any other commits' help. In another word, contents in one single commit can pass the CI to avoid code mess. In brief, there are three minor rules for us to keep in mind: +提交内容表示一次提交中包含的所有内容更改。 我们最好将所有内容包含在一个提交中,这样可以在没有任何其他提交帮助的情况下支持审阅者的完整审阅。 换句话说,一次提交中的内容(应当)是可以通过CI的,以避免代码混乱。 简而言之,我们要记住三个小规则: -* avoid very large change in a commit; -* complete and reviewable for each commit. -* check git config(`user.name`, `user.email`) when committing to ensure that it is associated with your github ID. +* 一次提交避免特别大的修改; +* 每次提交均应当完整且可审查. +* 提交时,检查git配置项(`user.name`, `user.email`) ,确保它与您的github ID相匹配. -In addition, in the code change part, we suggest that all contributors should read the [code style of UBML](#code-style). +另外,在代码更改部分,我们建议所有贡献者都应阅读UBML的 [代码样式](#代码样式). -No matter commit message, or commit content, we do take more emphasis on code review. +无论提交消息还是提交内容,我们都更加注重代码审查. -### PR Description +### PR 说明 -PR is the only way to make change to UBML project files. To help reviewers better get your purpose, PR description - could not be too detailed. We encourage contributors to follow the [PR template](./.gitee/PULL_REQUEST_TEMPLATE.md - ) to finish the pull request. +PR是更改UBML项目文件的唯一方法。 为了帮助审稿人更好地达到目标,PR说明不能太详细. 我们鼓励贡献者遵循 [PR 模板](./.gitee/PULL_REQUEST_TEMPLATE.md) 完成拉取请求. -## Test case contribution +## 测试用例贡献 -Any test case would be welcomed. Currently, UBML function test cases are high priority. +欢迎任何测试用例. 当前, UBML 功能性测试的优先级是最高的. -* For unit test, you need to create a test file named `xxxTest.java` in the test directory of the same module. Recommend you to use the junit5 UT framework +* 对于单元测试,您需要在同一模块的测试目录中创建一个名为`xxxTest.java` . 推荐您使用 junit5 UT 框架 +* 对于集成测试,可以将集成测试放在测试目录或UBML-test模块中。 建议使用模仿测试框架. -* For integration test, you can put the integration test in the test directory or the UBML-test module. It is recommended to use the mockito test framework. +## 致力于帮助任何事情 -## Engage to help anything +我们选择Gitee作为UBML合作的主要场所。 所以这里是UBML最新更新的.虽然通过PR贡献是一种明确的帮助方式,我们仍然鼓励其他方式. -We choose Gitee as the primary place for UBML to collaborate. So the latest updates of UBML are always here. Although - contributions via PR is an explicit way to help, we still call for any other ways. +* 如果可以的话,回复他人的问题; +* 帮助解决其他用户的问题; +* 帮助审查他人的PR设计; +* 帮助查看PR中其他人的代码; +* 讨论有关UBML的问题,以使事情更加明确; +* 在GitHub之外倡导UBML技术; +* 在UBML上撰写博客,等等. -* reply to other's issues if you could; -* help solve other user's problems; -* help review other's PR design; -* help review other's codes in PR; -* discuss about UBML to make things clearer; -* advocate UBML technology beyond GitHub; -* write blogs on UBML and so on. +## 代码样式 -## Code Style +UBML代码样式符合阿里巴巴Java编码准则. -UBML code style Comply with Alibaba Java Coding Guidelines. - -### Guidelines +### 指导方针 [Alibaba-Java-Coding-Guidelines](https://alibaba.github.io/Alibaba-Java-Coding-Guidelines/) -### IDE Plugin Install(not necessary) +### IDE插件安装(非必须) -*It is not necessary to install, if you want to find a problem when you are coding.* +*如果要在编码时发现问题,则无需安装.* #### idea IDE @@ -200,4 +194,4 @@ UBML code style Comply with Alibaba Java Coding Guidelines. [p3c-eclipse-plugin-install](https://github.com/alibaba/p3c/blob/master/eclipse-plugin/README.md) -In a word, **ANY HELP IS CONTRIBUTION.** \ No newline at end of file +总之几句话, **任何帮助都是贡献.** \ No newline at end of file -- Gitee From 3f0dfea7f77020cfbba7bb4f58043281cf7dbb79 Mon Sep 17 00:00:00 2001 From: Zhibei Hao <837948266@qq.com> Date: Wed, 10 Mar 2021 17:30:35 +0800 Subject: [PATCH 06/61] modify pom --- pom.xml | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/pom.xml b/pom.xml index 90d9df1..a580434 100644 --- a/pom.xml +++ b/pom.xml @@ -159,28 +159,29 @@ false - - - - - - - - - - - - - - - - - - - - - - + + + org.apache.maven.plugins + maven-checkstyle-plugin + ${maven-checkstyle-plugin.version} + + + validate + validate + + ${user.dir}/style/ubml_checkstyle.xml + UTF-8 + true + true + false + **/generated/**/* + + + check + + + + -- Gitee From 72878908121486830a21e1ca6c41e86a009b96b8 Mon Sep 17 00:00:00 2001 From: Zhibei Hao <837948266@qq.com> Date: Wed, 10 Mar 2021 17:53:29 +0800 Subject: [PATCH 07/61] optimize and format GspCommonModel --- .../commonmodel/entity/GspCommonModel.java | 52 +++++++------------ pom.xml | 44 ++++++++-------- 2 files changed, 40 insertions(+), 56 deletions(-) diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java index 2e2f3ff..71eec0c 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java @@ -83,7 +83,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo private boolean privateIsUseNamespaceConfig = false; private VersionControlInfo privateVersionContronInfo; - + /** * 国际化项前缀 */ @@ -158,6 +158,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return isVirtual; } + @Override public void setIsVirtual(boolean value) { isVirtual = value; } @@ -179,6 +180,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return privateEntityType; } + @Override public final void setEntityType(String value) { privateEntityType = value; } @@ -217,6 +219,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo /** * 主节点主键字段Id */ + @Override public final String getPrimayKeyID() { String result; if (getMainObject() == null || getMainObject().getColumnGenerateID() == null) { @@ -232,14 +235,17 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return result; } + @Override public String getGeneratingAssembly() { return generatingAssembly; } + @Override public void setGeneratingAssembly(String value) { generatingAssembly = value; } + @Override public String getDotnetGeneratingAssembly() { return generatingDotnetAssembly; } @@ -251,22 +257,27 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo /** * 变量实体 */ + @Override public CommonVariableEntity getVariables() { return variables; } + @Override public void setVariables(CommonVariableEntity value) { variables = value; } + @Override public final boolean getIsUseNamespaceConfig() { return privateIsUseNamespaceConfig; } + @Override public final void setIsUseNamespaceConfig(boolean value) { privateIsUseNamespaceConfig = value; } + @Override public final VersionControlInfo getVersionContronInfo() { if (privateVersionContronInfo == null) { privateVersionContronInfo = new VersionControlInfo(); @@ -275,7 +286,6 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo } - // 方法 // 获取字段 @@ -284,6 +294,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo privateVersionContronInfo = value; } + @Override public final String getI18nResourceInfoPrefix() { return privateI18nResourceInfoPrefix; } @@ -298,6 +309,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo * @param elementId * @return */ + @Override public final IGspCommonElement findElementById(String elementId) { if (getMainObject().getContainElements() != null && getMainObject().getContainElements().size() > 0) { for (int i = 0; i < getMainObject().getContainElements().size(); i++) { @@ -350,28 +362,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return result; } - // /** - // * 重新获取字段缓存 - // * - // * VM联动后,可能增加一些字段,需要重新获取字段缓存列表 - // */ - // public final void reGetObjectElements() { - // final String elementDicKey = "NodeElementDic"; - // for (IGspCommonObject objItem : GetAllObjectList()) { - // GspCommonObject objectItem = (GspCommonObject) objItem; - // if (objectItem == null) { - // throw new RuntimeException("错误的Object类型"); - // } - // if (objectItem.ExtProperties.containsKey(elementDicKey)) { - // objectItem.ExtProperties.remove(elementDicKey); - // } - // objectItem.getElements(); - // } - // } - - - // 获取节点 private IGspCommonElement findEleInChildObject(IGspCommonObject absObject, String elementId) { if (absObject.getContainChildObjects() != null && absObject.getContainChildObjects().size() > 0) { @@ -457,6 +448,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo * @param code * @return */ + @Override public final IGspCommonObject findObjectByCode(String code) { for (IGspCommonObject obj : getAllObjectList()) { if (code.equals(obj.getCode())) { @@ -514,6 +506,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo * * @return */ + @Override public GspCommonModel clone() { GspCommonModel tempVar; try { @@ -560,17 +553,6 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return new DataTypeAssemblyInfo(assName, assName); } - // public DataTypeAssemblyInfo getEntityAssemblyInfo() - // { - // string assName = string.format("{0}.{1}.{2}", GeneratingAssembly, this.getCode(), - // entityNamespaceSuffix); - // return new DataTypeAssemblyInfo(assName, assName); - // } -// public final CMAssemblyInfo getApiNamespace() { -// String assName = String.format("%1$s.%2$s.%3$s", getGeneratingAssembly(), this.getCode(), apiNamespaceSuffix); -// return new CMAssemblyInfo(assName, assName); -// } - @Override public DataTypeAssemblyInfo getEntityAssemblyInfo() { String assName = String.format("%1$s.%2$s.%3$s", getGeneratingAssembly(), this.getLowerCaseModelCode(), @@ -584,6 +566,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return new DataTypeAssemblyInfo(assName, assName); } + @Override public final String getGeneratedConfigID() { if (getIsUseNamespaceConfig()) { return getGeneratingAssembly() + "." + getCode(); @@ -591,6 +574,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return getCode(); } + @Override public final String getDotnetGeneratedConfigID() { if (getIsUseNamespaceConfig()) { return getDotnetGeneratingAssembly() + "." + getCode(); diff --git a/pom.xml b/pom.xml index a580434..5aacd3e 100644 --- a/pom.xml +++ b/pom.xml @@ -160,28 +160,28 @@ - - org.apache.maven.plugins - maven-checkstyle-plugin - ${maven-checkstyle-plugin.version} - - - validate - validate - - ${user.dir}/style/ubml_checkstyle.xml - UTF-8 - true - true - false - **/generated/**/* - - - check - - - - + + + + + + + + + + + + + + + + + + + + + + -- Gitee From 2bda122d8a8af5cb3ae05952e8177bfe514a0f51 Mon Sep 17 00:00:00 2001 From: bugu <837948266@qq.com> Date: Wed, 10 Mar 2021 17:54:46 +0800 Subject: [PATCH 08/61] !3 docs: translate CONTRIBUTING.md * optimize and format GspCommonModel * Merge branch 'develop' of https://gitee.com/haozhibei/ubml-impl into develop * modify pom * docs: translate CONTRIBUTIMG.md * docs: translate CONTRIBUTIMG.md --- CONTRIBUTING.md | 216 +++++++++--------- .../commonmodel/entity/GspCommonModel.java | 52 ++--- pom.xml | 1 + 3 files changed, 124 insertions(+), 145 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a119810..a769912 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,88 +1,87 @@ -# Contributing to UBML +# 为UBML做出贡献 -It is warmly welcomed if you have interest to hack on UBML. First, we encourage this kind of willing very much. And here is a list of contributing guide for you. +首先,热烈欢迎对UBML感兴趣的你。我们非常鼓励这种意愿。这里有一份对你有帮助的指南。 -## Topics +## 主题 -* [Reporting security issues](#reporting-security-issues) -* [Reporting general issues](#reporting-general-issues) -* [Code and doc contribution](#code-and-doc-contribution) -* [Test case contribution](#test-case-contribution) -* [Engage to help anything](#engage-to-help-anything) -* [Code Style](#code-style) +* [报告安全性问题](#reporting-security-issues) +* [报告一般性问题](#reporting-general-issues) +* [贡献文档和代码](#code-and-doc-contribution) +* [贡献测试用例](#test-case-contribution) +* [参与任何有帮助的事请](#engage-to-help-anything) +* [的艾玛书写风格](#code-style) -## Reporting security issues +## 报告安全性问题 -Security issues are always treated seriously. As our usual principle, we discourage anyone to spread security issues. If you find a security issue of UBML, please do not discuss it in public and even do not open a public issue. Instead we encourage you to send us a private email to [ubml_user@groups.163.com](mailto:ubml_user@groups.163.com) or [ubml_dev@groups.163.com](mailto:ubml_dev@groups.163.com)to report this. +安全问题永远会被认真对待。按照我们一贯的原则,我们不鼓励任何人传播安全问题。如果你发现了一个UBML的安全问题,请不要公开讨论它,并且不要放到公共问题中。我们鼓励您向[ubml_user@groups.163.com](mailto:ubml_user@groups.163.com)或[ubml_dev@groups.163.com](mailto:ubml_dev@groups.163.com)发送私人电子邮件报告此事。 -## Reporting general issues +## 报告一般性问题 -To be honest, we regard every user of UBML as a very kind contributor. After experiencing UBML, you may have some feedback for the project. Then feel free to open an issue via [NEW ISSUE](http://open.inspur.com/open-igix/ubml/issues/new). +平心而论,我们认为UBML的每一个用户都是非常友善的贡献者。在体验过UBML之后,您可能会对项目有一些反馈。然后通过[新建问题](http://open.inspur.com/open-igix/ubml/issues/new)自由地创建一个问题。 -Since we collaborate project UBML in a distributed way, we appreciate **WELL-WRITTEN**, **DETAILED**, **EXPLICIT** issue reports. To make the communication more efficient, we wish everyone could search if your issue is an existing one in the searching list. If you find it existing, please add your details in comments under the existing issue instead of opening a brand new one. +因为我们是以分布式的方式协作项目UBML,所以我们青睐**写得很好的**,**详细的**,**明确的**问题报告。为了使交流更有效率,我们希望每个人都可以提问前先搜索你的问题是否存在于列表中。如果您发现它存在,请在现有问题下的评论中添加您的详细信息,而不是开一个全新的问题。 -To make the issue details as standard as possible, we setup an [ISSUE TEMPLATE](./.gitee/ISSUE_TEMPLATE) for issue - reporters. Please **BE SURE** to follow the instructions to fill fields in template. +为了使问题细节尽可能标准化,我们为问题设置了一个[问题模板](./.gitee/ISSUE_TEMPLATE) +记者。请**确保**按照说明填写模板中的字段。 -There are a lot of cases when you could open an issue: +很多情况下,你可以开启一个提问: -* bug report -* feature request -* performance issues -* feature proposal -* feature design -* help wanted -* doc incomplete -* test improvement -* any questions on project -* and so on +*错误报告 +*功能要求 +*性能问题 +*功能建议 +*功能设计 +*寻求帮助 +*文档缺失 +*测试改进 +*任何项目中的问题 +*等等 -Also we must remind that when filling a new issue, please remember to remove the sensitive data from your post. Sensitive data could be password, secret key, network locations, private business data and so on. +我们也必须提醒您,当填写一个新的问题时,请记得从您的帖子中删除敏感数据。敏感数据包含密码、密钥、网络位置、私有业务数据等等。 -## Code and doc contribution +## 贡献文档和代码 -Every action to make project UBML better is encouraged. On GitHub, every improvement for UBML could be via a PR (short for pull request). +我们鼓励每一个使UBML项目更好的行为。在GitHub上,UBML的每一个改进都可以通过一个PR (pull request的缩写)实现。 -* If you find a typo, try to fix it! -* If you find a bug, try to fix it! -* If you find some redundant codes, try to remove them! -* If you find some test cases missing, try to add them! -* If you could enhance a feature, please **DO NOT** hesitate! -* If you find code implicit, try to add comments to make it clear! -* If you find code ugly, try to refactor that! -* If you can help to improve documents, it could not be better! -* If you find document incorrect, just do it and fix that! -* ... +*如果你发现一个拼写错误,试着修复它! +*如果你发现一个bug,试着修复它! +*如果你发现一些多余的代码,试着删除它们! +*如果你发现一些测试用例缺失,尝试添加它们! +*如果您可以增强一个功能,请**不要**犹豫! +*如果你发现代码是不易理解的,试着添加注释使它更明确! +*如果你发现代码很丑,试着重构它! +*如果你能帮助改进文档,那就再好不过了! +*如果你发现文档不正确,请立刻修复它! +*…… -Actually it is impossible to list them completely. Just remember one principle: +实际上,我们不可能把它们全部列出来。只要记住一个原则: -> WE ARE LOOKING FORWARD TO ANY PR FROM YOU. +> 我们期待着你的任何PR。 -Since you are ready to improve UBML with a PR, we suggest you could take a look at the PR rules here. +既然您已经准备好用PR来改进UBML,我们建议您可以在这里查看一下PR规则。 -* [Workspace Preparation](#workspace-preparation) -* [Branch Definition](#branch-definition) -* [Commit Rules](#commit-rules) -* [PR Description](#pr-description) +*(准备工作区)(# workspace-preparation) +*(定义分支)(# branch-definition) +*(提交规则) (# commit-rules) +*(PR说明)(# pr-description) -### Workspace Preparation +### 工作区准备 -To put forward a PR, we assume you have registered a GitHub ID. Then you could finish the preparation in the following steps: +为了提一个PR,如果您已经注册了GitHub ID,那么您可以按照以下步骤进行准备: -1. **FORK** UBML to your repository. To make this work, you just need to click the button Fork in right-left of [ubml -/ubml-standard](https://gitee.com/ubml/ubml-standard) main page. Then you will end up with your repository in `https -://gitee.com//ubml-standard`, in which `your-username` is your Gitee username. +1. **FORK** UBML到你的本地代码库。要做到这一点,您只需要单击[ubml +/ubml-standard](https://gitee.com/ubml/ubml-standard)主页右侧的Fork按钮。然后您将在 `https://gitee.com//ubml-standard`获取到,其中`your-username`是你的Gitee用户名。 -1. **CLONE** your own repository to develop locally. Use `git clone git@gitee.com:/ubml-impl.git` to clone repository to your local machine. Then you can create new branches to finish the change you wish to make. +1. **克隆**到本地自己的开发仓库。使用`git clone git@gitee.com:/ubml-impl.git`将代码库克隆到本地。然后,您可以创建新的分支来完成您希望进行的更改。 -1. **Set Remote** upstream to be `git@gitee.com:ubml/ubml-impl.git` using the following two commands: +1. **设置远程仓库地址** 使用如下两条命令更新远程链接为`git@gitee.com:ubml/ubml-impl.git`: ``` git remote add upstream git@giteee.com:ubml/ubml-impl.git git remote set-url --push upstream no-pushing ``` -With this remote setting, you can check your git remote configuration like this: +完成这个远程设置,你可以像这样检查你的git远程配置: ``` $ git remote -v @@ -92,105 +91,100 @@ upstream git@gitee.com:ubml/ubml-impl.git (fetch) upstream no-pushing (push) ``` -Adding this, we can easily synchronize local branches with upstream branches. +通过添加这个功能,我们可以很容易地同步本地分支和远程分支。 -### Branch Definition +### 分支合并 -Right now we assume every contribution via pull request is for [branch develop](https://gitee.com/ubml/ubml-standard -/tree/develop) in UBML. Before contributing, be aware of branch definition would help a lot. +现在,我们假设每个通过pull请求的贡献都是为了UBML[分支发展](https://gitee.com/ubml/ubml-standard/tree/develop)。在做出贡献之前,了解分支定义将会有很大帮助。 -As a contributor, keep in mind again that every contribution via pull request is for branch develop. While in project - UBML, there are several other branches, we generally call them release branches(such as 0.9.0,0.9.1), feature branches, hotfix branches and master branch. +作为贡献者,再次记住,通过pull请求的每个提交都是为了分支开发。而在UBML项目 +,还有其他几个分支,我们通常称之为发布分支(比如0.9.0,0.9.1),特性分支,热修复分支和主分支。 -When officially releasing a version, there will be a release branch and named with the version number. +当正式发布一个版本时,会有一个发布分支并以版本号命名。 -After the release, we will merge the commit of the release branch into the master branch. +在发布之后,我们将把发布分支的提交合并到主分支中。 -When we find that there is a bug in a certain version, we will decide to fix it in a later version or fix it in a specific hotfix version. When we decide to fix the hotfix version, we will checkout the hotfix branch based on the corresponding release branch, perform code repair and verification, and merge it into the develop branch and the master branch. +当我们发现某个版本有bug时,我们会决定在以后的版本中修复它,或者在特定的热修复版本中修复它。当我们决定修复热修复版本时,我们将基于相应的发布分支检出热修复分支,执行代码修复和验证,并将其合并到开发分支和主分支中。 -For larger features, we will pull out the feature branch for development and verification. +对于更大的特性,我们将抽出特性分支进行开发和验证。 -### Commit Rules +### 提交规则 -Actually in UBML, we take two rules serious when committing: +实际上,在UBML中,我们在提交时会参考两个原则: -* [Commit Message](#commit-message) -* [Commit Content](#commit-content) +* [提交消息](#commit-message) +* [提交内容](#commit-content) -#### Commit Message +#### 提交消息 -Commit message could help reviewers better understand what is the purpose of submitted PR. It could help accelerate the code review procedure as well. We encourage contributors to use **EXPLICIT** commit message rather than ambiguous message. In general, we advocate the following commit message type: +提交消息可以帮助审稿人更好地理解提交的PR的目的。 它还可以帮助加快代码审查过程。 我们鼓励贡献者使用** EXPLICIT **提交消息而不是模棱两可的消息。 一方面,我们通常提倡以下提交消息类型: -* docs: xxxx. For example, "docs: add docs about ubml-models introduction". -* feature: xxxx.For example, "feature: support VO customization". -* bugfix: xxxx. For example, "bugfix: fix panic when input nil parameter". -* refactor: xxxx. For example, "refactor: simplify to make codes more readable". -* test: xxx. For example, "test: add unit test case for func InsertIntoArray". -* other readable and explicit expression ways. +* docs: xxxx. 例如, "docs: add docs about ubml-models introduction". +* feature: xxxx.例如, "feature: support VO customization". +* bugfix: xxxx. 例如, "bugfix: fix panic when input nil parameter". +* refactor: xxxx. 例如, "refactor: simplify to make codes more readable". +* test: xxx. 例如, "test: add unit test case for func InsertIntoArray". +* 其他可读和显式的表达方式. -On the other side, we discourage contributors from committing message like the following ways: +另一方面,我们不鼓励贡献者像以下方式提交消息: * ~~fix bug~~ * ~~update~~ * ~~add doc~~ -If you get lost, please see [How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/) for a start. +如果你现在有点懵, 请参考 [How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/) 从头开始学习^^. -#### Commit Content +#### 提交内容 -Commit content represents all content changes included in one commit. We had better include things in one single commit which could support reviewer's complete review without any other commits' help. In another word, contents in one single commit can pass the CI to avoid code mess. In brief, there are three minor rules for us to keep in mind: +提交内容表示一次提交中包含的所有内容更改。 我们最好将所有内容包含在一个提交中,这样可以在没有任何其他提交帮助的情况下支持审阅者的完整审阅。 换句话说,一次提交中的内容(应当)是可以通过CI的,以避免代码混乱。 简而言之,我们要记住三个小规则: -* avoid very large change in a commit; -* complete and reviewable for each commit. -* check git config(`user.name`, `user.email`) when committing to ensure that it is associated with your github ID. +* 一次提交避免特别大的修改; +* 每次提交均应当完整且可审查. +* 提交时,检查git配置项(`user.name`, `user.email`) ,确保它与您的github ID相匹配. -In addition, in the code change part, we suggest that all contributors should read the [code style of UBML](#code-style). +另外,在代码更改部分,我们建议所有贡献者都应阅读UBML的 [代码样式](#代码样式). -No matter commit message, or commit content, we do take more emphasis on code review. +无论提交消息还是提交内容,我们都更加注重代码审查. -### PR Description +### PR 说明 -PR is the only way to make change to UBML project files. To help reviewers better get your purpose, PR description - could not be too detailed. We encourage contributors to follow the [PR template](./.gitee/PULL_REQUEST_TEMPLATE.md - ) to finish the pull request. +PR是更改UBML项目文件的唯一方法。 为了帮助审稿人更好地达到目标,PR说明不能太详细. 我们鼓励贡献者遵循 [PR 模板](./.gitee/PULL_REQUEST_TEMPLATE.md) 完成拉取请求. -## Test case contribution +## 测试用例贡献 -Any test case would be welcomed. Currently, UBML function test cases are high priority. +欢迎任何测试用例. 当前, UBML 功能性测试的优先级是最高的. -* For unit test, you need to create a test file named `xxxTest.java` in the test directory of the same module. Recommend you to use the junit5 UT framework +* 对于单元测试,您需要在同一模块的测试目录中创建一个名为`xxxTest.java` . 推荐您使用 junit5 UT 框架 +* 对于集成测试,可以将集成测试放在测试目录或UBML-test模块中。 建议使用模仿测试框架. -* For integration test, you can put the integration test in the test directory or the UBML-test module. It is recommended to use the mockito test framework. +## 致力于帮助任何事情 -## Engage to help anything +我们选择Gitee作为UBML合作的主要场所。 所以这里是UBML最新更新的.虽然通过PR贡献是一种明确的帮助方式,我们仍然鼓励其他方式. -We choose Gitee as the primary place for UBML to collaborate. So the latest updates of UBML are always here. Although - contributions via PR is an explicit way to help, we still call for any other ways. +* 如果可以的话,回复他人的问题; +* 帮助解决其他用户的问题; +* 帮助审查他人的PR设计; +* 帮助查看PR中其他人的代码; +* 讨论有关UBML的问题,以使事情更加明确; +* 在GitHub之外倡导UBML技术; +* 在UBML上撰写博客,等等. -* reply to other's issues if you could; -* help solve other user's problems; -* help review other's PR design; -* help review other's codes in PR; -* discuss about UBML to make things clearer; -* advocate UBML technology beyond GitHub; -* write blogs on UBML and so on. +## 代码样式 -## Code Style +UBML代码样式符合阿里巴巴Java编码准则. -UBML code style Comply with Alibaba Java Coding Guidelines. - -### Guidelines +### 指导方针 [Alibaba-Java-Coding-Guidelines](https://alibaba.github.io/Alibaba-Java-Coding-Guidelines/) -### IDE Plugin Install(not necessary) +### IDE插件安装(非必须) -*It is not necessary to install, if you want to find a problem when you are coding.* +*如果要在编码时发现问题,则无需安装.* #### idea IDE @@ -200,4 +194,4 @@ UBML code style Comply with Alibaba Java Coding Guidelines. [p3c-eclipse-plugin-install](https://github.com/alibaba/p3c/blob/master/eclipse-plugin/README.md) -In a word, **ANY HELP IS CONTRIBUTION.** \ No newline at end of file +总之几句话, **任何帮助都是贡献.** \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java index 2e2f3ff..71eec0c 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java @@ -83,7 +83,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo private boolean privateIsUseNamespaceConfig = false; private VersionControlInfo privateVersionContronInfo; - + /** * 国际化项前缀 */ @@ -158,6 +158,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return isVirtual; } + @Override public void setIsVirtual(boolean value) { isVirtual = value; } @@ -179,6 +180,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return privateEntityType; } + @Override public final void setEntityType(String value) { privateEntityType = value; } @@ -217,6 +219,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo /** * 主节点主键字段Id */ + @Override public final String getPrimayKeyID() { String result; if (getMainObject() == null || getMainObject().getColumnGenerateID() == null) { @@ -232,14 +235,17 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return result; } + @Override public String getGeneratingAssembly() { return generatingAssembly; } + @Override public void setGeneratingAssembly(String value) { generatingAssembly = value; } + @Override public String getDotnetGeneratingAssembly() { return generatingDotnetAssembly; } @@ -251,22 +257,27 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo /** * 变量实体 */ + @Override public CommonVariableEntity getVariables() { return variables; } + @Override public void setVariables(CommonVariableEntity value) { variables = value; } + @Override public final boolean getIsUseNamespaceConfig() { return privateIsUseNamespaceConfig; } + @Override public final void setIsUseNamespaceConfig(boolean value) { privateIsUseNamespaceConfig = value; } + @Override public final VersionControlInfo getVersionContronInfo() { if (privateVersionContronInfo == null) { privateVersionContronInfo = new VersionControlInfo(); @@ -275,7 +286,6 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo } - // 方法 // 获取字段 @@ -284,6 +294,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo privateVersionContronInfo = value; } + @Override public final String getI18nResourceInfoPrefix() { return privateI18nResourceInfoPrefix; } @@ -298,6 +309,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo * @param elementId * @return */ + @Override public final IGspCommonElement findElementById(String elementId) { if (getMainObject().getContainElements() != null && getMainObject().getContainElements().size() > 0) { for (int i = 0; i < getMainObject().getContainElements().size(); i++) { @@ -350,28 +362,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return result; } - // /** - // * 重新获取字段缓存 - // * - // * VM联动后,可能增加一些字段,需要重新获取字段缓存列表 - // */ - // public final void reGetObjectElements() { - // final String elementDicKey = "NodeElementDic"; - // for (IGspCommonObject objItem : GetAllObjectList()) { - // GspCommonObject objectItem = (GspCommonObject) objItem; - // if (objectItem == null) { - // throw new RuntimeException("错误的Object类型"); - // } - // if (objectItem.ExtProperties.containsKey(elementDicKey)) { - // objectItem.ExtProperties.remove(elementDicKey); - // } - // objectItem.getElements(); - // } - // } - - - // 获取节点 private IGspCommonElement findEleInChildObject(IGspCommonObject absObject, String elementId) { if (absObject.getContainChildObjects() != null && absObject.getContainChildObjects().size() > 0) { @@ -457,6 +448,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo * @param code * @return */ + @Override public final IGspCommonObject findObjectByCode(String code) { for (IGspCommonObject obj : getAllObjectList()) { if (code.equals(obj.getCode())) { @@ -514,6 +506,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo * * @return */ + @Override public GspCommonModel clone() { GspCommonModel tempVar; try { @@ -560,17 +553,6 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return new DataTypeAssemblyInfo(assName, assName); } - // public DataTypeAssemblyInfo getEntityAssemblyInfo() - // { - // string assName = string.format("{0}.{1}.{2}", GeneratingAssembly, this.getCode(), - // entityNamespaceSuffix); - // return new DataTypeAssemblyInfo(assName, assName); - // } -// public final CMAssemblyInfo getApiNamespace() { -// String assName = String.format("%1$s.%2$s.%3$s", getGeneratingAssembly(), this.getCode(), apiNamespaceSuffix); -// return new CMAssemblyInfo(assName, assName); -// } - @Override public DataTypeAssemblyInfo getEntityAssemblyInfo() { String assName = String.format("%1$s.%2$s.%3$s", getGeneratingAssembly(), this.getLowerCaseModelCode(), @@ -584,6 +566,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return new DataTypeAssemblyInfo(assName, assName); } + @Override public final String getGeneratedConfigID() { if (getIsUseNamespaceConfig()) { return getGeneratingAssembly() + "." + getCode(); @@ -591,6 +574,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return getCode(); } + @Override public final String getDotnetGeneratedConfigID() { if (getIsUseNamespaceConfig()) { return getDotnetGeneratingAssembly() + "." + getCode(); diff --git a/pom.xml b/pom.xml index 90d9df1..5aacd3e 100644 --- a/pom.xml +++ b/pom.xml @@ -159,6 +159,7 @@ false + -- Gitee From eed043e689ed0f884e4af39fb230fc6bc4068154 Mon Sep 17 00:00:00 2001 From: Zhibei Hao <837948266@qq.com> Date: Tue, 16 Mar 2021 09:20:56 +0800 Subject: [PATCH 09/61] optimize GspCommonModel --- .../definition/cef/json/SerializerUtils.java | 3 +- .../commonmodel/entity/GspCommonModel.java | 28 ++++++++----------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/SerializerUtils.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/SerializerUtils.java index 94a3c05..ca9f54a 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/SerializerUtils.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/SerializerUtils.java @@ -512,7 +512,8 @@ public class SerializerUtils { } } - public static > void writeArray(JsonGenerator jsonGenerator, JsonSerializer serializer, TList list) { + public static > void writeArray(JsonGenerator jsonGenerator, + JsonSerializer serializer, L list) { //void writeArray(JsonGenerator jsonGenerator, JsonSerializer serializer, TArray array){ SerializerUtils.WriteStartArray(jsonGenerator); for (T item : list) { diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java index 71eec0c..dafb04d 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java @@ -38,11 +38,11 @@ import org.openatom.ubml.model.common.definition.entity.AbstractMetadataContent; */ public class GspCommonModel extends AbstractMetadataContent implements IGspCommonModel, Cloneable { - private static final String coreNamespaceSuffix = "core"; + private static final String CORE_NAMESPACE_SUFFIX = "core"; - private static final String entityNamespaceSuffix = "entity"; + private static final String ENTITY_NAMESPACE_SUFFIX = "entity"; - private static final String apiNamespaceSuffix = "api"; + private static final String API_NAMESPACE_SUFFIX = "api"; private final java.util.HashMap extendNodeList = new java.util.HashMap(); @@ -57,7 +57,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo private String extendType = ""; - private String privateID; + private String privateId; private String privateCode; @@ -97,19 +97,18 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo /** * 扩展成员,用于扩展方法暂存运行时临时数据 */ - public java.util.Map getExtProperties() { return (extProperties != null) ? extProperties : (extProperties = new HashMap()); } @Override public final String getID() { - return privateID; + return privateId; } @Override public final void setID(String value) { - privateID = value; + privateId = value; } @Override @@ -363,7 +362,6 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo } - private IGspCommonElement findEleInChildObject(IGspCommonObject absObject, String elementId) { if (absObject.getContainChildObjects() != null && absObject.getContainChildObjects().size() > 0) { for (int k = 0; k < absObject.getContainChildObjects().size(); k++) // 子对象的循环 @@ -403,6 +401,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo * * @return */ + @Override public final java.util.ArrayList getAllObjectElementList() { java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList objects = getAllObjectList(); @@ -418,6 +417,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo * * @return */ + @Override public final java.util.ArrayList getAllObjectList() { // 通过堆栈递归取子孙节点,有空测一下复杂的场景对不对 ZhangJ2015年12月17日 java.util.Stack stack = new java.util.Stack(); @@ -536,12 +536,6 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return be; } - // public final CMAssemblyInfo getEntityAssemblyInfo() { -// String assName = String.format("%1$s.%2$s.%3$s", getGeneratingAssembly(), this.getCode(), -// entityNamespaceSuffix); -// return new CMAssemblyInfo(assName, assName); -// } -// private String getLowerCaseModelCode() { return getCode().toLowerCase(); } @@ -549,20 +543,20 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo @Override public DataTypeAssemblyInfo getCoreAssemblyInfo() { String assName = String.format("%1$s.%2$s.%3$s", getGeneratingAssembly(), this.getLowerCaseModelCode(), - coreNamespaceSuffix); + CORE_NAMESPACE_SUFFIX); return new DataTypeAssemblyInfo(assName, assName); } @Override public DataTypeAssemblyInfo getEntityAssemblyInfo() { String assName = String.format("%1$s.%2$s.%3$s", getGeneratingAssembly(), this.getLowerCaseModelCode(), - entityNamespaceSuffix); + ENTITY_NAMESPACE_SUFFIX); return new DataTypeAssemblyInfo(assName, assName); } @Override public DataTypeAssemblyInfo getApiNamespace() { - String assName = String.format("%1$s.%2$s.%3$s", getGeneratingAssembly(), this.getLowerCaseModelCode(), apiNamespaceSuffix); + String assName = String.format("%1$s.%2$s.%3$s", getGeneratingAssembly(), this.getLowerCaseModelCode(), API_NAMESPACE_SUFFIX); return new DataTypeAssemblyInfo(assName, assName); } -- Gitee From 29242cf1191860973f28c2c34a9f9885a0ac32a5 Mon Sep 17 00:00:00 2001 From: Zhibei Hao <837948266@qq.com> Date: Thu, 25 Mar 2021 15:18:59 +0800 Subject: [PATCH 10/61] optimize: optimize GspCommonObject and format --- .../commonmodel/entity/GspCommonObject.java | 15 ++----- pom.xml | 44 +++++++++---------- 2 files changed, 25 insertions(+), 34 deletions(-) diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java index 43a68d9..5358c0b 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java @@ -36,8 +36,6 @@ import org.openatom.ubml.model.common.definition.commonmodel.collection.GspUniqu import org.openatom.ubml.model.common.definition.commonmodel.entity.object.GspColumnGenerate; import org.openatom.ubml.model.common.definition.commonmodel.entity.object.GspCommonObjectType; -// import Inspur.Gsp.CommonModel.Api.*; - /** * The Definition Of Common Object,It`s The Abstract Definition Of BeObject、VoObject. @@ -50,7 +48,6 @@ import org.openatom.ubml.model.common.definition.commonmodel.entity.object.GspCo public class GspCommonObject extends GspCommonDataType implements IGspCommonObject, Cloneable { // 私有变量 // private boolean logicDelete; -// private String refDataObjectId = ""; private GspCommonObjectType objectType = GspCommonObjectType.MainObject; private GspColumnGenerate columnGenerateId = new GspColumnGenerate(); @@ -61,16 +58,11 @@ public class GspCommonObject extends GspCommonDataType implements IGspCommonObje private GspObjectCollection containChildObjects; private String orderbyCondition = ""; private String filterCondition = ""; - // private String modifierElementId = ""; -// private String modifiedDateElementId = ""; -// private String creatorElementId = ""; -// private String createdDateElementId = ""; -// private boolean recordDelData; private boolean isVirtual; private boolean isReadOnly; - // private GspDataTable dataTable; + private java.util.HashMap dicElements; - // internal IGspCommonModel parentModel;//? + private GspAssociationKeyCollection keys; private String belongModelId = ""; private java.util.HashMap extProperties; @@ -95,7 +87,6 @@ public class GspCommonObject extends GspCommonDataType implements IGspCommonObje */ - // 公有属性 /** * 当前结点所属的模型 @@ -629,6 +620,6 @@ public class GspCommonObject extends GspCommonDataType implements IGspCommonObje return dicElements.get(elementId); } - return (dicElements.getOrDefault(elementId, null)); + return dicElements.getOrDefault(elementId, null); } } \ No newline at end of file diff --git a/pom.xml b/pom.xml index 5aacd3e..a580434 100644 --- a/pom.xml +++ b/pom.xml @@ -160,28 +160,28 @@ - - - - - - - - - - - - - - - - - - - - - - + + org.apache.maven.plugins + maven-checkstyle-plugin + ${maven-checkstyle-plugin.version} + + + validate + validate + + ${user.dir}/style/ubml_checkstyle.xml + UTF-8 + true + true + false + **/generated/**/* + + + check + + + + -- Gitee From 4c8f0200f0f81f2b2df128f948704775f3eb01ae Mon Sep 17 00:00:00 2001 From: bugu <837948266@qq.com> Date: Thu, 25 Mar 2021 15:24:28 +0800 Subject: [PATCH 11/61] =?UTF-8?q?!5=20=E4=BC=98=E5=8C=96=EF=BC=9A=E8=B0=83?= =?UTF-8?q?=E6=95=B4BE=E3=80=81VO=E5=85=AC=E5=85=B1=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E7=BB=93=E6=9E=84=20*=20optimize:=20optimize=20GspCommonObject?= =?UTF-8?q?=20and=20format=20*=20optimize=20GspCommonModel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../definition/cef/json/SerializerUtils.java | 3 +- .../commonmodel/entity/GspCommonModel.java | 28 +++++------- .../commonmodel/entity/GspCommonObject.java | 15 ++----- pom.xml | 44 +++++++++---------- 4 files changed, 38 insertions(+), 52 deletions(-) diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/SerializerUtils.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/SerializerUtils.java index 94a3c05..ca9f54a 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/SerializerUtils.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/SerializerUtils.java @@ -512,7 +512,8 @@ public class SerializerUtils { } } - public static > void writeArray(JsonGenerator jsonGenerator, JsonSerializer serializer, TList list) { + public static > void writeArray(JsonGenerator jsonGenerator, + JsonSerializer serializer, L list) { //void writeArray(JsonGenerator jsonGenerator, JsonSerializer serializer, TArray array){ SerializerUtils.WriteStartArray(jsonGenerator); for (T item : list) { diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java index 71eec0c..dafb04d 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java @@ -38,11 +38,11 @@ import org.openatom.ubml.model.common.definition.entity.AbstractMetadataContent; */ public class GspCommonModel extends AbstractMetadataContent implements IGspCommonModel, Cloneable { - private static final String coreNamespaceSuffix = "core"; + private static final String CORE_NAMESPACE_SUFFIX = "core"; - private static final String entityNamespaceSuffix = "entity"; + private static final String ENTITY_NAMESPACE_SUFFIX = "entity"; - private static final String apiNamespaceSuffix = "api"; + private static final String API_NAMESPACE_SUFFIX = "api"; private final java.util.HashMap extendNodeList = new java.util.HashMap(); @@ -57,7 +57,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo private String extendType = ""; - private String privateID; + private String privateId; private String privateCode; @@ -97,19 +97,18 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo /** * 扩展成员,用于扩展方法暂存运行时临时数据 */ - public java.util.Map getExtProperties() { return (extProperties != null) ? extProperties : (extProperties = new HashMap()); } @Override public final String getID() { - return privateID; + return privateId; } @Override public final void setID(String value) { - privateID = value; + privateId = value; } @Override @@ -363,7 +362,6 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo } - private IGspCommonElement findEleInChildObject(IGspCommonObject absObject, String elementId) { if (absObject.getContainChildObjects() != null && absObject.getContainChildObjects().size() > 0) { for (int k = 0; k < absObject.getContainChildObjects().size(); k++) // 子对象的循环 @@ -403,6 +401,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo * * @return */ + @Override public final java.util.ArrayList getAllObjectElementList() { java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList objects = getAllObjectList(); @@ -418,6 +417,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo * * @return */ + @Override public final java.util.ArrayList getAllObjectList() { // 通过堆栈递归取子孙节点,有空测一下复杂的场景对不对 ZhangJ2015年12月17日 java.util.Stack stack = new java.util.Stack(); @@ -536,12 +536,6 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return be; } - // public final CMAssemblyInfo getEntityAssemblyInfo() { -// String assName = String.format("%1$s.%2$s.%3$s", getGeneratingAssembly(), this.getCode(), -// entityNamespaceSuffix); -// return new CMAssemblyInfo(assName, assName); -// } -// private String getLowerCaseModelCode() { return getCode().toLowerCase(); } @@ -549,20 +543,20 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo @Override public DataTypeAssemblyInfo getCoreAssemblyInfo() { String assName = String.format("%1$s.%2$s.%3$s", getGeneratingAssembly(), this.getLowerCaseModelCode(), - coreNamespaceSuffix); + CORE_NAMESPACE_SUFFIX); return new DataTypeAssemblyInfo(assName, assName); } @Override public DataTypeAssemblyInfo getEntityAssemblyInfo() { String assName = String.format("%1$s.%2$s.%3$s", getGeneratingAssembly(), this.getLowerCaseModelCode(), - entityNamespaceSuffix); + ENTITY_NAMESPACE_SUFFIX); return new DataTypeAssemblyInfo(assName, assName); } @Override public DataTypeAssemblyInfo getApiNamespace() { - String assName = String.format("%1$s.%2$s.%3$s", getGeneratingAssembly(), this.getLowerCaseModelCode(), apiNamespaceSuffix); + String assName = String.format("%1$s.%2$s.%3$s", getGeneratingAssembly(), this.getLowerCaseModelCode(), API_NAMESPACE_SUFFIX); return new DataTypeAssemblyInfo(assName, assName); } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java index 43a68d9..5358c0b 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java @@ -36,8 +36,6 @@ import org.openatom.ubml.model.common.definition.commonmodel.collection.GspUniqu import org.openatom.ubml.model.common.definition.commonmodel.entity.object.GspColumnGenerate; import org.openatom.ubml.model.common.definition.commonmodel.entity.object.GspCommonObjectType; -// import Inspur.Gsp.CommonModel.Api.*; - /** * The Definition Of Common Object,It`s The Abstract Definition Of BeObject、VoObject. @@ -50,7 +48,6 @@ import org.openatom.ubml.model.common.definition.commonmodel.entity.object.GspCo public class GspCommonObject extends GspCommonDataType implements IGspCommonObject, Cloneable { // 私有变量 // private boolean logicDelete; -// private String refDataObjectId = ""; private GspCommonObjectType objectType = GspCommonObjectType.MainObject; private GspColumnGenerate columnGenerateId = new GspColumnGenerate(); @@ -61,16 +58,11 @@ public class GspCommonObject extends GspCommonDataType implements IGspCommonObje private GspObjectCollection containChildObjects; private String orderbyCondition = ""; private String filterCondition = ""; - // private String modifierElementId = ""; -// private String modifiedDateElementId = ""; -// private String creatorElementId = ""; -// private String createdDateElementId = ""; -// private boolean recordDelData; private boolean isVirtual; private boolean isReadOnly; - // private GspDataTable dataTable; + private java.util.HashMap dicElements; - // internal IGspCommonModel parentModel;//? + private GspAssociationKeyCollection keys; private String belongModelId = ""; private java.util.HashMap extProperties; @@ -95,7 +87,6 @@ public class GspCommonObject extends GspCommonDataType implements IGspCommonObje */ - // 公有属性 /** * 当前结点所属的模型 @@ -629,6 +620,6 @@ public class GspCommonObject extends GspCommonDataType implements IGspCommonObje return dicElements.get(elementId); } - return (dicElements.getOrDefault(elementId, null)); + return dicElements.getOrDefault(elementId, null); } } \ No newline at end of file diff --git a/pom.xml b/pom.xml index 5aacd3e..a580434 100644 --- a/pom.xml +++ b/pom.xml @@ -160,28 +160,28 @@ - - - - - - - - - - - - - - - - - - - - - - + + org.apache.maven.plugins + maven-checkstyle-plugin + ${maven-checkstyle-plugin.version} + + + validate + validate + + ${user.dir}/style/ubml_checkstyle.xml + UTF-8 + true + true + false + **/generated/**/* + + + check + + + + -- Gitee From 19357acc6d8adc3adf25180498d001b8b54ad9e6 Mon Sep 17 00:00:00 2001 From: Zhibei Hao <837948266@qq.com> Date: Thu, 25 Mar 2021 15:28:42 +0800 Subject: [PATCH 12/61] remove checkstyle --- pom.xml | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/pom.xml b/pom.xml index a580434..5aacd3e 100644 --- a/pom.xml +++ b/pom.xml @@ -160,28 +160,28 @@ - - org.apache.maven.plugins - maven-checkstyle-plugin - ${maven-checkstyle-plugin.version} - - - validate - validate - - ${user.dir}/style/ubml_checkstyle.xml - UTF-8 - true - true - false - **/generated/**/* - - - check - - - - + + + + + + + + + + + + + + + + + + + + + + -- Gitee From fcb4f11249749d323c2ce9d2e69124076f967625 Mon Sep 17 00:00:00 2001 From: hanll02 Date: Thu, 25 Mar 2021 16:07:30 +0800 Subject: [PATCH 13/61] =?UTF-8?q?=E4=BC=98=E5=8C=96:=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=97=A0=E7=94=A8=E7=B1=BB=EF=BC=8C=E5=8E=BB=E6=8E=89=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../be/definition/common/BefDtBeanUtil.java | 31 ------------------- .../commonmodel/entity/GspCommonObject.java | 5 --- 2 files changed, 36 deletions(-) delete mode 100644 model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BefDtBeanUtil.java diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BefDtBeanUtil.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BefDtBeanUtil.java deleted file mode 100644 index 7c06128..0000000 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BefDtBeanUtil.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.be.definition.common; -// -//import com.inspur.edp.bef.bizentity.gspbusinessentity.api.IGspBeExtendInfoService; -//import com.inspur.edp.cef.designtime.api.util.CefDtBeanUtil; -//import io.iec.edp.caf.commons.utils.SpringBeanUtils; -// -//public class BefDtBeanUtil extends CefDtBeanUtil { -// private static IGspBeExtendInfoService beExtendInfoService; -// -// public static IGspBeExtendInfoService getBEExtendInfoService() { -// if (beExtendInfoService == null) { -// beExtendInfoService = SpringBeanUtils.getBean(IGspBeExtendInfoService.class); -// } -// return beExtendInfoService; -// } -//} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java index 5358c0b..1364a61 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java @@ -465,11 +465,6 @@ public class GspCommonObject extends GspCommonDataType implements IGspCommonObje * @return */ private IGspCommonElement getCommonObjIDElement() { -// for (IGspCommonField field : getContainElements()) { -// if (columnGenerateId.getElementID().equals(field.getID())) { -// return (IGspCommonElement) field; -// } -// } if (columnGenerateId != null) { IGspCommonField tempVar = findElement(columnGenerateId.getElementID()); -- Gitee From 1eb48a5862fae533d0731a6e320d1cad4c2ea9ec Mon Sep 17 00:00:00 2001 From: a1b2c3d4 <8869064+han-liangliang111@user.noreply.gitee.com> Date: Thu, 25 Mar 2021 16:40:27 +0800 Subject: [PATCH 14/61] =?UTF-8?q?!7=20=20=E4=BC=98=E5=8C=96=EF=BC=9A?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8=E7=B1=BB=EF=BC=8C=E5=8E=BB?= =?UTF-8?q?=E6=8E=89=E6=97=A0=E7=94=A8=E6=B3=A8=E9=87=8A=20*=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96:=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8=E7=B1=BB?= =?UTF-8?q?=EF=BC=8C=E5=8E=BB=E6=8E=89=E6=97=A0=E7=94=A8=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../be/definition/common/BefDtBeanUtil.java | 31 ------------------- .../commonmodel/entity/GspCommonObject.java | 5 --- 2 files changed, 36 deletions(-) delete mode 100644 model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BefDtBeanUtil.java diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BefDtBeanUtil.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BefDtBeanUtil.java deleted file mode 100644 index 7c06128..0000000 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BefDtBeanUtil.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.be.definition.common; -// -//import com.inspur.edp.bef.bizentity.gspbusinessentity.api.IGspBeExtendInfoService; -//import com.inspur.edp.cef.designtime.api.util.CefDtBeanUtil; -//import io.iec.edp.caf.commons.utils.SpringBeanUtils; -// -//public class BefDtBeanUtil extends CefDtBeanUtil { -// private static IGspBeExtendInfoService beExtendInfoService; -// -// public static IGspBeExtendInfoService getBEExtendInfoService() { -// if (beExtendInfoService == null) { -// beExtendInfoService = SpringBeanUtils.getBean(IGspBeExtendInfoService.class); -// } -// return beExtendInfoService; -// } -//} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java index 5358c0b..1364a61 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java @@ -465,11 +465,6 @@ public class GspCommonObject extends GspCommonDataType implements IGspCommonObje * @return */ private IGspCommonElement getCommonObjIDElement() { -// for (IGspCommonField field : getContainElements()) { -// if (columnGenerateId.getElementID().equals(field.getID())) { -// return (IGspCommonElement) field; -// } -// } if (columnGenerateId != null) { IGspCommonField tempVar = findElement(columnGenerateId.getElementID()); -- Gitee From bae1e2eccd56d4fc877dc4ba9a2dc4f896bc7ba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=89=91=E5=BF=83=E6=89=AC?= Date: Fri, 26 Mar 2021 16:52:04 +0800 Subject: [PATCH 15/61] !8 optimize: format code and update document * optimize: update pom/javadoc introduction * optimize: format code style --- .gitee/ISSUE_TEMPLATE/BUG_REPORT.md | 1 - .gitee/PULL_REQUEST_TEMPLATE.md | 1 - all/pom.xml | 4 ++-- bom/pom.xml | 4 ++-- common/pom.xml | 1 - .../provider/viewmodel/CustomActionProvider.java | 10 +++++----- .../provider/viewmodel/SimpleBasicActionProvider.java | 8 ++++---- .../provider/viewmodel/SimpleCustomActionProvider.java | 10 +++++----- model/framework/devtime-api/src/main/java/Test.java | 7 ------- 9 files changed, 18 insertions(+), 28 deletions(-) delete mode 100644 model/framework/devtime-api/src/main/java/Test.java diff --git a/.gitee/ISSUE_TEMPLATE/BUG_REPORT.md b/.gitee/ISSUE_TEMPLATE/BUG_REPORT.md index 19012cb..3bcde0a 100644 --- a/.gitee/ISSUE_TEMPLATE/BUG_REPORT.md +++ b/.gitee/ISSUE_TEMPLATE/BUG_REPORT.md @@ -2,7 +2,6 @@ name: Bug Report about: If you would like to report a issue to Seata, please use this template. - --- - [ ] I have searched the [issues](https://github.com/seata/seata/issues) of this repository and believe that this is not a duplicate. diff --git a/.gitee/PULL_REQUEST_TEMPLATE.md b/.gitee/PULL_REQUEST_TEMPLATE.md index d773ccb..7c05829 100644 --- a/.gitee/PULL_REQUEST_TEMPLATE.md +++ b/.gitee/PULL_REQUEST_TEMPLATE.md @@ -14,4 +14,3 @@ ### Ⅴ. Special notes for reviews - diff --git a/all/pom.xml b/all/pom.xml index 1847d80..f616cfe 100644 --- a/all/pom.xml +++ b/all/pom.xml @@ -18,7 +18,7 @@ ubml-common ${project.version} - + org.openatom.ubml ubml-model-common-definition @@ -54,7 +54,7 @@ ubml-model-common-generator ${project.version} - + org.openatom.ubml ubml-model-framework-devtime-api diff --git a/bom/pom.xml b/bom/pom.xml index abd6d1a..c9d5e7e 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -230,7 +230,7 @@ - + org.sonatype.plugins nexus-staging-maven-plugin @@ -258,7 +258,7 @@ --> - + org.apache.maven.plugins maven-release-plugin diff --git a/common/pom.xml b/common/pom.xml index 904ed3f..a518f0c 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -33,7 +33,6 @@ org.springframework spring-core - \ No newline at end of file diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/CustomActionProvider.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/CustomActionProvider.java index b17f82e..f4d3d35 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/CustomActionProvider.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/CustomActionProvider.java @@ -15,14 +15,9 @@ */ package org.openatom.ubml.model.externalapi.provider.viewmodel; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; import jdk.nashorn.internal.runtime.PropertyMap; import org.openatom.ubml.common.util.StringUtils; import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.externalapi.definition.entity.ModelType; import org.openatom.ubml.model.externalapi.definition.entity.Operation; import org.openatom.ubml.model.externalapi.definition.entity.Parameter; import org.openatom.ubml.model.externalapi.definition.temp.vo.GspViewModel; @@ -31,6 +26,11 @@ import org.openatom.ubml.model.externalapi.definition.temp.vo.VMCollectionParame import org.openatom.ubml.model.externalapi.definition.temp.vo.VMParameterType; import org.openatom.ubml.model.externalapi.definition.temp.vo.ViewModelAction; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + /** * CustomActionProvider * diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleBasicActionProvider.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleBasicActionProvider.java index ed189f5..8b03e4e 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleBasicActionProvider.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleBasicActionProvider.java @@ -15,16 +15,16 @@ */ package org.openatom.ubml.model.externalapi.provider.viewmodel; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; import org.openatom.ubml.common.util.StringUtils; import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.externalapi.definition.entity.ModelType; import org.openatom.ubml.model.externalapi.definition.entity.Operation; import org.openatom.ubml.model.externalapi.definition.entity.Parameter; import org.openatom.ubml.model.externalapi.definition.temp.vo.GspViewModel; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; + /** * 功能描述: * diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleCustomActionProvider.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleCustomActionProvider.java index 19e5030..84026fc 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleCustomActionProvider.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleCustomActionProvider.java @@ -15,12 +15,7 @@ */ package org.openatom.ubml.model.externalapi.provider.viewmodel; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.externalapi.definition.entity.ModelType; import org.openatom.ubml.model.externalapi.definition.entity.Operation; import org.openatom.ubml.model.externalapi.definition.entity.Parameter; import org.openatom.ubml.model.externalapi.definition.temp.vo.GspViewModel; @@ -29,6 +24,11 @@ import org.openatom.ubml.model.externalapi.definition.temp.vo.VMCollectionParame import org.openatom.ubml.model.externalapi.definition.temp.vo.VMParameterType; import org.openatom.ubml.model.externalapi.definition.temp.vo.ViewModelAction; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + /** * SimpleCustomActionProvider * diff --git a/model/framework/devtime-api/src/main/java/Test.java b/model/framework/devtime-api/src/main/java/Test.java deleted file mode 100644 index 88fceec..0000000 --- a/model/framework/devtime-api/src/main/java/Test.java +++ /dev/null @@ -1,7 +0,0 @@ -/** - * The type Test - * - * @author: haozhibei - */ -public class Test { -} -- Gitee From a6dfb8fa17a64b0923debb38b8959d7b083f6c7d Mon Sep 17 00:00:00 2001 From: haoxiaofei Date: Fri, 26 Mar 2021 17:06:19 +0800 Subject: [PATCH 16/61] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=97=A0=E7=94=A8=E7=B1=BB=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../be/definition/GspBizEntityObject.java | 25 -- .../be/definition/GspBusinessEntity.java | 10 - .../be/definition/common/SysnDboUtils.java | 230 ------------------ 3 files changed, 265 deletions(-) delete mode 100644 model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/SysnDboUtils.java diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityObject.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityObject.java index d954aaf..5e7919c 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityObject.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityObject.java @@ -15,8 +15,6 @@ */ package org.openatom.ubml.model.be.definition; -// import Inspur.Gsp.Bef.BizEntity.Authority.*; - import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import org.openatom.ubml.model.be.definition.beenum.BETriggerTimePointType; @@ -151,23 +149,6 @@ public class GspBizEntityObject extends GspCommonObject implements Cloneable { super.setParentObject(value); } - // // 权限 - // private java.util.ArrayList authFieldInfos; - - // /** - // * 关联的数据授权对象信息 - // * - // */ - // public java.util.ArrayList getAuthFieldInfos() { - // return authFieldInfos; - // } - - // void setAuthFieldInfos(java.util.ArrayList value) - - - - // CommonDataType - /** * [保存前]联动计算 */ @@ -258,12 +239,6 @@ public class GspBizEntityObject extends GspCommonObject implements Cloneable { // throw new RuntimeException("业务实体中无法赋值属性[ValAfterModify]"); } - - - - - // 方法 - /** * 克隆 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBusinessEntity.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBusinessEntity.java index 9004eb7..9a29627 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBusinessEntity.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBusinessEntity.java @@ -165,16 +165,6 @@ public class GspBusinessEntity extends GspCommonModel implements IMetadataConten return beMgrActions; } - // private java.util.ArrayList authorizations; - - /** - * BE关联的权限对象ID集合 - * - */ - // java.util.ArrayList getAuthorizations() - - // public void setAuthorizations(java.util.ArrayList value) - public final void setBizMgrActions(BizMgrActionCollection value) { beMgrActions = value; beMgrActions.setOwner(this.getMainObject()); diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/SysnDboUtils.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/SysnDboUtils.java deleted file mode 100644 index 122d4e9..0000000 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/SysnDboUtils.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.be.definition.common; -// -//import org.openatom.ubml.model.be.definition.GspBizEntityElement; -//import org.openatom.ubml.model.be.definition.GspBizEntityObject; -//import com.inspur.edp.cef.designtime.api.util.Guid; -//import com.inspur.edp.das.commonmodel.entity.object.GspCommonObjectType; -//import io.iec.edp.caf.businessobject.api.entity.DevBasicBoInfo; -//import io.iec.edp.caf.businessobject.api.service.DevBasicInfoService; -//import io.iec.edp.caf.commons.utils.SpringBeanUtils; -//import io.iec.edp.caf.databaseobject.api.entity.DataType; -//import io.iec.edp.caf.databaseobject.api.entity.DatabaseObjectColumn; -//import io.iec.edp.caf.databaseobject.api.entity.DatabaseObjectTable; -// -// -///** -// * The Tools To Sysn Be To Database Object -// * -// * @ClassName: SysnDboUtils -// * @Author: Benjamin Gong -// * @Date: 2021/1/11 17:13 -// * @Version: V1.0 -// */ -//public class SysnDboUtils { -// -// //createDbo -// public static DatabaseObjectTable createDbo(GspBizEntityObject bizObject, String boId, Boolean isUsingTimeStamp){ -// DatabaseObjectTable table = generateDboFromBizObject(bizObject, boId, bizObject.getRefObjectName(), isUsingTimeStamp); -// bizObject.setRefObjectName(table.getId()); -// return table; -// } -// -// private static DatabaseObjectTable generateDboFromBizObject(GspBizEntityObject bizObject, String boId, String dboID, Boolean usingTimeStamp) { -// //20180802修改_由于外层已确认设计时/运行时均无此dbo,故仅使用原dboID新建 -// String dboCode = getDboNameWithAppCode(bizObject.getCode(), boId); -// String dboName = bizObject.getName(); -// -// //20180817 dbo添加[是否生成时间戳][是否年度表] -// boolean isFiscalTable = false; -// boolean isUsingTimeStamp = getIsUsingTimeStamp(bizObject, usingTimeStamp); -// -//// //新建dbo时,检查dbo文件名/表名 -//// CheckDboFileNameRepeat(path, dboCode); -//// CheckDboTableNameRepeat(path, dboCode); -// -// DatabaseObjectTable table = new DatabaseObjectTable(dboCode, dboName, false, false, isUsingTimeStamp, isFiscalTable, boId, dboID); -// -// for (var ele : -// bizObject.getContainElements()) { -// if (ele.getIsVirtual()) -// continue; -// addDboColumn((GspBizEntityElement)ele, table, bizObject.getIDElement().getID()); -// } -// return table; -// } -// -// private static String getDboNameWithAppCode(String objCode, String boId) { -// DevBasicBoInfo boInfo = SpringBeanUtils.getBean(DevBasicInfoService.class).getDevBasicBoInfo(boId); -// if(boInfo == null) -// throw new RuntimeException("没有获取到业务对象["+boId+"]的相关信息"); -// String appCode = boInfo.getAppCode(); -// return appCode+objCode; -// } -// -// private static boolean getIsUsingTimeStamp(GspBizEntityObject bizObject, boolean isUsingTimeStamp) -// { -// if (bizObject.getObjectType() == GspCommonObjectType.MainObject) { -// return isUsingTimeStamp; -// } -// return false; -// } -// -// -// -// //addBboColumn -// public static void addDboColumn(GspBizEntityElement beElement, DatabaseObjectTable table, String primaryKeyID) { -// String refEleID = Guid.newGuid().toString(); -// beElement.setColumnID(refEleID); -// -// boolean isPrimaryKey = beElement.getID().equals(primaryKeyID); -// -// var info = getLengthPrecisionScale(beElement); -// //字段唯一则非空 -// table.addColumn( -// refEleID, -// beElement.getLabelID(), -// beElement.getName(), -// getDataTypeByMDataType(beElement), -// info.length, -// info.precision, -// info.scale, -// null, -// isPrimaryKey, -// isPrimaryKey, -// !isPrimaryKey, -// beElement.getIsMultiLanguage()); -// -// } -// -// public static DatabaseObjectColumn addDboColumn( -// GspBizEntityElement beElement, -// DatabaseObjectTable table, -// String primaryKeyID, -// String code, -// String name, -// int length, -// int precision, -// int scale){ -// String refEleID = Guid.newGuid().toString(); -// beElement.setColumnID(refEleID); -// boolean isPrimaryKey = beElement.getID().equals(primaryKeyID); -// //字段唯一则非空 -// table.addColumn( -// refEleID, -// code, -// name, -// getDataTypeByMDataType(beElement), -// length, -// precision, -// scale, -// null, -// isPrimaryKey, -// isPrimaryKey, -// !isPrimaryKey, -// beElement.getIsMultiLanguage()); -// -// return table.getColumnById(refEleID); -// } -// public static DataType getDataTypeByMDataType(GspBizEntityElement ele) { -// var mDataType = ele.getMDataType(); -// -// //多语字段的控制 -// if (ele.getIsMultiLanguage()) { -// switch (mDataType) { -// case String: -// return DataType.NVarchar; -// case Text: -// return DataType.NClob; -// default: -// throw new RuntimeException("字段'" + ele.getName() + "'为多语字段,其数据类型应为[字符串]或[备注]。"); -// } -// } -// -// //字段数据类型转换为列数据类型 -// switch (mDataType) { -// case Integer: -// return DataType.Int; -// case Decimal: -// return DataType.Decimal; -// case String: -// return DataType.Varchar; -// case Boolean: -// return DataType.Char; -// case Text: -// return DataType.Clob; -// case Date: -// return DataType.DateTime; -// case DateTime: -// return DataType.TimeStamp; -// case Binary: -// return DataType.Blob; -// default: -// throw new RuntimeException("未定义的字段数据类型'" + mDataType + "',无法转换为数据库对象字段类型。"); -// } -// } -// -// private static ElementLengthInfo getLengthPrecisionScale(GspBizEntityElement element) { -// int length = 0; -// int precision = 0; -// int scale = 0; -// -// // 解决lcm的长度精度小数位数与beElementDataType中长度精度小数位数中表达不一致问题 -// switch (element.getMDataType()) { -// //整型,赋值长度 -// case Integer: -// length = 0; -// precision = 0; -// scale = 0; -// break; -// //字符串,赋值长度 -// case String: -// length = element.getLength(); -// precision = 0; -// scale = 0; -// break; -// //浮点数字,赋值精度,小数位数 -// case Decimal: -// length = 0; -// precision = element.getLength(); -// scale = element.getPrecision(); -// break; -// //布尔型 -// case Boolean: -// length = 1; -// precision = 0; -// scale = 0; -// break; -// //其他,0,0,0 -// } -// -// return new ElementLengthInfo(length, precision, scale); -// } -// -// static class ElementLengthInfo { -// private int length; -// private int precision; -// private int scale; -// -// ElementLengthInfo(int length, int precision, int scale) { -// this.length = length; -// this.precision = precision; -// this.scale = scale; -// } -// } -// -//} -- Gitee From 2edc651a54fcd82f4720f8671855bc6897548818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E6=99=93=E9=A3=9E?= <8868651+haoxiaofei666@user.noreply.gitee.com> Date: Fri, 26 Mar 2021 17:18:34 +0800 Subject: [PATCH 17/61] =?UTF-8?q?!9=20=E4=BC=98=E5=8C=96=EF=BC=9A=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=97=A0=E7=94=A8=E7=B1=BB=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=20*=20=E4=BC=98=E5=8C=96=EF=BC=9A=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=97=A0=E7=94=A8=E7=B1=BB=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../be/definition/GspBizEntityObject.java | 25 -- .../be/definition/GspBusinessEntity.java | 10 - .../be/definition/common/SysnDboUtils.java | 230 ------------------ 3 files changed, 265 deletions(-) delete mode 100644 model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/SysnDboUtils.java diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityObject.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityObject.java index d954aaf..5e7919c 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityObject.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityObject.java @@ -15,8 +15,6 @@ */ package org.openatom.ubml.model.be.definition; -// import Inspur.Gsp.Bef.BizEntity.Authority.*; - import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import org.openatom.ubml.model.be.definition.beenum.BETriggerTimePointType; @@ -151,23 +149,6 @@ public class GspBizEntityObject extends GspCommonObject implements Cloneable { super.setParentObject(value); } - // // 权限 - // private java.util.ArrayList authFieldInfos; - - // /** - // * 关联的数据授权对象信息 - // * - // */ - // public java.util.ArrayList getAuthFieldInfos() { - // return authFieldInfos; - // } - - // void setAuthFieldInfos(java.util.ArrayList value) - - - - // CommonDataType - /** * [保存前]联动计算 */ @@ -258,12 +239,6 @@ public class GspBizEntityObject extends GspCommonObject implements Cloneable { // throw new RuntimeException("业务实体中无法赋值属性[ValAfterModify]"); } - - - - - // 方法 - /** * 克隆 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBusinessEntity.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBusinessEntity.java index 9004eb7..9a29627 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBusinessEntity.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBusinessEntity.java @@ -165,16 +165,6 @@ public class GspBusinessEntity extends GspCommonModel implements IMetadataConten return beMgrActions; } - // private java.util.ArrayList authorizations; - - /** - * BE关联的权限对象ID集合 - * - */ - // java.util.ArrayList getAuthorizations() - - // public void setAuthorizations(java.util.ArrayList value) - public final void setBizMgrActions(BizMgrActionCollection value) { beMgrActions = value; beMgrActions.setOwner(this.getMainObject()); diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/SysnDboUtils.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/SysnDboUtils.java deleted file mode 100644 index 122d4e9..0000000 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/SysnDboUtils.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.be.definition.common; -// -//import org.openatom.ubml.model.be.definition.GspBizEntityElement; -//import org.openatom.ubml.model.be.definition.GspBizEntityObject; -//import com.inspur.edp.cef.designtime.api.util.Guid; -//import com.inspur.edp.das.commonmodel.entity.object.GspCommonObjectType; -//import io.iec.edp.caf.businessobject.api.entity.DevBasicBoInfo; -//import io.iec.edp.caf.businessobject.api.service.DevBasicInfoService; -//import io.iec.edp.caf.commons.utils.SpringBeanUtils; -//import io.iec.edp.caf.databaseobject.api.entity.DataType; -//import io.iec.edp.caf.databaseobject.api.entity.DatabaseObjectColumn; -//import io.iec.edp.caf.databaseobject.api.entity.DatabaseObjectTable; -// -// -///** -// * The Tools To Sysn Be To Database Object -// * -// * @ClassName: SysnDboUtils -// * @Author: Benjamin Gong -// * @Date: 2021/1/11 17:13 -// * @Version: V1.0 -// */ -//public class SysnDboUtils { -// -// //createDbo -// public static DatabaseObjectTable createDbo(GspBizEntityObject bizObject, String boId, Boolean isUsingTimeStamp){ -// DatabaseObjectTable table = generateDboFromBizObject(bizObject, boId, bizObject.getRefObjectName(), isUsingTimeStamp); -// bizObject.setRefObjectName(table.getId()); -// return table; -// } -// -// private static DatabaseObjectTable generateDboFromBizObject(GspBizEntityObject bizObject, String boId, String dboID, Boolean usingTimeStamp) { -// //20180802修改_由于外层已确认设计时/运行时均无此dbo,故仅使用原dboID新建 -// String dboCode = getDboNameWithAppCode(bizObject.getCode(), boId); -// String dboName = bizObject.getName(); -// -// //20180817 dbo添加[是否生成时间戳][是否年度表] -// boolean isFiscalTable = false; -// boolean isUsingTimeStamp = getIsUsingTimeStamp(bizObject, usingTimeStamp); -// -//// //新建dbo时,检查dbo文件名/表名 -//// CheckDboFileNameRepeat(path, dboCode); -//// CheckDboTableNameRepeat(path, dboCode); -// -// DatabaseObjectTable table = new DatabaseObjectTable(dboCode, dboName, false, false, isUsingTimeStamp, isFiscalTable, boId, dboID); -// -// for (var ele : -// bizObject.getContainElements()) { -// if (ele.getIsVirtual()) -// continue; -// addDboColumn((GspBizEntityElement)ele, table, bizObject.getIDElement().getID()); -// } -// return table; -// } -// -// private static String getDboNameWithAppCode(String objCode, String boId) { -// DevBasicBoInfo boInfo = SpringBeanUtils.getBean(DevBasicInfoService.class).getDevBasicBoInfo(boId); -// if(boInfo == null) -// throw new RuntimeException("没有获取到业务对象["+boId+"]的相关信息"); -// String appCode = boInfo.getAppCode(); -// return appCode+objCode; -// } -// -// private static boolean getIsUsingTimeStamp(GspBizEntityObject bizObject, boolean isUsingTimeStamp) -// { -// if (bizObject.getObjectType() == GspCommonObjectType.MainObject) { -// return isUsingTimeStamp; -// } -// return false; -// } -// -// -// -// //addBboColumn -// public static void addDboColumn(GspBizEntityElement beElement, DatabaseObjectTable table, String primaryKeyID) { -// String refEleID = Guid.newGuid().toString(); -// beElement.setColumnID(refEleID); -// -// boolean isPrimaryKey = beElement.getID().equals(primaryKeyID); -// -// var info = getLengthPrecisionScale(beElement); -// //字段唯一则非空 -// table.addColumn( -// refEleID, -// beElement.getLabelID(), -// beElement.getName(), -// getDataTypeByMDataType(beElement), -// info.length, -// info.precision, -// info.scale, -// null, -// isPrimaryKey, -// isPrimaryKey, -// !isPrimaryKey, -// beElement.getIsMultiLanguage()); -// -// } -// -// public static DatabaseObjectColumn addDboColumn( -// GspBizEntityElement beElement, -// DatabaseObjectTable table, -// String primaryKeyID, -// String code, -// String name, -// int length, -// int precision, -// int scale){ -// String refEleID = Guid.newGuid().toString(); -// beElement.setColumnID(refEleID); -// boolean isPrimaryKey = beElement.getID().equals(primaryKeyID); -// //字段唯一则非空 -// table.addColumn( -// refEleID, -// code, -// name, -// getDataTypeByMDataType(beElement), -// length, -// precision, -// scale, -// null, -// isPrimaryKey, -// isPrimaryKey, -// !isPrimaryKey, -// beElement.getIsMultiLanguage()); -// -// return table.getColumnById(refEleID); -// } -// public static DataType getDataTypeByMDataType(GspBizEntityElement ele) { -// var mDataType = ele.getMDataType(); -// -// //多语字段的控制 -// if (ele.getIsMultiLanguage()) { -// switch (mDataType) { -// case String: -// return DataType.NVarchar; -// case Text: -// return DataType.NClob; -// default: -// throw new RuntimeException("字段'" + ele.getName() + "'为多语字段,其数据类型应为[字符串]或[备注]。"); -// } -// } -// -// //字段数据类型转换为列数据类型 -// switch (mDataType) { -// case Integer: -// return DataType.Int; -// case Decimal: -// return DataType.Decimal; -// case String: -// return DataType.Varchar; -// case Boolean: -// return DataType.Char; -// case Text: -// return DataType.Clob; -// case Date: -// return DataType.DateTime; -// case DateTime: -// return DataType.TimeStamp; -// case Binary: -// return DataType.Blob; -// default: -// throw new RuntimeException("未定义的字段数据类型'" + mDataType + "',无法转换为数据库对象字段类型。"); -// } -// } -// -// private static ElementLengthInfo getLengthPrecisionScale(GspBizEntityElement element) { -// int length = 0; -// int precision = 0; -// int scale = 0; -// -// // 解决lcm的长度精度小数位数与beElementDataType中长度精度小数位数中表达不一致问题 -// switch (element.getMDataType()) { -// //整型,赋值长度 -// case Integer: -// length = 0; -// precision = 0; -// scale = 0; -// break; -// //字符串,赋值长度 -// case String: -// length = element.getLength(); -// precision = 0; -// scale = 0; -// break; -// //浮点数字,赋值精度,小数位数 -// case Decimal: -// length = 0; -// precision = element.getLength(); -// scale = element.getPrecision(); -// break; -// //布尔型 -// case Boolean: -// length = 1; -// precision = 0; -// scale = 0; -// break; -// //其他,0,0,0 -// } -// -// return new ElementLengthInfo(length, precision, scale); -// } -// -// static class ElementLengthInfo { -// private int length; -// private int precision; -// private int scale; -// -// ElementLengthInfo(int length, int precision, int scale) { -// this.length = length; -// this.precision = precision; -// this.scale = scale; -// } -// } -// -//} -- Gitee From f06f672a57a6d7ff3964b0211d26ff35105fe9d5 Mon Sep 17 00:00:00 2001 From: Q-Lee <7961837+Q-Lee@user.noreply.gitee.com> Date: Mon, 29 Mar 2021 19:31:45 +0800 Subject: [PATCH 18/61] =?UTF-8?q?!11=20=E4=BC=98=E5=8C=96:=20(1)=E8=A7=84?= =?UTF-8?q?=E8=8C=83MavenDependency.java=20=E4=B8=AD=E9=87=8D=E5=86=99equa?= =?UTF-8?q?ls=E7=9A=84=E6=96=B9=E5=BC=8F=20(2)=E9=87=8D=E5=86=99equals?= =?UTF-8?q?=E6=97=B6=E5=BF=85=E9=A1=BB=E9=87=8D=E5=86=99hashCode=E6=96=B9?= =?UTF-8?q?=E6=B3=95=20*=20=E4=BC=98=E5=8C=96:=20(1)=E8=A7=84=E8=8C=83Mave?= =?UTF-8?q?nDependency.java=20=E4=B8=AD=E9=87=8D=E5=86=99equals=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=20(2)=E9=87=8D=E5=86=99equals=E6=97=B6?= =?UTF-8?q?=E5=BF=85=E9=A1=BB=E9=87=8D=E5=86=99hashCode=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../generator/api/entity/MavenDependency.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/MavenDependency.java b/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/MavenDependency.java index ff8ee02..1eeac48 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/MavenDependency.java +++ b/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/MavenDependency.java @@ -78,11 +78,24 @@ public class MavenDependency { this.groupId = groupId; } - public boolean equals(MavenDependency source) { - if (source == null) { + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof MavenDependency)) { return false; } - return source.getGroupId().equals(getGroupId()) - && source.getArtifactId().equals(getArtifactId()); + MavenDependency md = (MavenDependency) obj; + return (groupId == null ? md.getGroupId() == null : groupId.equals(md.getGroupId())) && + (artifactId == null ? md.getArtifactId() == null : artifactId.equals(md.getArtifactId())); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + (groupId == null ? 0 : groupId.hashCode()); + result = 31 * result + (artifactId == null ? 0 : artifactId.hashCode()); + return result; } } -- Gitee From 4b2c490baf8f72bdc40c580ab46598eece54c054 Mon Sep 17 00:00:00 2001 From: bugu <837948266@qq.com> Date: Mon, 29 Mar 2021 19:40:34 +0800 Subject: [PATCH 19/61] =?UTF-8?q?!6=20=E4=BC=98=E5=8C=96=EF=BC=9A=E4=BC=98?= =?UTF-8?q?=E5=8C=96GspCommonObject=20*=20Merge=20branch=20'develop'=20of?= =?UTF-8?q?=20https://gitee.com/haozhibei/ubml-impl=20into=20develop=20*?= =?UTF-8?q?=20Merge=20remote-tracking=20branch=20'upstream/develop'=20into?= =?UTF-8?q?=20develop=20*=20remove=20checkstyle=20*=20optimize:=20optimize?= =?UTF-8?q?=20GspCommonObject=20and=20format=20*=20optimize=20GspCommonMod?= =?UTF-8?q?el?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- Gitee From 7e65ab0f3403c57a8b088f2e17e2231ed5cbb98c Mon Sep 17 00:00:00 2001 From: Zhibei Hao <837948266@qq.com> Date: Mon, 29 Mar 2021 19:45:07 +0800 Subject: [PATCH 20/61] add copyright header to some eapi class --- .../externalapi/runtime/api/EndpointInfo.java | 15 +++++++++++++++ .../api/ExternalApiCustomizedMetadataService.java | 15 +++++++++++++++ .../api/ExternalApiCustomizedPublishService.java | 15 +++++++++++++++ .../runtime/api/ExternalApiEngine.java | 15 +++++++++++++++ .../runtime/api/ExternalApiInvokeAgent.java | 15 +++++++++++++++ .../runtime/api/ExternalApiMetadataService.java | 15 +++++++++++++++ .../runtime/api/ExternalApiPublishService.java | 15 +++++++++++++++ .../runtime/api/PublishedExternalApiInfo.java | 15 +++++++++++++++ 8 files changed, 120 insertions(+) diff --git a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/EndpointInfo.java b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/EndpointInfo.java index 9083281..2389c6d 100644 --- a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/EndpointInfo.java +++ b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/EndpointInfo.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.opeantom.ubml.externalapi.runtime.api; diff --git a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiCustomizedMetadataService.java b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiCustomizedMetadataService.java index 0609162..1ff536b 100644 --- a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiCustomizedMetadataService.java +++ b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiCustomizedMetadataService.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.opeantom.ubml.externalapi.runtime.api; import org.openatom.ubml.model.common.definition.entity.GspMetadata; diff --git a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiCustomizedPublishService.java b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiCustomizedPublishService.java index 4fcc276..f5ef654 100644 --- a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiCustomizedPublishService.java +++ b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiCustomizedPublishService.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.opeantom.ubml.externalapi.runtime.api; import java.util.List; diff --git a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiEngine.java b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiEngine.java index 4a0bc08..2c35a9d 100644 --- a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiEngine.java +++ b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiEngine.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.opeantom.ubml.externalapi.runtime.api; import com.fasterxml.jackson.databind.JsonNode; diff --git a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiInvokeAgent.java b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiInvokeAgent.java index b294324..4350cfb 100644 --- a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiInvokeAgent.java +++ b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiInvokeAgent.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.opeantom.ubml.externalapi.runtime.api; import com.fasterxml.jackson.databind.JsonNode; diff --git a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiMetadataService.java b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiMetadataService.java index 67bfd9d..6df9643 100644 --- a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiMetadataService.java +++ b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiMetadataService.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.opeantom.ubml.externalapi.runtime.api; import org.openatom.ubml.model.common.definition.entity.GspMetadata; diff --git a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiPublishService.java b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiPublishService.java index bf958ab..32f1256 100644 --- a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiPublishService.java +++ b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiPublishService.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.opeantom.ubml.externalapi.runtime.api; /** diff --git a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/PublishedExternalApiInfo.java b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/PublishedExternalApiInfo.java index d492352..a208853 100644 --- a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/PublishedExternalApiInfo.java +++ b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/PublishedExternalApiInfo.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.opeantom.ubml.externalapi.runtime.api; -- Gitee From f9d855c6c82a13684eed2e117a6903030c3ccb4b Mon Sep 17 00:00:00 2001 From: luzhanxiang Date: Tue, 30 Mar 2021 14:55:41 +0800 Subject: [PATCH 21/61] =?UTF-8?q?=E4=BF=AE=E6=94=B9GITEE=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitee/ISSUE_TEMPLATE/BUG_REPORT.md | 2 +- .gitee/ISSUE_TEMPLATE/FEATURE_REQUEST.md | 2 +- .gitee/PULL_REQUEST_TEMPLATE.md | 16 ++++++++++++--- .gitee/PULL_REQUEST_TEMPLATE.zh-CN.md | 26 ++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 .gitee/PULL_REQUEST_TEMPLATE.zh-CN.md diff --git a/.gitee/ISSUE_TEMPLATE/BUG_REPORT.md b/.gitee/ISSUE_TEMPLATE/BUG_REPORT.md index 3bcde0a..fd5abf9 100644 --- a/.gitee/ISSUE_TEMPLATE/BUG_REPORT.md +++ b/.gitee/ISSUE_TEMPLATE/BUG_REPORT.md @@ -4,7 +4,7 @@ about: If you would like to report a issue to Seata, please use this template. --- -- [ ] I have searched the [issues](https://github.com/seata/seata/issues) of this repository and believe that this is not a duplicate. +- [ ] I have searched the [issues](https://gitee.com/ubml/ubml-impl/issues) of this repository and believe that this is not a duplicate. ### Ⅰ. Issue Description diff --git a/.gitee/ISSUE_TEMPLATE/FEATURE_REQUEST.md b/.gitee/ISSUE_TEMPLATE/FEATURE_REQUEST.md index b386516..a7894bd 100644 --- a/.gitee/ISSUE_TEMPLATE/FEATURE_REQUEST.md +++ b/.gitee/ISSUE_TEMPLATE/FEATURE_REQUEST.md @@ -1,6 +1,6 @@ --- name: Feature Request -about: Suggest an idea for Seata +about: Suggest an idea for ubml-impl --- diff --git a/.gitee/PULL_REQUEST_TEMPLATE.md b/.gitee/PULL_REQUEST_TEMPLATE.md index 7c05829..e6a2542 100644 --- a/.gitee/PULL_REQUEST_TEMPLATE.md +++ b/.gitee/PULL_REQUEST_TEMPLATE.md @@ -1,5 +1,7 @@ +For English PR titles, **Please start with one of the following prefixes**: `feature:`/`bugfix:`/`optimize:`/`docs:`/`test:`/`refactor:` + ### Ⅰ. Describe what this PR did @@ -7,10 +9,18 @@ -### Ⅲ. Why don't you add test cases (unit test/integration test)? +### Ⅲ. Change type +- [ ] feature +- [ ] bugfix +- [ ] optimize +- [ ] docs +- [ ] test +- [ ] refactor + +### Ⅳ. Why don't you add test cases (unit test/integration test)? -### Ⅳ. Describe how to verify it +### Ⅴ. Describe how to verify it -### Ⅴ. Special notes for reviews +### Ⅵ. Special notes for reviews diff --git a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md new file mode 100644 index 0000000..fa4af23 --- /dev/null +++ b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md @@ -0,0 +1,26 @@ + + +***中文PR标题**,**必须**`特性:`、`修复:`、`优化:`、`文档:`、`测试:`、`重构:`**开头** + +### Ⅰ. 请描述本地提交所做内容 + + +### Ⅱ. 本次提交是否修复了某个Issue? + + + +### Ⅲ. 本次修改类型 +- [ ] 特性 +- [ ] 修复 +- [ ] 优化 +- [ ] 文档 +- [ ] 测试 +- [ ] 重构 + +### Ⅲ. 为什么没有添加测试用例 (单元测试/集成测试)? + + +### Ⅳ. 请描述如何验证提交内容 + + +### Ⅴ. 特殊备注 -- Gitee From f5e7656523e03869c5ed42a9fdf7e5e70938fdfd Mon Sep 17 00:00:00 2001 From: luzhanxiang Date: Tue, 30 Mar 2021 14:57:58 +0800 Subject: [PATCH 22/61] =?UTF-8?q?!1=20docs:=E4=BF=AE=E6=94=B9PR=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=20*=20=E4=BF=AE=E6=94=B9GITEE=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitee/ISSUE_TEMPLATE/BUG_REPORT.md | 2 +- .gitee/ISSUE_TEMPLATE/FEATURE_REQUEST.md | 2 +- .gitee/PULL_REQUEST_TEMPLATE.md | 16 ++++++++++++--- .gitee/PULL_REQUEST_TEMPLATE.zh-CN.md | 26 ++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 .gitee/PULL_REQUEST_TEMPLATE.zh-CN.md diff --git a/.gitee/ISSUE_TEMPLATE/BUG_REPORT.md b/.gitee/ISSUE_TEMPLATE/BUG_REPORT.md index 3bcde0a..fd5abf9 100644 --- a/.gitee/ISSUE_TEMPLATE/BUG_REPORT.md +++ b/.gitee/ISSUE_TEMPLATE/BUG_REPORT.md @@ -4,7 +4,7 @@ about: If you would like to report a issue to Seata, please use this template. --- -- [ ] I have searched the [issues](https://github.com/seata/seata/issues) of this repository and believe that this is not a duplicate. +- [ ] I have searched the [issues](https://gitee.com/ubml/ubml-impl/issues) of this repository and believe that this is not a duplicate. ### Ⅰ. Issue Description diff --git a/.gitee/ISSUE_TEMPLATE/FEATURE_REQUEST.md b/.gitee/ISSUE_TEMPLATE/FEATURE_REQUEST.md index b386516..a7894bd 100644 --- a/.gitee/ISSUE_TEMPLATE/FEATURE_REQUEST.md +++ b/.gitee/ISSUE_TEMPLATE/FEATURE_REQUEST.md @@ -1,6 +1,6 @@ --- name: Feature Request -about: Suggest an idea for Seata +about: Suggest an idea for ubml-impl --- diff --git a/.gitee/PULL_REQUEST_TEMPLATE.md b/.gitee/PULL_REQUEST_TEMPLATE.md index 7c05829..e6a2542 100644 --- a/.gitee/PULL_REQUEST_TEMPLATE.md +++ b/.gitee/PULL_REQUEST_TEMPLATE.md @@ -1,5 +1,7 @@ +For English PR titles, **Please start with one of the following prefixes**: `feature:`/`bugfix:`/`optimize:`/`docs:`/`test:`/`refactor:` + ### Ⅰ. Describe what this PR did @@ -7,10 +9,18 @@ -### Ⅲ. Why don't you add test cases (unit test/integration test)? +### Ⅲ. Change type +- [ ] feature +- [ ] bugfix +- [ ] optimize +- [ ] docs +- [ ] test +- [ ] refactor + +### Ⅳ. Why don't you add test cases (unit test/integration test)? -### Ⅳ. Describe how to verify it +### Ⅴ. Describe how to verify it -### Ⅴ. Special notes for reviews +### Ⅵ. Special notes for reviews diff --git a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md new file mode 100644 index 0000000..fa4af23 --- /dev/null +++ b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md @@ -0,0 +1,26 @@ + + +***中文PR标题**,**必须**`特性:`、`修复:`、`优化:`、`文档:`、`测试:`、`重构:`**开头** + +### Ⅰ. 请描述本地提交所做内容 + + +### Ⅱ. 本次提交是否修复了某个Issue? + + + +### Ⅲ. 本次修改类型 +- [ ] 特性 +- [ ] 修复 +- [ ] 优化 +- [ ] 文档 +- [ ] 测试 +- [ ] 重构 + +### Ⅲ. 为什么没有添加测试用例 (单元测试/集成测试)? + + +### Ⅳ. 请描述如何验证提交内容 + + +### Ⅴ. 特殊备注 -- Gitee From 12f0596587fd1aaadebb3672b655aff97ee4bed2 Mon Sep 17 00:00:00 2001 From: luzhanxiang Date: Tue, 30 Mar 2021 14:58:37 +0800 Subject: [PATCH 23/61] =?UTF-8?q?=E4=BF=AE=E6=94=B9Gitee=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitee/PULL_REQUEST_TEMPLATE.zh-CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md index fa4af23..652f339 100644 --- a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md +++ b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md @@ -1,6 +1,6 @@ -***中文PR标题**,**必须**`特性:`、`修复:`、`优化:`、`文档:`、`测试:`、`重构:`**开头** +***中文PR标题**,**必须以**`特性:`、`修复:`、`优化:`、`文档:`、`测试:`、`重构:`**开头** ### Ⅰ. 请描述本地提交所做内容 -- Gitee From 249649b83a31ab69e2486f54a8e096a32ef6b9e9 Mon Sep 17 00:00:00 2001 From: luzhanxiang Date: Tue, 30 Mar 2021 15:45:35 +0800 Subject: [PATCH 24/61] =?UTF-8?q?=E4=BF=AE=E6=94=B9Gitee=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BUG_REPORT.md => ISSUE_TEMPLATE.en.md} | 9 +++-- .gitee/ISSUE_TEMPLATE.zh-CN.md | 36 +++++++++++++++++++ .gitee/ISSUE_TEMPLATE/FEATURE_REQUEST.md | 16 --------- ...EMPLATE.md => PULL_REQUEST_TEMPLATE.en.md} | 0 4 files changed, 40 insertions(+), 21 deletions(-) rename .gitee/{ISSUE_TEMPLATE/BUG_REPORT.md => ISSUE_TEMPLATE.en.md} (77%) create mode 100644 .gitee/ISSUE_TEMPLATE.zh-CN.md delete mode 100644 .gitee/ISSUE_TEMPLATE/FEATURE_REQUEST.md rename .gitee/{PULL_REQUEST_TEMPLATE.md => PULL_REQUEST_TEMPLATE.en.md} (100%) diff --git a/.gitee/ISSUE_TEMPLATE/BUG_REPORT.md b/.gitee/ISSUE_TEMPLATE.en.md similarity index 77% rename from .gitee/ISSUE_TEMPLATE/BUG_REPORT.md rename to .gitee/ISSUE_TEMPLATE.en.md index fd5abf9..9621fe3 100644 --- a/.gitee/ISSUE_TEMPLATE/BUG_REPORT.md +++ b/.gitee/ISSUE_TEMPLATE.en.md @@ -1,11 +1,10 @@ ---- -name: Bug Report -about: If you would like to report a issue to Seata, please use this template. - ---- - [ ] I have searched the [issues](https://gitee.com/ubml/ubml-impl/issues) of this repository and believe that this is not a duplicate. +**For English Issue titles, Please start with `bug:` if you want to report bugs, `feature:` for features as well.** + +**Please choose right tags for this issue.** + ### Ⅰ. Issue Description diff --git a/.gitee/ISSUE_TEMPLATE.zh-CN.md b/.gitee/ISSUE_TEMPLATE.zh-CN.md new file mode 100644 index 0000000..9057e6a --- /dev/null +++ b/.gitee/ISSUE_TEMPLATE.zh-CN.md @@ -0,0 +1,36 @@ + +- [ ] 请确认已经搜索[issues](https://gitee.com/ubml/ubml-impl/issues)并且没有发现重复的问题 + +**中文Issue标题, 如果反馈Bug,请以`bug:`开头。反馈特性请以`特性:`开头。** + +**请选择恰当的Issue标签** + +### Ⅰ. Issue描述 + + +### Ⅱ. 请描述发生了什么 + + 如果存在异常,请贴出异常堆栈信息: + +``` +请将异常堆栈信息粘贴在此处! +``` + + +### Ⅲ. 请描述你的期望 + + +### Ⅳ. 如何复现 (请尽可能的精确和细致) + +1. xxx +2. xxx +3. xxx + +### Ⅴ. 还有什么我们需要了解的? + + +### Ⅵ. 环境信息: + +- JDK version : +- OS : +- Others: \ No newline at end of file diff --git a/.gitee/ISSUE_TEMPLATE/FEATURE_REQUEST.md b/.gitee/ISSUE_TEMPLATE/FEATURE_REQUEST.md deleted file mode 100644 index a7894bd..0000000 --- a/.gitee/ISSUE_TEMPLATE/FEATURE_REQUEST.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -name: Feature Request -about: Suggest an idea for ubml-impl - ---- - -## Why you need it? - Is your feature request related to a problem? Please describe in details - - -## How it could be? -A clear and concise description of what you want to happen. You can explain more about input of the feature, and output of it. - - -## Other related information -Add any other context or screenshots about the feature request here. \ No newline at end of file diff --git a/.gitee/PULL_REQUEST_TEMPLATE.md b/.gitee/PULL_REQUEST_TEMPLATE.en.md similarity index 100% rename from .gitee/PULL_REQUEST_TEMPLATE.md rename to .gitee/PULL_REQUEST_TEMPLATE.en.md -- Gitee From 00616fa67ee6c353de79694f51d50a0451442d1d Mon Sep 17 00:00:00 2001 From: luzhanxiang Date: Tue, 30 Mar 2021 15:47:56 +0800 Subject: [PATCH 25/61] =?UTF-8?q?=E4=BF=AE=E6=94=B9Gitee=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitee/PULL_REQUEST_TEMPLATE.zh-CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md index 652f339..2925fd4 100644 --- a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md +++ b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md @@ -1,6 +1,6 @@ -***中文PR标题**,**必须以**`特性:`、`修复:`、`优化:`、`文档:`、`测试:`、`重构:`**开头** +**中文PR标题**,**必须以**`特性:`、`修复:`、`优化:`、`文档:`、`测试:`、`重构:`**开头** ### Ⅰ. 请描述本地提交所做内容 -- Gitee From a90bab3c2f58a341ec0e246c18b31b637c982442 Mon Sep 17 00:00:00 2001 From: hanll02 Date: Wed, 31 Mar 2021 15:16:02 +0800 Subject: [PATCH 26/61] =?UTF-8?q?1=E3=80=81=E7=89=B9=E6=80=A7:=20add=20met?= =?UTF-8?q?adata=20i18n=20extraction=20and=20merge=20entity=20class=202?= =?UTF-8?q?=E3=80=81=E4=BC=98=E5=8C=96:=20=E4=BF=AE=E6=94=B9=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E5=BA=8F=E5=88=97=E5=8C=96=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/common/definition/pom.xml | 5 + .../definition/cef/entity/GspCommonField.java | 2 +- .../context/CefResourceExtractContext.java | 67 +++++++++++ .../cef/i18n/context/CefResourceInfo.java | 78 ++++++++++++ .../i18n/context/CefResourceMergeContext.java | 47 ++++++++ .../i18n/context/CefResourcePrefixInfo.java | 38 ++++++ .../context/ICefResourceExtractContext.java | 32 +++++ .../context/ICefResourceMergeContext.java | 37 ++++++ .../extractor/AbstractResourceExtractor.java | 112 ++++++++++++++++++ .../AssoRefFieldResourceExtractor.java | 44 +++++++ .../i18n/extractor/AssoResourceExtractor.java | 57 +++++++++ .../extractor/CefFieldResourceExtractor.java | 102 ++++++++++++++++ .../extractor/DataTypeResourceExtractor.java | 88 ++++++++++++++ .../i18n/merger/AbstractResourceMerger.java | 50 ++++++++ .../merger/AssoRefFieldResourceMerger.java | 29 +++++ .../cef/i18n/merger/AssoResourceMerger.java | 45 +++++++ .../i18n/merger/CefFieldResourceMerger.java | 98 +++++++++++++++ .../i18n/merger/DataTypeResourceMerger.java | 62 ++++++++++ .../names/CefResourceDescriptionNames.java | 22 ++++ .../cef/i18n/names/CefResourceKeyNames.java | 23 ++++ .../cef/increment/extractor/ExtractUtils.java | 20 ++++ .../cef/increment/merger/MergeUtils.java | 23 ++++ 22 files changed, 1080 insertions(+), 1 deletion(-) create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceInfo.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourcePrefixInfo.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceExtractContext.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AbstractResourceExtractor.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoRefFieldResourceExtractor.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoResourceExtractor.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/CefFieldResourceExtractor.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/DataTypeResourceExtractor.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AbstractResourceMerger.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoRefFieldResourceMerger.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoResourceMerger.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceDescriptionNames.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceKeyNames.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/extractor/ExtractUtils.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/merger/MergeUtils.java diff --git a/model/common/definition/pom.xml b/model/common/definition/pom.xml index e7490d1..0ff5f18 100644 --- a/model/common/definition/pom.xml +++ b/model/common/definition/pom.xml @@ -18,5 +18,10 @@ ubml-common 0.9.0-SNAPSHOT + + org.openatom.ubml + ubml-model-framework-common + 0.9.0-SNAPSHOT + \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonField.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonField.java index 72863c7..ef64010 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonField.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonField.java @@ -67,7 +67,7 @@ public class GspCommonField implements IGspCommonField { private boolean isRequire = true; @JsonProperty(CefNames.IS_MULTI_LANGUAGE) private boolean isMultilLanguage; - @JsonProperty(CefNames.IS_VIRTUAL) + @JsonProperty(CefNames.BELONG_OBJECT) private transient IGspCommonDataType belongObject; @JsonProperty(CefNames.CHILD_ELEMENTS) //todo:j-json diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java new file mode 100644 index 0000000..26974eb --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java @@ -0,0 +1,67 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +import org.openatom.ubml.model.common.definition.cef.util.DataValidator; +import org.openatom.ubml.model.framework.definition.entity.I18nResourceItem; +import org.openatom.ubml.model.framework.definition.entity.I18nResourceItemCollection; + +/** + * 多语资源项抽取上下文 + */ +public class CefResourceExtractContext implements ICefResourceExtractContext { + private String metaPrefix; + private I18nResourceItemCollection resourceItems; + + public CefResourceExtractContext(String metaPrefix, I18nResourceItemCollection items) { + DataValidator.checkForEmptyString(metaPrefix, "元数据前缀"); + DataValidator.checkForNullReference(items, "国际化资源项"); + this.metaPrefix = metaPrefix; + this.resourceItems = items; + } + + /** + * 获取前缀 + * + * @return + */ + public final String getKeyPrefix() { + return metaPrefix; + } + + /** + * 新增/修改 + * + * @param info + */ + public final void setResourceItem(CefResourceInfo info) { + String key = info.getResourceKey(); + String value = info.getResourceValue(); + String description = info.getDescription(); + + I18nResourceItem resource = GetNewResource(key, value, description); + + resourceItems.add(resource); + } + + private I18nResourceItem GetNewResource(String key, String value, String description) { + I18nResourceItem resourceItem = new I18nResourceItem(); + resourceItem.setKey(key); + resourceItem.setValue(value); + resourceItem.setComment(description); + return resourceItem; + } +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceInfo.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceInfo.java new file mode 100644 index 0000000..9defaf0 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceInfo.java @@ -0,0 +1,78 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +import org.openatom.ubml.model.common.definition.cef.util.DataValidator; + +public class CefResourceInfo { + + public CefResourceInfo(CefResourcePrefixInfo prefixInfo, String resourceKeyPropName, String descriptionPropName, + String resourceValue) { + DataValidator.checkForNullReference(prefixInfo, "PrefixInfo"); + DataValidator.checkForEmptyString(prefixInfo.getDescriptionPrefix(), "DescriptionPrefix"); + DataValidator.checkForEmptyString(prefixInfo.getResourceKeyPrefix(), "ResourceKeyPrefix"); + + DataValidator.checkForEmptyString(resourceKeyPropName, "ResourceKeyPropName"); + DataValidator.checkForEmptyString(descriptionPropName, "DescriptionPropName"); + DataValidator.checkForEmptyString(resourceValue, "ResourceValue"); + + this.prefixInfo = prefixInfo; + this.resourceKeyPropName = resourceKeyPropName; + this.descriptionPropName = descriptionPropName; + this.resourceValue = resourceValue; + } + + private CefResourcePrefixInfo prefixInfo; + + public final CefResourcePrefixInfo getPrefixInfo() { + return prefixInfo; + } + + /** + * 属性名 e.g. NAME + */ + private String resourceKeyPropName; + + public final String getResourceKeyPropName() { + return resourceKeyPropName; + } + + /** + * 描述中属性名 e.g. 名称 + */ + private String descriptionPropName; + + public final String getDescriptionPropName() { + return descriptionPropName; + } + + /** + * 默认语言的值 + */ + private String resourceValue; + + public final String getResourceValue() { + return resourceValue; + } + + public String getResourceKey() { + return getPrefixInfo().getResourceKeyPrefix() + "." + getResourceKeyPropName(); + } + + public String getDescription() { + return getPrefixInfo().getDescriptionPrefix() + "的" + getDescriptionPropName(); + } +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java new file mode 100644 index 0000000..7c634db --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java @@ -0,0 +1,47 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +import org.openatom.ubml.model.common.definition.cef.util.DataValidator; +import org.openatom.ubml.model.framework.definition.entity.I18nResourceItemCollection; + +public class CefResourceMergeContext implements ICefResourceMergeContext { + + private String metaPrefix; + private I18nResourceItemCollection resourceItems; + + public CefResourceMergeContext(String metaPrefix, I18nResourceItemCollection items) { + DataValidator.checkForEmptyString(metaPrefix, "元数据前缀"); + DataValidator.checkForNullReference(items, "国际化资源项"); + this.metaPrefix = metaPrefix; + this.resourceItems = items; + } + + @Override + public String getKeyPrefix() { + return this.metaPrefix; + } + + @Override + public void setKeyPrefix(String keyPrefix) { + this.metaPrefix = keyPrefix; + } + + public I18nResourceItemCollection getResourceItems() { + return this.resourceItems; + } + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourcePrefixInfo.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourcePrefixInfo.java new file mode 100644 index 0000000..325aa44 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourcePrefixInfo.java @@ -0,0 +1,38 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +public class CefResourcePrefixInfo { + private String resourceKeyPrefix; + private String descriptionPrefix; + + public String getResourceKeyPrefix() { + return resourceKeyPrefix; + } + + public void setResourceKeyPrefix(String resourceKeyPrefix) { + this.resourceKeyPrefix = resourceKeyPrefix; + } + + public String getDescriptionPrefix() { + return descriptionPrefix; + } + + public void setDescriptionPrefix(String descriptionPrefix) { + this.descriptionPrefix = descriptionPrefix; + } +} + diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceExtractContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceExtractContext.java new file mode 100644 index 0000000..9db7d91 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceExtractContext.java @@ -0,0 +1,32 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +public interface ICefResourceExtractContext { + /** + * 获取前缀 + * + * @return + */ + String getKeyPrefix(); + + /** + * 新增/修改 + * + * @param info + */ + void setResourceItem(CefResourceInfo info); +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java new file mode 100644 index 0000000..5227df7 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java @@ -0,0 +1,37 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +import org.openatom.ubml.model.framework.definition.entity.I18nResourceItemCollection; + +public interface ICefResourceMergeContext { + + /** + * 获取前缀 + * + * @return + */ + String getKeyPrefix(); + + void setKeyPrefix(String keyPrefix); + + /** + * 获取资源项 + * + * @return + */ + I18nResourceItemCollection getResourceItems(); +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AbstractResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AbstractResourceExtractor.java new file mode 100644 index 0000000..2c0639d --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AbstractResourceExtractor.java @@ -0,0 +1,112 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; + +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourceInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; + +/** + * 国际化抽取器基类 + */ +public abstract class AbstractResourceExtractor { + /** + * 国际化抽取器基类 + * + * @param context 上下文 + * @param parentResourceInfo 父抽取器的前缀信息 + */ + protected AbstractResourceExtractor(ICefResourceExtractContext context, CefResourcePrefixInfo parentResourceInfo) { + this.context = context; + this.parentResourcePrefixInfo = parentResourceInfo; + } + + protected AbstractResourceExtractor(ICefResourceExtractContext context) { + this(context, null); + } + + /** + * 国际化抽取上下文 + */ + private ICefResourceExtractContext context; + + protected final ICefResourceExtractContext getContext() { + return context; + } + + /** + * 父抽取器的前缀信息 + */ + private CefResourcePrefixInfo parentResourcePrefixInfo; + + protected final CefResourcePrefixInfo getParentResourcePrefixInfo() { + return parentResourcePrefixInfo; + } + + /** + * 当前抽取器的前缀信息 + */ + private CefResourcePrefixInfo currentResourcePrefixInfo; + + protected final CefResourcePrefixInfo getCurrentResourcePrefixInfo() { + return currentResourcePrefixInfo; + } + + private void setCurrentResourcePrefixInfo(CefResourcePrefixInfo value) { + currentResourcePrefixInfo = value; + } + + //#endregion + + /** + * 抽取国际化项入口方法 + */ + public final void extract() { + setCurrentResourcePrefixInfo(buildCurrentPrefix()); + setPrefixInfo(); + extractItems(); + } + + /** + * 抽取 + */ + protected abstract void extractItems(); + + /** + * 构造前缀 + * + * @return + */ + protected abstract CefResourcePrefixInfo buildCurrentPrefix(); + + /** + * 赋值前缀 + */ + protected abstract void setPrefixInfo(); + + /** + * 新增抽取资源项 + * + * @param propName 属性名 + * @param value 值 + * @param descriptionPropName 描述中属性名 + */ + protected final void addResourceInfo(String propName, String value, String descriptionPropName) { + CefResourceInfo info = new CefResourceInfo(getCurrentResourcePrefixInfo(), propName, descriptionPropName, value); + getContext().setResourceItem(info); + } + +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoRefFieldResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoRefFieldResourceExtractor.java new file mode 100644 index 0000000..e428b9d --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoRefFieldResourceExtractor.java @@ -0,0 +1,44 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; + +public abstract class AssoRefFieldResourceExtractor extends CefFieldResourceExtractor { + private IGspCommonField commonField; + + public AssoRefFieldResourceExtractor(IGspCommonField field, ICefResourceExtractContext context, + CefResourcePrefixInfo parentResourceInfo) { + super(field, context, parentResourceInfo); + commonField = field; + } + + protected CefResourcePrefixInfo buildCurrentPrefix() { + if (!commonField.getIsRefElement()) { + throw new RuntimeException("[多语项抽取]非关联带出字段,不应使用AssoRefFieldResourceExtractor进行抽取。"); + + } + if (getParentResourcePrefixInfo() == null) { + throw new RuntimeException("多语项抽取_字段关联信息" + commonField.getParentAssociation() + "无对应的多语前缀信息。"); + } + CefResourcePrefixInfo fieldResourceInfo = new CefResourcePrefixInfo(); + fieldResourceInfo.setResourceKeyPrefix(getParentResourcePrefixInfo().getResourceKeyPrefix() + "." + commonField.getLabelID()); + fieldResourceInfo.setDescriptionPrefix(getParentResourcePrefixInfo().getDescriptionPrefix() + "的关联带出属性'" + commonField.getName() + "'"); + return fieldResourceInfo; + } +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoResourceExtractor.java new file mode 100644 index 0000000..bac49a7 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoResourceExtractor.java @@ -0,0 +1,57 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.element.GspAssociation; +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; + +public abstract class AssoResourceExtractor extends AbstractResourceExtractor { + private GspAssociation asso; + + protected AssoResourceExtractor(GspAssociation asso, ICefResourceExtractContext context, + CefResourcePrefixInfo parentResourceInfo) { + super(context, parentResourceInfo); + this.asso = asso; + } + + protected void extractItems() { + if (asso.getRefElementCollection() != null && asso.getRefElementCollection().size() > 0) { + for (IGspCommonField item : asso.getRefElementCollection()) { + getAssoRefFieldResourceExtractor(getContext(), getCurrentResourcePrefixInfo(), item).extract(); + } + } + } + + protected CefResourcePrefixInfo buildCurrentPrefix() { + if (getParentResourcePrefixInfo() == null) { + throw new RuntimeException("多语项抽取_字段" + asso.getBelongElement().getName() + "无对应的多语前缀信息。"); + } + return getParentResourcePrefixInfo(); + } + + /** + * 赋值节点的国际化项前缀 + */ + protected final void setPrefixInfo() { + asso.setI18nResourceInfoPrefix(getCurrentResourcePrefixInfo().getResourceKeyPrefix()); + } + + protected abstract AssoRefFieldResourceExtractor getAssoRefFieldResourceExtractor( + ICefResourceExtractContext context, CefResourcePrefixInfo assoPrefixInfo, IGspCommonField field); + +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/CefFieldResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/CefFieldResourceExtractor.java new file mode 100644 index 0000000..853037d --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/CefFieldResourceExtractor.java @@ -0,0 +1,102 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.collection.GspAssociationCollection; +import org.openatom.ubml.model.common.definition.cef.collection.GspEnumValueCollection; +import org.openatom.ubml.model.common.definition.cef.element.GspAssociation; +import org.openatom.ubml.model.common.definition.cef.element.GspEnumValue; +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceDescriptionNames; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; + +public abstract class CefFieldResourceExtractor extends AbstractResourceExtractor { + private IGspCommonField commonField; + + protected CefFieldResourceExtractor(IGspCommonField field, ICefResourceExtractContext context, + CefResourcePrefixInfo parentResourceInfo) { + super(context, parentResourceInfo); + commonField = field; + } + + protected final void extractItems() { + + addResourceInfo(CefResourceKeyNames.NAME, commonField.getName(), CefResourceDescriptionNames.NAME); + + //关联枚举 + switch (commonField.getObjectType()) { + case Association: + extractAssoInfo(commonField.getChildAssociations()); + break; + case Enum: + extractEnumValue(commonField.getContainEnumValues()); + break; + case None: + break; + } + + //扩展 + extractExtendProperties(commonField); + } + + /** + * 赋值字段的国际化项前缀 + */ + protected final void setPrefixInfo() { + commonField.setI18nResourceInfoPrefix(getCurrentResourcePrefixInfo().getResourceKeyPrefix()); + } + + protected CefResourcePrefixInfo buildCurrentPrefix() { + if (getParentResourcePrefixInfo() == null) { + throw new RuntimeException("多语项抽取_节点" + commonField.getBelongObject().getName() + "中字段" + commonField.getName() + ",无节点对应的多语前缀信息。"); + } + CefResourcePrefixInfo fieldResourceInfo = new CefResourcePrefixInfo(); + fieldResourceInfo.setResourceKeyPrefix(getParentResourcePrefixInfo().getResourceKeyPrefix() + "." + commonField.getLabelID()); + fieldResourceInfo.setDescriptionPrefix(getParentResourcePrefixInfo().getDescriptionPrefix() + "中'" + commonField.getName() + "'属性"); + return fieldResourceInfo; + } + + private void extractAssoInfo(GspAssociationCollection assos) { + if (assos != null && assos.size() > 0) { + for (GspAssociation item : assos) { + getAssoResourceExtractor(getContext(), getCurrentResourcePrefixInfo(), item).extract(); + } + } + } + + private void extractEnumValue(GspEnumValueCollection enumValues) { + if (enumValues != null && enumValues.size() > 0) { + for (GspEnumValue item : enumValues) { + String keyPropName = item.getValue() + "." + CefResourceKeyNames.DISPLAY_VALUE; + String value = item.getName(); + String descriptionPropName = "枚举信息'" + item.getName() + "'的" + CefResourceDescriptionNames.DISPLAY_VALUE; + addResourceInfo(keyPropName, value, descriptionPropName); + + String enumKey = getCurrentResourcePrefixInfo().getResourceKeyPrefix() + "." + item.getValue(); + item.setI18nResourceInfoPrefix(enumKey); + } + } + } + + protected void extractExtendProperties(IGspCommonField commonField) { + } + + protected abstract AssoResourceExtractor getAssoResourceExtractor(ICefResourceExtractContext context, + CefResourcePrefixInfo fieldPrefixInfo, GspAssociation asso); + +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/DataTypeResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/DataTypeResourceExtractor.java new file mode 100644 index 0000000..290d99b --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/DataTypeResourceExtractor.java @@ -0,0 +1,88 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; + +import org.openatom.ubml.model.common.definition.cef.IFieldCollection; +import org.openatom.ubml.model.common.definition.cef.IGspCommonDataType; +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceDescriptionNames; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; + +public abstract class DataTypeResourceExtractor extends AbstractResourceExtractor { + + private IGspCommonDataType dataType; + + protected DataTypeResourceExtractor(IGspCommonDataType commonDataType, ICefResourceExtractContext context, + CefResourcePrefixInfo parentResourceInfo) { + super(context, parentResourceInfo); + dataType = commonDataType; + } + + protected final void extractItems() { + + addResourceInfo(CefResourceKeyNames.NAME, dataType.getName(), CefResourceDescriptionNames.NAME); + extractDataTypeFields(dataType.getContainElements()); + //扩展 + extractExtendProperties(dataType); + } + + protected final CefResourcePrefixInfo buildCurrentPrefix() { + CefResourcePrefixInfo prefixInfo = new CefResourcePrefixInfo(); + if (getParentResourcePrefixInfo() == null) { + throw new RuntimeException("多语项抽取_节点" + dataType.getName() + "所属模型,无对应的多语前缀信息。"); + } + prefixInfo.setResourceKeyPrefix(getParentResourcePrefixInfo().getResourceKeyPrefix() + "." + dataType.getCode()); + prefixInfo.setDescriptionPrefix(getParentResourcePrefixInfo().getDescriptionPrefix() + "中'" + dataType.getName() + "'实体"); + return prefixInfo; + } + + /** + * 赋值节点的国际化项前缀 + */ + protected final void setPrefixInfo() { + dataType.setI18nResourceInfoPrefix(getCurrentResourcePrefixInfo().getResourceKeyPrefix()); + } + + private void extractDataTypeFields(IFieldCollection fields) { + if (fields == null || fields.size() == 0) { + return; + } + for (IGspCommonField field : fields) { + CefFieldResourceExtractor extractor = getCefFieldResourceExtractor(getContext(), getCurrentResourcePrefixInfo(), field); + extractor.extract(); + } + + } + + /** + * 获取字段抽取器 + * + * @param context + * @return + */ + protected abstract CefFieldResourceExtractor getCefFieldResourceExtractor(ICefResourceExtractContext context, + CefResourcePrefixInfo objPrefixInfo, IGspCommonField field); + + /** + * 抽取扩展项 + * + * @param dataType + */ + protected void extractExtendProperties(IGspCommonDataType dataType) { + } +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AbstractResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AbstractResourceMerger.java new file mode 100644 index 0000000..88b3988 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AbstractResourceMerger.java @@ -0,0 +1,50 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; + +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; + +public abstract class AbstractResourceMerger { + protected AbstractResourceMerger( + ICefResourceMergeContext context, CefResourcePrefixInfo parentResourceInfo) { + this.context = context; + this.parentResourcePrefixInfo = parentResourceInfo; + } + + protected AbstractResourceMerger(ICefResourceMergeContext context) { + this.context = context; + } + + private ICefResourceMergeContext context; + + protected final ICefResourceMergeContext getContext() { + return context; + } + + private CefResourcePrefixInfo parentResourcePrefixInfo; + + protected final CefResourcePrefixInfo getParentResourcePrefixInfo() { + return parentResourcePrefixInfo; + } + + public void merge() { + mergeItems(); + } + + protected abstract void mergeItems(); + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoRefFieldResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoRefFieldResourceMerger.java new file mode 100644 index 0000000..af7d001 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoRefFieldResourceMerger.java @@ -0,0 +1,29 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; + +public abstract class AssoRefFieldResourceMerger extends CefFieldResourceMerger { + private IGspCommonField commonField; + + protected AssoRefFieldResourceMerger(IGspCommonField commonField, + ICefResourceMergeContext context) { + super(commonField, context); + this.commonField = commonField; + } +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoResourceMerger.java new file mode 100644 index 0000000..c2da8c0 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoResourceMerger.java @@ -0,0 +1,45 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.element.GspAssociation; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; + +; + +public abstract class AssoResourceMerger extends AbstractResourceMerger { + private GspAssociation asso; + + protected AssoResourceMerger(GspAssociation asso, + ICefResourceMergeContext context) { + super(context); + this.asso = asso; + } + + @Override + protected void mergeItems() { + if (asso.getRefElementCollection() != null && asso.getRefElementCollection().size() > 0) { + for (IGspCommonField item : asso.getRefElementCollection()) { + getAssoRefFieldResourceMerger(getContext(), item).merge(); + } + } + } + + protected abstract AssoRefFieldResourceMerger getAssoRefFieldResourceMerger( + ICefResourceMergeContext context, IGspCommonField field); + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java new file mode 100644 index 0000000..5b6fbca --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java @@ -0,0 +1,98 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.collection.GspAssociationCollection; +import org.openatom.ubml.model.common.definition.cef.collection.GspEnumValueCollection; +import org.openatom.ubml.model.common.definition.cef.element.GspAssociation; +import org.openatom.ubml.model.common.definition.cef.element.GspEnumValue; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; +import org.openatom.ubml.model.common.definition.cef.increment.merger.MergeUtils; +import org.openatom.ubml.model.framework.definition.entity.I18nResourceItemCollection; + +public abstract class CefFieldResourceMerger extends AbstractResourceMerger { + + private IGspCommonField field; + + protected CefFieldResourceMerger(IGspCommonField field, + ICefResourceMergeContext context) { + super(context); + this.field = field; + } + + @Override + protected void mergeItems() { + + //关联枚举 + + switch (field.getObjectType()) { + case Association: + mergeAssoInfo(field); + break; + case Enum: + mergeEnum(field); + break; + case None: + I18nResourceItemCollection resourceItems = getContext().getResourceItems(); + String keyPrefix = MergeUtils.getKeyPrefix(this.field.getI18nResourceInfoPrefix(), CefResourceKeyNames.NAME); + field.setName(resourceItems.getResourceItemByKey(keyPrefix).getValue()); + break; + default: + throw new RuntimeException("暂不支持" + field.getObjectType() + "类型字段的多语合并"); + } + + //扩展 + extractExtendProperties(field); + } + + private void mergeEnum(IGspCommonField field) { + I18nResourceItemCollection resourceItems = getContext().getResourceItems(); + String keyPrefix = MergeUtils + .getKeyPrefix(this.field.getI18nResourceInfoPrefix(), CefResourceKeyNames.NAME); + field.setName(resourceItems.getResourceItemByKey(keyPrefix).getValue()); + GspEnumValueCollection enumValues = field.getContainEnumValues(); + if (enumValues != null && enumValues.size() > 0) { + for (GspEnumValue item : enumValues) { + String enumValueKeyPrefix = MergeUtils + .getKeyPrefix(item.getI18nResourceInfoPrefix(), CefResourceKeyNames.DISPLAY_VALUE); + item.setName(resourceItems.getResourceItemByKey(enumValueKeyPrefix).getValue()); + + } + } + } + + private void mergeAssoInfo(IGspCommonField field) { + I18nResourceItemCollection resourceItems = getContext().getResourceItems(); + String keyPrefix = MergeUtils + .getKeyPrefix(this.field.getI18nResourceInfoPrefix(), CefResourceKeyNames.NAME); + field.setName(resourceItems.getResourceItemByKey(keyPrefix).getValue()); + + GspAssociationCollection assos = field.getChildAssociations(); + if (assos != null && assos.size() > 0) { + for (GspAssociation item : assos) { + getAssoResourceMerger(getContext(), item).merge(); + } + } + } + + protected void extractExtendProperties(IGspCommonField commonField) { + } + + protected abstract AssoResourceMerger getAssoResourceMerger(ICefResourceMergeContext context, GspAssociation asso); + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java new file mode 100644 index 0000000..05f0010 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java @@ -0,0 +1,62 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; + +import org.openatom.ubml.model.common.definition.cef.IFieldCollection; +import org.openatom.ubml.model.common.definition.cef.IGspCommonDataType; +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; +import org.openatom.ubml.model.framework.definition.entity.I18nResourceItemCollection; + +import static org.openatom.ubml.model.common.definition.cef.increment.merger.MergeUtils.getKeyPrefix; + +public abstract class DataTypeResourceMerger extends AbstractResourceMerger { + + private IGspCommonDataType dataType; + + protected DataTypeResourceMerger(IGspCommonDataType commonDataType, ICefResourceMergeContext context) { + super(context); + this.dataType = commonDataType; + } + + @Override + protected void mergeItems() { + I18nResourceItemCollection resourceItems = getContext().getResourceItems(); + String keyPrefix = getKeyPrefix(dataType.getI18nResourceInfoPrefix(), CefResourceKeyNames.NAME); + dataType.setName(resourceItems.getResourceItemByKey(keyPrefix).getValue()); + extractDataTypeFields(dataType.getContainElements()); + //扩展 + extractExtendProperties(dataType); + } + + private void extractDataTypeFields(IFieldCollection fields) { + if (fields == null || fields.size() == 0) { + return; + } + for (IGspCommonField field : fields) { + CefFieldResourceMerger merger = getCefFieldResourceMerger(getContext(), field); + merger.merge(); + } + } + + protected abstract CefFieldResourceMerger getCefFieldResourceMerger( + ICefResourceMergeContext context, IGspCommonField field); + + protected void extractExtendProperties(IGspCommonDataType dataType) { + } + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceDescriptionNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceDescriptionNames.java new file mode 100644 index 0000000..ccdc3ad --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceDescriptionNames.java @@ -0,0 +1,22 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.names; + +public final class CefResourceDescriptionNames { + public static final String NAME = "名称"; + + public static final String DISPLAY_VALUE = "枚举显示值"; +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceKeyNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceKeyNames.java new file mode 100644 index 0000000..20df520 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceKeyNames.java @@ -0,0 +1,23 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.names; + +public final class CefResourceKeyNames { + + public static final String NAME = "NAME"; + + public static final String DISPLAY_VALUE = "DISPLAY_VALUE"; +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/extractor/ExtractUtils.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/extractor/ExtractUtils.java new file mode 100644 index 0000000..e8a2c31 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/extractor/ExtractUtils.java @@ -0,0 +1,20 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.increment.extractor; + +public class ExtractUtils { + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/merger/MergeUtils.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/merger/MergeUtils.java new file mode 100644 index 0000000..2f8c877 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/merger/MergeUtils.java @@ -0,0 +1,23 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.increment.merger; + +public class MergeUtils { + + public static String getKeyPrefix(String currentKey, String preFix) { + return String.format("%1$s.%2$s", currentKey, preFix); + } +} -- Gitee From fcb3d14b448ad81664585a7d01c6138f8a63268a Mon Sep 17 00:00:00 2001 From: a1b2c3d4 <8869064+han-liangliang111@user.noreply.gitee.com> Date: Wed, 31 Mar 2021 19:58:00 +0800 Subject: [PATCH 27/61] =?UTF-8?q?!14=201=E3=80=81=E7=89=B9=E6=80=A7?= =?UTF-8?q?=EF=BC=9A=E5=A2=9E=E5=8A=A0=E5=85=83=E6=95=B0=E6=8D=AE=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96=E6=8A=BD=E5=8F=96=E5=90=88=E5=B9=B6=E5=AE=9E?= =?UTF-8?q?=E4=BD=93=E7=B1=BB=EF=BC=9B2=E3=80=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=9A=E4=BF=AE=E6=94=B9=E5=B1=9E=E6=80=A7=E5=BA=8F=E5=88=97?= =?UTF-8?q?=E5=8C=96=E5=90=8D=E7=A7=B0=20*=201=E3=80=81=E7=89=B9=E6=80=A7:?= =?UTF-8?q?=20add=20metadata=20i18n=20extraction=20and=20merge=20entity=20?= =?UTF-8?q?class=20*=20Merge=20branch=20'develop'=20of=20https://gitee.com?= =?UTF-8?q?/ubml/ubml-impl=20into=20develop=20*=20Merge=20branch=20'develo?= =?UTF-8?q?p'=20of=20https://gitee.com/ubml/ubml-impl=20into=20develop=20*?= =?UTF-8?q?=20Merge=20branch=20'develop'=20of=20https://gitee.com/ubml/ubm?= =?UTF-8?q?l-impl=20into=20develop=20*=20=E4=BC=98=E5=8C=96:=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=97=A0=E7=94=A8=E7=B1=BB=EF=BC=8C=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E6=97=A0=E7=94=A8=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/common/definition/pom.xml | 5 + .../definition/cef/entity/GspCommonField.java | 2 +- .../context/CefResourceExtractContext.java | 67 +++++++++++ .../cef/i18n/context/CefResourceInfo.java | 78 ++++++++++++ .../i18n/context/CefResourceMergeContext.java | 47 ++++++++ .../i18n/context/CefResourcePrefixInfo.java | 38 ++++++ .../context/ICefResourceExtractContext.java | 32 +++++ .../context/ICefResourceMergeContext.java | 37 ++++++ .../extractor/AbstractResourceExtractor.java | 112 ++++++++++++++++++ .../AssoRefFieldResourceExtractor.java | 44 +++++++ .../i18n/extractor/AssoResourceExtractor.java | 57 +++++++++ .../extractor/CefFieldResourceExtractor.java | 102 ++++++++++++++++ .../extractor/DataTypeResourceExtractor.java | 88 ++++++++++++++ .../i18n/merger/AbstractResourceMerger.java | 50 ++++++++ .../merger/AssoRefFieldResourceMerger.java | 29 +++++ .../cef/i18n/merger/AssoResourceMerger.java | 45 +++++++ .../i18n/merger/CefFieldResourceMerger.java | 98 +++++++++++++++ .../i18n/merger/DataTypeResourceMerger.java | 62 ++++++++++ .../names/CefResourceDescriptionNames.java | 22 ++++ .../cef/i18n/names/CefResourceKeyNames.java | 23 ++++ .../cef/increment/extractor/ExtractUtils.java | 20 ++++ .../cef/increment/merger/MergeUtils.java | 23 ++++ 22 files changed, 1080 insertions(+), 1 deletion(-) create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceInfo.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourcePrefixInfo.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceExtractContext.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AbstractResourceExtractor.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoRefFieldResourceExtractor.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoResourceExtractor.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/CefFieldResourceExtractor.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/DataTypeResourceExtractor.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AbstractResourceMerger.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoRefFieldResourceMerger.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoResourceMerger.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceDescriptionNames.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceKeyNames.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/extractor/ExtractUtils.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/merger/MergeUtils.java diff --git a/model/common/definition/pom.xml b/model/common/definition/pom.xml index e7490d1..0ff5f18 100644 --- a/model/common/definition/pom.xml +++ b/model/common/definition/pom.xml @@ -18,5 +18,10 @@ ubml-common 0.9.0-SNAPSHOT + + org.openatom.ubml + ubml-model-framework-common + 0.9.0-SNAPSHOT + \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonField.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonField.java index 72863c7..ef64010 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonField.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonField.java @@ -67,7 +67,7 @@ public class GspCommonField implements IGspCommonField { private boolean isRequire = true; @JsonProperty(CefNames.IS_MULTI_LANGUAGE) private boolean isMultilLanguage; - @JsonProperty(CefNames.IS_VIRTUAL) + @JsonProperty(CefNames.BELONG_OBJECT) private transient IGspCommonDataType belongObject; @JsonProperty(CefNames.CHILD_ELEMENTS) //todo:j-json diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java new file mode 100644 index 0000000..26974eb --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java @@ -0,0 +1,67 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +import org.openatom.ubml.model.common.definition.cef.util.DataValidator; +import org.openatom.ubml.model.framework.definition.entity.I18nResourceItem; +import org.openatom.ubml.model.framework.definition.entity.I18nResourceItemCollection; + +/** + * 多语资源项抽取上下文 + */ +public class CefResourceExtractContext implements ICefResourceExtractContext { + private String metaPrefix; + private I18nResourceItemCollection resourceItems; + + public CefResourceExtractContext(String metaPrefix, I18nResourceItemCollection items) { + DataValidator.checkForEmptyString(metaPrefix, "元数据前缀"); + DataValidator.checkForNullReference(items, "国际化资源项"); + this.metaPrefix = metaPrefix; + this.resourceItems = items; + } + + /** + * 获取前缀 + * + * @return + */ + public final String getKeyPrefix() { + return metaPrefix; + } + + /** + * 新增/修改 + * + * @param info + */ + public final void setResourceItem(CefResourceInfo info) { + String key = info.getResourceKey(); + String value = info.getResourceValue(); + String description = info.getDescription(); + + I18nResourceItem resource = GetNewResource(key, value, description); + + resourceItems.add(resource); + } + + private I18nResourceItem GetNewResource(String key, String value, String description) { + I18nResourceItem resourceItem = new I18nResourceItem(); + resourceItem.setKey(key); + resourceItem.setValue(value); + resourceItem.setComment(description); + return resourceItem; + } +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceInfo.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceInfo.java new file mode 100644 index 0000000..9defaf0 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceInfo.java @@ -0,0 +1,78 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +import org.openatom.ubml.model.common.definition.cef.util.DataValidator; + +public class CefResourceInfo { + + public CefResourceInfo(CefResourcePrefixInfo prefixInfo, String resourceKeyPropName, String descriptionPropName, + String resourceValue) { + DataValidator.checkForNullReference(prefixInfo, "PrefixInfo"); + DataValidator.checkForEmptyString(prefixInfo.getDescriptionPrefix(), "DescriptionPrefix"); + DataValidator.checkForEmptyString(prefixInfo.getResourceKeyPrefix(), "ResourceKeyPrefix"); + + DataValidator.checkForEmptyString(resourceKeyPropName, "ResourceKeyPropName"); + DataValidator.checkForEmptyString(descriptionPropName, "DescriptionPropName"); + DataValidator.checkForEmptyString(resourceValue, "ResourceValue"); + + this.prefixInfo = prefixInfo; + this.resourceKeyPropName = resourceKeyPropName; + this.descriptionPropName = descriptionPropName; + this.resourceValue = resourceValue; + } + + private CefResourcePrefixInfo prefixInfo; + + public final CefResourcePrefixInfo getPrefixInfo() { + return prefixInfo; + } + + /** + * 属性名 e.g. NAME + */ + private String resourceKeyPropName; + + public final String getResourceKeyPropName() { + return resourceKeyPropName; + } + + /** + * 描述中属性名 e.g. 名称 + */ + private String descriptionPropName; + + public final String getDescriptionPropName() { + return descriptionPropName; + } + + /** + * 默认语言的值 + */ + private String resourceValue; + + public final String getResourceValue() { + return resourceValue; + } + + public String getResourceKey() { + return getPrefixInfo().getResourceKeyPrefix() + "." + getResourceKeyPropName(); + } + + public String getDescription() { + return getPrefixInfo().getDescriptionPrefix() + "的" + getDescriptionPropName(); + } +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java new file mode 100644 index 0000000..7c634db --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java @@ -0,0 +1,47 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +import org.openatom.ubml.model.common.definition.cef.util.DataValidator; +import org.openatom.ubml.model.framework.definition.entity.I18nResourceItemCollection; + +public class CefResourceMergeContext implements ICefResourceMergeContext { + + private String metaPrefix; + private I18nResourceItemCollection resourceItems; + + public CefResourceMergeContext(String metaPrefix, I18nResourceItemCollection items) { + DataValidator.checkForEmptyString(metaPrefix, "元数据前缀"); + DataValidator.checkForNullReference(items, "国际化资源项"); + this.metaPrefix = metaPrefix; + this.resourceItems = items; + } + + @Override + public String getKeyPrefix() { + return this.metaPrefix; + } + + @Override + public void setKeyPrefix(String keyPrefix) { + this.metaPrefix = keyPrefix; + } + + public I18nResourceItemCollection getResourceItems() { + return this.resourceItems; + } + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourcePrefixInfo.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourcePrefixInfo.java new file mode 100644 index 0000000..325aa44 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourcePrefixInfo.java @@ -0,0 +1,38 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +public class CefResourcePrefixInfo { + private String resourceKeyPrefix; + private String descriptionPrefix; + + public String getResourceKeyPrefix() { + return resourceKeyPrefix; + } + + public void setResourceKeyPrefix(String resourceKeyPrefix) { + this.resourceKeyPrefix = resourceKeyPrefix; + } + + public String getDescriptionPrefix() { + return descriptionPrefix; + } + + public void setDescriptionPrefix(String descriptionPrefix) { + this.descriptionPrefix = descriptionPrefix; + } +} + diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceExtractContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceExtractContext.java new file mode 100644 index 0000000..9db7d91 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceExtractContext.java @@ -0,0 +1,32 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +public interface ICefResourceExtractContext { + /** + * 获取前缀 + * + * @return + */ + String getKeyPrefix(); + + /** + * 新增/修改 + * + * @param info + */ + void setResourceItem(CefResourceInfo info); +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java new file mode 100644 index 0000000..5227df7 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java @@ -0,0 +1,37 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +import org.openatom.ubml.model.framework.definition.entity.I18nResourceItemCollection; + +public interface ICefResourceMergeContext { + + /** + * 获取前缀 + * + * @return + */ + String getKeyPrefix(); + + void setKeyPrefix(String keyPrefix); + + /** + * 获取资源项 + * + * @return + */ + I18nResourceItemCollection getResourceItems(); +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AbstractResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AbstractResourceExtractor.java new file mode 100644 index 0000000..2c0639d --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AbstractResourceExtractor.java @@ -0,0 +1,112 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; + +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourceInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; + +/** + * 国际化抽取器基类 + */ +public abstract class AbstractResourceExtractor { + /** + * 国际化抽取器基类 + * + * @param context 上下文 + * @param parentResourceInfo 父抽取器的前缀信息 + */ + protected AbstractResourceExtractor(ICefResourceExtractContext context, CefResourcePrefixInfo parentResourceInfo) { + this.context = context; + this.parentResourcePrefixInfo = parentResourceInfo; + } + + protected AbstractResourceExtractor(ICefResourceExtractContext context) { + this(context, null); + } + + /** + * 国际化抽取上下文 + */ + private ICefResourceExtractContext context; + + protected final ICefResourceExtractContext getContext() { + return context; + } + + /** + * 父抽取器的前缀信息 + */ + private CefResourcePrefixInfo parentResourcePrefixInfo; + + protected final CefResourcePrefixInfo getParentResourcePrefixInfo() { + return parentResourcePrefixInfo; + } + + /** + * 当前抽取器的前缀信息 + */ + private CefResourcePrefixInfo currentResourcePrefixInfo; + + protected final CefResourcePrefixInfo getCurrentResourcePrefixInfo() { + return currentResourcePrefixInfo; + } + + private void setCurrentResourcePrefixInfo(CefResourcePrefixInfo value) { + currentResourcePrefixInfo = value; + } + + //#endregion + + /** + * 抽取国际化项入口方法 + */ + public final void extract() { + setCurrentResourcePrefixInfo(buildCurrentPrefix()); + setPrefixInfo(); + extractItems(); + } + + /** + * 抽取 + */ + protected abstract void extractItems(); + + /** + * 构造前缀 + * + * @return + */ + protected abstract CefResourcePrefixInfo buildCurrentPrefix(); + + /** + * 赋值前缀 + */ + protected abstract void setPrefixInfo(); + + /** + * 新增抽取资源项 + * + * @param propName 属性名 + * @param value 值 + * @param descriptionPropName 描述中属性名 + */ + protected final void addResourceInfo(String propName, String value, String descriptionPropName) { + CefResourceInfo info = new CefResourceInfo(getCurrentResourcePrefixInfo(), propName, descriptionPropName, value); + getContext().setResourceItem(info); + } + +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoRefFieldResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoRefFieldResourceExtractor.java new file mode 100644 index 0000000..e428b9d --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoRefFieldResourceExtractor.java @@ -0,0 +1,44 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; + +public abstract class AssoRefFieldResourceExtractor extends CefFieldResourceExtractor { + private IGspCommonField commonField; + + public AssoRefFieldResourceExtractor(IGspCommonField field, ICefResourceExtractContext context, + CefResourcePrefixInfo parentResourceInfo) { + super(field, context, parentResourceInfo); + commonField = field; + } + + protected CefResourcePrefixInfo buildCurrentPrefix() { + if (!commonField.getIsRefElement()) { + throw new RuntimeException("[多语项抽取]非关联带出字段,不应使用AssoRefFieldResourceExtractor进行抽取。"); + + } + if (getParentResourcePrefixInfo() == null) { + throw new RuntimeException("多语项抽取_字段关联信息" + commonField.getParentAssociation() + "无对应的多语前缀信息。"); + } + CefResourcePrefixInfo fieldResourceInfo = new CefResourcePrefixInfo(); + fieldResourceInfo.setResourceKeyPrefix(getParentResourcePrefixInfo().getResourceKeyPrefix() + "." + commonField.getLabelID()); + fieldResourceInfo.setDescriptionPrefix(getParentResourcePrefixInfo().getDescriptionPrefix() + "的关联带出属性'" + commonField.getName() + "'"); + return fieldResourceInfo; + } +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoResourceExtractor.java new file mode 100644 index 0000000..bac49a7 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoResourceExtractor.java @@ -0,0 +1,57 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.element.GspAssociation; +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; + +public abstract class AssoResourceExtractor extends AbstractResourceExtractor { + private GspAssociation asso; + + protected AssoResourceExtractor(GspAssociation asso, ICefResourceExtractContext context, + CefResourcePrefixInfo parentResourceInfo) { + super(context, parentResourceInfo); + this.asso = asso; + } + + protected void extractItems() { + if (asso.getRefElementCollection() != null && asso.getRefElementCollection().size() > 0) { + for (IGspCommonField item : asso.getRefElementCollection()) { + getAssoRefFieldResourceExtractor(getContext(), getCurrentResourcePrefixInfo(), item).extract(); + } + } + } + + protected CefResourcePrefixInfo buildCurrentPrefix() { + if (getParentResourcePrefixInfo() == null) { + throw new RuntimeException("多语项抽取_字段" + asso.getBelongElement().getName() + "无对应的多语前缀信息。"); + } + return getParentResourcePrefixInfo(); + } + + /** + * 赋值节点的国际化项前缀 + */ + protected final void setPrefixInfo() { + asso.setI18nResourceInfoPrefix(getCurrentResourcePrefixInfo().getResourceKeyPrefix()); + } + + protected abstract AssoRefFieldResourceExtractor getAssoRefFieldResourceExtractor( + ICefResourceExtractContext context, CefResourcePrefixInfo assoPrefixInfo, IGspCommonField field); + +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/CefFieldResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/CefFieldResourceExtractor.java new file mode 100644 index 0000000..853037d --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/CefFieldResourceExtractor.java @@ -0,0 +1,102 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.collection.GspAssociationCollection; +import org.openatom.ubml.model.common.definition.cef.collection.GspEnumValueCollection; +import org.openatom.ubml.model.common.definition.cef.element.GspAssociation; +import org.openatom.ubml.model.common.definition.cef.element.GspEnumValue; +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceDescriptionNames; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; + +public abstract class CefFieldResourceExtractor extends AbstractResourceExtractor { + private IGspCommonField commonField; + + protected CefFieldResourceExtractor(IGspCommonField field, ICefResourceExtractContext context, + CefResourcePrefixInfo parentResourceInfo) { + super(context, parentResourceInfo); + commonField = field; + } + + protected final void extractItems() { + + addResourceInfo(CefResourceKeyNames.NAME, commonField.getName(), CefResourceDescriptionNames.NAME); + + //关联枚举 + switch (commonField.getObjectType()) { + case Association: + extractAssoInfo(commonField.getChildAssociations()); + break; + case Enum: + extractEnumValue(commonField.getContainEnumValues()); + break; + case None: + break; + } + + //扩展 + extractExtendProperties(commonField); + } + + /** + * 赋值字段的国际化项前缀 + */ + protected final void setPrefixInfo() { + commonField.setI18nResourceInfoPrefix(getCurrentResourcePrefixInfo().getResourceKeyPrefix()); + } + + protected CefResourcePrefixInfo buildCurrentPrefix() { + if (getParentResourcePrefixInfo() == null) { + throw new RuntimeException("多语项抽取_节点" + commonField.getBelongObject().getName() + "中字段" + commonField.getName() + ",无节点对应的多语前缀信息。"); + } + CefResourcePrefixInfo fieldResourceInfo = new CefResourcePrefixInfo(); + fieldResourceInfo.setResourceKeyPrefix(getParentResourcePrefixInfo().getResourceKeyPrefix() + "." + commonField.getLabelID()); + fieldResourceInfo.setDescriptionPrefix(getParentResourcePrefixInfo().getDescriptionPrefix() + "中'" + commonField.getName() + "'属性"); + return fieldResourceInfo; + } + + private void extractAssoInfo(GspAssociationCollection assos) { + if (assos != null && assos.size() > 0) { + for (GspAssociation item : assos) { + getAssoResourceExtractor(getContext(), getCurrentResourcePrefixInfo(), item).extract(); + } + } + } + + private void extractEnumValue(GspEnumValueCollection enumValues) { + if (enumValues != null && enumValues.size() > 0) { + for (GspEnumValue item : enumValues) { + String keyPropName = item.getValue() + "." + CefResourceKeyNames.DISPLAY_VALUE; + String value = item.getName(); + String descriptionPropName = "枚举信息'" + item.getName() + "'的" + CefResourceDescriptionNames.DISPLAY_VALUE; + addResourceInfo(keyPropName, value, descriptionPropName); + + String enumKey = getCurrentResourcePrefixInfo().getResourceKeyPrefix() + "." + item.getValue(); + item.setI18nResourceInfoPrefix(enumKey); + } + } + } + + protected void extractExtendProperties(IGspCommonField commonField) { + } + + protected abstract AssoResourceExtractor getAssoResourceExtractor(ICefResourceExtractContext context, + CefResourcePrefixInfo fieldPrefixInfo, GspAssociation asso); + +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/DataTypeResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/DataTypeResourceExtractor.java new file mode 100644 index 0000000..290d99b --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/DataTypeResourceExtractor.java @@ -0,0 +1,88 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; + +import org.openatom.ubml.model.common.definition.cef.IFieldCollection; +import org.openatom.ubml.model.common.definition.cef.IGspCommonDataType; +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceDescriptionNames; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; + +public abstract class DataTypeResourceExtractor extends AbstractResourceExtractor { + + private IGspCommonDataType dataType; + + protected DataTypeResourceExtractor(IGspCommonDataType commonDataType, ICefResourceExtractContext context, + CefResourcePrefixInfo parentResourceInfo) { + super(context, parentResourceInfo); + dataType = commonDataType; + } + + protected final void extractItems() { + + addResourceInfo(CefResourceKeyNames.NAME, dataType.getName(), CefResourceDescriptionNames.NAME); + extractDataTypeFields(dataType.getContainElements()); + //扩展 + extractExtendProperties(dataType); + } + + protected final CefResourcePrefixInfo buildCurrentPrefix() { + CefResourcePrefixInfo prefixInfo = new CefResourcePrefixInfo(); + if (getParentResourcePrefixInfo() == null) { + throw new RuntimeException("多语项抽取_节点" + dataType.getName() + "所属模型,无对应的多语前缀信息。"); + } + prefixInfo.setResourceKeyPrefix(getParentResourcePrefixInfo().getResourceKeyPrefix() + "." + dataType.getCode()); + prefixInfo.setDescriptionPrefix(getParentResourcePrefixInfo().getDescriptionPrefix() + "中'" + dataType.getName() + "'实体"); + return prefixInfo; + } + + /** + * 赋值节点的国际化项前缀 + */ + protected final void setPrefixInfo() { + dataType.setI18nResourceInfoPrefix(getCurrentResourcePrefixInfo().getResourceKeyPrefix()); + } + + private void extractDataTypeFields(IFieldCollection fields) { + if (fields == null || fields.size() == 0) { + return; + } + for (IGspCommonField field : fields) { + CefFieldResourceExtractor extractor = getCefFieldResourceExtractor(getContext(), getCurrentResourcePrefixInfo(), field); + extractor.extract(); + } + + } + + /** + * 获取字段抽取器 + * + * @param context + * @return + */ + protected abstract CefFieldResourceExtractor getCefFieldResourceExtractor(ICefResourceExtractContext context, + CefResourcePrefixInfo objPrefixInfo, IGspCommonField field); + + /** + * 抽取扩展项 + * + * @param dataType + */ + protected void extractExtendProperties(IGspCommonDataType dataType) { + } +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AbstractResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AbstractResourceMerger.java new file mode 100644 index 0000000..88b3988 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AbstractResourceMerger.java @@ -0,0 +1,50 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; + +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; + +public abstract class AbstractResourceMerger { + protected AbstractResourceMerger( + ICefResourceMergeContext context, CefResourcePrefixInfo parentResourceInfo) { + this.context = context; + this.parentResourcePrefixInfo = parentResourceInfo; + } + + protected AbstractResourceMerger(ICefResourceMergeContext context) { + this.context = context; + } + + private ICefResourceMergeContext context; + + protected final ICefResourceMergeContext getContext() { + return context; + } + + private CefResourcePrefixInfo parentResourcePrefixInfo; + + protected final CefResourcePrefixInfo getParentResourcePrefixInfo() { + return parentResourcePrefixInfo; + } + + public void merge() { + mergeItems(); + } + + protected abstract void mergeItems(); + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoRefFieldResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoRefFieldResourceMerger.java new file mode 100644 index 0000000..af7d001 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoRefFieldResourceMerger.java @@ -0,0 +1,29 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; + +public abstract class AssoRefFieldResourceMerger extends CefFieldResourceMerger { + private IGspCommonField commonField; + + protected AssoRefFieldResourceMerger(IGspCommonField commonField, + ICefResourceMergeContext context) { + super(commonField, context); + this.commonField = commonField; + } +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoResourceMerger.java new file mode 100644 index 0000000..c2da8c0 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoResourceMerger.java @@ -0,0 +1,45 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.element.GspAssociation; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; + +; + +public abstract class AssoResourceMerger extends AbstractResourceMerger { + private GspAssociation asso; + + protected AssoResourceMerger(GspAssociation asso, + ICefResourceMergeContext context) { + super(context); + this.asso = asso; + } + + @Override + protected void mergeItems() { + if (asso.getRefElementCollection() != null && asso.getRefElementCollection().size() > 0) { + for (IGspCommonField item : asso.getRefElementCollection()) { + getAssoRefFieldResourceMerger(getContext(), item).merge(); + } + } + } + + protected abstract AssoRefFieldResourceMerger getAssoRefFieldResourceMerger( + ICefResourceMergeContext context, IGspCommonField field); + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java new file mode 100644 index 0000000..5b6fbca --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java @@ -0,0 +1,98 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.collection.GspAssociationCollection; +import org.openatom.ubml.model.common.definition.cef.collection.GspEnumValueCollection; +import org.openatom.ubml.model.common.definition.cef.element.GspAssociation; +import org.openatom.ubml.model.common.definition.cef.element.GspEnumValue; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; +import org.openatom.ubml.model.common.definition.cef.increment.merger.MergeUtils; +import org.openatom.ubml.model.framework.definition.entity.I18nResourceItemCollection; + +public abstract class CefFieldResourceMerger extends AbstractResourceMerger { + + private IGspCommonField field; + + protected CefFieldResourceMerger(IGspCommonField field, + ICefResourceMergeContext context) { + super(context); + this.field = field; + } + + @Override + protected void mergeItems() { + + //关联枚举 + + switch (field.getObjectType()) { + case Association: + mergeAssoInfo(field); + break; + case Enum: + mergeEnum(field); + break; + case None: + I18nResourceItemCollection resourceItems = getContext().getResourceItems(); + String keyPrefix = MergeUtils.getKeyPrefix(this.field.getI18nResourceInfoPrefix(), CefResourceKeyNames.NAME); + field.setName(resourceItems.getResourceItemByKey(keyPrefix).getValue()); + break; + default: + throw new RuntimeException("暂不支持" + field.getObjectType() + "类型字段的多语合并"); + } + + //扩展 + extractExtendProperties(field); + } + + private void mergeEnum(IGspCommonField field) { + I18nResourceItemCollection resourceItems = getContext().getResourceItems(); + String keyPrefix = MergeUtils + .getKeyPrefix(this.field.getI18nResourceInfoPrefix(), CefResourceKeyNames.NAME); + field.setName(resourceItems.getResourceItemByKey(keyPrefix).getValue()); + GspEnumValueCollection enumValues = field.getContainEnumValues(); + if (enumValues != null && enumValues.size() > 0) { + for (GspEnumValue item : enumValues) { + String enumValueKeyPrefix = MergeUtils + .getKeyPrefix(item.getI18nResourceInfoPrefix(), CefResourceKeyNames.DISPLAY_VALUE); + item.setName(resourceItems.getResourceItemByKey(enumValueKeyPrefix).getValue()); + + } + } + } + + private void mergeAssoInfo(IGspCommonField field) { + I18nResourceItemCollection resourceItems = getContext().getResourceItems(); + String keyPrefix = MergeUtils + .getKeyPrefix(this.field.getI18nResourceInfoPrefix(), CefResourceKeyNames.NAME); + field.setName(resourceItems.getResourceItemByKey(keyPrefix).getValue()); + + GspAssociationCollection assos = field.getChildAssociations(); + if (assos != null && assos.size() > 0) { + for (GspAssociation item : assos) { + getAssoResourceMerger(getContext(), item).merge(); + } + } + } + + protected void extractExtendProperties(IGspCommonField commonField) { + } + + protected abstract AssoResourceMerger getAssoResourceMerger(ICefResourceMergeContext context, GspAssociation asso); + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java new file mode 100644 index 0000000..05f0010 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java @@ -0,0 +1,62 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; + +import org.openatom.ubml.model.common.definition.cef.IFieldCollection; +import org.openatom.ubml.model.common.definition.cef.IGspCommonDataType; +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; +import org.openatom.ubml.model.framework.definition.entity.I18nResourceItemCollection; + +import static org.openatom.ubml.model.common.definition.cef.increment.merger.MergeUtils.getKeyPrefix; + +public abstract class DataTypeResourceMerger extends AbstractResourceMerger { + + private IGspCommonDataType dataType; + + protected DataTypeResourceMerger(IGspCommonDataType commonDataType, ICefResourceMergeContext context) { + super(context); + this.dataType = commonDataType; + } + + @Override + protected void mergeItems() { + I18nResourceItemCollection resourceItems = getContext().getResourceItems(); + String keyPrefix = getKeyPrefix(dataType.getI18nResourceInfoPrefix(), CefResourceKeyNames.NAME); + dataType.setName(resourceItems.getResourceItemByKey(keyPrefix).getValue()); + extractDataTypeFields(dataType.getContainElements()); + //扩展 + extractExtendProperties(dataType); + } + + private void extractDataTypeFields(IFieldCollection fields) { + if (fields == null || fields.size() == 0) { + return; + } + for (IGspCommonField field : fields) { + CefFieldResourceMerger merger = getCefFieldResourceMerger(getContext(), field); + merger.merge(); + } + } + + protected abstract CefFieldResourceMerger getCefFieldResourceMerger( + ICefResourceMergeContext context, IGspCommonField field); + + protected void extractExtendProperties(IGspCommonDataType dataType) { + } + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceDescriptionNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceDescriptionNames.java new file mode 100644 index 0000000..ccdc3ad --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceDescriptionNames.java @@ -0,0 +1,22 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.names; + +public final class CefResourceDescriptionNames { + public static final String NAME = "名称"; + + public static final String DISPLAY_VALUE = "枚举显示值"; +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceKeyNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceKeyNames.java new file mode 100644 index 0000000..20df520 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceKeyNames.java @@ -0,0 +1,23 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.names; + +public final class CefResourceKeyNames { + + public static final String NAME = "NAME"; + + public static final String DISPLAY_VALUE = "DISPLAY_VALUE"; +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/extractor/ExtractUtils.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/extractor/ExtractUtils.java new file mode 100644 index 0000000..e8a2c31 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/extractor/ExtractUtils.java @@ -0,0 +1,20 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.increment.extractor; + +public class ExtractUtils { + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/merger/MergeUtils.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/merger/MergeUtils.java new file mode 100644 index 0000000..2f8c877 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/merger/MergeUtils.java @@ -0,0 +1,23 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.increment.merger; + +public class MergeUtils { + + public static String getKeyPrefix(String currentKey, String preFix) { + return String.format("%1$s.%2$s", currentKey, preFix); + } +} -- Gitee From 855f27dd2b1629343a3c19dd6fa4ab4532cdf193 Mon Sep 17 00:00:00 2001 From: mopowoxo Date: Thu, 1 Apr 2021 15:55:37 +0800 Subject: [PATCH 28/61] =?UTF-8?q?!15=20=E4=BC=98=E5=8C=96=EF=BC=9A?= =?UTF-8?q?=E4=BD=BF=E7=94=A8ubml=20codestyle=E5=AF=B9framework=E4=B8=8B?= =?UTF-8?q?=E7=9A=84=E6=96=87=E4=BB=B6=E8=BF=9B=E8=A1=8C=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96=20*=20ubml=20code=20style=20modify=20*=20Merge=20bran?= =?UTF-8?q?ch=20'develop'=20of=20https://gitee.com/mopowoxo/ubml-impl=20in?= =?UTF-8?q?to=20develop=20*=20=E7=A7=BB=E9=99=A4=E6=97=A0=E6=95=88import?= =?UTF-8?q?=20*=20merge=20conflict=20*=20=E6=B7=BB=E5=8A=A0hashcode?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E9=87=8D=E5=86=99equals=E6=96=B9?= =?UTF-8?q?=E6=B3=95=EF=BC=8C=E7=A7=BB=E9=99=A4=E6=97=A0=E6=95=88=E5=BC=95?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../openatom/ubml/model/framework/api/FileService.java | 5 ----- .../definition/entity/MetadataConfiguration.java | 4 ++-- .../framework/definition/entity/MetadataIndexDto.java | 2 +- .../definition/entity/MetadataPackageForIndex.java | 2 +- .../definition/entity/MetadataPackageVersion.java | 2 +- .../framework/definition/entity/ProjectMetadataCache.java | 4 ++-- .../definition/entity/mvnEntity/MetadataInfoFilter.java | 2 +- .../entity/mvnEntity/MetadataInfoWithVersion.java | 2 +- .../definition/entity/mvnEntity/MetadataRepo.java | 2 +- .../entity/mvnEntity/PackageWithMetadataInfo.java | 2 +- .../definition/entity/mvnEntity/PageMetadataInfo.java | 2 +- .../MetadataInfoFilterWithProcessMode.java | 2 +- .../MetadataInfoWithVersionWithProcessMode.java | 2 +- .../PackageWithMetadataInfoWithProcessMode.java | 2 +- .../withprocessmode/PageMetadataInfoWithProcessMode.java | 2 +- .../model/framework/spi/MetadataTransferSerializer.java | 4 +--- .../framework/designtime/api/MetadataProjectService.java | 4 +--- .../framework/designtime/api/MetadataService.java | 8 ++++---- .../ubml/model/framework/generator/api/JitContext.java | 4 ++-- .../generator/api/common/JitCompilerConfigLoader.java | 2 +- .../framework/generator/api/entity/MavenDependency.java | 2 +- 21 files changed, 26 insertions(+), 35 deletions(-) diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/api/FileService.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/api/FileService.java index 43e0ff1..b0e2955 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/api/FileService.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/api/FileService.java @@ -93,8 +93,6 @@ public interface FileService { */ void fileCopy(String sourcePath, String destinationPath) throws IOException; - - //文件夹操作 /** @@ -136,8 +134,6 @@ public interface FileService { */ void deleteAllFilesUnderDirectory(String dirPath) throws IOException; - - //路径操作 /** @@ -255,7 +251,6 @@ public interface FileService { */ Path forceMoveDir(String fromDir, String toDir) throws IOException; - /** * 获取工程路径 * diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataConfiguration.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataConfiguration.java index f2a5484..2becc97 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataConfiguration.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataConfiguration.java @@ -68,7 +68,7 @@ public class MetadataConfiguration implements Serializable { } public void setTransferSerializer( - TransferSerializerConfigData transferSerializer) { + TransferSerializerConfigData transferSerializer) { this.transferSerializer = transferSerializer; } @@ -101,7 +101,7 @@ public class MetadataConfiguration implements Serializable { } public void setMdExtRuleSerializer( - MdExtRuleSerializerConfigData mdExtRuleSerializer) { + MdExtRuleSerializerConfigData mdExtRuleSerializer) { this.mdExtRuleSerializer = mdExtRuleSerializer; } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexDto.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexDto.java index 7915d35..747ce79 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexDto.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexDto.java @@ -33,7 +33,7 @@ public class MetadataIndexDto { } public void setMetadataIndexItems( - List metadataIndexItems) { + List metadataIndexItems) { this.metadataIndexItems = metadataIndexItems; } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageForIndex.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageForIndex.java index 4cc2c89..a9184fe 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageForIndex.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageForIndex.java @@ -97,7 +97,7 @@ public class MetadataPackageForIndex { } public void setDepMetadataPackages( - Map depMetadataPackages) { + Map depMetadataPackages) { this.depMetadataPackages = depMetadataPackages; } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageVersion.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageVersion.java index 3b39a50..50062de 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageVersion.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageVersion.java @@ -118,7 +118,7 @@ public class MetadataPackageVersion { if (!(another instanceof MetadataPackageVersion)) { throw new RuntimeException("MetadataPackageVersion的CompareTo方法只能传入MetadataPackageVersion类型的参数。"); } - MetadataPackageVersion anotherVersion = (MetadataPackageVersion)another; + MetadataPackageVersion anotherVersion = (MetadataPackageVersion) another; for (int i = 0; i < VERSION_LENGTH; i++) { if (this.versionInt[i] > anotherVersion.getVersionInt()[i]) { return 1; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectMetadataCache.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectMetadataCache.java index e792b27..055ab1f 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectMetadataCache.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectMetadataCache.java @@ -38,7 +38,7 @@ public class ProjectMetadataCache { } public void setDirectReferences( - Map directReferences) { + Map directReferences) { this.directReferences = directReferences; } @@ -47,7 +47,7 @@ public class ProjectMetadataCache { } public void setAllReferences( - Map allReferences) { + Map allReferences) { this.allReferences = allReferences; } } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoFilter.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoFilter.java index 2cdab54..983537a 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoFilter.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoFilter.java @@ -90,7 +90,7 @@ public class MetadataInfoFilter { } public void setRefPackages( - List refPackages) { + List refPackages) { this.refPackages = refPackages; } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoWithVersion.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoWithVersion.java index d7ec954..b33a5b2 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoWithVersion.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoWithVersion.java @@ -134,7 +134,7 @@ public class MetadataInfoWithVersion { } public void setMavenInfos( - List mavenInfos) { + List mavenInfos) { this.mavenInfos = mavenInfos; } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataRepo.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataRepo.java index 8749cac..e096255 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataRepo.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataRepo.java @@ -31,7 +31,7 @@ public class MetadataRepo { } public void setRepoList( - List repoList) { + List repoList) { this.repoList = repoList; } } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PackageWithMetadataInfo.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PackageWithMetadataInfo.java index 8bdee2e..d035c6b 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PackageWithMetadataInfo.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PackageWithMetadataInfo.java @@ -62,7 +62,7 @@ public class PackageWithMetadataInfo { } public void setMetadatas( - List metadatas) { + List metadatas) { this.metadatas = metadatas; } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PageMetadataInfo.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PageMetadataInfo.java index 3029b1d..8951667 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PageMetadataInfo.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PageMetadataInfo.java @@ -41,7 +41,7 @@ public class PageMetadataInfo { } public void setMetadataInfos( - List metadataInfos) { + List metadataInfos) { this.metadataInfos = metadataInfos; } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoFilterWithProcessMode.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoFilterWithProcessMode.java index e452994..f6bf690 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoFilterWithProcessMode.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoFilterWithProcessMode.java @@ -98,7 +98,7 @@ public class MetadataInfoFilterWithProcessMode { } public void setRefPackages( - List refPackages) { + List refPackages) { this.refPackages = refPackages; } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoWithVersionWithProcessMode.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoWithVersionWithProcessMode.java index dde82f7..1d72732 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoWithVersionWithProcessMode.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoWithVersionWithProcessMode.java @@ -144,7 +144,7 @@ public class MetadataInfoWithVersionWithProcessMode { } public void setMavenInfos( - List mavenInfos) { + List mavenInfos) { this.mavenInfos = mavenInfos; } } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/PackageWithMetadataInfoWithProcessMode.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/PackageWithMetadataInfoWithProcessMode.java index f26c660..693892e 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/PackageWithMetadataInfoWithProcessMode.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/PackageWithMetadataInfoWithProcessMode.java @@ -71,7 +71,7 @@ public class PackageWithMetadataInfoWithProcessMode { } public void setMetadatas( - List metadatas) { + List metadatas) { this.metadatas = metadatas; } } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/PageMetadataInfoWithProcessMode.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/PageMetadataInfoWithProcessMode.java index 613a585..2b8735b 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/PageMetadataInfoWithProcessMode.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/PageMetadataInfoWithProcessMode.java @@ -41,7 +41,7 @@ public class PageMetadataInfoWithProcessMode { } public void setMetadataInfos( - List metadataInfos) { + List metadataInfos) { this.metadataInfos = metadataInfos; } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataTransferSerializer.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataTransferSerializer.java index 06f34d6..4887094 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataTransferSerializer.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataTransferSerializer.java @@ -18,9 +18,7 @@ package org.openatom.ubml.model.framework.spi; import org.openatom.ubml.model.common.definition.entity.IMetadataContent; /** - * Classname MetadataTransferSerializer - * Description 元数据调用的序列化器,转换成各元数据实体 - * Date 2019/11/18 8:50 + * Classname MetadataTransferSerializer Description 元数据调用的序列化器,转换成各元数据实体 Date 2019/11/18 8:50 * * @author zhongchq * @version 1.0 diff --git a/model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/MetadataProjectService.java b/model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/MetadataProjectService.java index 39993bc..2491428 100644 --- a/model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/MetadataProjectService.java +++ b/model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/MetadataProjectService.java @@ -25,8 +25,7 @@ import org.openatom.ubml.model.framework.definition.entity.ProcessMode; import org.openatom.ubml.model.framework.definition.entity.mvnEntity.MavenPackageRefs; /** - * @author zhaoleitr - * 元数据工程服务 + * @author zhaoleitr 元数据工程服务 */ public interface MetadataProjectService { @@ -198,7 +197,6 @@ public interface MetadataProjectService { @Deprecated String getMavenUpdateFlag(String projPath); - /** * 获取工程类型(生成型 or 解析型) * diff --git a/model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/MetadataService.java b/model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/MetadataService.java index 7881b51..865f8ff 100644 --- a/model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/MetadataService.java +++ b/model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/MetadataService.java @@ -293,8 +293,8 @@ public interface MetadataService { * @return 元数据索引信息传输列表 */ List getRemoteMetadataIndexList(String text, String path, String selectedPackageSource, - List metadataTypeList, boolean page, int pageSize, int pageIndex, - boolean isFilterByRefs, boolean conflictAvoidFlag); + List metadataTypeList, boolean page, int pageSize, int pageIndex, + boolean isFilterByRefs, boolean conflictAvoidFlag); /** * 获取本地元数据索引信息列表 @@ -308,7 +308,7 @@ public interface MetadataService { * @return */ List getLocalMetadataList(String text, String path, List metadataTypeList, - boolean page, int pageSize, int pageIndex); + boolean page, int pageSize, int pageIndex); /** * 根据元数据索引信息获取元数据信息 @@ -320,7 +320,7 @@ public interface MetadataService { * @return 元数据信息传输实体 */ Metadata4RefDto pickMetadataIndex(int scopeType, String currentPath, MetadataIndexItemDto metadataIndexDto, - boolean isNeedMdDto); + boolean isNeedMdDto); /** * 获取工程信息 diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/JitContext.java b/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/JitContext.java index a325f1b..5c49acd 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/JitContext.java +++ b/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/JitContext.java @@ -75,7 +75,7 @@ public class JitContext { } public void setMetadataCache( - Map metadataCache) { + Map metadataCache) { this.metadataCache = metadataCache; } @@ -84,7 +84,7 @@ public class JitContext { } public void setModuleInfoList( - List moduleInfoList) { + List moduleInfoList) { this.moduleInfoList = moduleInfoList; } diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/common/JitCompilerConfigLoader.java b/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/common/JitCompilerConfigLoader.java index 0d5c37d..a24ddcb 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/common/JitCompilerConfigLoader.java +++ b/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/common/JitCompilerConfigLoader.java @@ -52,7 +52,7 @@ public class JitCompilerConfigLoader { } public static void setCompilerTypeConfigurations( - List compilerTypeConfigurations) { + List compilerTypeConfigurations) { JitCompilerConfigLoader.compilerTypeConfigurations = compilerTypeConfigurations; } diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/MavenDependency.java b/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/MavenDependency.java index 1eeac48..d5c05dd 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/MavenDependency.java +++ b/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/MavenDependency.java @@ -88,7 +88,7 @@ public class MavenDependency { } MavenDependency md = (MavenDependency) obj; return (groupId == null ? md.getGroupId() == null : groupId.equals(md.getGroupId())) && - (artifactId == null ? md.getArtifactId() == null : artifactId.equals(md.getArtifactId())); + (artifactId == null ? md.getArtifactId() == null : artifactId.equals(md.getArtifactId())); } @Override -- Gitee From ada51df267e0fe5dbcea29760f40d433d89f9b5e Mon Sep 17 00:00:00 2001 From: hanll02 Date: Fri, 2 Apr 2021 14:37:04 +0800 Subject: [PATCH 29/61] =?UTF-8?q?1=E3=80=81=E4=BC=98=E5=8C=96:=20=E5=BE=AA?= =?UTF-8?q?=E7=8E=AF=E4=BE=9D=E8=B5=96=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/common/definition/pom.xml | 5 - .../context/CefResourceExtractContext.java | 67 ----------- .../cef/i18n/context/CefResourceInfo.java | 78 ------------ .../i18n/context/CefResourceMergeContext.java | 47 -------- .../i18n/context/CefResourcePrefixInfo.java | 38 ------ .../context/ICefResourceExtractContext.java | 32 ----- .../context/ICefResourceMergeContext.java | 37 ------ .../extractor/AbstractResourceExtractor.java | 112 ------------------ .../AssoRefFieldResourceExtractor.java | 44 ------- .../i18n/extractor/AssoResourceExtractor.java | 57 --------- .../extractor/CefFieldResourceExtractor.java | 102 ---------------- .../extractor/DataTypeResourceExtractor.java | 88 -------------- .../i18n/merger/AbstractResourceMerger.java | 50 -------- .../merger/AssoRefFieldResourceMerger.java | 29 ----- .../cef/i18n/merger/AssoResourceMerger.java | 45 ------- .../i18n/merger/CefFieldResourceMerger.java | 98 --------------- .../i18n/merger/DataTypeResourceMerger.java | 62 ---------- .../names/CefResourceDescriptionNames.java | 22 ---- .../cef/i18n/names/CefResourceKeyNames.java | 23 ---- 19 files changed, 1036 deletions(-) delete mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java delete mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceInfo.java delete mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java delete mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourcePrefixInfo.java delete mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceExtractContext.java delete mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java delete mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AbstractResourceExtractor.java delete mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoRefFieldResourceExtractor.java delete mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoResourceExtractor.java delete mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/CefFieldResourceExtractor.java delete mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/DataTypeResourceExtractor.java delete mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AbstractResourceMerger.java delete mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoRefFieldResourceMerger.java delete mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoResourceMerger.java delete mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java delete mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java delete mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceDescriptionNames.java delete mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceKeyNames.java diff --git a/model/common/definition/pom.xml b/model/common/definition/pom.xml index 0ff5f18..e7490d1 100644 --- a/model/common/definition/pom.xml +++ b/model/common/definition/pom.xml @@ -18,10 +18,5 @@ ubml-common 0.9.0-SNAPSHOT - - org.openatom.ubml - ubml-model-framework-common - 0.9.0-SNAPSHOT - \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java deleted file mode 100644 index 26974eb..0000000 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; - -import org.openatom.ubml.model.common.definition.cef.util.DataValidator; -import org.openatom.ubml.model.framework.definition.entity.I18nResourceItem; -import org.openatom.ubml.model.framework.definition.entity.I18nResourceItemCollection; - -/** - * 多语资源项抽取上下文 - */ -public class CefResourceExtractContext implements ICefResourceExtractContext { - private String metaPrefix; - private I18nResourceItemCollection resourceItems; - - public CefResourceExtractContext(String metaPrefix, I18nResourceItemCollection items) { - DataValidator.checkForEmptyString(metaPrefix, "元数据前缀"); - DataValidator.checkForNullReference(items, "国际化资源项"); - this.metaPrefix = metaPrefix; - this.resourceItems = items; - } - - /** - * 获取前缀 - * - * @return - */ - public final String getKeyPrefix() { - return metaPrefix; - } - - /** - * 新增/修改 - * - * @param info - */ - public final void setResourceItem(CefResourceInfo info) { - String key = info.getResourceKey(); - String value = info.getResourceValue(); - String description = info.getDescription(); - - I18nResourceItem resource = GetNewResource(key, value, description); - - resourceItems.add(resource); - } - - private I18nResourceItem GetNewResource(String key, String value, String description) { - I18nResourceItem resourceItem = new I18nResourceItem(); - resourceItem.setKey(key); - resourceItem.setValue(value); - resourceItem.setComment(description); - return resourceItem; - } -} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceInfo.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceInfo.java deleted file mode 100644 index 9defaf0..0000000 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceInfo.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; - -import org.openatom.ubml.model.common.definition.cef.util.DataValidator; - -public class CefResourceInfo { - - public CefResourceInfo(CefResourcePrefixInfo prefixInfo, String resourceKeyPropName, String descriptionPropName, - String resourceValue) { - DataValidator.checkForNullReference(prefixInfo, "PrefixInfo"); - DataValidator.checkForEmptyString(prefixInfo.getDescriptionPrefix(), "DescriptionPrefix"); - DataValidator.checkForEmptyString(prefixInfo.getResourceKeyPrefix(), "ResourceKeyPrefix"); - - DataValidator.checkForEmptyString(resourceKeyPropName, "ResourceKeyPropName"); - DataValidator.checkForEmptyString(descriptionPropName, "DescriptionPropName"); - DataValidator.checkForEmptyString(resourceValue, "ResourceValue"); - - this.prefixInfo = prefixInfo; - this.resourceKeyPropName = resourceKeyPropName; - this.descriptionPropName = descriptionPropName; - this.resourceValue = resourceValue; - } - - private CefResourcePrefixInfo prefixInfo; - - public final CefResourcePrefixInfo getPrefixInfo() { - return prefixInfo; - } - - /** - * 属性名 e.g. NAME - */ - private String resourceKeyPropName; - - public final String getResourceKeyPropName() { - return resourceKeyPropName; - } - - /** - * 描述中属性名 e.g. 名称 - */ - private String descriptionPropName; - - public final String getDescriptionPropName() { - return descriptionPropName; - } - - /** - * 默认语言的值 - */ - private String resourceValue; - - public final String getResourceValue() { - return resourceValue; - } - - public String getResourceKey() { - return getPrefixInfo().getResourceKeyPrefix() + "." + getResourceKeyPropName(); - } - - public String getDescription() { - return getPrefixInfo().getDescriptionPrefix() + "的" + getDescriptionPropName(); - } -} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java deleted file mode 100644 index 7c634db..0000000 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; - -import org.openatom.ubml.model.common.definition.cef.util.DataValidator; -import org.openatom.ubml.model.framework.definition.entity.I18nResourceItemCollection; - -public class CefResourceMergeContext implements ICefResourceMergeContext { - - private String metaPrefix; - private I18nResourceItemCollection resourceItems; - - public CefResourceMergeContext(String metaPrefix, I18nResourceItemCollection items) { - DataValidator.checkForEmptyString(metaPrefix, "元数据前缀"); - DataValidator.checkForNullReference(items, "国际化资源项"); - this.metaPrefix = metaPrefix; - this.resourceItems = items; - } - - @Override - public String getKeyPrefix() { - return this.metaPrefix; - } - - @Override - public void setKeyPrefix(String keyPrefix) { - this.metaPrefix = keyPrefix; - } - - public I18nResourceItemCollection getResourceItems() { - return this.resourceItems; - } - -} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourcePrefixInfo.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourcePrefixInfo.java deleted file mode 100644 index 325aa44..0000000 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourcePrefixInfo.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; - -public class CefResourcePrefixInfo { - private String resourceKeyPrefix; - private String descriptionPrefix; - - public String getResourceKeyPrefix() { - return resourceKeyPrefix; - } - - public void setResourceKeyPrefix(String resourceKeyPrefix) { - this.resourceKeyPrefix = resourceKeyPrefix; - } - - public String getDescriptionPrefix() { - return descriptionPrefix; - } - - public void setDescriptionPrefix(String descriptionPrefix) { - this.descriptionPrefix = descriptionPrefix; - } -} - diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceExtractContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceExtractContext.java deleted file mode 100644 index 9db7d91..0000000 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceExtractContext.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; - -public interface ICefResourceExtractContext { - /** - * 获取前缀 - * - * @return - */ - String getKeyPrefix(); - - /** - * 新增/修改 - * - * @param info - */ - void setResourceItem(CefResourceInfo info); -} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java deleted file mode 100644 index 5227df7..0000000 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; - -import org.openatom.ubml.model.framework.definition.entity.I18nResourceItemCollection; - -public interface ICefResourceMergeContext { - - /** - * 获取前缀 - * - * @return - */ - String getKeyPrefix(); - - void setKeyPrefix(String keyPrefix); - - /** - * 获取资源项 - * - * @return - */ - I18nResourceItemCollection getResourceItems(); -} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AbstractResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AbstractResourceExtractor.java deleted file mode 100644 index 2c0639d..0000000 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AbstractResourceExtractor.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; - -import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourceInfo; -import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; -import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; - -/** - * 国际化抽取器基类 - */ -public abstract class AbstractResourceExtractor { - /** - * 国际化抽取器基类 - * - * @param context 上下文 - * @param parentResourceInfo 父抽取器的前缀信息 - */ - protected AbstractResourceExtractor(ICefResourceExtractContext context, CefResourcePrefixInfo parentResourceInfo) { - this.context = context; - this.parentResourcePrefixInfo = parentResourceInfo; - } - - protected AbstractResourceExtractor(ICefResourceExtractContext context) { - this(context, null); - } - - /** - * 国际化抽取上下文 - */ - private ICefResourceExtractContext context; - - protected final ICefResourceExtractContext getContext() { - return context; - } - - /** - * 父抽取器的前缀信息 - */ - private CefResourcePrefixInfo parentResourcePrefixInfo; - - protected final CefResourcePrefixInfo getParentResourcePrefixInfo() { - return parentResourcePrefixInfo; - } - - /** - * 当前抽取器的前缀信息 - */ - private CefResourcePrefixInfo currentResourcePrefixInfo; - - protected final CefResourcePrefixInfo getCurrentResourcePrefixInfo() { - return currentResourcePrefixInfo; - } - - private void setCurrentResourcePrefixInfo(CefResourcePrefixInfo value) { - currentResourcePrefixInfo = value; - } - - //#endregion - - /** - * 抽取国际化项入口方法 - */ - public final void extract() { - setCurrentResourcePrefixInfo(buildCurrentPrefix()); - setPrefixInfo(); - extractItems(); - } - - /** - * 抽取 - */ - protected abstract void extractItems(); - - /** - * 构造前缀 - * - * @return - */ - protected abstract CefResourcePrefixInfo buildCurrentPrefix(); - - /** - * 赋值前缀 - */ - protected abstract void setPrefixInfo(); - - /** - * 新增抽取资源项 - * - * @param propName 属性名 - * @param value 值 - * @param descriptionPropName 描述中属性名 - */ - protected final void addResourceInfo(String propName, String value, String descriptionPropName) { - CefResourceInfo info = new CefResourceInfo(getCurrentResourcePrefixInfo(), propName, descriptionPropName, value); - getContext().setResourceItem(info); - } - -} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoRefFieldResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoRefFieldResourceExtractor.java deleted file mode 100644 index e428b9d..0000000 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoRefFieldResourceExtractor.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; - -import org.openatom.ubml.model.common.definition.cef.IGspCommonField; -import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; -import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; - -public abstract class AssoRefFieldResourceExtractor extends CefFieldResourceExtractor { - private IGspCommonField commonField; - - public AssoRefFieldResourceExtractor(IGspCommonField field, ICefResourceExtractContext context, - CefResourcePrefixInfo parentResourceInfo) { - super(field, context, parentResourceInfo); - commonField = field; - } - - protected CefResourcePrefixInfo buildCurrentPrefix() { - if (!commonField.getIsRefElement()) { - throw new RuntimeException("[多语项抽取]非关联带出字段,不应使用AssoRefFieldResourceExtractor进行抽取。"); - - } - if (getParentResourcePrefixInfo() == null) { - throw new RuntimeException("多语项抽取_字段关联信息" + commonField.getParentAssociation() + "无对应的多语前缀信息。"); - } - CefResourcePrefixInfo fieldResourceInfo = new CefResourcePrefixInfo(); - fieldResourceInfo.setResourceKeyPrefix(getParentResourcePrefixInfo().getResourceKeyPrefix() + "." + commonField.getLabelID()); - fieldResourceInfo.setDescriptionPrefix(getParentResourcePrefixInfo().getDescriptionPrefix() + "的关联带出属性'" + commonField.getName() + "'"); - return fieldResourceInfo; - } -} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoResourceExtractor.java deleted file mode 100644 index bac49a7..0000000 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoResourceExtractor.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; - -import org.openatom.ubml.model.common.definition.cef.IGspCommonField; -import org.openatom.ubml.model.common.definition.cef.element.GspAssociation; -import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; -import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; - -public abstract class AssoResourceExtractor extends AbstractResourceExtractor { - private GspAssociation asso; - - protected AssoResourceExtractor(GspAssociation asso, ICefResourceExtractContext context, - CefResourcePrefixInfo parentResourceInfo) { - super(context, parentResourceInfo); - this.asso = asso; - } - - protected void extractItems() { - if (asso.getRefElementCollection() != null && asso.getRefElementCollection().size() > 0) { - for (IGspCommonField item : asso.getRefElementCollection()) { - getAssoRefFieldResourceExtractor(getContext(), getCurrentResourcePrefixInfo(), item).extract(); - } - } - } - - protected CefResourcePrefixInfo buildCurrentPrefix() { - if (getParentResourcePrefixInfo() == null) { - throw new RuntimeException("多语项抽取_字段" + asso.getBelongElement().getName() + "无对应的多语前缀信息。"); - } - return getParentResourcePrefixInfo(); - } - - /** - * 赋值节点的国际化项前缀 - */ - protected final void setPrefixInfo() { - asso.setI18nResourceInfoPrefix(getCurrentResourcePrefixInfo().getResourceKeyPrefix()); - } - - protected abstract AssoRefFieldResourceExtractor getAssoRefFieldResourceExtractor( - ICefResourceExtractContext context, CefResourcePrefixInfo assoPrefixInfo, IGspCommonField field); - -} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/CefFieldResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/CefFieldResourceExtractor.java deleted file mode 100644 index 853037d..0000000 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/CefFieldResourceExtractor.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; - -import org.openatom.ubml.model.common.definition.cef.IGspCommonField; -import org.openatom.ubml.model.common.definition.cef.collection.GspAssociationCollection; -import org.openatom.ubml.model.common.definition.cef.collection.GspEnumValueCollection; -import org.openatom.ubml.model.common.definition.cef.element.GspAssociation; -import org.openatom.ubml.model.common.definition.cef.element.GspEnumValue; -import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; -import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; -import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceDescriptionNames; -import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; - -public abstract class CefFieldResourceExtractor extends AbstractResourceExtractor { - private IGspCommonField commonField; - - protected CefFieldResourceExtractor(IGspCommonField field, ICefResourceExtractContext context, - CefResourcePrefixInfo parentResourceInfo) { - super(context, parentResourceInfo); - commonField = field; - } - - protected final void extractItems() { - - addResourceInfo(CefResourceKeyNames.NAME, commonField.getName(), CefResourceDescriptionNames.NAME); - - //关联枚举 - switch (commonField.getObjectType()) { - case Association: - extractAssoInfo(commonField.getChildAssociations()); - break; - case Enum: - extractEnumValue(commonField.getContainEnumValues()); - break; - case None: - break; - } - - //扩展 - extractExtendProperties(commonField); - } - - /** - * 赋值字段的国际化项前缀 - */ - protected final void setPrefixInfo() { - commonField.setI18nResourceInfoPrefix(getCurrentResourcePrefixInfo().getResourceKeyPrefix()); - } - - protected CefResourcePrefixInfo buildCurrentPrefix() { - if (getParentResourcePrefixInfo() == null) { - throw new RuntimeException("多语项抽取_节点" + commonField.getBelongObject().getName() + "中字段" + commonField.getName() + ",无节点对应的多语前缀信息。"); - } - CefResourcePrefixInfo fieldResourceInfo = new CefResourcePrefixInfo(); - fieldResourceInfo.setResourceKeyPrefix(getParentResourcePrefixInfo().getResourceKeyPrefix() + "." + commonField.getLabelID()); - fieldResourceInfo.setDescriptionPrefix(getParentResourcePrefixInfo().getDescriptionPrefix() + "中'" + commonField.getName() + "'属性"); - return fieldResourceInfo; - } - - private void extractAssoInfo(GspAssociationCollection assos) { - if (assos != null && assos.size() > 0) { - for (GspAssociation item : assos) { - getAssoResourceExtractor(getContext(), getCurrentResourcePrefixInfo(), item).extract(); - } - } - } - - private void extractEnumValue(GspEnumValueCollection enumValues) { - if (enumValues != null && enumValues.size() > 0) { - for (GspEnumValue item : enumValues) { - String keyPropName = item.getValue() + "." + CefResourceKeyNames.DISPLAY_VALUE; - String value = item.getName(); - String descriptionPropName = "枚举信息'" + item.getName() + "'的" + CefResourceDescriptionNames.DISPLAY_VALUE; - addResourceInfo(keyPropName, value, descriptionPropName); - - String enumKey = getCurrentResourcePrefixInfo().getResourceKeyPrefix() + "." + item.getValue(); - item.setI18nResourceInfoPrefix(enumKey); - } - } - } - - protected void extractExtendProperties(IGspCommonField commonField) { - } - - protected abstract AssoResourceExtractor getAssoResourceExtractor(ICefResourceExtractContext context, - CefResourcePrefixInfo fieldPrefixInfo, GspAssociation asso); - -} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/DataTypeResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/DataTypeResourceExtractor.java deleted file mode 100644 index 290d99b..0000000 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/DataTypeResourceExtractor.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; - -import org.openatom.ubml.model.common.definition.cef.IFieldCollection; -import org.openatom.ubml.model.common.definition.cef.IGspCommonDataType; -import org.openatom.ubml.model.common.definition.cef.IGspCommonField; -import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; -import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; -import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceDescriptionNames; -import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; - -public abstract class DataTypeResourceExtractor extends AbstractResourceExtractor { - - private IGspCommonDataType dataType; - - protected DataTypeResourceExtractor(IGspCommonDataType commonDataType, ICefResourceExtractContext context, - CefResourcePrefixInfo parentResourceInfo) { - super(context, parentResourceInfo); - dataType = commonDataType; - } - - protected final void extractItems() { - - addResourceInfo(CefResourceKeyNames.NAME, dataType.getName(), CefResourceDescriptionNames.NAME); - extractDataTypeFields(dataType.getContainElements()); - //扩展 - extractExtendProperties(dataType); - } - - protected final CefResourcePrefixInfo buildCurrentPrefix() { - CefResourcePrefixInfo prefixInfo = new CefResourcePrefixInfo(); - if (getParentResourcePrefixInfo() == null) { - throw new RuntimeException("多语项抽取_节点" + dataType.getName() + "所属模型,无对应的多语前缀信息。"); - } - prefixInfo.setResourceKeyPrefix(getParentResourcePrefixInfo().getResourceKeyPrefix() + "." + dataType.getCode()); - prefixInfo.setDescriptionPrefix(getParentResourcePrefixInfo().getDescriptionPrefix() + "中'" + dataType.getName() + "'实体"); - return prefixInfo; - } - - /** - * 赋值节点的国际化项前缀 - */ - protected final void setPrefixInfo() { - dataType.setI18nResourceInfoPrefix(getCurrentResourcePrefixInfo().getResourceKeyPrefix()); - } - - private void extractDataTypeFields(IFieldCollection fields) { - if (fields == null || fields.size() == 0) { - return; - } - for (IGspCommonField field : fields) { - CefFieldResourceExtractor extractor = getCefFieldResourceExtractor(getContext(), getCurrentResourcePrefixInfo(), field); - extractor.extract(); - } - - } - - /** - * 获取字段抽取器 - * - * @param context - * @return - */ - protected abstract CefFieldResourceExtractor getCefFieldResourceExtractor(ICefResourceExtractContext context, - CefResourcePrefixInfo objPrefixInfo, IGspCommonField field); - - /** - * 抽取扩展项 - * - * @param dataType - */ - protected void extractExtendProperties(IGspCommonDataType dataType) { - } -} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AbstractResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AbstractResourceMerger.java deleted file mode 100644 index 88b3988..0000000 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AbstractResourceMerger.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; - -import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; -import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; - -public abstract class AbstractResourceMerger { - protected AbstractResourceMerger( - ICefResourceMergeContext context, CefResourcePrefixInfo parentResourceInfo) { - this.context = context; - this.parentResourcePrefixInfo = parentResourceInfo; - } - - protected AbstractResourceMerger(ICefResourceMergeContext context) { - this.context = context; - } - - private ICefResourceMergeContext context; - - protected final ICefResourceMergeContext getContext() { - return context; - } - - private CefResourcePrefixInfo parentResourcePrefixInfo; - - protected final CefResourcePrefixInfo getParentResourcePrefixInfo() { - return parentResourcePrefixInfo; - } - - public void merge() { - mergeItems(); - } - - protected abstract void mergeItems(); - -} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoRefFieldResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoRefFieldResourceMerger.java deleted file mode 100644 index af7d001..0000000 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoRefFieldResourceMerger.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; - -import org.openatom.ubml.model.common.definition.cef.IGspCommonField; -import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; - -public abstract class AssoRefFieldResourceMerger extends CefFieldResourceMerger { - private IGspCommonField commonField; - - protected AssoRefFieldResourceMerger(IGspCommonField commonField, - ICefResourceMergeContext context) { - super(commonField, context); - this.commonField = commonField; - } -} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoResourceMerger.java deleted file mode 100644 index c2da8c0..0000000 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoResourceMerger.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; - -import org.openatom.ubml.model.common.definition.cef.IGspCommonField; -import org.openatom.ubml.model.common.definition.cef.element.GspAssociation; -import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; - -; - -public abstract class AssoResourceMerger extends AbstractResourceMerger { - private GspAssociation asso; - - protected AssoResourceMerger(GspAssociation asso, - ICefResourceMergeContext context) { - super(context); - this.asso = asso; - } - - @Override - protected void mergeItems() { - if (asso.getRefElementCollection() != null && asso.getRefElementCollection().size() > 0) { - for (IGspCommonField item : asso.getRefElementCollection()) { - getAssoRefFieldResourceMerger(getContext(), item).merge(); - } - } - } - - protected abstract AssoRefFieldResourceMerger getAssoRefFieldResourceMerger( - ICefResourceMergeContext context, IGspCommonField field); - -} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java deleted file mode 100644 index 5b6fbca..0000000 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; - -import org.openatom.ubml.model.common.definition.cef.IGspCommonField; -import org.openatom.ubml.model.common.definition.cef.collection.GspAssociationCollection; -import org.openatom.ubml.model.common.definition.cef.collection.GspEnumValueCollection; -import org.openatom.ubml.model.common.definition.cef.element.GspAssociation; -import org.openatom.ubml.model.common.definition.cef.element.GspEnumValue; -import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; -import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; -import org.openatom.ubml.model.common.definition.cef.increment.merger.MergeUtils; -import org.openatom.ubml.model.framework.definition.entity.I18nResourceItemCollection; - -public abstract class CefFieldResourceMerger extends AbstractResourceMerger { - - private IGspCommonField field; - - protected CefFieldResourceMerger(IGspCommonField field, - ICefResourceMergeContext context) { - super(context); - this.field = field; - } - - @Override - protected void mergeItems() { - - //关联枚举 - - switch (field.getObjectType()) { - case Association: - mergeAssoInfo(field); - break; - case Enum: - mergeEnum(field); - break; - case None: - I18nResourceItemCollection resourceItems = getContext().getResourceItems(); - String keyPrefix = MergeUtils.getKeyPrefix(this.field.getI18nResourceInfoPrefix(), CefResourceKeyNames.NAME); - field.setName(resourceItems.getResourceItemByKey(keyPrefix).getValue()); - break; - default: - throw new RuntimeException("暂不支持" + field.getObjectType() + "类型字段的多语合并"); - } - - //扩展 - extractExtendProperties(field); - } - - private void mergeEnum(IGspCommonField field) { - I18nResourceItemCollection resourceItems = getContext().getResourceItems(); - String keyPrefix = MergeUtils - .getKeyPrefix(this.field.getI18nResourceInfoPrefix(), CefResourceKeyNames.NAME); - field.setName(resourceItems.getResourceItemByKey(keyPrefix).getValue()); - GspEnumValueCollection enumValues = field.getContainEnumValues(); - if (enumValues != null && enumValues.size() > 0) { - for (GspEnumValue item : enumValues) { - String enumValueKeyPrefix = MergeUtils - .getKeyPrefix(item.getI18nResourceInfoPrefix(), CefResourceKeyNames.DISPLAY_VALUE); - item.setName(resourceItems.getResourceItemByKey(enumValueKeyPrefix).getValue()); - - } - } - } - - private void mergeAssoInfo(IGspCommonField field) { - I18nResourceItemCollection resourceItems = getContext().getResourceItems(); - String keyPrefix = MergeUtils - .getKeyPrefix(this.field.getI18nResourceInfoPrefix(), CefResourceKeyNames.NAME); - field.setName(resourceItems.getResourceItemByKey(keyPrefix).getValue()); - - GspAssociationCollection assos = field.getChildAssociations(); - if (assos != null && assos.size() > 0) { - for (GspAssociation item : assos) { - getAssoResourceMerger(getContext(), item).merge(); - } - } - } - - protected void extractExtendProperties(IGspCommonField commonField) { - } - - protected abstract AssoResourceMerger getAssoResourceMerger(ICefResourceMergeContext context, GspAssociation asso); - -} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java deleted file mode 100644 index 05f0010..0000000 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; - -import org.openatom.ubml.model.common.definition.cef.IFieldCollection; -import org.openatom.ubml.model.common.definition.cef.IGspCommonDataType; -import org.openatom.ubml.model.common.definition.cef.IGspCommonField; -import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; -import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; -import org.openatom.ubml.model.framework.definition.entity.I18nResourceItemCollection; - -import static org.openatom.ubml.model.common.definition.cef.increment.merger.MergeUtils.getKeyPrefix; - -public abstract class DataTypeResourceMerger extends AbstractResourceMerger { - - private IGspCommonDataType dataType; - - protected DataTypeResourceMerger(IGspCommonDataType commonDataType, ICefResourceMergeContext context) { - super(context); - this.dataType = commonDataType; - } - - @Override - protected void mergeItems() { - I18nResourceItemCollection resourceItems = getContext().getResourceItems(); - String keyPrefix = getKeyPrefix(dataType.getI18nResourceInfoPrefix(), CefResourceKeyNames.NAME); - dataType.setName(resourceItems.getResourceItemByKey(keyPrefix).getValue()); - extractDataTypeFields(dataType.getContainElements()); - //扩展 - extractExtendProperties(dataType); - } - - private void extractDataTypeFields(IFieldCollection fields) { - if (fields == null || fields.size() == 0) { - return; - } - for (IGspCommonField field : fields) { - CefFieldResourceMerger merger = getCefFieldResourceMerger(getContext(), field); - merger.merge(); - } - } - - protected abstract CefFieldResourceMerger getCefFieldResourceMerger( - ICefResourceMergeContext context, IGspCommonField field); - - protected void extractExtendProperties(IGspCommonDataType dataType) { - } - -} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceDescriptionNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceDescriptionNames.java deleted file mode 100644 index ccdc3ad..0000000 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceDescriptionNames.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.common.definition.cef.i18n.names; - -public final class CefResourceDescriptionNames { - public static final String NAME = "名称"; - - public static final String DISPLAY_VALUE = "枚举显示值"; -} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceKeyNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceKeyNames.java deleted file mode 100644 index 20df520..0000000 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceKeyNames.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright © OpenAtom Foundation. - * - * 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 org.openatom.ubml.model.common.definition.cef.i18n.names; - -public final class CefResourceKeyNames { - - public static final String NAME = "NAME"; - - public static final String DISPLAY_VALUE = "DISPLAY_VALUE"; -} \ No newline at end of file -- Gitee From 7992568ed222be8b8c1e0cf1d0a924df104d02ec Mon Sep 17 00:00:00 2001 From: Q-Lee Date: Fri, 2 Apr 2021 15:07:43 +0800 Subject: [PATCH 30/61] =?UTF-8?q?=E4=BC=98=E5=8C=96:=20(1)=20=E8=A7=84?= =?UTF-8?q?=E8=8C=83I18nResourceItem.java=20=E4=B8=AD=E9=87=8D=E5=86=99equ?= =?UTF-8?q?als=E7=9A=84=E6=96=B9=E5=BC=8F=20(2)=20=E9=87=8D=E5=86=99I18nRe?= =?UTF-8?q?sourceItem.java=E4=B8=AD=E7=9A=84hashCode=E6=96=B9=E6=B3=95=20(?= =?UTF-8?q?3)=20=E7=BC=96=E5=86=99FileUtils.java=E7=9A=84=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95=20(4)=20=E6=B3=A8=E9=87=8A=E6=9C=80?= =?UTF-8?q?=E5=A4=96=E5=B1=82pom=E7=9A=84=E4=BB=A3=E7=A0=81=E8=A7=84?= =?UTF-8?q?=E8=8C=83=E6=89=AB=E6=8F=8F=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../definition/entity/I18nResourceItem.java | 13 ++++-- .../generator/api/common/FileUtilsTest.java | 20 +++++++++ .../test/resources/fileUtils-test-file.txt | 1 + model/framework/pom.xml | 12 +++++ pom.xml | 44 +++++++++---------- 5 files changed, 64 insertions(+), 26 deletions(-) create mode 100644 model/framework/generator-api/src/test/java/org/openatom/ubml/model/framework/generator/api/common/FileUtilsTest.java create mode 100644 model/framework/generator-api/src/test/resources/fileUtils-test-file.txt diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResourceItem.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResourceItem.java index 116dc58..b82ebd7 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResourceItem.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResourceItem.java @@ -65,15 +65,20 @@ public class I18nResourceItem { @Override public boolean equals(Object obj) { - if (obj instanceof I18nResourceItem) { - return this.key.equals(((I18nResourceItem)obj).key); - } else { + if (this == obj) { + return true; + } + if (!(obj instanceof I18nResourceItem)) { return false; } + I18nResourceItem item = (I18nResourceItem) obj; + return key == null ? item.getKey() == null : key.equals(item.getKey()); } @Override public int hashCode() { - return super.hashCode(); + int result = 17; + result = 31 * result + (key == null ? 0 : key.hashCode()); + return result; } } diff --git a/model/framework/generator-api/src/test/java/org/openatom/ubml/model/framework/generator/api/common/FileUtilsTest.java b/model/framework/generator-api/src/test/java/org/openatom/ubml/model/framework/generator/api/common/FileUtilsTest.java new file mode 100644 index 0000000..2a48cbf --- /dev/null +++ b/model/framework/generator-api/src/test/java/org/openatom/ubml/model/framework/generator/api/common/FileUtilsTest.java @@ -0,0 +1,20 @@ +package org.openatom.ubml.model.framework.generator.api.common; + +import org.junit.Assert; +import org.junit.Test; +import org.springframework.boot.test.context.SpringBootTest; + +import static org.hamcrest.Matchers.is; + +@SpringBootTest +public class FileUtilsTest { + private static String TEST_FILE_NAME = "/fileUtils-test-file.txt"; + private static String EXPECT_RESULT = "junit test"; + + @Test + public void fileReadTest() { + String testFilePath = this.getClass().getResource(TEST_FILE_NAME).getPath(); + String content = FileUtils.fileRead(testFilePath); + Assert.assertThat(content, is(EXPECT_RESULT)); + } +} \ No newline at end of file diff --git a/model/framework/generator-api/src/test/resources/fileUtils-test-file.txt b/model/framework/generator-api/src/test/resources/fileUtils-test-file.txt new file mode 100644 index 0000000..eb50260 --- /dev/null +++ b/model/framework/generator-api/src/test/resources/fileUtils-test-file.txt @@ -0,0 +1 @@ +junit test \ No newline at end of file diff --git a/model/framework/pom.xml b/model/framework/pom.xml index 2bbf042..584b636 100644 --- a/model/framework/pom.xml +++ b/model/framework/pom.xml @@ -25,5 +25,17 @@ generator-core + + 2.2.0.RELEASE + + + + + org.springframework.boot + spring-boot-starter-test + ${spring-boot.version} + test + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index a580434..5aacd3e 100644 --- a/pom.xml +++ b/pom.xml @@ -160,28 +160,28 @@ - - org.apache.maven.plugins - maven-checkstyle-plugin - ${maven-checkstyle-plugin.version} - - - validate - validate - - ${user.dir}/style/ubml_checkstyle.xml - UTF-8 - true - true - false - **/generated/**/* - - - check - - - - + + + + + + + + + + + + + + + + + + + + + + -- Gitee From 61a7dd378afce841016d970e879c246c9f448216 Mon Sep 17 00:00:00 2001 From: Q-Lee Date: Fri, 2 Apr 2021 15:38:46 +0800 Subject: [PATCH 31/61] =?UTF-8?q?=E4=BC=98=E5=8C=96:=20(1)=E5=B0=86?= =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E5=85=AC=E5=85=B1=E7=B1=BBI18nResourceItemCo?= =?UTF-8?q?llection=E3=80=81I18nResourceItem=E4=BB=8Emodel-framework-commo?= =?UTF-8?q?n=E6=A8=A1=E5=9D=97=E6=8A=BD=E7=A6=BB=E5=88=B0model-common?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/common}/definition/entity/I18nResourceItem.java | 4 ++-- .../common}/definition/entity/I18nResourceItemCollection.java | 2 +- .../ubml/model/framework/definition/entity/I18nResource.java | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) rename model/{framework/common/src/main/java/org/openatom/ubml/model/framework => common/definition/src/main/java/org/openatom/ubml/model/common}/definition/entity/I18nResourceItem.java (92%) rename model/{framework/common/src/main/java/org/openatom/ubml/model/framework => common/definition/src/main/java/org/openatom/ubml/model/common}/definition/entity/I18nResourceItemCollection.java (97%) diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResourceItem.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/I18nResourceItem.java similarity index 92% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResourceItem.java rename to model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/I18nResourceItem.java index 116dc58..065baad 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResourceItem.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/I18nResourceItem.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package org.openatom.ubml.model.common.definition.entity; public class I18nResourceItem { @@ -66,7 +66,7 @@ public class I18nResourceItem { @Override public boolean equals(Object obj) { if (obj instanceof I18nResourceItem) { - return this.key.equals(((I18nResourceItem)obj).key); + return this.key.equals(((I18nResourceItem) obj).key); } else { return false; } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResourceItemCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/I18nResourceItemCollection.java similarity index 97% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResourceItemCollection.java rename to model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/I18nResourceItemCollection.java index bbd1233..e1ccdec 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResourceItemCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/I18nResourceItemCollection.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package org.openatom.ubml.model.common.definition.entity; import java.util.ArrayList; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResource.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResource.java index 030f835..5e5380b 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResource.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResource.java @@ -15,6 +15,8 @@ */ package org.openatom.ubml.model.framework.definition.entity; +import org.openatom.ubml.model.common.definition.entity.I18nResourceItemCollection; + public class I18nResource { /** -- Gitee From 0d749d72cce5388c2a8fdb8307e65fd0a3bd3390 Mon Sep 17 00:00:00 2001 From: haoxiaofei Date: Sat, 3 Apr 2021 16:09:57 +0800 Subject: [PATCH 32/61] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=B1=BB=EF=BC=9A?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B8=B8=E9=87=8F=E7=B1=BB=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../collection/GspElementCollection.java | 7 +++--- .../entity/CmEntityRuleNames.java | 23 +++++++++++++++++++ .../entity/object/GspUniqueConstraint.java | 7 ++++-- 3 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmEntityRuleNames.java diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspElementCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspElementCollection.java index 5cb7497..77f4242 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspElementCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspElementCollection.java @@ -59,7 +59,6 @@ public class GspElementCollection extends GspFieldCollection implements IElement } } - /** * 克隆 * @@ -81,13 +80,13 @@ public class GspElementCollection extends GspFieldCollection implements IElement @Override public IGspCommonElement getItem(String id) { Object tempVar = super.getByID(id); - return (IGspCommonElement)((tempVar instanceof IGspCommonElement) ? tempVar : null); + return (IGspCommonElement) ((tempVar instanceof IGspCommonElement) ? tempVar : null); } @Override public final IGspCommonElement getItem(int index) { Object tempVar = super.getByIndex(index); - return (IGspCommonElement)((tempVar instanceof IGspCommonElement) ? tempVar : null); + return (IGspCommonElement) ((tempVar instanceof IGspCommonElement) ? tempVar : null); } /** @@ -103,7 +102,7 @@ public class GspElementCollection extends GspFieldCollection implements IElement if (parentObject != value) { parentObject = value; for (IGspCommonField item : this) { - GspCommonElement ele = (GspCommonElement)item; + GspCommonElement ele = (GspCommonElement) item; ele.setBelongObject(value); } } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmEntityRuleNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmEntityRuleNames.java new file mode 100644 index 0000000..088c66d --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmEntityRuleNames.java @@ -0,0 +1,23 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.commonmodel.controlruledef.entity; + +public class CmEntityRuleNames { + public static String CmEntityRuleObjectType = "GspCommonModelEntity"; + public static String AddChildEntity = "AddChildEntity"; + public static String ModifyChildEntities = "ModifyChildEntities"; + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspUniqueConstraint.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspUniqueConstraint.java index 5465ff5..1395049 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspUniqueConstraint.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspUniqueConstraint.java @@ -102,6 +102,9 @@ public class GspUniqueConstraint implements Cloneable { * 约束包含的字段列表 */ public final BaseList getElementList() { + if (elementList == null) { + elementList = new BaseList<>(); + } return this.elementList; } @@ -131,8 +134,8 @@ public class GspUniqueConstraint implements Cloneable { } catch (CloneNotSupportedException e) { return null; } - GspUniqueConstraint newConstraint = (GspUniqueConstraint)((tempVar instanceof GspUniqueConstraint) ? tempVar - : null); + GspUniqueConstraint newConstraint = (GspUniqueConstraint) ((tempVar instanceof GspUniqueConstraint) ? tempVar + : null); newConstraint.id = this.id; newConstraint.code = this.getCode(); newConstraint.name = this.name; -- Gitee From 98a56809c9e5bd7a9836b62b13fd86cb53470bf2 Mon Sep 17 00:00:00 2001 From: wangzehao Date: Sat, 3 Apr 2021 20:35:19 +0800 Subject: [PATCH 33/61] =?UTF-8?q?!20=20=E4=BC=98=E5=8C=96=EF=BC=9A?= =?UTF-8?q?=E4=BF=AE=E5=A4=8DVO=E6=A8=A1=E5=9E=8B=E7=9A=84=E9=83=A8?= =?UTF-8?q?=E5=88=86=E4=BB=A3=E7=A0=81=E8=A7=84=E8=8C=83=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20*=20VO=E6=A8=A1=E5=9E=8B=E4=BB=A3=E7=A0=81=E8=A7=84=E8=8C=83?= =?UTF-8?q?=E8=B0=83=E6=95=B4=20*=20VO=E6=A8=A1=E5=9E=8B=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../openatom/ubml/common/util/BlobUtils.java | 4 +- .../ubml/common/util/JacksonJsonUtil.java | 70 ++--- .../ubml/common/util/ReflectionUtils.java | 31 +- .../ubml/common/util/StringUtils.java | 17 +- .../be/definition/GspBizEntityElement.java | 19 +- .../model/vo/definition/GspViewObject.java | 15 +- .../action/ActionFormatParameter.java | 7 +- .../action/IViewModelParameter.java | 205 +++++++------ .../action/IViewModelParameterCollection.java | 23 +- .../action/MappedCdpActionBase.java | 4 +- .../vo/definition/action/VMActionResult.java | 6 +- .../vo/definition/action/ViewModelAction.java | 12 +- .../action/ViewModelActionType.java | 48 ++- ...ction.java => ChangeSetMappingAction.java} | 27 +- .../ChangeSetReversalMappingAction.java | 23 ++ .../ChangesetReversalMappingAction.java | 24 -- .../internalexternalaction/CreateAction.java | 23 +- .../DataMappingAction.java | 24 +- .../DataReversalMappingAction.java | 24 +- .../internalexternalaction/DeleteAction.java | 24 +- .../IInternalExtendAction.java | 5 +- .../internalexternalaction/ModifyAction.java | 24 +- .../MultiDeleteAction.java | 11 +- .../internalexternalaction/QueryAction.java | 23 +- .../RetrieveAction.java | 23 +- .../mappedbiz/MappedBizActionParameter.java | 10 +- .../MappedBizActionParameterCollection.java | 10 +- .../mappedcdp/MappedCdpActionParameter.java | 10 +- .../MappedCdpActionParameterCollection.java | 10 +- .../ViewModelParActualValue.java | 57 ++-- .../ViewModelParActualValueType.java | 29 +- .../viewmodelbase/ViewModelParameter.java | 10 +- .../ViewModelParameterCollection.java | 6 +- .../viewmodelbase/ViewModelReturnValue.java | 53 ++-- .../ViewModelVoidReturnValue.java | 91 +++--- .../collection/VMActionCollection.java | 17 +- .../collection/VMElementCollection.java | 26 +- .../collection/ValueHelpConfigCollection.java | 11 +- .../collection/ViewObjectCollection.java | 202 ++++++------- .../vo/definition/common/ElementHelpType.java | 61 ++-- .../definition/common/HelpExtendAction.java | 37 ++- .../vo/definition/common/InitVoUtil.java | 12 +- .../common/InternalExtendActionUtil.java | 10 +- .../vo/definition/common/MappingType.java | 110 +++---- .../vo/definition/common/MetadataType.java | 37 +-- .../vo/definition/common/TemplateVoInfo.java | 82 ++--- .../common/VMCollectionParameterType.java | 46 ++- .../vo/definition/common/VMHelpConfig.java | 35 +-- .../vo/definition/common/VMParameterMode.java | 46 ++- .../vo/definition/common/VMParameterType.java | 72 ++--- .../vo/definition/common/ValueHelpConfig.java | 12 +- .../definition/common/ViewModelMapping.java | 281 ++++++++---------- .../definition/common/copy/CopyContext.java | 95 +++--- .../common/mapping/GspQoObjectMapping.java | 43 ++- .../common/mapping/GspVoElementMapping.java | 95 +++--- .../mapping/GspVoElementSourceType.java | 46 ++- .../common/mapping/GspVoObjectMapping.java | 7 +- .../common/mapping/GspVoObjectSourceType.java | 46 ++- .../dataextendinfo/VoDataExtendInfo.java | 7 +- .../extendinfo/entity/GspVoExtendInfo.java | 10 +- .../json/element/ViewElementSerializer.java | 8 +- .../json/model/ViewModelSerializer.java | 19 +- .../json/operation/VmActionSerializer.java | 11 +- 63 files changed, 1157 insertions(+), 1329 deletions(-) rename model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/{ChangesetMappingAction.java => ChangeSetMappingAction.java} (31%) create mode 100644 model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangeSetReversalMappingAction.java delete mode 100644 model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetReversalMappingAction.java diff --git a/common/src/main/java/org/openatom/ubml/common/util/BlobUtils.java b/common/src/main/java/org/openatom/ubml/common/util/BlobUtils.java index 9648065..d5f4902 100644 --- a/common/src/main/java/org/openatom/ubml/common/util/BlobUtils.java +++ b/common/src/main/java/org/openatom/ubml/common/util/BlobUtils.java @@ -62,7 +62,7 @@ public class BlobUtils { } try { - return new String(blob.getBytes((long)1, (int)blob.length()), Constants.DEFAULT_CHARSET); + return new String(blob.getBytes((long) 1, (int) blob.length()), Constants.DEFAULT_CHARSET); } catch (Exception e) { throw new ShouldNeverHappenException(e); } @@ -98,7 +98,7 @@ public class BlobUtils { } try { - return blob.getBytes((long)1, (int)blob.length()); + return blob.getBytes((long) 1, (int) blob.length()); } catch (Exception e) { throw new ShouldNeverHappenException(e); } diff --git a/common/src/main/java/org/openatom/ubml/common/util/JacksonJsonUtil.java b/common/src/main/java/org/openatom/ubml/common/util/JacksonJsonUtil.java index 42a295b..b47bf32 100644 --- a/common/src/main/java/org/openatom/ubml/common/util/JacksonJsonUtil.java +++ b/common/src/main/java/org/openatom/ubml/common/util/JacksonJsonUtil.java @@ -40,35 +40,35 @@ public class JacksonJsonUtil { // 忽略不识别的字段 MAPPER.configure(Feature.IGNORE_UNKNOWN, true); LOG.info( - "MapperFeature {}: {}. Unknown properties will be quietly ignored.", - Feature.IGNORE_UNKNOWN, - true); + "MapperFeature {}: {}. Unknown properties will be quietly ignored.", + Feature.IGNORE_UNKNOWN, + true); // 允许没有引号包裹的字段 MAPPER.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); LOG.info( - "JsonParser.Feature {}: {}. Allow use of unquoted field names.", - JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, - true); + "JsonParser.Feature {}: {}. Allow use of unquoted field names.", + JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, + true); // 当遇到不能识别的属性时,正常执行 MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); LOG.info( - "MapperFeature {}: {}. It will not result in a failure if an unknown property is encountered.", - DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, - false); + "MapperFeature {}: {}. It will not result in a failure if an unknown property is encountered.", + DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, + false); // 忽略字段大小写 MAPPER.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); LOG.info( - "MapperFeature {}: {}. The bean properties will be matched using their lower-case equivalents, any case-combination should work.", - MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, - true); + "MapperFeature {}: {}. The bean properties will be matched using their lower-case equivalents, any case-combination should work.", + MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, + true); // 允许JSON字符串包含非JSON标准控制字符 MAPPER.configure(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true); LOG.info( - "JsonParser.Feature {}: {}. allow JSON Strings to contain unquoted control characters (ASCII characters with value less than 32, including tab and line feed characters) or not.", - JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, - true); + "JsonParser.Feature {}: {}. allow JSON Strings to contain unquoted control characters (ASCII characters with value less than 32, including tab and line feed characters) or not.", + JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, + true); } private JacksonJsonUtil() { @@ -82,10 +82,10 @@ public class JacksonJsonUtil { return MAPPER.writeValueAsString(object); } catch (Exception e) { throw new JsonParseException( - MessageFormat.format( - "Failed to serialize the object {0} which belong to class {1}.", - object, object.getClass().getCanonicalName()), - e); + MessageFormat.format( + "Failed to serialize the object {0} which belong to class {1}.", + object, object.getClass().getCanonicalName()), + e); } } @@ -94,10 +94,10 @@ public class JacksonJsonUtil { return MAPPER.readValue(json, clazz); } catch (Exception e) { throw new JsonParseException( - MessageFormat.format( - "Failed to deserialize from json string to class object {}.", - clazz.getCanonicalName()), - e); + MessageFormat.format( + "Failed to deserialize from json string to class object {}.", + clazz.getCanonicalName()), + e); } } @@ -106,9 +106,9 @@ public class JacksonJsonUtil { return MAPPER.treeToValue(jsonNode, clazz); } catch (Exception e) { throw new JsonParseException( - MessageFormat.format( - "Failed to parse JsonNode to class object {0}.", clazz.getCanonicalName()), - e); + MessageFormat.format( + "Failed to parse JsonNode to class object {0}.", clazz.getCanonicalName()), + e); } } @@ -117,14 +117,14 @@ public class JacksonJsonUtil { return MAPPER.readValue(in, clazz); } catch (Exception e) { LOG.error( - "Failed to deserialize from input stream to class object {0}.", - clazz.getCanonicalName(), - e); + "Failed to deserialize from input stream to class object {0}.", + clazz.getCanonicalName(), + e); throw new JsonParseException( - MessageFormat.format( - "Failed to deserialize from input stream to class object {0}.", - clazz.getCanonicalName()), - e); + MessageFormat.format( + "Failed to deserialize from input stream to class object {0}.", + clazz.getCanonicalName()), + e); } } @@ -133,7 +133,7 @@ public class JacksonJsonUtil { return MAPPER.readTree(json); } catch (Exception e) { throw new JsonParseException( - MessageFormat.format("Failed to read json tree from string \n{0}\n", json), e); + MessageFormat.format("Failed to read json tree from string \n{0}\n", json), e); } } @@ -170,7 +170,7 @@ public class JacksonJsonUtil { } public JsonParseException( - String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } } diff --git a/common/src/main/java/org/openatom/ubml/common/util/ReflectionUtils.java b/common/src/main/java/org/openatom/ubml/common/util/ReflectionUtils.java index 5fefd22..a554ad5 100644 --- a/common/src/main/java/org/openatom/ubml/common/util/ReflectionUtils.java +++ b/common/src/main/java/org/openatom/ubml/common/util/ReflectionUtils.java @@ -59,7 +59,7 @@ public class ReflectionUtils { * @throws IllegalAccessException the illegal access exception */ public static Object getFieldValue(Object target, String fieldName) - throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { + throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { Class cl = target.getClass(); int i = 0; while ((i++) < MAX_NEST_DEPTH && cl != null) { @@ -87,8 +87,8 @@ public class ReflectionUtils { * @throws InvocationTargetException the invocation target exception */ public static Object invokeMethod(Object target, String methodName) - throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, - InvocationTargetException { + throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, + InvocationTargetException { Class cl = target.getClass(); int i = 0; while ((i++) < MAX_NEST_DEPTH && cl != null) { @@ -118,8 +118,8 @@ public class ReflectionUtils { * @throws InvocationTargetException the invocation target exception */ public static Object invokeMethod(Object target, String methodName, Class[] parameterTypes, Object[] args) - throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, - InvocationTargetException { + throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, + InvocationTargetException { Class cl = target.getClass(); int i = 0; while ((i++) < MAX_NEST_DEPTH && cl != null) { @@ -149,9 +149,9 @@ public class ReflectionUtils { * @throws InvocationTargetException the invocation target exception */ public static Object invokeStaticMethod(Class targetClass, String methodName, Class[] parameterTypes, - Object[] parameterValues) - throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, - InvocationTargetException { + Object[] parameterValues) + throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, + InvocationTargetException { int i = 0; while ((i++) < MAX_NEST_DEPTH && targetClass != null) { try { @@ -175,7 +175,7 @@ public class ReflectionUtils { * @throws SecurityException the security exception */ public static Method getMethod(Class classType, String methodName, Class[] parameterTypes) - throws NoSuchMethodException, SecurityException { + throws NoSuchMethodException, SecurityException { return classType.getMethod(methodName, parameterTypes); } @@ -218,14 +218,11 @@ public class ReflectionUtils { } /** - * Gets a value indicates whether the sub class is or inheriting or implementing the base class. - * that means: - * 1.while the sub class is a class and the base class is a class too,the value indicates whether the sub class - * inherits from base class; - * 2.while the sub class is an interface and the base class is an interface too,the value indicates whether the sub - * class inherits from the base class; - * 3.while the sub class is a class and the base class is an interface,the value indicates whether the sub class - * implements the base class; + * Gets a value indicates whether the sub class is or inheriting or implementing the base class. that means: 1.while + * the sub class is a class and the base class is a class too,the value indicates whether the sub class inherits + * from base class; 2.while the sub class is an interface and the base class is an interface too,the value indicates + * whether the sub class inherits from the base class; 3.while the sub class is a class and the base class is an + * interface,the value indicates whether the sub class implements the base class; * * @param subClass can be a concrete class or an interface * @param baseClass an abstract class or an interface diff --git a/common/src/main/java/org/openatom/ubml/common/util/StringUtils.java b/common/src/main/java/org/openatom/ubml/common/util/StringUtils.java index 94fa09d..c9676bd 100644 --- a/common/src/main/java/org/openatom/ubml/common/util/StringUtils.java +++ b/common/src/main/java/org/openatom/ubml/common/util/StringUtils.java @@ -178,7 +178,7 @@ public class StringUtils { return String.valueOf(obj); } if (obj instanceof String) { - return (String)obj; + return (String) obj; } if (obj instanceof Number || obj instanceof Character || obj instanceof Boolean) { return String.valueOf(obj); @@ -189,8 +189,8 @@ public class StringUtils { if (obj instanceof Collection) { StringBuilder sb = new StringBuilder(); sb.append("["); - if (!((Collection)obj).isEmpty()) { - for (Object o : (Collection)obj) { + if (!((Collection) obj).isEmpty()) { + for (Object o : (Collection) obj) { sb.append(toString(o)).append(","); } sb.deleteCharAt(sb.length() - 1); @@ -201,9 +201,9 @@ public class StringUtils { if (obj instanceof Map) { StringBuilder sb = new StringBuilder(); sb.append("{"); - if (!((Map)obj).isEmpty()) { - for (Object k : ((Map)obj).keySet()) { - Object v = ((Map)obj).get(k); + if (!((Map) obj).isEmpty()) { + for (Object k : ((Map) obj).keySet()) { + Object v = ((Map) obj).get(k); sb.append(toString(k)).append("->").append(toString(v)).append(","); } sb.deleteCharAt(sb.length() - 1); @@ -312,9 +312,8 @@ public class StringUtils { return fixLenthString.substring(1, strLength + 1); } - public static String join(Object[] array, String separator) { - return array == null ? null : join((Object[])array, separator, 0, array.length); + return array == null ? null : join((Object[]) array, separator, 0, array.length); } public static String join(Object[] array, String separator, int startIndex, int endIndex) { @@ -351,7 +350,7 @@ public class StringUtils { } private static boolean CheckSeparator(char cha) { - char[] separator = new char[]{' ', ' ', '\u2028', '\u2029', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '\u200b', '\u2028', '\u2029', ' ', ' '}; + char[] separator = new char[] {' ', ' ', '\u2028', '\u2029', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '\u200b', '\u2028', '\u2029', ' ', ' '}; char[] var2 = separator; int var3 = separator.length; diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityElement.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityElement.java index bcab516..092a2a3 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityElement.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityElement.java @@ -152,21 +152,22 @@ public class GspBizEntityElement extends GspCommonElement implements Cloneable { return; } for (GspAssociation childAssociation : getChildAssociations()) { - GspCommonAssociation dependentAssociation = (GspCommonAssociation)(dependentElement.getChildAssociations() - .getItem(childAssociation.getId())); - mergeChildAssociation((GspCommonAssociation)childAssociation, dependentAssociation, isRef); + GspCommonAssociation dependentAssociation = (GspCommonAssociation) (dependentElement.getChildAssociations() + .getItem(childAssociation.getId())); + mergeChildAssociation((GspCommonAssociation) childAssociation, dependentAssociation, isRef); } } private void mergeChildAssociation(GspCommonAssociation childAssociation, GspCommonAssociation dependentAssociation, - boolean isRef) { + boolean isRef) { if (isRef) { mergeAssociationBaseInfo(childAssociation, dependentAssociation); } mergeRefElements(childAssociation, dependentAssociation); } - private void mergeAssociationBaseInfo(GspCommonAssociation childAssociation, GspCommonAssociation dependentAssociation) { + private void mergeAssociationBaseInfo(GspCommonAssociation childAssociation, + GspCommonAssociation dependentAssociation) { childAssociation.setRefModelID(dependentAssociation.getRefModelID()); childAssociation.setRefModelCode(dependentAssociation.getRefModelCode()); childAssociation.setRefModelName(dependentAssociation.getRefModelName()); @@ -185,9 +186,9 @@ public class GspBizEntityElement extends GspCommonElement implements Cloneable { return; } for (IGspCommonField refElement : childAssociation.getRefElementCollection()) { - GspBizEntityElement dependentRefElement = (GspBizEntityElement)dependentAssociation.getRefElementCollection() - .getItem(refElement.getID()); - ((GspBizEntityElement)refElement).mergeWithDependentElement(dependentRefElement); + GspBizEntityElement dependentRefElement = (GspBizEntityElement) dependentAssociation.getRefElementCollection() + .getItem(refElement.getID()); + ((GspBizEntityElement) refElement).mergeWithDependentElement(dependentRefElement); } } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewObject.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewObject.java index 56ab8cf..f234dff 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewObject.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewObject.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.io.Serializable; import java.util.ArrayList; import java.util.function.Predicate; -import lombok.var; import org.openatom.ubml.model.common.definition.cef.IGspCommonField; import org.openatom.ubml.model.common.definition.cef.entity.ClassInfo; import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonElement; @@ -276,20 +275,16 @@ public class GspViewObject extends GspCommonObject implements Serializable { } if (getContainElements() != null && getContainElements().size() > 0) { - Object tempVar3 = getContainElements().clone(); - node.setContainElements((VMElementCollection)((tempVar3 instanceof VMElementCollection) ? tempVar3 : null)); + VMElementCollection tempVar3 = getContainElements().clone(); + node.setContainElements(tempVar3); for (IGspCommonField BelongObj : node.getContainElements()) { BelongObj.setBelongObject(node); } } - //if (Association != null) - //{ - // node.Association = Association.Clone() as IVOAssociation; - //} if (mapping != null) { - var map = mapping.clone(); - node.setMapping((GspVoObjectMapping)((map instanceof GspVoObjectMapping) ? map : null)); + GspVoObjectMapping map = mapping.clone(); + node.setMapping((GspVoObjectMapping)(map)); } @@ -372,4 +367,4 @@ public class GspViewObject extends GspCommonObject implements Serializable { filterCondition = value; } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ActionFormatParameter.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ActionFormatParameter.java index 762068c..5909ba6 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ActionFormatParameter.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ActionFormatParameter.java @@ -52,23 +52,22 @@ public class ActionFormatParameter implements Cloneable, Serializable { privateName = value; } - /** * 克隆 * * @return Action执行参数 */ @Override - public final ActionFormatParameter clone() { + public final ActionFormatParameter clone() { Object tempVar = null; try { tempVar = super.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } - ActionFormatParameter obj = (ActionFormatParameter)((tempVar instanceof ActionFormatParameter) ? tempVar : null); + ActionFormatParameter obj = (ActionFormatParameter) ((tempVar instanceof ActionFormatParameter) ? tempVar : null); return obj; } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameter.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameter.java index db93219..56a6f8a 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameter.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameter.java @@ -14,106 +14,105 @@ import org.openatom.ubml.model.vo.definition.common.VMParameterType; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public interface IViewModelParameter -{ - - /** - * @return The Id Of The Parameter - */ - String getID(); - - /** - * @param value The Id Of The Parameter - */ - void setID(String value); - - /** - * @return The Code Of The Parameter - */ - String getParamCode(); - - /** - * @param value The Code Of The Parameter - */ - void setParamCode(String value); - - /** - * @return The Name Of The Parameter - */ - String getParamName(); - - /** - * @param value The Name Of The Parameter - */ - void setParamName(String value); - - /** - * @return The Type Of The Parameter - */ - VMParameterType getParameterType(); - - /** - * @param value The Type Of The Parameter - */ - void setParameterType(VMParameterType value); - - /** - * @return The Assembly Of The Parameter,It`s Useful For Dotnet - */ - String getAssembly(); - - /** - * @param value The Assembly Of The Parameter,It`s Useful For Dotnet - */ - void setAssembly(String value); - - /** - * @return The Class Name Of The Parameter Type - */ - String getClassName(); - - /** - * @param value The Class Name Of The Parameter Type - */ - void setClassName(String value); - - /** - * @return The Parameter Mode Of The Parameter,The Default Value Is In - */ - VMParameterMode getMode(); - - /** - * @param value The Parameter Mode Of The Parameter,The Default Value Is In - */ - void setMode(VMParameterMode value); - - /** - * @return The Description Of The Parameter - */ - String getParamDescription(); - - /** - * @param value The Description Of The Parameter - */ - void setParamDescription(String value); - - /** - * @return The Collection Type Of The Parameter - */ - VMCollectionParameterType getCollectionParameterType(); - - /** - * @param value The Collection Type Of The Parameter - */ - void setCollectionParameterType(VMCollectionParameterType value); - - /** - * @return The Actual Value Of The Parameter,It`s Not Required - */ - ViewModelParActualValue getActualValue(); - - /** - * @param value The Actual Value Of The Parameter,It`s Not Required - */ - void setActualValue(ViewModelParActualValue value); -} \ No newline at end of file +public interface IViewModelParameter { + + /** + * @return The Id Of The Parameter + */ + String getID(); + + /** + * @param value The Id Of The Parameter + */ + void setID(String value); + + /** + * @return The Code Of The Parameter + */ + String getParamCode(); + + /** + * @param value The Code Of The Parameter + */ + void setParamCode(String value); + + /** + * @return The Name Of The Parameter + */ + String getParamName(); + + /** + * @param value The Name Of The Parameter + */ + void setParamName(String value); + + /** + * @return The Type Of The Parameter + */ + VMParameterType getParameterType(); + + /** + * @param value The Type Of The Parameter + */ + void setParameterType(VMParameterType value); + + /** + * @return The Assembly Of The Parameter,It`s Useful For Dotnet + */ + String getAssembly(); + + /** + * @param value The Assembly Of The Parameter,It`s Useful For Dotnet + */ + void setAssembly(String value); + + /** + * @return The Class Name Of The Parameter Type + */ + String getClassName(); + + /** + * @param value The Class Name Of The Parameter Type + */ + void setClassName(String value); + + /** + * @return The Parameter Mode Of The Parameter,The Default Value Is In + */ + VMParameterMode getMode(); + + /** + * @param value The Parameter Mode Of The Parameter,The Default Value Is In + */ + void setMode(VMParameterMode value); + + /** + * @return The Description Of The Parameter + */ + String getParamDescription(); + + /** + * @param value The Description Of The Parameter + */ + void setParamDescription(String value); + + /** + * @return The Collection Type Of The Parameter + */ + VMCollectionParameterType getCollectionParameterType(); + + /** + * @param value The Collection Type Of The Parameter + */ + void setCollectionParameterType(VMCollectionParameterType value); + + /** + * @return The Actual Value Of The Parameter,It`s Not Required + */ + ViewModelParActualValue getActualValue(); + + /** + * @param value The Actual Value Of The Parameter,It`s Not Required + */ + void setActualValue(ViewModelParActualValue value); +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameterCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameterCollection.java index 37b5d3d..238dfae 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameterCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameterCollection.java @@ -13,15 +13,16 @@ import java.util.List; */ public interface IViewModelParameterCollection extends List { - /** - * @return The Parameters Count In The Collection - */ - int getCount(); + /** + * @return The Parameters Count In The Collection + */ + int getCount(); - /** - * Get A Parameter With The Input Index - * @param index The Parameter To Get - * @return The Got Parameter - */ - T getItem(int index); -} \ No newline at end of file + /** + * Get A Parameter With The Input Index + * + * @param index The Parameter To Get + * @return The Got Parameter + */ + T getItem(int index); +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpActionBase.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpActionBase.java index bbe628f..1c13bc8 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpActionBase.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpActionBase.java @@ -56,7 +56,7 @@ public abstract class MappedCdpActionBase extends ViewModelAction implements Ser @Override public boolean equals(ViewModelAction other) { - MappedCdpActionBase cdpAction = (MappedCdpActionBase)((other instanceof MappedCdpActionBase) ? other : null); + MappedCdpActionBase cdpAction = (MappedCdpActionBase) ((other instanceof MappedCdpActionBase) ? other : null); if (cdpAction == null) { return false; } @@ -76,4 +76,4 @@ public abstract class MappedCdpActionBase extends ViewModelAction implements Ser public String toString() { return String.format("[VM action] ID:%1$s, Code:%2$s, Name:%3$s", getID(), getCode(), getName()); } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/VMActionResult.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/VMActionResult.java index b290b38..dfca859 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/VMActionResult.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/VMActionResult.java @@ -25,7 +25,6 @@ public class VMActionResult implements Cloneable, Serializable { privateTypeName = value; } - /** * 克隆 * @@ -39,9 +38,8 @@ public class VMActionResult implements Cloneable, Serializable { } catch (CloneNotSupportedException e) { e.printStackTrace(); } - VMActionResult obj = (VMActionResult)((tempVar instanceof ActionFormatParameter) ? tempVar : null); - + VMActionResult obj = (VMActionResult) ((tempVar instanceof ActionFormatParameter) ? tempVar : null); return obj; } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelAction.java index 2e4be93..1bfe5a5 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelAction.java @@ -173,7 +173,7 @@ public abstract class ViewModelAction implements Cloneable, Serializable { if (obj.getClass() != getClass()) { return false; } - return equals((ViewModelAction)obj); + return equals((ViewModelAction) obj); } /** @@ -186,8 +186,8 @@ public abstract class ViewModelAction implements Cloneable, Serializable { } if (getID().equals(other.getID()) && getCode().equals(other.getCode()) && getName() - .equals(other.getName()) && getType() == other.getType() && getMapping() - .equals(other.getMapping()) && getComponentName().equals(other.getComponentName())) { + .equals(other.getName()) && getType() == other.getType() && getMapping() + .equals(other.getMapping()) && getComponentName().equals(other.getComponentName())) { return true; } @@ -207,7 +207,7 @@ public abstract class ViewModelAction implements Cloneable, Serializable { hashCode = (hashCode * 397) ^ (getReturnValue() != null ? getReturnValue().hashCode() : 0); hashCode = (hashCode * 397) ^ getType().getValue(); hashCode = - (hashCode * 397) ^ (getComponentName() != null ? getComponentName().hashCode() : 0); + (hashCode * 397) ^ (getComponentName() != null ? getComponentName().hashCode() : 0); hashCode = (hashCode * 397) ^ (getMapping() != null ? getMapping().hashCode() : 0); return hashCode; @@ -222,6 +222,6 @@ public abstract class ViewModelAction implements Cloneable, Serializable { @Override public String toString() { return String - .format("[VM BizAction] ID:%1$s,Code:%2$s,Name:%3$s", getID(), getCode(), getName()); + .format("[VM BizAction] ID:%1$s,Code:%2$s,Name:%3$s", getID(), getCode(), getName()); } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelActionType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelActionType.java index e693acf..6db0574 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelActionType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelActionType.java @@ -8,33 +8,25 @@ package org.openatom.ubml.model.vo.definition.action; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public enum ViewModelActionType -{ - /** - BE 的业务操作 - - */ - BEAction, +public enum ViewModelActionType { + /** + * BE 的业务操作 + */ + BEAction, + /** + * VM 操作 + */ + VMAction, + /** + * 自定义操作 + */ + Custom; - /** - VM 操作 - - */ - VMAction, + public int getValue() { + return this.ordinal(); + } - /** - 自定义操作 - - */ - Custom; - - public int getValue() - { - return this.ordinal(); - } - - public static ViewModelActionType forValue(int value) - { - return values()[value]; - } -} \ No newline at end of file + public static ViewModelActionType forValue(int value) { + return values()[value]; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetMappingAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangeSetMappingAction.java similarity index 31% rename from model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetMappingAction.java rename to model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangeSetMappingAction.java index 80df087..b667c4d 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetMappingAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangeSetMappingAction.java @@ -3,22 +3,21 @@ package org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; /** - * The Definition Of Changeset Mapping Action + * The Definition Of ChangeSet Mapping Action * - * @ClassName: ChangesetMappingAction + * @ClassName: ChangeSetMappingAction * @Author: Benjamin Gong * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class ChangesetMappingAction extends MappedCdpAction implements IInternalExtendAction -{ - public static final String id = "5798f884-c222-47f4-8bbe-685c7013dee4"; - public static final String code = "ChangesetMapping"; - public static final String name = "内置变更集Mapping操作"; - public ChangesetMappingAction() - { - setID(id); - setCode(code); - setName(name); - } -} \ No newline at end of file +public class ChangeSetMappingAction extends MappedCdpAction implements IInternalExtendAction { + public static final String id = "5798f884-c222-47f4-8bbe-685c7013dee4"; + public static final String code = "ChangeSetMapping"; + public static final String name = "内置变更集Mapping操作"; + + public ChangeSetMappingAction() { + setID(id); + setCode(code); + setName(name); + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangeSetReversalMappingAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangeSetReversalMappingAction.java new file mode 100644 index 0000000..84c7b49 --- /dev/null +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangeSetReversalMappingAction.java @@ -0,0 +1,23 @@ +package org.openatom.ubml.model.vo.definition.action.internalexternalaction; + +import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; + +/** + * The Definition Of ChangeSet Reversal Mapping Action + * + * @ClassName: ChangeSetReversalMappingAction + * @Author: Benjamin Gong + * @Date: 2021/1/11 17:13 + * @Version: V1.0 + */ +public class ChangeSetReversalMappingAction extends MappedCdpAction implements IInternalExtendAction { + public static final String id = "301c5991-a32d-4221-88bf-8c9d07bdd884"; + public static final String code = "ChangeSetReversalMapping"; + public static final String name = "内置变更集反向Mapping操作"; + + public ChangeSetReversalMappingAction() { + setID(id); + setCode(code); + setName(name); + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetReversalMappingAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetReversalMappingAction.java deleted file mode 100644 index 6240363..0000000 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetReversalMappingAction.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.openatom.ubml.model.vo.definition.action.internalexternalaction; - -import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; - -/** - * The Definition Of Changeset Reversal Mapping Action - * - * @ClassName: ChangesetReversalMappingAction - * @Author: Benjamin Gong - * @Date: 2021/1/11 17:13 - * @Version: V1.0 - */ -public class ChangesetReversalMappingAction extends MappedCdpAction implements IInternalExtendAction -{ - public static final String id = "301c5991-a32d-4221-88bf-8c9d07bdd884"; - public static final String code = "ChangesetReversalMapping"; - public static final String name = "内置变更集反向Mapping操作"; - public ChangesetReversalMappingAction() - { - setID(id); - setCode(code); - setName(name); - } -} \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/CreateAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/CreateAction.java index 9784229..29a6186 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/CreateAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/CreateAction.java @@ -10,15 +10,14 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class CreateAction extends MappedCdpAction implements IInternalExtendAction -{ - public static final String id = "52479451-8e22-4751-8684-80489ce5786b"; - public static final String code = "Create"; - public static final String name = "内置新增数据操作"; - public CreateAction() - { - setID(id); - setCode(code); - setName(name); - } -} \ No newline at end of file +public class CreateAction extends MappedCdpAction implements IInternalExtendAction { + public static final String id = "52479451-8e22-4751-8684-80489ce5786b"; + public static final String code = "Create"; + public static final String name = "内置新增数据操作"; + + public CreateAction() { + setID(id); + setCode(code); + setName(name); + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataMappingAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataMappingAction.java index 0f97672..e9bd1f1 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataMappingAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataMappingAction.java @@ -1,6 +1,7 @@ package org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; + /** * The Definition Of Data Mapping Action * @@ -9,15 +10,14 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class DataMappingAction extends MappedCdpAction implements IInternalExtendAction -{ - public static final String id = "42221ca3-9ee4-40af-89d2-ff4c8b466ac3"; - public static final String code = "DataMapping"; - public static final String name = "内置数据Mapping操作"; - public DataMappingAction() - { - setID(id); - setCode(code); - setName(name); - } -} \ No newline at end of file +public class DataMappingAction extends MappedCdpAction implements IInternalExtendAction { + public static final String id = "42221ca3-9ee4-40af-89d2-ff4c8b466ac3"; + public static final String code = "DataMapping"; + public static final String name = "内置数据Mapping操作"; + + public DataMappingAction() { + setID(id); + setCode(code); + setName(name); + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataReversalMappingAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataReversalMappingAction.java index e040827..3ed7219 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataReversalMappingAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataReversalMappingAction.java @@ -1,6 +1,7 @@ package org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; + /** * The Definition Of Data Reversal Mapping Action * @@ -9,15 +10,14 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class DataReversalMappingAction extends MappedCdpAction implements IInternalExtendAction -{ - public static final String id = "991bf216-f55b-40bf-bb42-1b831b6ef3e9"; - public static final String code = "DataReversalMapping"; - public static final String name = "内置数据反向Mapping操作"; - public DataReversalMappingAction() - { - setID(id); - setCode(code); - setName(name); - } -} \ No newline at end of file +public class DataReversalMappingAction extends MappedCdpAction implements IInternalExtendAction { + public static final String id = "991bf216-f55b-40bf-bb42-1b831b6ef3e9"; + public static final String code = "DataReversalMapping"; + public static final String name = "内置数据反向Mapping操作"; + + public DataReversalMappingAction() { + setID(id); + setCode(code); + setName(name); + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DeleteAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DeleteAction.java index feb2d55..b1285af 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DeleteAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DeleteAction.java @@ -1,6 +1,7 @@ package org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; + /** * The Definition Of Delete Action * @@ -9,15 +10,14 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class DeleteAction extends MappedCdpAction implements IInternalExtendAction -{ - public static final String id = "9a17e935-7366-489d-b110-0ae103e5648e"; - public static final String code= "Delete"; - public static final String name = "内置删除操作"; - public DeleteAction() - { - setID(id); - setCode(code); - setName(name); - } -} \ No newline at end of file +public class DeleteAction extends MappedCdpAction implements IInternalExtendAction { + public static final String id = "9a17e935-7366-489d-b110-0ae103e5648e"; + public static final String code = "Delete"; + public static final String name = "内置删除操作"; + + public DeleteAction() { + setID(id); + setCode(code); + setName(name); + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/IInternalExtendAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/IInternalExtendAction.java index 675ef85..aa0217f 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/IInternalExtendAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/IInternalExtendAction.java @@ -8,6 +8,5 @@ package org.openatom.ubml.model.vo.definition.action.internalexternalaction; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public interface IInternalExtendAction -{ -} \ No newline at end of file +public interface IInternalExtendAction { +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ModifyAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ModifyAction.java index 7468eb8..e6a2e3e 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ModifyAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ModifyAction.java @@ -1,6 +1,7 @@ package org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; + /** * The Definition Of Modify Action * @@ -9,16 +10,15 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class ModifyAction extends MappedCdpAction implements IInternalExtendAction -{ - public static final String id = "47dd3752-72a3-4c56-81c0-ae8ccfe5eb98"; - public static final String code = "Modify"; - public static final String name = "内置修改操作"; - public ModifyAction() - { - setID(id); - setCode(code); - setName(name); - } +public class ModifyAction extends MappedCdpAction implements IInternalExtendAction { + public static final String id = "47dd3752-72a3-4c56-81c0-ae8ccfe5eb98"; + public static final String code = "Modify"; + public static final String name = "内置修改操作"; + + public ModifyAction() { + setID(id); + setCode(code); + setName(name); + } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/MultiDeleteAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/MultiDeleteAction.java index b66d876..054289d 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/MultiDeleteAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/MultiDeleteAction.java @@ -1,20 +1,21 @@ package org.openatom.ubml.model.vo.definition.action.internalexternalaction; + import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; /** - * The Definition Of Mutly Delete Action + * The Definition Of Multi Delete Action * * @ClassName: MultiDeleteAction * @Author: Benjamin Gong * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class MultiDeleteAction extends MappedCdpAction implements IInternalExtendAction{ +public class MultiDeleteAction extends MappedCdpAction implements IInternalExtendAction { public static final String id = "7b1c3c4l-t1a4-4dyc-b75b-7695hcb3we7e"; - public static final String code= "MultiDelete"; + public static final String code = "MultiDelete"; public static final String name = "内置批量删除操作"; - public MultiDeleteAction() - { + + public MultiDeleteAction() { setID(id); setCode(code); setName(name); diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/QueryAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/QueryAction.java index 2736415..0201e77 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/QueryAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/QueryAction.java @@ -10,16 +10,15 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class QueryAction extends MappedCdpAction implements IInternalExtendAction -{ - public static final String id = "6fe68bfa-7c1b-4d6b-a7ef-14654168ae75"; - public static final String code = "Query"; - public static final String name = "内置查询操作"; - public QueryAction() - { - setID(id); - setCode(code); - setName(name); - } +public class QueryAction extends MappedCdpAction implements IInternalExtendAction { + public static final String id = "6fe68bfa-7c1b-4d6b-a7ef-14654168ae75"; + public static final String code = "Query"; + public static final String name = "内置查询操作"; -} \ No newline at end of file + public QueryAction() { + setID(id); + setCode(code); + setName(name); + } + +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/RetrieveAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/RetrieveAction.java index ffc3dce..677654c 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/RetrieveAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/RetrieveAction.java @@ -10,15 +10,14 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class RetrieveAction extends MappedCdpAction implements IInternalExtendAction -{ - public static final String id = "7a02f472-5bbd-424b-9d9e-f82e3f9f448e"; - public static final String code = "Retrieve"; - public static final String name = "内置检索操作"; - public RetrieveAction() - { - setID(id); - setCode(code); - setName(name); - } -} \ No newline at end of file +public class RetrieveAction extends MappedCdpAction implements IInternalExtendAction { + public static final String id = "7a02f472-5bbd-424b-9d9e-f82e3f9f448e"; + public static final String code = "Retrieve"; + public static final String name = "内置检索操作"; + + public RetrieveAction() { + setID(id); + setCode(code); + setName(name); + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameter.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameter.java index 0361f35..cab0d4e 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameter.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameter.java @@ -10,10 +10,8 @@ import org.openatom.ubml.model.vo.definition.action.viewmodelbase.ViewModelParam * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class MappedBizActionParameter extends ViewModelParameter -{ - public MappedBizActionParameter() - { +public class MappedBizActionParameter extends ViewModelParameter { + public MappedBizActionParameter() { - } -} \ No newline at end of file + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameterCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameterCollection.java index 4cdfc71..3f46f2c 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameterCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameterCollection.java @@ -10,10 +10,8 @@ import org.openatom.ubml.model.vo.definition.action.viewmodelbase.ViewModelParam * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class MappedBizActionParameterCollection extends ViewModelParameterCollection -{ - public MappedBizActionParameterCollection() - { +public class MappedBizActionParameterCollection extends ViewModelParameterCollection { + public MappedBizActionParameterCollection() { - } -} \ No newline at end of file + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameter.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameter.java index e103cf6..6412337 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameter.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameter.java @@ -10,9 +10,7 @@ import org.openatom.ubml.model.vo.definition.action.viewmodelbase.ViewModelParam * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class MappedCdpActionParameter extends ViewModelParameter -{ - public MappedCdpActionParameter() - { - } -} \ No newline at end of file +public class MappedCdpActionParameter extends ViewModelParameter { + public MappedCdpActionParameter() { + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameterCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameterCollection.java index fbc4127..3a9242a 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameterCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameterCollection.java @@ -10,9 +10,7 @@ import org.openatom.ubml.model.vo.definition.action.viewmodelbase.ViewModelParam * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class MappedCdpActionParameterCollection extends ViewModelParameterCollection -{ - public MappedCdpActionParameterCollection() - { - } -} \ No newline at end of file +public class MappedCdpActionParameterCollection extends ViewModelParameterCollection { + public MappedCdpActionParameterCollection() { + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValue.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValue.java index 0f76497..3389831 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValue.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValue.java @@ -1,49 +1,48 @@ package org.openatom.ubml.model.vo.definition.action.viewmodelbase; - import com.fasterxml.jackson.annotation.JsonProperty; /** - * The Definition Of View Model Parameter Action Value.In A View Model Action,The Parameter Value From The Component Can Be Transfer From Outer Invoke Or Fixed - * When The Value Is Fixed, The Actual Value Is Required. + * The Definition Of View Model Parameter Action Value.In A View Model Action,The Parameter Value From The Component Can + * Be Transfer From Outer Invoke Or Fixed When The Value Is Fixed, The Actual Value Is Required. * * @ClassName: ViewModelParActualValue * @Author: Benjamin Gong * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class ViewModelParActualValue { +public class ViewModelParActualValue { - private String value = ""; + private String value = ""; - @JsonProperty("Value") - public String getValue() { - return value; - } + @JsonProperty("Value") + public String getValue() { + return value; + } - public void setValue(String value) { - this.value = value; - } + public void setValue(String value) { + this.value = value; + } - private boolean hasValue = false; + private boolean hasValue = false; - @JsonProperty("HasValue") - public boolean getHasValue() { - return hasValue; - } + @JsonProperty("HasValue") + public boolean getHasValue() { + return hasValue; + } - public void setHasValue(boolean value) { - hasValue = value; - } + public void setHasValue(boolean value) { + hasValue = value; + } - private ViewModelParActualValueType valueType = ViewModelParActualValueType.Constant; + private ViewModelParActualValueType valueType = ViewModelParActualValueType.Constant; - @JsonProperty("ValueType") - public ViewModelParActualValueType getValueType() { - return valueType; - } + @JsonProperty("ValueType") + public ViewModelParActualValueType getValueType() { + return valueType; + } - public void setValueType(ViewModelParActualValueType value) { - this.valueType = value; - } -} \ No newline at end of file + public void setValueType(ViewModelParActualValueType value) { + this.valueType = value; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValueType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValueType.java index a53c6f2..c4ff944 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValueType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValueType.java @@ -9,15 +9,24 @@ package org.openatom.ubml.model.vo.definition.action.viewmodelbase; * @Version: V1.0 */ public enum ViewModelParActualValueType { - Constant,//常量 - Expression, //表达式 - Variable;//vo变量 + /** + * 常量 + */ + Constant, + /** + * 表达式 + */ + Expression, + /** + * vo变量 + */ + Variable; - public int getValue() { - return this.ordinal(); - } + public int getValue() { + return this.ordinal(); + } - public static ViewModelParActualValueType forValue(int value) { - return values()[value]; - } -} \ No newline at end of file + public static ViewModelParActualValueType forValue(int value) { + return values()[value]; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameter.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameter.java index 1f8a51d..c8a3f7b 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameter.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameter.java @@ -1,6 +1,5 @@ package org.openatom.ubml.model.vo.definition.action.viewmodelbase; - import org.openatom.ubml.model.vo.definition.action.IViewModelParameter; import org.openatom.ubml.model.vo.definition.common.VMCollectionParameterType; import org.openatom.ubml.model.vo.definition.common.VMParameterMode; @@ -140,14 +139,15 @@ public abstract class ViewModelParameter implements IViewModelParameter { } private ViewModelParActualValue actualValue; - public ViewModelParActualValue getActualValue(){ - if(actualValue == null){ + + public ViewModelParActualValue getActualValue() { + if (actualValue == null) { actualValue = new ViewModelParActualValue(); } return actualValue; } - public void setActualValue(ViewModelParActualValue value){ + public void setActualValue(ViewModelParActualValue value) { actualValue = value; } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameterCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameterCollection.java index dc18265..18c4156 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameterCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameterCollection.java @@ -15,6 +15,6 @@ import org.openatom.ubml.model.vo.definition.action.IViewModelParameterCollectio public class ViewModelParameterCollection extends BaseList implements IViewModelParameterCollection { - public ViewModelParameterCollection() { - } -} \ No newline at end of file + public ViewModelParameterCollection() { + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelReturnValue.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelReturnValue.java index 63a6605..dc202ce 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelReturnValue.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelReturnValue.java @@ -1,7 +1,5 @@ package org.openatom.ubml.model.vo.definition.action.viewmodelbase; - - import org.openatom.ubml.model.vo.definition.common.VMParameterMode; /** @@ -12,32 +10,29 @@ import org.openatom.ubml.model.vo.definition.common.VMParameterMode; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class ViewModelReturnValue extends ViewModelParameter -{ - /** - 参数名 - - */ - @Override - public String getParamName(){ - return null; - } - @Override - public void setParamName(String value) - { +public class ViewModelReturnValue extends ViewModelParameter { + /** + * 参数名 + */ + @Override + public String getParamName() { + return null; + } + + @Override + public void setParamName(String value) { + + } - } + /** + * 参数模式 + */ + @Override + public VMParameterMode getMode() { + return VMParameterMode.OUT; + } - /** - 参数模式 - - */ - @Override - public VMParameterMode getMode(){ - return VMParameterMode.OUT; - } - @Override - public void setMode(VMParameterMode value) - { - } -} \ No newline at end of file + @Override + public void setMode(VMParameterMode value) { + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelVoidReturnValue.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelVoidReturnValue.java index 86a8e90..777bfe5 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelVoidReturnValue.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelVoidReturnValue.java @@ -1,7 +1,5 @@ package org.openatom.ubml.model.vo.definition.action.viewmodelbase; - - import org.openatom.ubml.model.vo.definition.common.VMParameterType; /** @@ -12,51 +10,44 @@ import org.openatom.ubml.model.vo.definition.common.VMParameterType; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class ViewModelVoidReturnValue extends ViewModelReturnValue -{ - public static final String assembly = "mscorlib.dll"; - public static final String className = "Void"; - - /** - 参数类对应程序集类 - - */ - @Override - public String getAssembly(){ - return assembly; - } - - @Override - public void setAssembly(String value) - { - } - - /** - 参数类名 - - */ - @Override - public String getClassName(){ - return className; - } - - @Override - public void setClassName(String value) - { - } - - /** - 参数类型,与Assembly和ClassName关联 - - */ - @Override - public VMParameterType getParameterType() - { - return VMParameterType.Custom; - - } - @Override - public void setParameterType(VMParameterType value) - { - } -} \ No newline at end of file +public class ViewModelVoidReturnValue extends ViewModelReturnValue { + public static final String assembly = "mscorlib.dll"; + public static final String className = "Void"; + + /** + * 参数类对应程序集类 + */ + @Override + public String getAssembly() { + return assembly; + } + + @Override + public void setAssembly(String value) { + } + + /** + * 参数类名 + */ + @Override + public String getClassName() { + return className; + } + + @Override + public void setClassName(String value) { + } + + /** + * 参数类型,与Assembly和ClassName关联 + */ + @Override + public VMParameterType getParameterType() { + return VMParameterType.Custom; + + } + + @Override + public void setParameterType(VMParameterType value) { + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMActionCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMActionCollection.java index 8b9e983..6cea50c 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMActionCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMActionCollection.java @@ -21,7 +21,6 @@ public class VMActionCollection extends BaseList implements Clo * @return 操作 */ public final ViewModelAction getItem(String id) { -// return this.FirstOrDefault(i => id.equals(i.ID)); for (ViewModelAction item : this) { if (item.getID().equals(id)) { return item; @@ -30,7 +29,6 @@ public class VMActionCollection extends BaseList implements Clo return null; } - /** * 克隆 * @@ -41,7 +39,7 @@ public class VMActionCollection extends BaseList implements Clo VMActionCollection collections = new VMActionCollection(); for (ViewModelAction op : this) { ViewModelAction tempVar = op.clone(); - collections.add((ViewModelAction)((tempVar instanceof ViewModelAction) ? tempVar : null)); + collections.add((ViewModelAction) tempVar); } return collections; @@ -58,15 +56,11 @@ public class VMActionCollection extends BaseList implements Clo if (obj == null) { return false; } - // if (obj.equals(this)) - //{ - //return true; - //} if (obj.getClass() != getClass()) { return false; } - return equals((VMActionCollection)obj); + return equals((VMActionCollection) obj); } /** @@ -76,7 +70,6 @@ public class VMActionCollection extends BaseList implements Clo * @return 如果当前对象等于 other 参数,则为 true;否则为 false。 */ protected boolean equals(VMActionCollection other) { -// if (Count != other.size()) if (this.size() != other.size()) { return false; } @@ -98,7 +91,7 @@ public class VMActionCollection extends BaseList implements Clo if (action == null) { return false; } - String id = ((ViewModelAction)action).getID(); + String id = ((ViewModelAction) action).getID(); if (id == null) { return false; } @@ -113,9 +106,9 @@ public class VMActionCollection extends BaseList implements Clo return false; } super.removeIf(item -> - actionId.equals(item.getID()) + actionId.equals(item.getID()) ); return true; } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMElementCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMElementCollection.java index eff9718..235e372 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMElementCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMElementCollection.java @@ -25,27 +25,22 @@ public class VMElementCollection extends GspElementCollection implements Seriali super(owner); } - - ///属性 - /** * 根据ID获取节点元素 * * @param id 节点元素ID * @return 节点元素 */ - @Override//不能override final的類 + @Override public final GspViewModelElement getItem(String id) { for (IGspCommonField item : this) { if (item instanceof GspViewModelElement) { - return (GspViewModelElement)item; + return (GspViewModelElement) item; } } return null; } - - /** * 重载Equals方法 * @@ -57,15 +52,10 @@ public class VMElementCollection extends GspElementCollection implements Seriali if (obj == null) { return false; } - // if (obj.equals(this)) - //{ - //return true; - //} if (obj.getClass() != getClass()) { return false; } - - return equals((VMElementCollection)obj); + return equals((VMElementCollection) obj); } /** @@ -87,7 +77,6 @@ public class VMElementCollection extends GspElementCollection implements Seriali return false; } } - return true; } @@ -97,14 +86,13 @@ public class VMElementCollection extends GspElementCollection implements Seriali * @return VO节点元素集合 */ @Override - public final VMElementCollection clone() { + public final VMElementCollection clone() { VMElementCollection collections; - collections = new VMElementCollection((GspViewObject)getParentObject()); + collections = new VMElementCollection((GspViewObject) getParentObject()); for (IGspCommonField item : this) { - GspViewModelElement obj = ((GspViewModelElement)item).clone(); - GspViewModelElement tempVar = ((obj instanceof GspViewModelElement) ? obj : null); + GspViewModelElement tempVar = ((GspViewModelElement) item).clone(); collections.add(tempVar); } return collections; } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ValueHelpConfigCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ValueHelpConfigCollection.java index aa01cd2..8976e7a 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ValueHelpConfigCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ValueHelpConfigCollection.java @@ -21,7 +21,6 @@ public class ValueHelpConfigCollection extends BaseList impleme super(); } - /** * 获取指定ID的值帮助配置 * @@ -35,10 +34,8 @@ public class ValueHelpConfigCollection extends BaseList impleme } } return null; -// return Items.firstOrDefault(i => elementId.equals(i.ElementId)); } - /** * 批量添加值帮助配置 * @@ -46,7 +43,7 @@ public class ValueHelpConfigCollection extends BaseList impleme */ public final void addRange(ValueHelpConfig[] items) { for (ValueHelpConfig item : items) { - add(item); + super.add(item); } } @@ -69,12 +66,10 @@ public class ValueHelpConfigCollection extends BaseList impleme @Override public final ValueHelpConfigCollection clone() { ValueHelpConfigCollection newCollection = new ValueHelpConfigCollection(); - for (ValueHelpConfig item : this) { - add(item); + super.add(item); } - return newCollection; } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ViewObjectCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ViewObjectCollection.java index 3c853ca..a773a31 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ViewObjectCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ViewObjectCollection.java @@ -13,122 +13,102 @@ import org.openatom.ubml.model.vo.definition.GspViewObject; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class ViewObjectCollection extends GspObjectCollection implements Serializable -{ - /** - 结点集合构造函数 - - @param parentObject 父节点 - */ -// public ViewObjectCollection(IGSPCommonObject parentObject) - public ViewObjectCollection(IGspCommonObject parentObject) - { - super(parentObject); - } +public class ViewObjectCollection extends GspObjectCollection implements Serializable { + /** + * 结点集合构造函数 + * + * @param parentObject 父节点 + */ + public ViewObjectCollection(IGspCommonObject parentObject) { + super(parentObject); + } - /** - 根据ID获取节点 - - @param id 节点ID - @return 节点 - */ - public final GspViewObject getItem(String id) - { -// Object tempVar = this.FirstOrDefault(i => id.equals(i.ID)); - for ( IGspCommonObject item : this){ - if(item.getID().equals(id)){ - IGspCommonObject tempVar=item; - return (GspViewObject)((tempVar instanceof GspViewObject) ? tempVar : null); - } - } - return null; + /** + * 根据ID获取节点 + * + * @param id 节点ID + * @return 节点 + */ + public final GspViewObject getItem(String id) { + for (IGspCommonObject item : this) { + if (item.getID().equals(id)) { + return (GspViewObject) ((item instanceof GspViewObject) ? item : null); + } + } + return null; + } - } + /** + * 重载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; + } - /** - 重载Equals方法 - - @param obj 要比较的对象 - @return 如果当前对象等于 other 参数,则为 true;否则为 false。 - */ - @Override - public boolean equals(Object obj) - { - if ( obj.equals(null)) - { - return false; - } - if ( obj.equals(this)) - { - return true; - } - if (obj.getClass() != getClass()) - { - return false; - } + return equals((ViewObjectCollection) obj); + } - return equals((ViewObjectCollection)obj); - } + /** + * 获取HashCode + * + * @return hashCode + */ + @Override + public int hashCode() { + return super.hashCode(); + } - /** - 获取HashCode - - @return hashCode - */ - @Override - public int hashCode() - { - return super.hashCode(); - } + /** + * 当前对象是否等于同一类型的另一个对象。 + * + * @param other 与此对象进行比较的对象。 + * @return 如果当前对象等于 other 参数,则为 true;否则为 false。 + */ + protected boolean equals(ViewObjectCollection other) { + if (this.size() != other.size()) { + return false; + } + for (IGspCommonObject item : this) { + IGspCommonObject otherItem = other.getItem(item.getID()); + if (otherItem == null) { + return false; + } + if (!item.equals(otherItem)) { + return false; + } + } + return true; + } - /** - 当前对象是否等于同一类型的另一个对象。 - - @param other 与此对象进行比较的对象。 - @return 如果当前对象等于 other 参数,则为 true;否则为 false。 - */ - protected boolean equals(ViewObjectCollection other) - { -// if (Count != other.size()) - if (this.size() != other.size()) - { - return false; - } -// for (var item : this) - for (IGspCommonObject item : this) - { - IGspCommonObject otherItem = other.getItem(item.getID()); - if (otherItem == null) - { - return false; - } - if (!item.equals(otherItem)) - { - return false; - } - } + /** + * 克隆 + * + * @return VO节点元素集合 + */ + public final ViewObjectCollection clone() { + ViewObjectCollection collections = new ViewObjectCollection(getParentObject()); + for (IGspCommonObject node : this) { + if (node == null) { + collections.add(null); + } else { + if (node instanceof GspViewObject) { + collections.add(((GspViewObject) node).clone()); + } + } - return true; - } + } + return collections; + } - /** - 克隆 - - @return VO节点元素集合 - */ -// public final Object clone() - public final ViewObjectCollection clone() - { -// ViewObjectCollection collections = new ViewObjectCollection(ParentObject); - ViewObjectCollection collections = new ViewObjectCollection(getParentObject()); -// for (var node : this) - for (IGspCommonObject node : this) - { - Object tempVar = ((GspViewObject)((node instanceof GspViewObject) ? node : null)).clone(); - collections.add((GspViewObject)((tempVar instanceof GspViewObject) ? tempVar : null)); - } - - return collections; - } - -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ElementHelpType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ElementHelpType.java index 5a64d3c..2cf6476 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ElementHelpType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ElementHelpType.java @@ -8,40 +8,37 @@ package org.openatom.ubml.model.vo.definition.common; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public enum ElementHelpType -{ - /** 无 - */ - None(0), +public enum ElementHelpType { + /** + * 无 + */ + None(0), - /** 数据表帮助 - */ - SmartHelp(1); + /** + * 数据表帮助 + */ + SmartHelp(1); - private int intValue; - private static java.util.HashMap mappings; - private synchronized static java.util.HashMap getMappings() - { - if (mappings == null) - { - mappings = new java.util.HashMap(); - } - return mappings; - } + private int intValue; + private static java.util.HashMap mappings; - ElementHelpType(int value) - { - intValue = value; - ElementHelpType.getMappings().put(value, this); - } + private synchronized static java.util.HashMap getMappings() { + if (mappings == null) { + mappings = new java.util.HashMap(); + } + return mappings; + } - public int getValue() - { - return intValue; - } + ElementHelpType(int value) { + intValue = value; + ElementHelpType.getMappings().put(value, this); + } - public static ElementHelpType forValue(int value) - { - return getMappings().get(value); - } -} \ No newline at end of file + public int getValue() { + return intValue; + } + + public static ElementHelpType forValue(int value) { + return getMappings().get(value); + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/HelpExtendAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/HelpExtendAction.java index 3eab81c..4227225 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/HelpExtendAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/HelpExtendAction.java @@ -10,24 +10,21 @@ import org.openatom.ubml.model.vo.definition.collection.VMActionCollection; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class HelpExtendAction -{ - private VMActionCollection beforeHelp; - /** - 帮助前扩展 - - */ - public final VMActionCollection getBeforeHelp() - { - if (beforeHelp == null) - { - beforeHelp = new VMActionCollection(); - } - return beforeHelp; - } - public final void setBeforeHelp(VMActionCollection value) - { - beforeHelp = value; - } +public class HelpExtendAction { + private VMActionCollection beforeHelp; -} \ No newline at end of file + /** + * 帮助前扩展 + */ + public final VMActionCollection getBeforeHelp() { + if (beforeHelp == null) { + beforeHelp = new VMActionCollection(); + } + return beforeHelp; + } + + public final void setBeforeHelp(VMActionCollection value) { + beforeHelp = value; + } + +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InitVoUtil.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InitVoUtil.java index 27e1289..057af9c 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InitVoUtil.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InitVoUtil.java @@ -17,12 +17,14 @@ import org.openatom.ubml.model.vo.definition.GspViewObject; * @Version: V1.0 */ public final class InitVoUtil { - public static GspViewModel BuildVirtualVo(String metadataID, String metadataName, String metadataCode, String metadataAssembly) { + public static GspViewModel BuildVirtualVo(String metadataID, String metadataName, String metadataCode, + String metadataAssembly) { GspViewModel vo = InitVo(metadataID, metadataName, metadataCode, metadataAssembly, true); return vo; } - private static GspViewModel InitVo(String metadataID, String metadataName, String metadataCode, String metadataAssembly, boolean isVirtual) { + private static GspViewModel InitVo(String metadataID, String metadataName, String metadataCode, + String metadataAssembly, boolean isVirtual) { GspViewModel vo = new GspViewModel(); vo.setID(metadataID); vo.setCode(metadataCode); @@ -45,7 +47,7 @@ public final class InitVoUtil { mainObj.setID(Guid.newGuid().toString()); mainObj.setCode(objCode); mainObj.setName(objName); - GspColumnGenerate columnGenerate=new GspColumnGenerate(); + GspColumnGenerate columnGenerate = new GspColumnGenerate(); columnGenerate.setElementID(idElement.getID()); columnGenerate.setGenerateType("Guid"); mainObj.setColumnGenerateID(columnGenerate); @@ -69,7 +71,7 @@ public final class InitVoUtil { idElement.setLength(36); idElement.setPrecision(0); idElement.setIsRequire(true); - // voElemet + // voElement if (isVirtual) { idElement.setIsVirtual(true); idElement.setIsVirtualViewElement(true); @@ -78,4 +80,4 @@ public final class InitVoUtil { return idElement; } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InternalExtendActionUtil.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InternalExtendActionUtil.java index b4011d4..9519aab 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InternalExtendActionUtil.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InternalExtendActionUtil.java @@ -1,8 +1,8 @@ package org.openatom.ubml.model.vo.definition.common; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; -import org.openatom.ubml.model.vo.definition.action.internalexternalaction.ChangesetMappingAction; -import org.openatom.ubml.model.vo.definition.action.internalexternalaction.ChangesetReversalMappingAction; +import org.openatom.ubml.model.vo.definition.action.internalexternalaction.ChangeSetMappingAction; +import org.openatom.ubml.model.vo.definition.action.internalexternalaction.ChangeSetReversalMappingAction; import org.openatom.ubml.model.vo.definition.action.internalexternalaction.CreateAction; import org.openatom.ubml.model.vo.definition.action.internalexternalaction.DataMappingAction; import org.openatom.ubml.model.vo.definition.action.internalexternalaction.DataReversalMappingAction; @@ -57,13 +57,13 @@ public class InternalExtendActionUtil { case DataReversalMappingActionId: return new DataReversalMappingAction(); case ChangesetReversalMappingActionId: - return new ChangesetReversalMappingAction(); + return new ChangeSetReversalMappingAction(); case ChangesetMappingActionId: - return new ChangesetMappingAction(); + return new ChangeSetMappingAction(); case MultiDeleteActionId: return new MultiDeleteAction(); default: throw new RuntimeException(String.format("无id='%1$s'的内置扩展操作。", actionId)); } } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MappingType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MappingType.java index 5cd092d..5858344 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MappingType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MappingType.java @@ -8,76 +8,62 @@ package org.openatom.ubml.model.vo.definition.common; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public enum MappingType -{ - /** - Vo - - */ - ViewObject, +public enum MappingType { + /** + * Vo + */ + ViewObject, - /** - BE - - */ - BizEntity, + /** + * BE + */ + BizEntity, - /** - DM - - */ - DataModel, + /** + * DM + */ + DataModel, - /** - BE节点 - - */ - BEObject, + /** + * BE节点 + */ + BEObject, - /** - GspDataModel节点 - - */ - DMObject, + /** + * GspDataModel节点 + */ + DMObject, - /** - 节点元素 - - */ - Element, + /** + * 节点元素 + */ + Element, - /** - BE 操作 - - */ - BizOperation, + /** + * BE 操作 + */ + BizOperation, - /** - 构件方法 - - */ - ComponentMethod, + /** + * 构件方法 + */ + ComponentMethod, - /** - 数据对象 - - */ - DataObject, + /** + * 数据对象 + */ + DataObject, - /** - 数据对象列 - - */ - GSPColumn; + /** + * 数据对象列 + */ + GSPColumn; + public int getValue() { + return this.ordinal(); + } - public int getValue() - { - return this.ordinal(); - } - - public static MappingType forValue(int value) - { - return values()[value]; - } -} \ No newline at end of file + public static MappingType forValue(int value) { + return values()[value]; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MetadataType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MetadataType.java index a4e14bb..7f156be 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MetadataType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MetadataType.java @@ -8,27 +8,22 @@ package org.openatom.ubml.model.vo.definition.common; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public enum MetadataType -{ - /** - BE - - */ - BizEntity, +public enum MetadataType { + /** + * BE + */ + BizEntity, - /** - QO - - */ - QueryObject; + /** + * QO + */ + QueryObject; - public int getValue() - { - return this.ordinal(); - } + public int getValue() { + return this.ordinal(); + } - public static MetadataType forValue(int value) - { - return values()[value]; - } -} \ No newline at end of file + public static MetadataType forValue(int value) { + return values()[value]; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/TemplateVoInfo.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/TemplateVoInfo.java index 53c953f..2c5a1ea 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/TemplateVoInfo.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/TemplateVoInfo.java @@ -13,45 +13,45 @@ import org.openatom.ubml.model.vo.definition.json.ViewModelJsonConst; */ public class TemplateVoInfo { - private String templateVoServiceUnit; - - /** - * 模板VO信息 - */ - @JsonProperty(ViewModelJsonConst.TemplateVoServiceUnit) - public final String getTemplateVoServiceUnit() { - return templateVoServiceUnit; - } - - public void setTemplateVoServiceUnit(String value) { - this.templateVoServiceUnit = value; - } - - private String templateVoPkgName; - - /** - * 模板VO信息 - */ - @JsonProperty(ViewModelJsonConst.TemplateVoPkgName) - public final String getTemplateVoPkgName() { - return templateVoPkgName; - } - - public void setTemplateVoPkgName(String value) { - this.templateVoPkgName = value; - } - - private String templateVoId; - - /** - * 模板VO信息 - */ - @JsonProperty(ViewModelJsonConst.TemplateVoId) - public final String getTemplateVoId() { - return templateVoId; - } - - public void setTemplateVoId(String value) { - this.templateVoId = value; - } + private String templateVoServiceUnit; + + /** + * 模板VO信息 + */ + @JsonProperty(ViewModelJsonConst.TemplateVoServiceUnit) + public final String getTemplateVoServiceUnit() { + return templateVoServiceUnit; + } + + public void setTemplateVoServiceUnit(String value) { + this.templateVoServiceUnit = value; + } + + private String templateVoPkgName; + + /** + * 模板VO信息 + */ + @JsonProperty(ViewModelJsonConst.TemplateVoPkgName) + public final String getTemplateVoPkgName() { + return templateVoPkgName; + } + + public void setTemplateVoPkgName(String value) { + this.templateVoPkgName = value; + } + + private String templateVoId; + + /** + * 模板VO信息 + */ + @JsonProperty(ViewModelJsonConst.TemplateVoId) + public final String getTemplateVoId() { + return templateVoId; + } + + public void setTemplateVoId(String value) { + this.templateVoId = value; + } } diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMCollectionParameterType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMCollectionParameterType.java index dbb6fdc..ae05c7d 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMCollectionParameterType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMCollectionParameterType.java @@ -8,31 +8,25 @@ package org.openatom.ubml.model.vo.definition.common; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public enum VMCollectionParameterType -{ - /** - 未使用集合形式 - - */ - None, - /** - 列表 - - */ - List, - /** - 数组 - - */ - Array; +public enum VMCollectionParameterType { + /** + * 未使用集合形式 + */ + None, + /** + * 列表 + */ + List, + /** + * 数组 + */ + Array; - public int getValue() - { - return this.ordinal(); - } + public int getValue() { + return this.ordinal(); + } - public static VMCollectionParameterType forValue(int value) - { - return values()[value]; - } -} \ No newline at end of file + public static VMCollectionParameterType forValue(int value) { + return values()[value]; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMHelpConfig.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMHelpConfig.java index 93e0dfb..2845593 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMHelpConfig.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMHelpConfig.java @@ -8,23 +8,20 @@ package org.openatom.ubml.model.vo.definition.common; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class VMHelpConfig implements Cloneable -{ - private String helpId; - public final String getHelpId() - { - return helpId; - } - public final void setHelpId(String value) - { - helpId = value; - } +public class VMHelpConfig implements Cloneable { + private String helpId; -// public final Object clone() - public Object clone() - { - VMHelpConfig config = new VMHelpConfig(); - config.helpId = helpId; - return config; - } -} \ No newline at end of file + public final String getHelpId() { + return helpId; + } + + public final void setHelpId(String value) { + helpId = value; + } + + public Object clone() { + VMHelpConfig config = new VMHelpConfig(); + config.helpId = helpId; + return config; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterMode.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterMode.java index c61124d..8db884b 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterMode.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterMode.java @@ -8,31 +8,25 @@ package org.openatom.ubml.model.vo.definition.common; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public enum VMParameterMode -{ - /** - 传入参数 - - */ - IN, - /** - 传出参数 - - */ - OUT, - /** - 传入传出参数 - - */ - INOUT; +public enum VMParameterMode { + /** + * 传入参数 + */ + IN, + /** + * 传出参数 + */ + OUT, + /** + * 传入传出参数 + */ + INOUT; - public int getValue() - { - return this.ordinal(); - } + public int getValue() { + return this.ordinal(); + } - public static VMParameterMode forValue(int value) - { - return values()[value]; - } -} \ No newline at end of file + public static VMParameterMode forValue(int value) { + return values()[value]; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterType.java index c42f94e..66046c3 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterType.java @@ -8,39 +8,43 @@ package org.openatom.ubml.model.vo.definition.common; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public enum VMParameterType -{ - /**字符型 - */ - String, - /**布尔型 - */ - Boolean, - /**整数 - */ - Int32, - /**浮点数字 - */ - Decimal, - /**双浮点 - */ - Double, - /**时间 - */ - DateTime, - //对象类型 - Object, - /**自定义 - */ - Custom; +public enum VMParameterType { + /** + * 字符型 + */ + String, + /** + * 布尔型 + */ + Boolean, + /** + * 整数 + */ + Int32, + /** + * 浮点数字 + */ + Decimal, + /** + * 双浮点 + */ + Double, + /** + * 时间 + */ + DateTime, + //对象类型 + Object, + /** + * 自定义 + */ + Custom; - public int getValue() - { - return this.ordinal(); - } + public int getValue() { + return this.ordinal(); + } - public static VMParameterType forValue(int value) - { - return values()[value]; - } -} \ No newline at end of file + public static VMParameterType forValue(int value) { + return values()[value]; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ValueHelpConfig.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ValueHelpConfig.java index 0d939ec..6e2162c 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ValueHelpConfig.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ValueHelpConfig.java @@ -1,6 +1,5 @@ package org.openatom.ubml.model.vo.definition.common; - import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import java.io.Serializable; @@ -44,9 +43,9 @@ public class ValueHelpConfig implements Cloneable, Serializable { private CustomizationInfo customizationInfo; - - ///构造函数 - + /** + * constructor + */ public ValueHelpConfig() { } @@ -64,7 +63,6 @@ public class ValueHelpConfig implements Cloneable, Serializable { setFilterExpression(filterExpression); } - public final String getElementId() { return elementId; } @@ -132,8 +130,8 @@ public class ValueHelpConfig implements Cloneable, Serializable { } catch (CloneNotSupportedException e) { e.printStackTrace(); } - ValueHelpConfig obj = (ValueHelpConfig)((tempVar instanceof ValueHelpConfig) ? tempVar : null); + ValueHelpConfig obj = (ValueHelpConfig) ((tempVar instanceof ValueHelpConfig) ? tempVar : null); return obj; } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ViewModelMapping.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ViewModelMapping.java index e4a220a..8444bf3 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ViewModelMapping.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ViewModelMapping.java @@ -10,154 +10,133 @@ import java.io.Serializable; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class ViewModelMapping implements Cloneable, Serializable -{ - /** - 映射类型 - - */ - private MappingType privateMapType = MappingType.forValue(0); - public final MappingType getMapType() - { - return privateMapType; - } - public final void setMapType(MappingType value) - { - privateMapType = value; - } - - /** - 映射的对方元数据ContentId,用于唯一确定元数据 - - */ - private String privateTargetMetadataId; - public final String getTargetMetadataId() - { - return privateTargetMetadataId; - } - public final void setTargetMetadataId(String value) - { - privateTargetMetadataId = value; - } - - ///// - ///// 映射的对方元数据类型,BE或QO - ///// - //public MetadataType TargetMetadataType { get; set; } - - /** - 映射的对方元数据包名,用于唯一确定元数据 - - */ - private String privateTargetMetadataPkgName; - public final String getTargetMetadataPkgName() - { - return privateTargetMetadataPkgName; - } - public final void setTargetMetadataPkgName(String value) - { - privateTargetMetadataPkgName = value; - } - - /** - 映射的元素ID,用于确定具体的元数据成员 - - */ - private String privateTargetObjId; - public final String getTargetObjId() - { - return privateTargetObjId; - } - public final void setTargetObjId(String value) - { - privateTargetObjId = value; - } - - /** - 重载的相等运算符 - - @param other - @return - */ - protected final boolean equals(ViewModelMapping other) - { - return getMapType() == other.getMapType() && other.getTargetMetadataId().equals(getTargetMetadataId()) &&other.getTargetMetadataPkgName().equals(getTargetMetadataPkgName()) && other.getTargetObjId().equals(getTargetObjId()); - } - - /** - 重写相等判断 - - @param obj - @return - */ - @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((ViewModelMapping)obj); - } - - /** - 创建作为当前实例副本的新对象。 - - @return - 作为此实例副本的新对象。 - - 2 - */ - public Object clone() - { - try { - ViewModelMapping mapping = (ViewModelMapping)super.clone(); - return mapping; - } catch (CloneNotSupportedException e) { - return null; - } - } - - /** - 返回表示当前 。 - - @return - ,表示当前的 。 - - 2 - */ - @Override - public String toString() - { - return String.format("[MappingInfo]MapType: %1$s, TargetMetadataId: %2$s, TargetMetadataPkgName:%3$s, TargetObjId: %4$s", getMapType(), getTargetMetadataId(), getTargetMetadataPkgName(), getTargetObjId()); - } - - /** - 用作特定类型的哈希函数。 - - @return - 当前 的哈希代码。 - - 2 - */ - @Override - public int hashCode() - { -// unchecked - { - int hashCode = getMapType().getValue(); - hashCode = (hashCode * 397) ^ (getTargetMetadataId() != null ? getTargetMetadataId().hashCode() : 0); - hashCode = (hashCode * 397) ^ (getTargetMetadataPkgName() != null ? getTargetMetadataPkgName().hashCode() : 0); - hashCode = (hashCode * 397) ^ (getTargetObjId() != null ? getTargetObjId().hashCode() : 0); - return hashCode; - } - } -} \ No newline at end of file +public class ViewModelMapping implements Cloneable, Serializable { + /** + * 映射类型 + */ + private MappingType privateMapType = MappingType.forValue(0); + + public final MappingType getMapType() { + return privateMapType; + } + + public final void setMapType(MappingType value) { + privateMapType = value; + } + + /** + * 映射的对方元数据ContentId,用于唯一确定元数据 + */ + private String privateTargetMetadataId; + + public final String getTargetMetadataId() { + return privateTargetMetadataId; + } + + public final void setTargetMetadataId(String value) { + privateTargetMetadataId = value; + } + + ///// + ///// 映射的对方元数据类型,BE或QO + ///// + //public MetadataType TargetMetadataType { get; set; } + + /** + * 映射的对方元数据包名,用于唯一确定元数据 + */ + private String privateTargetMetadataPkgName; + + public final String getTargetMetadataPkgName() { + return privateTargetMetadataPkgName; + } + + public final void setTargetMetadataPkgName(String value) { + privateTargetMetadataPkgName = value; + } + + /** + * 映射的元素ID,用于确定具体的元数据成员 + */ + private String privateTargetObjId; + + public final String getTargetObjId() { + return privateTargetObjId; + } + + public final void setTargetObjId(String value) { + privateTargetObjId = value; + } + + /** + * 重载的相等运算符 + * + * @param other + * @return + */ + protected final boolean equals(ViewModelMapping other) { + return getMapType() == other.getMapType() && other.getTargetMetadataId().equals(getTargetMetadataId()) && other.getTargetMetadataPkgName().equals(getTargetMetadataPkgName()) && other.getTargetObjId().equals(getTargetObjId()); + } + + /** + * 重写相等判断 + * + * @param obj + * @return + */ + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (obj.getClass() != getClass()) { + return false; + } + return equals((ViewModelMapping) obj); + } + + /** + * 创建作为当前实例副本的新对象。 + * + * @return 作为此实例副本的新对象。 + * + * 2 + */ + public Object clone() { + try { + ViewModelMapping mapping = (ViewModelMapping) super.clone(); + return mapping; + } catch (CloneNotSupportedException e) { + return null; + } + } + + /** + * 返回表示当前 。 + * + * @return ,表示当前的 。 + * + * 2 + */ + @Override + public String toString() { + return String.format("[MappingInfo]MapType: %1$s, TargetMetadataId: %2$s, TargetMetadataPkgName:%3$s, TargetObjId: %4$s", getMapType(), getTargetMetadataId(), getTargetMetadataPkgName(), getTargetObjId()); + } + + /** + * 用作特定类型的哈希函数。 + * + * @return 当前 的哈希代码。 + * + * 2 + */ + @Override + public int hashCode() { + int hashCode = getMapType().getValue(); + hashCode = (hashCode * 397) ^ (getTargetMetadataId() != null ? getTargetMetadataId().hashCode() : 0); + hashCode = (hashCode * 397) ^ (getTargetMetadataPkgName() != null ? getTargetMetadataPkgName().hashCode() : 0); + hashCode = (hashCode * 397) ^ (getTargetObjId() != null ? getTargetObjId().hashCode() : 0); + return hashCode; + + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/copy/CopyContext.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/copy/CopyContext.java index bc93a5f..84f9eb7 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/copy/CopyContext.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/copy/CopyContext.java @@ -10,53 +10,48 @@ import org.openatom.ubml.model.vo.definition.GspViewModel; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class CopyContext -{ - /** - 源Vo - - */ - private GspViewModel privateOriginVo; - public final GspViewModel getOriginVo() - { - return privateOriginVo; - } - public final void setOriginVo(GspViewModel value) - { - - privateOriginVo = value; - } - - /** - 新Vo的元数据头节点 - - */ -// private MetadataHeader privateMetadataHeader; - private CopyContext privateMetadataHeader; - public final CopyContext getMetadataHeader() - { - - return privateMetadataHeader; - } - public final void setMetadataHeader(CopyContext value) - { - privateMetadataHeader = value; - } - - private boolean includeVoActions = false; - /** - 是否拷贝Vo操作 - - */ - boolean getIncludeVoActions(){ - return this.includeVoActions; - } - public final void setIncludeVoActions(boolean value) - { - if (value) - { - throw new RuntimeException("vo元数据拷贝暂不支持拷贝操作。"); - } - includeVoActions = value; - } -} \ No newline at end of file +public class CopyContext { + /** + * 源Vo + */ + private GspViewModel privateOriginVo; + + public final GspViewModel getOriginVo() { + return privateOriginVo; + } + + public final void setOriginVo(GspViewModel value) { + + privateOriginVo = value; + } + + /** + * 新Vo的元数据头节点 + */ + private CopyContext privateMetadataHeader; + + public final CopyContext getMetadataHeader() { + + return privateMetadataHeader; + } + + public final void setMetadataHeader(CopyContext value) { + privateMetadataHeader = value; + } + + private boolean includeVoActions = false; + + /** + * 是否拷贝Vo操作 + */ + boolean getIncludeVoActions() { + return this.includeVoActions; + } + + public final void setIncludeVoActions(boolean value) { + if (value) { + throw new RuntimeException("vo元数据拷贝暂不支持拷贝操作。"); + } + includeVoActions = value; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspQoObjectMapping.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspQoObjectMapping.java index 449989a..248b262 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspQoObjectMapping.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspQoObjectMapping.java @@ -1,25 +1,24 @@ package org.openatom.ubml.model.vo.definition.common.mapping; -public class GspQoObjectMapping extends GspVoObjectMapping -{ - /** - * The Definition Of The Qo Object Mapping - * - * @ClassName: GspVoObjectSourceType - * @Author: Benjamin Gong - * @Date: 2021/1/11 17:13 - * @Version: V1.0 - */ - public GspVoObjectSourceType SourceType = - GspVoObjectSourceType.QoObject; +public class GspQoObjectMapping extends GspVoObjectMapping { + /** + * The Definition Of The Qo Object Mapping + * + * @ClassName: GspVoObjectSourceType + * @Author: Benjamin Gong + * @Date: 2021/1/11 17:13 + * @Version: V1.0 + */ + public GspVoObjectSourceType SourceType = + GspVoObjectSourceType.QoObject; - private String privateIndexVoId; - public final String getIndexVoId() - { - return privateIndexVoId; - } - public final void setIndexVoId(String value) - { - privateIndexVoId = value; - } -} \ No newline at end of file + private String privateIndexVoId; + + public final String getIndexVoId() { + return privateIndexVoId; + } + + public final void setIndexVoId(String value) { + privateIndexVoId = value; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementMapping.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementMapping.java index 4f9c61d..955a929 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementMapping.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementMapping.java @@ -10,53 +10,48 @@ import org.openatom.ubml.model.vo.definition.common.ViewModelMapping; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class GspVoElementMapping extends ViewModelMapping -{ - /** - 映射节点ID - - */ - private String targetObjectId; - public final String getTargetObjectId() - { - return targetObjectId; - } - public final void setTargetObjectId(String value) - { - targetObjectId = value; - } - - /** - 映射字段ID - - */ - private String targetElementId; - public final String getTargetElementId() - { - return targetElementId; - } - public final void setTargetElementId(String value) - { - targetElementId = value; - } - - /** - 数据源(be或qo) - - */ - private GspVoElementSourceType sourceType = - GspVoElementSourceType.forValue(0); - public final GspVoElementSourceType getSourceType() - { - return sourceType; - } - public final void setSourceType(GspVoElementSourceType value) - { - sourceType = value; - } - - public GspVoElementMapping clone() { - return (GspVoElementMapping)super.clone(); - } - -} \ No newline at end of file +public class GspVoElementMapping extends ViewModelMapping { + /** + * 映射节点ID + */ + private String targetObjectId; + + /** + * 映射字段ID + */ + private String targetElementId; + + /** + * 数据源(be或qo) + */ + private GspVoElementSourceType sourceType = GspVoElementSourceType.forValue(0); + + public final String getTargetObjectId() { + return targetObjectId; + } + + public final void setTargetObjectId(String value) { + targetObjectId = value; + } + + public final String getTargetElementId() { + return targetElementId; + } + + public final void setTargetElementId(String value) { + targetElementId = value; + } + + public final GspVoElementSourceType getSourceType() { + return sourceType; + } + + public final void setSourceType(GspVoElementSourceType value) { + sourceType = value; + } + + public GspVoElementMapping clone() { + return (GspVoElementMapping) super.clone(); + } + +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementSourceType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementSourceType.java index 4f725eb..f9c67fb 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementSourceType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementSourceType.java @@ -8,33 +8,27 @@ package org.openatom.ubml.model.vo.definition.common.mapping; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public enum GspVoElementSourceType -{ - /** - BE - - */ - BeElement, +public enum GspVoElementSourceType { + /** + * BE + */ + BeElement, - /** - QO - - */ - QoElement, + /** + * QO + */ + QoElement, - /** - VO - - */ - VoElement; + /** + * VO + */ + VoElement; - public int getValue() - { - return this.ordinal(); - } + public int getValue() { + return this.ordinal(); + } - public static GspVoElementSourceType forValue(int value) - { - return values()[value]; - } -} \ No newline at end of file + public static GspVoElementSourceType forValue(int value) { + return values()[value]; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectMapping.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectMapping.java index 5f9b851..b8e6558 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectMapping.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectMapping.java @@ -11,8 +11,7 @@ import org.openatom.ubml.model.vo.definition.common.ViewModelMapping; * @Version: V1.0 */ public class GspVoObjectMapping extends ViewModelMapping { - private GspVoObjectSourceType type = - GspVoObjectSourceType.forValue(0); + private GspVoObjectSourceType type = GspVoObjectSourceType.forValue(0); /** * 数据源(be或qo或vo) @@ -29,6 +28,6 @@ public class GspVoObjectMapping extends ViewModelMapping { } public GspVoObjectMapping clone() { - return (GspVoObjectMapping)super.clone(); + return (GspVoObjectMapping) super.clone(); } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectSourceType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectSourceType.java index 977fc6d..400158f 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectSourceType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectSourceType.java @@ -8,33 +8,27 @@ package org.openatom.ubml.model.vo.definition.common.mapping; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public enum GspVoObjectSourceType -{ - /** - BE - - */ - BeObject, +public enum GspVoObjectSourceType { + /** + * BE + */ + BeObject, - /** - QO - - */ - QoObject, + /** + * QO + */ + QoObject, - /** - VO - - */ - VoObject; + /** + * VO + */ + VoObject; - public int getValue() - { - return this.ordinal(); - } + public int getValue() { + return this.ordinal(); + } - public static GspVoObjectSourceType forValue(int value) - { - return values()[value]; - } -} \ No newline at end of file + public static GspVoObjectSourceType forValue(int value) { + return values()[value]; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/dataextendinfo/VoDataExtendInfo.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/dataextendinfo/VoDataExtendInfo.java index 7c15ac8..5047904 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/dataextendinfo/VoDataExtendInfo.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/dataextendinfo/VoDataExtendInfo.java @@ -165,7 +165,6 @@ public class VoDataExtendInfo { return retrieveActions; } - // public void setRetrieveActions(VMActionCollection value) public void setRetrieveActions(VMActionCollection value) { this.retrieveActions = value; } @@ -267,7 +266,6 @@ public class VoDataExtendInfo { this.beforeCreateActions = value; } - /** * 新增数据 * @@ -317,7 +315,6 @@ public class VoDataExtendInfo { this.beforeDeleteActions = value; } - /** * 删除数据 * @@ -350,7 +347,6 @@ public class VoDataExtendInfo { this.afterDeleteActions = value; } - /** * 保存数据前 * @@ -399,7 +395,6 @@ public class VoDataExtendInfo { this.afterSaveActions = value; } - /** * 变更集反向Mapping * @@ -415,4 +410,4 @@ public class VoDataExtendInfo { public void setChangesetReversalMappingActions(VMActionCollection value) { this.changesetReversalMappingActions = value; } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/entity/GspVoExtendInfo.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/entity/GspVoExtendInfo.java index 43a198f..72579ac 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/entity/GspVoExtendInfo.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/entity/GspVoExtendInfo.java @@ -1,14 +1,12 @@ package org.openatom.ubml.model.vo.definition.extendinfo.entity; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - +import java.util.Date; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; -import java.util.Date; +import lombok.Data; +import lombok.NoArgsConstructor; /** * The Josn Deserializer Of Biz Operation @@ -38,7 +36,7 @@ public class GspVoExtendInfo { public GspVoExtendInfo(String id, String extendInfo, String configId, String createdBy, Date createdOn, String lastChangedBy, Date lastChangedOn, String beSourceId) { - this(id,extendInfo,configId,createdBy,createdOn,lastChangedBy,lastChangedOn); + this(id, extendInfo, configId, createdBy, createdOn, lastChangedBy, lastChangedOn); this.beSourceId = beSourceId; } diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/element/ViewElementSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/element/ViewElementSerializer.java index 7da29ad..cf9746d 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/element/ViewElementSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/element/ViewElementSerializer.java @@ -1,7 +1,8 @@ package org.openatom.ubml.model.vo.definition.json.element; import com.fasterxml.jackson.core.JsonGenerator; -import lombok.var; +import java.util.HashMap; +import java.util.Map; import org.openatom.ubml.model.common.definition.cef.json.SerializerUtils; import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonElement; import org.openatom.ubml.model.common.definition.commonmodel.json.element.CmElementSerializer; @@ -9,6 +10,7 @@ import org.openatom.ubml.model.vo.definition.GspViewModelElement; import org.openatom.ubml.model.vo.definition.json.ViewModelJsonConst; import org.openatom.ubml.model.vo.definition.json.mapping.GspVoElementMappingSerializer; import org.openatom.ubml.model.vo.definition.json.operation.VmActionCollectionSerializer; + /** * The Josn Serializer Of View Model Elemnet * @@ -68,10 +70,10 @@ public class ViewElementSerializer extends CmElementSerializer { private void writeExtendProperties(JsonGenerator writer, GspViewModelElement vm) { SerializerUtils.writePropertyName(writer, ViewModelJsonConst.ExtendProperties); - var dic = vm.getExtendProperties(); + HashMap dic = vm.getExtendProperties(); SerializerUtils.writeStartObject(writer); if (dic != null && dic.size() > 0) { - for (var item : dic.entrySet()) { + for (Map.Entry item : dic.entrySet()) { SerializerUtils.writePropertyValue(writer, item.getKey(), item.getValue()); } } diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelSerializer.java index f622e70..0c6124a 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelSerializer.java @@ -1,7 +1,8 @@ package org.openatom.ubml.model.vo.definition.json.model; import com.fasterxml.jackson.core.JsonGenerator; -import lombok.var; +import java.util.HashMap; +import java.util.Map; import org.openatom.ubml.model.common.definition.cef.json.SerializerUtils; import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonModel; import org.openatom.ubml.model.common.definition.commonmodel.json.model.CommonModelSerializer; @@ -22,8 +23,6 @@ import org.openatom.ubml.model.vo.definition.json.operation.VmActionCollectionSe */ public class ViewModelSerializer extends CommonModelSerializer { - - //BaseProp @Override protected void writeExtendModelProperty(IGspCommonModel commonModel, JsonGenerator writer) { GspViewModel vm = (GspViewModel) commonModel; @@ -70,17 +69,16 @@ public class ViewModelSerializer extends CommonModelSerializer { private void writeValueHelpConfigs(JsonGenerator writer, GspViewModel vm) { SerializerUtils.writePropertyName(writer, ViewModelJsonConst.ValueHelpConfigs); - SerializerUtils.writeArray(writer,new ValueHelpConfigSerizlizer(), vm.getValueHelpConfigs()); + SerializerUtils.writeArray(writer, new ValueHelpConfigSerizlizer(), vm.getValueHelpConfigs()); } - private void writeExtendProperties(JsonGenerator writer, GspViewModel vm) { SerializerUtils.writePropertyName(writer, ViewModelJsonConst.ExtendProperties); - var dic = vm.getExtendProperties(); + HashMap dic = vm.getExtendProperties(); SerializerUtils.writeStartObject(writer); if (dic != null && dic.size() > 0) { - for (var item : dic.entrySet()) { + for (Map.Entry item : dic.entrySet()) { SerializerUtils.writePropertyValue(writer, item.getKey(), item.getValue()); } } @@ -89,20 +87,15 @@ public class ViewModelSerializer extends CommonModelSerializer { private void writeVoDataExtendInfo(JsonGenerator writer, GspViewModel vm) { SerializerUtils.writePropertyName(writer, ViewModelJsonConst.DataExtendInfo); - var converter = new VoDataExtendInfoSerializer(); + VoDataExtendInfoSerializer converter = new VoDataExtendInfoSerializer(); converter.serialize(vm.getDataExtendInfo(), writer, null); } - - - - //SelfProp @Override protected void writeExtendModelSelfProperty(IGspCommonModel commonModel, JsonGenerator writer) { } - @Override protected CmObjectSerializer getCmObjectSerializer() { return new ViewObjectSerializer(); diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionSerializer.java index 2588ca5..c90b555 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionSerializer.java @@ -3,10 +3,13 @@ package org.openatom.ubml.model.vo.definition.json.operation; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; -import lombok.var; +import java.util.HashMap; +import java.util.Map; import org.openatom.ubml.model.common.definition.cef.json.CefNames; import org.openatom.ubml.model.common.definition.cef.json.SerializerUtils; import org.openatom.ubml.model.common.definition.commonmodel.json.CommonModelNames; +import org.openatom.ubml.model.vo.definition.action.IViewModelParameter; +import org.openatom.ubml.model.vo.definition.action.IViewModelParameterCollection; import org.openatom.ubml.model.vo.definition.action.ViewModelAction; import org.openatom.ubml.model.vo.definition.action.viewmodelbase.ViewModelParameter; import org.openatom.ubml.model.vo.definition.json.ViewModelJsonConst; @@ -46,7 +49,7 @@ public abstract class VmActionSerializer extends Json //[ SerializerUtils.WriteStartArray(writer); if (action.getParameterCollection().getCount() > 0) { - for (var item : action.getParameterCollection()) { + for (Object item : action.getParameterCollection()) { getParaConvertor().serialize((ViewModelParameter)item, writer, null); } } @@ -75,10 +78,10 @@ public abstract class VmActionSerializer extends Json private void writeExtendProperties(JsonGenerator writer, ViewModelAction vm) { SerializerUtils.writePropertyName(writer, ViewModelJsonConst.ExtendProperties); - var dic = vm.getExtendProperties(); + HashMap dic = vm.getExtendProperties(); SerializerUtils.writeStartObject(writer); if (dic != null && dic.size() > 0) { - for (var item : dic.entrySet()) { + for (Map.Entry item : dic.entrySet()) { SerializerUtils.writePropertyValue(writer, item.getKey(), item.getValue()); } } -- Gitee From 8815e814e9c160c22659e6879f8f0725a51a586e Mon Sep 17 00:00:00 2001 From: bugu <837948266@qq.com> Date: Sat, 3 Apr 2021 20:39:14 +0800 Subject: [PATCH 34/61] !19 optimize : change BizEntity constants * format BizEntity Constant --- .../model/be/definition/common/BEConst.java | 2 +- .../definition/common/BizEntityEnumConst.java | 18 +- .../definition/common/BizEntityJsonConst.java | 198 ++++++++++-------- .../json/element/BizElementDeserializer.java | 12 +- .../json/element/BizElementSerializer.java | 16 +- .../json/model/BizEntityDeserializer.java | 28 +-- .../json/model/BizEntitySerializer.java | 24 +-- .../json/object/BizObjectDeserializer.java | 12 +- .../json/object/BizObjectSerializer.java | 8 +- .../operation/BizActionBaseDeserializer.java | 6 +- .../operation/BizActionBaseSerializer.java | 4 +- .../BizDeterminationDeserializer.java | 12 +- .../operation/BizDeterminationSerializer.java | 14 +- .../operation/BizMgrActionDeserializer.java | 4 +- .../operation/BizMgrActionSerializer.java | 4 +- .../operation/BizOperationDeserializer.java | 18 +- .../operation/BizOperationSerializer.java | 16 +- .../json/operation/BizParaDeserializer.java | 18 +- .../operation/BizParameterSerializer.java | 18 +- .../operation/BizValidationDeserializer.java | 18 +- .../operation/BizValidationSerializer.java | 20 +- .../RequestChildElementsDeserializer.java | 4 +- .../ValidatoinTriggerPointsDeserializer.java | 4 +- 23 files changed, 251 insertions(+), 227 deletions(-) diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BEConst.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BEConst.java index 62799b6..491ff54 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BEConst.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BEConst.java @@ -236,7 +236,7 @@ public final class BEConst { /** * ComponentName */ - public static final String BE_OP_COMPONENT_Name = "ComponentName"; + public static final String BE_OP_COMPONENT_NAME = "ComponentName"; /** * ComponentPkgName diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BizEntityEnumConst.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BizEntityEnumConst.java index 6244f63..df9f1a2 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BizEntityEnumConst.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BizEntityEnumConst.java @@ -24,10 +24,20 @@ package org.openatom.ubml.model.be.definition.common; * @Version: V1.0 */ public class BizEntityEnumConst { - //RequiredCheckOccasion - public static final String RequiredCheckOccasionSave = "Save"; - public static final String RequiredCheckOccasionModify = "Modify"; - public static final String RequiredCheckOccasionAll = "All"; + /** + * The Const RequiredCheckOccasion + */ + public static final String REQUIRED_CHECK_OCCASION_SAVE = "Save"; + + /** + * The Const REQUIRED_CHECK_OCCASION_MODIFY + */ + public static final String REQUIRED_CHECK_OCCASION_MODIFY = "Modify"; + + /** + * The Const REQUIRED_CHECK_OCCASION_ALL + */ + public static final String REQUIRED_CHECK_OCCASION_ALL = "All"; } \ No newline at end of file diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BizEntityJsonConst.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BizEntityJsonConst.java index c110a8b..9859fba 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BizEntityJsonConst.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BizEntityJsonConst.java @@ -24,113 +24,127 @@ package org.openatom.ubml.model.be.definition.common; * @Version: V1.0 */ public class BizEntityJsonConst { + //业务实体 - public static final String Category = "Category"; - public static final String SourceEntity = "SourceEntity"; - public static final String DataLockType = "DataLockType"; - public static final String ExtendType = "ExtendType"; - public static final String DependentEntityId = "DependentEntityId"; - public static final String DependentEntityName = "DependentEntityName"; - public static final String DependentEntityPackageName = "DependentEntityPackageName"; - public static final String IsUsingTimeStamp = "IsUsingTimeStamp"; - public static final String BizMgrActions = "BizMgrActions"; - public static final String BizMgrAction = "BizMgrAction"; - public static final String ComponentAssemblyName = "ComponentAssemblyName"; - public static final String AssemblyName = "AssemblyName"; - public static final String CacheConfiguration = "CacheConfiguration"; - public static final String EnableCaching = "EnableCaching"; - public static final String EnableTreeDtm = "EnableTreeDtm"; - public static final String IsDefaultNull = "IsDefaultNull"; + public static final String CATEGORY = "Category"; + public static final String SOURCE_ENTITY = "SourceEntity"; + public static final String DATA_LOCK_TYPE = "DataLockType"; + public static final String EXTEND_TYPE = "ExtendType"; + public static final String DEPENDENT_ENTITY_ID = "DependentEntityId"; + public static final String DEPENDENT_ENTITY_NAME = "DependentEntityName"; + public static final String ENTITY_PACKAGE_NAME = "DependentEntityPackageName"; + public static final String IS_USING_TIME_STAMP = "IsUsingTimeStamp"; + public static final String BIZ_MGR_ACTIONS = "BizMgrActions"; + public static final String BIZ_MGR_ACTION = "BizMgrAction"; + public static final String COMPONENT_ASSEMBLY_NAME = "ComponentAssemblyName"; + public static final String ASSEMBLY_NAME = "AssemblyName"; + public static final String CACHE_CONFIGURATION = "CacheConfiguration"; + public static final String ENABLE_CACHING = "EnableCaching"; + public static final String ENABLE_TREE_DTM = "EnableTreeDtm"; + public static final String IS_DEFAULT_NULL = "IsDefaultNull"; //业务实体对象 - public static final String Determinations = "Determinations"; - public static final String Validations = "Validations"; - public static final String BizActions = "BizActions"; - public static final String BelongModel = "BelongModel"; - public static final String ParentObject = "ParentObject"; - public static final String ParentObjectID = "ParentObjectID"; - public static final String LogicDeleteControlInfo = "LogicDeleteControlInfo"; + public static final String DETERMINATIONS = "Determinations"; + public static final String VALIDATIONS = "Validations"; + public static final String BIZ_ACTIONS = "BizActions"; + public static final String BELONG_MODEL = "BelongModel"; + public static final String PARENT_OBJECT = "ParentObject"; + public static final String PARENT_OBJECT_ID = "ParentObjectID"; + public static final String LOGIC_DELETE_CONTROL_INFO = "LogicDeleteControlInfo"; //业务实体字段 - public static final String CalculationExpress = "CalculationExpress"; - public static final String ValidationExpress = "ValidationExpress"; - public static final String RtElementConfigId = "RtElementConfigId"; - public static final String Readonly = "Readonly"; - public static final String RequiredCheckOccasion = "RequiredCheckOccasion"; - public static final String UnifiedDataType = "UnifiedDataType"; + /** + * + */ + public static final String CALCULATION_EXPRESS = "CalculationExpress"; + public static final String VALIDATION_EXPRESS = "ValidationExpress"; + public static final String ELEMENT_CONFIG_ID = "RtElementConfigId"; + public static final String READONLY = "Readonly"; + public static final String REQUIRED_CHECK_OCCASION = "RequiredCheckOccasion"; + public static final String UNIFIED_DATA_TYPE = "UnifiedDataType"; - //操作 - public static final String Description = "Description"; - public static final String ComponentId = "ComponentId"; - public static final String ComponentPkgName = "ComponentPkgName"; - public static final String ComponentName = "ComponentName"; - public static final String IsVisible = "IsVisible"; - public static final String OpType = "OpType"; - public static final String Owner = "Owner"; - public static final String BelongModelId = "BelongModelID"; - public static final String IsRef = "IsRef"; - public static final String IsGenerateComponent = "IsGenerateComponent"; + /** + * Operation + */ + public static final String DESCRIPTION = "Description"; + public static final String COMPONENT_ID = "ComponentId"; + public static final String COMPONENT_PKG_NAME = "ComponentPkgName"; + public static final String COMPONENT_NAME = "ComponentName"; + public static final String IS_VISIBLE = "IsVisible"; + public static final String OP_TYPE = "OpType"; + public static final String OWNER = "Owner"; + public static final String BELONG_MODEL_ID = "BelongModelID"; + public static final String IS_REF = "IsRef"; + public static final String IS_GENERATE_COMPONENT = "IsGenerateComponent"; - //BizActionBase - public static final String CurentAuthType = "CurentAuthType"; - public static final String Parameters = "Parameters"; + /** + * BizActionBase + */ + public static final String CURENT_AUTH_TYPE = "CurentAuthType"; + public static final String PARAMETERS = "Parameters"; public static final String ReturnValue = "ReturnValue"; - public static final String OpIdList = "OpIdList"; - public static final String ParamCode = "ParamCode"; - public static final String ParamName = "ParamName"; - public static final String ParameterType = "ParameterType"; - public static final String CollectionParameterType = "CollectionParameterType"; - public static final String Assembly = "Assembly"; - public static final String ClassName = "ClassName"; - public static final String JavaClassName = "JavaClassName"; - public static final String Mode = "Mode"; - public static final String ParamDescription = "ParamDescription"; + public static final String OP_ID_LIST = "OpIdList"; + public static final String PARAM_CODE = "ParamCode"; + public static final String PARAM_NAME = "ParamName"; + public static final String PARAMETER_TYPE = "ParameterType"; + public static final String COLLECTION_PARAMETER_TYPE = "CollectionParameterType"; + public static final String ASSEMBLY = "Assembly"; + public static final String CLASS_NAME = "ClassName"; + public static final String JAVA_CLASS_NAME = "JavaClassName"; + public static final String MODE = "Mode"; + public static final String PARAM_DESCRIPTION = "ParamDescription"; - //determination - public static final String DeterminationType = "DeterminationType"; - public static final String TriggerTimePointType = "TriggerTimePointType"; - public static final String RequestNodeTriggerType = "RequestNodeTriggerType"; - public static final String RequestElements = "RequestElements"; - public static final String RequestChildElements = "RequestChildElements"; - public static final String RequestChildElementKey = "RequestChildElementKey"; - public static final String RequestChildElementValue = "RequestChildElementValue"; - public static final String PreDtmId = "PreDtmId"; - public static final String Determination = "Determination"; + /** + * determination + */ + public static final String DETERMINATION_TYPE = "DeterminationType"; + public static final String TRIGGER_TIME_POINT_TYPE = "TriggerTimePointType"; + public static final String REQUEST_NODE_TRIGGER_TYPE = "RequestNodeTriggerType"; + public static final String REQUEST_ELEMENTS = "RequestElements"; + public static final String REQUEST_CHILD_ELEMENTS = "RequestChildElements"; + public static final String REQUEST_CHILD_ELEMENT_KEY = "RequestChildElementKey"; + public static final String REQUEST_CHILD_ELEMENT_VALUE = "RequestChildElementValue"; + public static final String PRE_DTM_ID = "PreDtmId"; + public static final String DETERMINATION = "Determination"; //validation - public static final String ValidationType = "ValidationType"; - public static final String Order = "Order"; - public static final String Precedings = "Precedings"; - public static final String Succeedings = "Succeedings"; - public static final String PrecedingIds = "PrecedingIds"; - public static final String SucceedingIds = "SucceedingIds"; - public static final String ValidationTriggerPoints = "ValidationTriggerPoints"; - public static final String ValidationTriggerPointKey = "ValidationTriggerPointKey"; - public static final String ValidationTriggerPointValue = "ValidationTriggerPointValue"; - public static final String ValidationAfterSave = "ValAfterSave"; - public static final String Validation = "Validation"; -//RequestNodeTriggerType + public static final String VALIDATION_TYPE = "ValidationType"; + public static final String ORDER = "Order"; + public static final String PRECEDINGS = "Precedings"; + public static final String SUCCEEDINGS = "Succeedings"; + public static final String PRECEDING_IDS = "PrecedingIds"; + public static final String SUCCEEDING_IDS = "SucceedingIds"; + public static final String VALIDATION_TRIGGER_POINTS = "ValidationTriggerPoints"; + public static final String VALIDATION_TRIGGER_POINT_KEY = "ValidationTriggerPointKey"; + public static final String VALIDATION_TRIGGER_POINT_VALUE = "ValidationTriggerPointValue"; + public static final String VALIDATION_AFTER_SAVE = "ValAfterSave"; + public static final String VALIDATION = "Validation"; + + /** + * Authority + */ + public static final String AUTHORIZATIONS = "Authorizations"; + public static final String AUTH_FIELD_INFOS = "AuthFieldInfos"; + public static final String AUTH_FIELD_ID = "AuthFieldID"; + public static final String AUTH_FIELD_NAME = "AuthFieldName"; + public static final String AUTHORIZATION_ID = "AuthorizationID"; + public static final String AUTH_ID = "AuthID"; + public static final String ELEMENT_ID = "ElementID"; - //Authority - public static final String Authorizations = "Authorizations"; - public static final String AuthFieldInfos = "AuthFieldInfos"; - public static final String AuthFieldID = "AuthFieldID"; - public static final String AuthFieldName = "AuthFieldName"; - public static final String AuthorizationID = "AuthorizationID"; - public static final String AuthID = "AuthID"; - public static final String ElementID = "ElementID"; + public static final String ACTION_INFOS = "ActionInfos"; - public static final String ActionInfos = "ActionInfos"; + public static final String AUTH_ACTION_ID = "AuthActionID"; + public static final String AUTH_ACTION_OP_ID = "AuthActionOpID"; + public static final String AUTH_ACTION_OP_NAME = "AuthActionOpName"; - public static final String AuthActionID = "AuthActionID"; - public static final String AuthActionOpID = "AuthActionOpID"; - public static final String AuthActionOpName = "AuthActionOpName"; - public static final String FuncOperationID = "FuncOperationID"; - public static final String FuncOperationName = "FuncOperationName"; + public static final String FUNC_OPERATION_ID = "FuncOperationID"; + public static final String FUNC_OPERATION_NAME = "FuncOperationName"; - //Increment - public static final String AddedAction = "AddedAction"; - public static final String ModifyAction = "ModifyAction"; + /** + * Increment + */ + public static final String ADDED_ACTION = "AddedAction"; + public static final String MODIFY_ACTION = "ModifyAction"; } \ No newline at end of file diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/element/BizElementDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/element/BizElementDeserializer.java index 4f426f5..f3d8953 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/element/BizElementDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/element/BizElementDeserializer.java @@ -42,23 +42,23 @@ public class BizElementDeserializer extends CmElementDeserializer { boolean result = true; GspBizEntityElement field = (GspBizEntityElement)item; switch (propName) { - case BizEntityJsonConst.CalculationExpress: + case BizEntityJsonConst.CALCULATION_EXPRESS: field.setCalculationExpress(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.ValidationExpress: + case BizEntityJsonConst.VALIDATION_EXPRESS: field.setValidationExpress(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.RequiredCheckOccasion: + case BizEntityJsonConst.REQUIRED_CHECK_OCCASION: field.setRequiredCheckOccasion(SerializerUtils.readPropertyValue_Enum(jsonParser, RequiredCheckOccasion.class, RequiredCheckOccasion.values())); break; - case BizEntityJsonConst.IsDefaultNull: + case BizEntityJsonConst.IS_DEFAULT_NULL: field.setIsDefaultNull(SerializerUtils.readPropertyValue_boolean(jsonParser)); break; - case BizEntityJsonConst.UnifiedDataType: + case BizEntityJsonConst.UNIFIED_DATA_TYPE: //todo:json-文件中无Udt信息,为null SerializerUtils.readPropertyValue_String(jsonParser); break; - case BizEntityJsonConst.RtElementConfigId: + case BizEntityJsonConst.ELEMENT_CONFIG_ID: field.setRtElementConfigId(SerializerUtils.readPropertyValue_String(jsonParser)); break; default: diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/element/BizElementSerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/element/BizElementSerializer.java index f183dea..133cddb 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/element/BizElementSerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/element/BizElementSerializer.java @@ -41,10 +41,10 @@ public class BizElementSerializer extends CmElementSerializer { @Override protected void writeExtendElementSelfProperty(JsonGenerator writer, IGspCommonElement commonElement) { GspBizEntityElement bizElement = (GspBizEntityElement)commonElement; - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.CalculationExpress, bizElement.getCalculationExpress()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ValidationExpress, bizElement.getValidationExpress()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.RtElementConfigId, bizElement.getRtElementConfigId()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.IsDefaultNull, bizElement.getIsDefaultNull()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.CALCULATION_EXPRESS, bizElement.getCalculationExpress()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.VALIDATION_EXPRESS, bizElement.getValidationExpress()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ELEMENT_CONFIG_ID, bizElement.getRtElementConfigId()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.IS_DEFAULT_NULL, bizElement.getIsDefaultNull()); writeUnifiedDataTypeDef(writer, bizElement); writeReqireCheckOccasion(writer, bizElement); } @@ -70,17 +70,17 @@ public class BizElementSerializer extends CmElementSerializer { } private void writeReqireCheckOccasion(JsonGenerator writer, GspBizEntityElement bizElement) { - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.RequiredCheckOccasion); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.REQUIRED_CHECK_OCCASION); String value; switch (bizElement.getRequiredCheckOccasion()) { case All: - value = BizEntityEnumConst.RequiredCheckOccasionAll; + value = BizEntityEnumConst.REQUIRED_CHECK_OCCASION_ALL; break; case Save: - value = BizEntityEnumConst.RequiredCheckOccasionSave; + value = BizEntityEnumConst.REQUIRED_CHECK_OCCASION_SAVE; break; case Modify: - value = BizEntityEnumConst.RequiredCheckOccasionModify; + value = BizEntityEnumConst.REQUIRED_CHECK_OCCASION_MODIFY; break; default: throw new RuntimeException("未定义的枚举值:" + bizElement.getRequiredCheckOccasion()); diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/model/BizEntityDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/model/BizEntityDeserializer.java index 6b57ce3..1a94c7d 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/model/BizEntityDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/model/BizEntityDeserializer.java @@ -45,46 +45,46 @@ public class BizEntityDeserializer extends CommonModelDeserializer { GspBusinessEntity be = (GspBusinessEntity)cm; boolean hasProperty = true; switch (propName) { - case BizEntityJsonConst.Category: + case BizEntityJsonConst.CATEGORY: be.setCategory(SerializerUtils.readPropertyValue_Enum(reader, BECategory.class, BECategory.values())); break; - case BizEntityJsonConst.DataLockType: + case BizEntityJsonConst.DATA_LOCK_TYPE: be.setDataLockType(SerializerUtils.readPropertyValue_Enum(reader, GspDataLockType.class, GspDataLockType.values())); break; - case BizEntityJsonConst.ExtendType: + case BizEntityJsonConst.EXTEND_TYPE: SerializerUtils.readPropertyValue_String(reader); break; - case BizEntityJsonConst.DependentEntityId: + case BizEntityJsonConst.DEPENDENT_ENTITY_ID: be.setDependentEntityId(SerializerUtils.readPropertyValue_String(reader)); break; - case BizEntityJsonConst.DependentEntityName: + case BizEntityJsonConst.DEPENDENT_ENTITY_NAME: be.setDependentEntityName(SerializerUtils.readPropertyValue_String(reader)); break; - case BizEntityJsonConst.CacheConfiguration: + case BizEntityJsonConst.CACHE_CONFIGURATION: be.setCacheConfiguration(SerializerUtils.readPropertyValue_String(reader)); break; - case BizEntityJsonConst.DependentEntityPackageName: + case BizEntityJsonConst.ENTITY_PACKAGE_NAME: be.setDependentEntityPackageName(SerializerUtils.readPropertyValue_String(reader)); break; - case BizEntityJsonConst.EnableCaching: + case BizEntityJsonConst.ENABLE_CACHING: be.setEnableCaching(SerializerUtils.readPropertyValue_boolean(reader)); break; - case BizEntityJsonConst.EnableTreeDtm: + case BizEntityJsonConst.ENABLE_TREE_DTM: be.setEnableTreeDtm(SerializerUtils.readPropertyValue_boolean(reader)); break; - case BizEntityJsonConst.IsUsingTimeStamp: + case BizEntityJsonConst.IS_USING_TIME_STAMP: be.setIsUsingTimeStamp(SerializerUtils.readPropertyValue_boolean(reader)); break; - case BizEntityJsonConst.BizMgrActions: + case BizEntityJsonConst.BIZ_MGR_ACTIONS: readBizMgrActions(reader, be); break; - case BizEntityJsonConst.ComponentAssemblyName: + case BizEntityJsonConst.COMPONENT_ASSEMBLY_NAME: be.setComponentAssemblyName(SerializerUtils.readPropertyValue_String(reader)); break; - case BizEntityJsonConst.AssemblyName: + case BizEntityJsonConst.ASSEMBLY_NAME: SerializerUtils.readPropertyValue_String(reader); break; - case BizEntityJsonConst.Authorizations: + case BizEntityJsonConst.AUTHORIZATIONS: readAuthorizations(reader, be); break; default: diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/model/BizEntitySerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/model/BizEntitySerializer.java index 81bb8fe..52734c9 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/model/BizEntitySerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/model/BizEntitySerializer.java @@ -42,23 +42,23 @@ public class BizEntitySerializer extends CommonModelSerializer { protected void writeExtendModelProperty(IGspCommonModel commonModel, JsonGenerator writer) { GspBusinessEntity be = (GspBusinessEntity)commonModel; writeBizActions(writer, be); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.DependentEntityId, be.getDependentEntityId()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.DependentEntityName, be.getDependentEntityName()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.DependentEntityPackageName, be.getDependentEntityPackageName()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.CacheConfiguration, be.getCacheConfiguration()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.EnableCaching, be.getEnableCaching()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.EnableTreeDtm, be.getEnableTreeDtm()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.DEPENDENT_ENTITY_ID, be.getDependentEntityId()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.DEPENDENT_ENTITY_NAME, be.getDependentEntityName()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ENTITY_PACKAGE_NAME, be.getDependentEntityPackageName()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.CACHE_CONFIGURATION, be.getCacheConfiguration()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ENABLE_CACHING, be.getEnableCaching()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ENABLE_TREE_DTM, be.getEnableTreeDtm()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ComponentAssemblyName, be.getComponentAssemblyName()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.Category, be.getCategory().getValue()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.DataLockType, be.getDataLockType().getValue()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ExtendType, be.getExtendType()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.IsUsingTimeStamp, be.getIsUsingTimeStamp()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.COMPONENT_ASSEMBLY_NAME, be.getComponentAssemblyName()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.CATEGORY, be.getCategory().getValue()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.DATA_LOCK_TYPE, be.getDataLockType().getValue()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.EXTEND_TYPE, be.getExtendType()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.IS_USING_TIME_STAMP, be.getIsUsingTimeStamp()); // SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.Authorizations, be.getAuthorizations()); } private void writeBizActions(JsonGenerator writer, GspBusinessEntity be) { - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.BizMgrActions); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.BIZ_MGR_ACTIONS); BizMgrActionCollection actionList = be.getBizMgrActions(); BizMgrActionCollectionSerializer operationsConvertor = getMgrActionsConverter(); try { diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/object/BizObjectDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/object/BizObjectDeserializer.java index ac8efc5..319483d 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/object/BizObjectDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/object/BizObjectDeserializer.java @@ -56,24 +56,24 @@ public class BizObjectDeserializer extends CmObjectDeserializer { boolean result = true; GspBizEntityObject object = (GspBizEntityObject)commonObject; switch (propName) { - case BizEntityJsonConst.Determinations: + case BizEntityJsonConst.DETERMINATIONS: readDeterminations(jsonParser, object); break; - case BizEntityJsonConst.Validations: + case BizEntityJsonConst.VALIDATIONS: readValidations(jsonParser, object); break; - case BizEntityJsonConst.BizActions: + case BizEntityJsonConst.BIZ_ACTIONS: readBizActions(jsonParser, object); break; - case BizEntityJsonConst.AuthFieldInfos: + case BizEntityJsonConst.AUTH_FIELD_INFOS: readAuthFieldInfos(jsonParser, object); break; - case BizEntityJsonConst.ValidationAfterSave: + case BizEntityJsonConst.VALIDATION_AFTER_SAVE: CommonValCollection collection = new CommonValCollection(); CommonValDeserializer der = new CommonValDeserializer(); SerializerUtils.readArray(jsonParser, der, collection); break; - case BizEntityJsonConst.LogicDeleteControlInfo: + case BizEntityJsonConst.LOGIC_DELETE_CONTROL_INFO: object.setLogicDeleteControlInfo(SerializerUtils.readPropertyValue_Object(LogicDeleteControlInfo.class, jsonParser)); try { jsonParser.nextToken(); diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/object/BizObjectSerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/object/BizObjectSerializer.java index 4c08e54..e9316c8 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/object/BizObjectSerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/object/BizObjectSerializer.java @@ -54,7 +54,7 @@ public class BizObjectSerializer extends CmObjectSerializer { writeValidations(writer, bizObject); WriteBizActions(writer, bizObject); if (bizObject.getLogicDeleteControlInfo() != null) { - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.LogicDeleteControlInfo); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.LOGIC_DELETE_CONTROL_INFO); SerializerUtils.writePropertyValue_Object(writer, bizObject.getLogicDeleteControlInfo()); } @@ -62,7 +62,7 @@ public class BizObjectSerializer extends CmObjectSerializer { } private void writeDeterminations(JsonGenerator writer, GspBizEntityObject bizObject) { - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.Determinations); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.DETERMINATIONS); DeterminationCollection dtms = bizObject.getDeterminations(); try { dtmCollectionSerializer.serialize(dtms, writer, null); @@ -72,7 +72,7 @@ public class BizObjectSerializer extends CmObjectSerializer { } private void writeValidations(JsonGenerator writer, GspBizEntityObject bizObject) { - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.Validations); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.VALIDATIONS); ValidationCollection actionList = bizObject.getValidations(); try { valCollectionSerializer.serialize(actionList, writer, null); @@ -82,7 +82,7 @@ public class BizObjectSerializer extends CmObjectSerializer { } private void WriteBizActions(JsonGenerator writer, GspBizEntityObject bizObject) { - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.BizActions); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.BIZ_ACTIONS); BizActionCollection actionList = bizObject.getBizActions(); try { actionCollectionSeriallizer.serialize(actionList, writer, null); diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionBaseDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionBaseDeserializer.java index db45140..91f12f6 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionBaseDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionBaseDeserializer.java @@ -45,13 +45,13 @@ public abstract class BizActionBaseDeserializer extends BizOperationDeserializer BizActionBase action = (BizActionBase)op; boolean hasProperty = true; switch (propName) { - case BizEntityJsonConst.CurentAuthType: + case BizEntityJsonConst.CURENT_AUTH_TYPE: SerializerUtils.readPropertyValue_Enum(jsonParser, AuthType.class, AuthType.values()); break; - case BizEntityJsonConst.OpIdList: + case BizEntityJsonConst.OP_ID_LIST: action.setOpIdList(SerializerUtils.readStringArray(jsonParser)); break; - case BizEntityJsonConst.Parameters: + case BizEntityJsonConst.PARAMETERS: readParameters(jsonParser, action); break; case BizEntityJsonConst.ReturnValue: diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionBaseSerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionBaseSerializer.java index 7f705d1..6a54465 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionBaseSerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionBaseSerializer.java @@ -50,7 +50,7 @@ public abstract class BizActionBaseSerializer extends BizOperationSerializer 0) { @@ -63,7 +63,7 @@ public abstract class BizActionBaseSerializer extends BizOperationSerializer 0) { diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizDeterminationDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizDeterminationDeserializer.java index dd1d65d..165aa40 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizDeterminationDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizDeterminationDeserializer.java @@ -44,22 +44,22 @@ public class BizDeterminationDeserializer extends BizOperationDeserializer dic = dtm.getRequestChildElements(); SerializerUtils.WriteStartArray(writer); if (dic != null && dic.size() > 0) { for (Map.Entry item : dic.entrySet()) { SerializerUtils.writeStartObject(writer); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.RequestChildElementKey, item.getKey()); - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.RequestChildElementValue); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.REQUEST_CHILD_ELEMENT_KEY, item.getKey()); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.REQUEST_CHILD_ELEMENT_VALUE); writeDtmElementCollection(writer, item.getValue()); SerializerUtils.writeEndObject(writer); } diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionDeserializer.java index c6bf32d..0670737 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionDeserializer.java @@ -38,10 +38,10 @@ public class BizMgrActionDeserializer extends BizActionBaseDeserializer { BizMgrAction action = (BizMgrAction)op; boolean hasProperty = true; switch (propName) { - case BizEntityJsonConst.FuncOperationID: + case BizEntityJsonConst.FUNC_OPERATION_ID: action.setFuncOperationID(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.FuncOperationName: + case BizEntityJsonConst.FUNC_OPERATION_NAME: action.setFuncOperationName(SerializerUtils.readPropertyValue_String(jsonParser)); break; default: diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionSerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionSerializer.java index c862dd4..8f819ae 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionSerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionSerializer.java @@ -38,8 +38,8 @@ public class BizMgrActionSerializer extends BizActionBaseSerializer { @Override protected void writeExtendActionBaseProperty(JsonGenerator writer, BizActionBase action) { - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.FuncOperationID, ((BizMgrAction)action).getFuncOperationID()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.FuncOperationName, ((BizMgrAction)action).getFuncOperationName()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.FUNC_OPERATION_ID, ((BizMgrAction)action).getFuncOperationID()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.FUNC_OPERATION_NAME, ((BizMgrAction)action).getFuncOperationName()); } @Override diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationDeserializer.java index 35e0f7c..c67c690 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationDeserializer.java @@ -99,31 +99,31 @@ public abstract class BizOperationDeserializer extends J case CommonModelNames.NAME: op.setName(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.Description: + case BizEntityJsonConst.DESCRIPTION: op.setDescription(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.ComponentId: + case BizEntityJsonConst.COMPONENT_ID: op.setComponentId(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.ComponentName: + case BizEntityJsonConst.COMPONENT_NAME: op.setComponentName(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.ComponentPkgName: + case BizEntityJsonConst.COMPONENT_PKG_NAME: op.setComponentPkgName(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.IsVisible: + case BizEntityJsonConst.IS_VISIBLE: op.setIsVisible(SerializerUtils.readPropertyValue_boolean(jsonParser)); break; - case BizEntityJsonConst.OpType: + case BizEntityJsonConst.OP_TYPE: SerializerUtils.readPropertyValue_String(jsonParser); break; - case BizEntityJsonConst.BelongModelId: + case BizEntityJsonConst.BELONG_MODEL_ID: op.setBelongModelID(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.IsRef: + case BizEntityJsonConst.IS_REF: op.setIsRef(SerializerUtils.readPropertyValue_boolean(jsonParser)); break; - case BizEntityJsonConst.IsGenerateComponent: + case BizEntityJsonConst.IS_GENERATE_COMPONENT: op.setIsGenerateComponent(SerializerUtils.readPropertyValue_boolean(jsonParser)); break; case CefNames.CUSTOMIZATION_INFO: diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationSerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationSerializer.java index 659cd62..86fa8f7 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationSerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationSerializer.java @@ -52,7 +52,7 @@ public abstract class BizOperationSerializer extends Jso // 若为内置操作,则只序列化基本信息 if (isInternalAction(op.getID())) return; - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.IsRef, op.getIsRef()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.IS_REF, op.getIsRef()); writeExtendOperationBaseProperty(writer, op); } @@ -69,15 +69,15 @@ public abstract class BizOperationSerializer extends Jso private void writeSelfProperty(BizOperation op, JsonGenerator writer) { SerializerUtils.writePropertyValue(writer, CommonModelNames.CODE, op.getCode()); SerializerUtils.writePropertyValue(writer, CommonModelNames.NAME, op.getName()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.Description, op.getDescription()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ComponentId, op.getComponentId()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ComponentName, op.getComponentName()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ComponentPkgName, op.getComponentPkgName()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.IsVisible, op.getIsVisible()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.DESCRIPTION, op.getDescription()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.COMPONENT_ID, op.getComponentId()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.COMPONENT_NAME, op.getComponentName()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.COMPONENT_PKG_NAME, op.getComponentPkgName()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.IS_VISIBLE, op.getIsVisible()); //SerializerUtils.writePropertyValue(writer, BizEntityConst.OpType, op.OpType);//子类赋值 //Owner不序列化 - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.BelongModelId, op.getBelongModelID()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.IsGenerateComponent, op.getIsGenerateComponent()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.BELONG_MODEL_ID, op.getBelongModelID()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.IS_GENERATE_COMPONENT, op.getIsGenerateComponent()); SerializerUtils.writePropertyValue(writer, CefNames.CUSTOMIZATION_INFO, op.getCustomizationInfo()); // 若为内置操作,则只序列化基本信息 if (isInternalAction(op.getID())) { diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizParaDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizParaDeserializer.java index 09b9b68..7425930 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizParaDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizParaDeserializer.java @@ -60,31 +60,31 @@ public abstract class BizParaDeserializer extends JsonDe case CommonModelNames.ID: para.setID(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.ParamCode: + case BizEntityJsonConst.PARAM_CODE: para.setParamCode(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.ParamName: + case BizEntityJsonConst.PARAM_NAME: para.setParamName(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.ParameterType: + case BizEntityJsonConst.PARAMETER_TYPE: para.setParameterType(SerializerUtils.readPropertyValue_Enum(jsonParser, BizParameterType.class, BizParameterType.values())); break; - case BizEntityJsonConst.Assembly: + case BizEntityJsonConst.ASSEMBLY: para.setAssembly(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.ClassName: + case BizEntityJsonConst.CLASS_NAME: para.setNetClassName(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.JavaClassName: + case BizEntityJsonConst.JAVA_CLASS_NAME: para.setClassName(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.Mode: + case BizEntityJsonConst.MODE: para.setMode(SerializerUtils.readPropertyValue_Enum(jsonParser, BizParameterMode.class, BizParameterMode.values())); break; - case BizEntityJsonConst.ParamDescription: + case BizEntityJsonConst.PARAM_DESCRIPTION: para.setParamDescription(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.CollectionParameterType: + case BizEntityJsonConst.COLLECTION_PARAMETER_TYPE: para.setCollectionParameterType(SerializerUtils.readPropertyValue_Enum(jsonParser, BizCollectionParameterType.class, BizCollectionParameterType.values())); break; default: diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizParameterSerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizParameterSerializer.java index e7ef028..4155464 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizParameterSerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizParameterSerializer.java @@ -42,15 +42,15 @@ public class BizParameterSerializer extends JsonSerializ //{ SerializerUtils.writeStartObject(writer); SerializerUtils.writePropertyValue(writer, CommonModelNames.ID, para.getID()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ParamCode, para.getParamCode()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ParamName, para.getParamName()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ParameterType, para.getParameterType().getValue()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.CollectionParameterType, para.getCollectionParameterType().getValue()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.Assembly, para.getAssembly()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ClassName, para.getNetClassName()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.JavaClassName, para.getClassName()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.Mode, para.getMode().getValue()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ParamDescription, para.getParamDescription()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.PARAM_CODE, para.getParamCode()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.PARAM_NAME, para.getParamName()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.PARAMETER_TYPE, para.getParameterType().getValue()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.COLLECTION_PARAMETER_TYPE, para.getCollectionParameterType().getValue()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ASSEMBLY, para.getAssembly()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.CLASS_NAME, para.getNetClassName()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.JAVA_CLASS_NAME, para.getClassName()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.MODE, para.getMode().getValue()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.PARAM_DESCRIPTION, para.getParamDescription()); //} SerializerUtils.writeEndObject(writer); } diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizValidationDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizValidationDeserializer.java index cbaeb0f..8e4bc15 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizValidationDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizValidationDeserializer.java @@ -47,31 +47,31 @@ public class BizValidationDeserializer extends BizOperationDeserializer @Override protected void writeExtendOperationSelfProperty(JsonGenerator writer, BizOperation op) { Validation validation = (Validation)op; - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ValidationType, validation.getValidationType().getValue()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.VALIDATION_TYPE, validation.getValidationType().getValue()); int triggerTimePointType = 0; for (BETriggerTimePointType timePointType : validation.getTriggerTimePointType()) { triggerTimePointType += timePointType.getValue(); } - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.TriggerTimePointType, triggerTimePointType); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.TRIGGER_TIME_POINT_TYPE, triggerTimePointType); // SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.Order, validation.getOrder()); // WritePrecedingIds(writer, validation); // WriteSucceedingIds(writer, validation); @@ -57,7 +57,7 @@ public class BizValidationSerializer extends BizOperationSerializer for (RequestNodeTriggerType requestNodeTrigger : validation.getRequestNodeTriggerType()) { requestNodeTriggerType += requestNodeTrigger.getValue(); } - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.RequestNodeTriggerType, requestNodeTriggerType); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.REQUEST_NODE_TRIGGER_TYPE, requestNodeTriggerType); writeRequestElements(writer, validation); writeRequestChildElements(writer, validation); @@ -65,7 +65,7 @@ public class BizValidationSerializer extends BizOperationSerializer } private void writeRequestElements(JsonGenerator writer, Validation dtm) { - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.RequestElements); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.REQUEST_ELEMENTS); writeValidationElementCollection(writer, dtm.getRequestElements()); } @@ -82,14 +82,14 @@ public class BizValidationSerializer extends BizOperationSerializer } private void writeRequestChildElements(JsonGenerator writer, Validation dtm) { - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.RequestChildElements); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.REQUEST_CHILD_ELEMENTS); HashMap dic = dtm.getRequestChildElements(); SerializerUtils.WriteStartArray(writer); if (dic != null && dic.size() > 0) { for (Map.Entry item : dic.entrySet()) { SerializerUtils.writeStartObject(writer); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.RequestChildElementKey, item.getKey()); - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.RequestChildElementValue); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.REQUEST_CHILD_ELEMENT_KEY, item.getKey()); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.REQUEST_CHILD_ELEMENT_VALUE); writeValidationElementCollection(writer, item.getValue()); SerializerUtils.writeEndObject(writer); } @@ -98,18 +98,18 @@ public class BizValidationSerializer extends BizOperationSerializer } private void writeValidationTriggerPoints(JsonGenerator writer, Validation val) { - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.ValidationTriggerPoints); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.VALIDATION_TRIGGER_POINTS); HashMap> dic = val.getValidationTriggerPoints(); SerializerUtils.WriteStartArray(writer); if (dic != null && dic.size() > 0) { for (Map.Entry> item : dic.entrySet()) { SerializerUtils.writeStartObject(writer); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ValidationTriggerPointKey, item.getKey().getValue()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.VALIDATION_TRIGGER_POINT_KEY, item.getKey().getValue()); int requestNodeTriggerType = 0; for (RequestNodeTriggerType trigger : item.getValue()) { requestNodeTriggerType += trigger.getValue(); } - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ValidationTriggerPointValue, requestNodeTriggerType); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.VALIDATION_TRIGGER_POINT_VALUE, requestNodeTriggerType); SerializerUtils.writeEndObject(writer); } } diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/RequestChildElementsDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/RequestChildElementsDeserializer.java index 62ab9ff..466e061 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/RequestChildElementsDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/RequestChildElementsDeserializer.java @@ -68,10 +68,10 @@ public abstract class RequestChildElementsDeserializer hashMap, String propName, JsonParser jsonParser) { switch (propName) { - case BizEntityJsonConst.RequestChildElementKey: + case BizEntityJsonConst.REQUEST_CHILD_ELEMENT_KEY: currentKey = SerializerUtils.readPropertyValue_String(jsonParser); break; - case BizEntityJsonConst.RequestChildElementValue: + case BizEntityJsonConst.REQUEST_CHILD_ELEMENT_VALUE: T collection = createValueType(); SerializerUtils.readArray(jsonParser, new StringDeserializer(), collection, true); hashMap.put(currentKey, collection); diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/ValidatoinTriggerPointsDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/ValidatoinTriggerPointsDeserializer.java index d380684..da59173 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/ValidatoinTriggerPointsDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/ValidatoinTriggerPointsDeserializer.java @@ -69,10 +69,10 @@ public class ValidatoinTriggerPointsDeserializer extends JsonDeserializer> hashMap, String propName, JsonParser jsonParser) { switch (propName) { - case BizEntityJsonConst.ValidationTriggerPointKey: + case BizEntityJsonConst.VALIDATION_TRIGGER_POINT_KEY: currentKey = (BETriggerTimePointType)BizOperationDeserializer.readBETriggerTimePointType(jsonParser).toArray()[0]; break; - case BizEntityJsonConst.ValidationTriggerPointValue: + case BizEntityJsonConst.VALIDATION_TRIGGER_POINT_VALUE: EnumSet currentValue = BizOperationDeserializer.readRequestNodeTriggerType(jsonParser); hashMap.put(currentKey, currentValue); break; -- Gitee From d25d570c791535de05337106a2f9d7150144c023 Mon Sep 17 00:00:00 2001 From: haoxiaofei Date: Wed, 7 Apr 2021 10:26:50 +0800 Subject: [PATCH 35/61] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=B8=B8=E9=87=8F=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controlruledef/entity/CmEntityRuleNames.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmEntityRuleNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmEntityRuleNames.java index 088c66d..fa4574d 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmEntityRuleNames.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmEntityRuleNames.java @@ -16,8 +16,7 @@ package org.openatom.ubml.model.common.definition.commonmodel.controlruledef.entity; public class CmEntityRuleNames { - public static String CmEntityRuleObjectType = "GspCommonModelEntity"; - public static String AddChildEntity = "AddChildEntity"; - public static String ModifyChildEntities = "ModifyChildEntities"; - + public static String CM_ENTITY_RULE_OBJECT_TYPE = "GspCommonModelEntity"; + public static String ADD_CHILD_ENTITY = "AddChildEntity"; + public static String MODIFY_CHILD_ENTITIES = "ModifyChildEntities"; } -- Gitee From ed08381ec3e18f5b16e34581e66dc1768a84a220 Mon Sep 17 00:00:00 2001 From: haoxiaofei Date: Wed, 7 Apr 2021 10:37:06 +0800 Subject: [PATCH 36/61] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=AD=98=E5=9C=A8=E7=A9=BA=E6=8C=87=E9=92=88=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E7=9A=84=E8=B5=8B=E5=80=BC=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commonmodel/entity/object/GspUniqueConstraint.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspUniqueConstraint.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspUniqueConstraint.java index 1395049..2f7553b 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspUniqueConstraint.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspUniqueConstraint.java @@ -134,8 +134,10 @@ public class GspUniqueConstraint implements Cloneable { } catch (CloneNotSupportedException e) { return null; } - GspUniqueConstraint newConstraint = (GspUniqueConstraint) ((tempVar instanceof GspUniqueConstraint) ? tempVar - : null); + if (!(tempVar instanceof GspUniqueConstraint)) { + return null; + } + GspUniqueConstraint newConstraint = (GspUniqueConstraint) tempVar; newConstraint.id = this.id; newConstraint.code = this.getCode(); newConstraint.name = this.name; -- Gitee From 749eb37ca36e03f1ca1aa2fc10ac180cecb95156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?hao=E5=B0=8Ffly?= <8868651+haoxiaofei666@user.noreply.gitee.com> Date: Wed, 7 Apr 2021 10:43:13 +0800 Subject: [PATCH 37/61] =?UTF-8?q?!21=20=E6=96=B0=E5=A2=9E=E7=B1=BB?= =?UTF-8?q?=EF=BC=9A=E6=96=B0=E5=A2=9E=E5=B8=B8=E9=87=8F=E7=B1=BB=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=20*=20!2=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Dbug=EF=BC=9A=E4=BF=AE=E5=A4=8D=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=A9=BA=E6=8C=87=E9=92=88=E5=BC=82=E5=B8=B8=E7=9A=84=E8=B5=8B?= =?UTF-8?q?=E5=80=BC=E8=AF=AD=E5=8F=A5=20*=20=E4=BF=AE=E5=A4=8Dbug?= =?UTF-8?q?=EF=BC=9A=E4=BF=AE=E5=A4=8D=E5=AD=98=E5=9C=A8=E7=A9=BA=E6=8C=87?= =?UTF-8?q?=E9=92=88=E5=BC=82=E5=B8=B8=E7=9A=84=E8=B5=8B=E5=80=BC=E8=AF=AD?= =?UTF-8?q?=E5=8F=A5=20*=20!1=20=E4=BC=98=E5=8C=96=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=B8=B8=E9=87=8F=E5=91=BD=E5=90=8D=20*=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=9A=E4=BC=98=E5=8C=96=E5=B8=B8=E9=87=8F=E5=91=BD?= =?UTF-8?q?=E5=90=8D=20*=20Merge=20branch=20'develop'=20of=20https://gitee?= =?UTF-8?q?.com/ubml/ubml-impl=20into=20dev=5Fhxf2=20*=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E7=B1=BB=EF=BC=9A=E6=96=B0=E5=A2=9E=E5=B8=B8=E9=87=8F?= =?UTF-8?q?=E7=B1=BB=EF=BC=8C=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=20*=20Me?= =?UTF-8?q?rge=20branch=20'develop'=20of=20https://gitee.com/ubml/ubml-imp?= =?UTF-8?q?l=20into=20develop=20*=20=E4=BC=98=E5=8C=96=EF=BC=9A=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=97=A0=E7=94=A8=E7=B1=BB=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../collection/GspElementCollection.java | 7 +++--- .../entity/CmEntityRuleNames.java | 22 +++++++++++++++++++ .../entity/object/GspUniqueConstraint.java | 9 ++++++-- 3 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmEntityRuleNames.java diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspElementCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspElementCollection.java index 5cb7497..77f4242 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspElementCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspElementCollection.java @@ -59,7 +59,6 @@ public class GspElementCollection extends GspFieldCollection implements IElement } } - /** * 克隆 * @@ -81,13 +80,13 @@ public class GspElementCollection extends GspFieldCollection implements IElement @Override public IGspCommonElement getItem(String id) { Object tempVar = super.getByID(id); - return (IGspCommonElement)((tempVar instanceof IGspCommonElement) ? tempVar : null); + return (IGspCommonElement) ((tempVar instanceof IGspCommonElement) ? tempVar : null); } @Override public final IGspCommonElement getItem(int index) { Object tempVar = super.getByIndex(index); - return (IGspCommonElement)((tempVar instanceof IGspCommonElement) ? tempVar : null); + return (IGspCommonElement) ((tempVar instanceof IGspCommonElement) ? tempVar : null); } /** @@ -103,7 +102,7 @@ public class GspElementCollection extends GspFieldCollection implements IElement if (parentObject != value) { parentObject = value; for (IGspCommonField item : this) { - GspCommonElement ele = (GspCommonElement)item; + GspCommonElement ele = (GspCommonElement) item; ele.setBelongObject(value); } } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmEntityRuleNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmEntityRuleNames.java new file mode 100644 index 0000000..fa4574d --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmEntityRuleNames.java @@ -0,0 +1,22 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.commonmodel.controlruledef.entity; + +public class CmEntityRuleNames { + public static String CM_ENTITY_RULE_OBJECT_TYPE = "GspCommonModelEntity"; + public static String ADD_CHILD_ENTITY = "AddChildEntity"; + public static String MODIFY_CHILD_ENTITIES = "ModifyChildEntities"; +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspUniqueConstraint.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspUniqueConstraint.java index 5465ff5..2f7553b 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspUniqueConstraint.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspUniqueConstraint.java @@ -102,6 +102,9 @@ public class GspUniqueConstraint implements Cloneable { * 约束包含的字段列表 */ public final BaseList getElementList() { + if (elementList == null) { + elementList = new BaseList<>(); + } return this.elementList; } @@ -131,8 +134,10 @@ public class GspUniqueConstraint implements Cloneable { } catch (CloneNotSupportedException e) { return null; } - GspUniqueConstraint newConstraint = (GspUniqueConstraint)((tempVar instanceof GspUniqueConstraint) ? tempVar - : null); + if (!(tempVar instanceof GspUniqueConstraint)) { + return null; + } + GspUniqueConstraint newConstraint = (GspUniqueConstraint) tempVar; newConstraint.id = this.id; newConstraint.code = this.getCode(); newConstraint.name = this.name; -- Gitee From 36377766f78bfdea886882271d9c7330417d2752 Mon Sep 17 00:00:00 2001 From: bugu <837948266@qq.com> Date: Wed, 7 Apr 2021 19:32:33 +0800 Subject: [PATCH 38/61] =?UTF-8?q?!22=20=E4=BC=98=E5=8C=96=EF=BC=9A?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=B8=B8=E9=87=8F=E5=91=BD=E5=90=8D=E9=A3=8E?= =?UTF-8?q?=E6=A0=BC=20*=20format=20CONSTANT=20*=20Merge=20remote-tracking?= =?UTF-8?q?=20branch=20'upstream/develop'=20into=20develop=20*=20format=20?= =?UTF-8?q?BizEntity=20Constant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/BizReturnValueDeserializer.java | 4 +- .../be/definition/operation/Validation.java | 2 +- .../componentbase/BizVoidReturnType.java | 6 ++- .../internalbeaction/ModifyBEAction.java | 15 ++++--- .../internalbeaction/RetrieveBEAction.java | 15 ++++--- .../internalmgraction/DeleteMgrAction.java | 3 ++ .../internalmgraction/ModifyMgrAction.java | 15 ++++--- .../internalmgraction/QueryMgrAction.java | 15 ++++--- .../RetrieveDefaultMgrAction.java | 15 ++++--- .../internalmgraction/RetrieveMgrAction.java | 12 ++--- pom.xml | 44 +++++++++---------- 11 files changed, 83 insertions(+), 63 deletions(-) diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizReturnValueDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizReturnValueDeserializer.java index 329d0f9..17b3f88 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizReturnValueDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizReturnValueDeserializer.java @@ -33,8 +33,8 @@ public class BizReturnValueDeserializer extends BizParaDeserializer { @Override public final BizReturnValue deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) { BizReturnValue rez = (BizReturnValue)super.deserialize(jsonParser, null); - if (BizVoidReturnType.assembly.equals(rez.getAssembly()) - && BizVoidReturnType.className.equals(rez.getClassName())) { + if (BizVoidReturnType.ASSEMBLY.equals(rez.getAssembly()) + && BizVoidReturnType.CLASS_NAME.equals(rez.getClassName())) { BizReturnValue newRez = new BizVoidReturnType(); newRez.setID(rez.getID()); newRez.setParamCode(rez.getParamCode()); diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/Validation.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/Validation.java index 964cca4..e2c0644 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/Validation.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/Validation.java @@ -139,7 +139,7 @@ public class Validation extends BizOperation implements Cloneable { { // int hashCode = (super.hashCode() * 397) ^ (new // Integer(getOrder())).hashCode(); - int hashCode = (super.hashCode() * 397); + int hashCode = super.hashCode() * 397; hashCode = (hashCode * 397) ^ getValidationType().hashCode(); hashCode = (hashCode * 397) ^ getRequestNodeTriggerType().hashCode(); return hashCode; diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/componentbase/BizVoidReturnType.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/componentbase/BizVoidReturnType.java index 3ef75d6..81cb14f 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/componentbase/BizVoidReturnType.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/componentbase/BizVoidReturnType.java @@ -26,8 +26,10 @@ import org.openatom.ubml.model.be.definition.operation.componentenum.BizParamete * @Version: V1.0 */ public class BizVoidReturnType extends BizReturnValue { - public static final String assembly = "mscorlib.dll"; - public static final String className = "Void"; + + public static final String ASSEMBLY = "mscorlib.dll"; + + public static final String CLASS_NAME = "Void"; /** * 参数类对应程序集类 diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalbeaction/ModifyBEAction.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalbeaction/ModifyBEAction.java index 792a508..5a70938 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalbeaction/ModifyBEAction.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalbeaction/ModifyBEAction.java @@ -26,13 +26,16 @@ import org.openatom.ubml.model.be.definition.operation.BizAction; * @Version: V1.0 */ public class ModifyBEAction extends BizAction implements IInternalBEAction { - public static final String id = "tf9MVINdJ0yhUrsJgfcvBA"; - public static final String code = "Modify"; - public static final String name = "内置修改操作"; + + public static final String ID = "tf9MVINdJ0yhUrsJgfcvBA"; + + public static final String CODE = "Modify"; + + public static final String NAME = "内置修改操作"; public ModifyBEAction() { - setID(id); - setCode(code); - setName(name); + setID(ID); + setCode(CODE); + setName(NAME); } } \ No newline at end of file diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalbeaction/RetrieveBEAction.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalbeaction/RetrieveBEAction.java index c9ab072..a0b7461 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalbeaction/RetrieveBEAction.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalbeaction/RetrieveBEAction.java @@ -26,13 +26,16 @@ import org.openatom.ubml.model.be.definition.operation.BizAction; * @Version: V1.0 */ public class RetrieveBEAction extends BizAction implements IInternalBEAction { - public static final String id = "cJwzDlFfa0uz4rChlTEd4g"; - public static final String code = "Retrieve"; - public static final String name = "内置检索操作"; + + public static final String ID = "cJwzDlFfa0uz4rChlTEd4g"; + + public static final String CODE = "Retrieve"; + + public static final String NAME = "内置检索操作"; public RetrieveBEAction() { - setID(id); - setCode(code); - setName(name); + setID(ID); + setCode(CODE); + setName(NAME); } } \ No newline at end of file diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalmgraction/DeleteMgrAction.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalmgraction/DeleteMgrAction.java index 45484a4..36be477 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalmgraction/DeleteMgrAction.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalmgraction/DeleteMgrAction.java @@ -26,8 +26,11 @@ import org.openatom.ubml.model.be.definition.operation.BizMgrAction; * @Version: V1.0 */ public class DeleteMgrAction extends BizMgrAction implements IInternalMgrAction { + public static final String id = "9sEsnADPFkCRK6ZBC0OwiA"; + public static final String code = "Delete"; + public static final String name = "内置删除操作"; public DeleteMgrAction() { diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalmgraction/ModifyMgrAction.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalmgraction/ModifyMgrAction.java index d1ab501..3f0abc4 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalmgraction/ModifyMgrAction.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalmgraction/ModifyMgrAction.java @@ -26,14 +26,17 @@ import org.openatom.ubml.model.be.definition.operation.BizMgrAction; * @Version: V1.0 */ public class ModifyMgrAction extends BizMgrAction implements IInternalMgrAction { - public static final String id = "8Wna6KaBQEOHpRJfmGMBYQ"; - public static final String code = "Modify"; - public static final String name = "内置修改操作"; + + public static final String ID = "8Wna6KaBQEOHpRJfmGMBYQ"; + + public static final String CODE = "Modify"; + + public static final String NAME = "内置修改操作"; public ModifyMgrAction() { - setID(id); - setCode(code); - setName(name); + setID(ID); + setCode(CODE); + setName(NAME); } } \ No newline at end of file diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalmgraction/QueryMgrAction.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalmgraction/QueryMgrAction.java index 8051090..a3d8d00 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalmgraction/QueryMgrAction.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalmgraction/QueryMgrAction.java @@ -26,14 +26,17 @@ import org.openatom.ubml.model.be.definition.operation.BizMgrAction; * @Version: V1.0 */ public class QueryMgrAction extends BizMgrAction implements IInternalMgrAction { - public static final String id = "m_6xIwJwoUy7qzsuZ6_S5A"; - public static final String code = "Query"; - public static final String name = "内置查询操作"; + + public static final String ID = "m_6xIwJwoUy7qzsuZ6_S5A"; + + public static final String CODE = "Query"; + + public static final String NAME = "内置查询操作"; public QueryMgrAction() { - setID(id); - setCode(code); - setName(name); + setID(ID); + setCode(CODE); + setName(NAME); } } \ No newline at end of file diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalmgraction/RetrieveDefaultMgrAction.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalmgraction/RetrieveDefaultMgrAction.java index e714ac0..4774afa 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalmgraction/RetrieveDefaultMgrAction.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalmgraction/RetrieveDefaultMgrAction.java @@ -26,13 +26,16 @@ import org.openatom.ubml.model.be.definition.operation.BizMgrAction; * @Version: V1.0 */ public class RetrieveDefaultMgrAction extends BizMgrAction implements IInternalMgrAction { - public static final String id = "Tji_dbrLtEKQlOLRpOJj9Q"; - public static final String code = "RetrieveDefault"; - public static final String name = "内置新增操作"; + + public static final String ID = "Tji_dbrLtEKQlOLRpOJj9Q"; + + public static final String CODE = "RetrieveDefault"; + + public static final String NAME = "内置新增操作"; public RetrieveDefaultMgrAction() { - setID(id); - setCode(code); - setName(name); + setID(ID); + setCode(CODE); + setName(NAME); } } \ No newline at end of file diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalmgraction/RetrieveMgrAction.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalmgraction/RetrieveMgrAction.java index 022b783..7b4c6d7 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalmgraction/RetrieveMgrAction.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/internalmgraction/RetrieveMgrAction.java @@ -26,13 +26,13 @@ import org.openatom.ubml.model.be.definition.operation.BizMgrAction; * @Version: V1.0 */ public class RetrieveMgrAction extends BizMgrAction implements IInternalMgrAction { - public static final String id = "fQbpcO7bIEGoRdTZZIyrag"; - public static final String code = "Retrieve"; - public static final String name = "内置检索操作"; + public static final String ID = "fQbpcO7bIEGoRdTZZIyrag"; + public static final String CODE = "Retrieve"; + public static final String NAME = "内置检索操作"; public RetrieveMgrAction() { - setID(id); - setCode(code); - setName(name); + setID(ID); + setCode(CODE); + setName(NAME); } } \ No newline at end of file diff --git a/pom.xml b/pom.xml index 5aacd3e..a580434 100644 --- a/pom.xml +++ b/pom.xml @@ -160,28 +160,28 @@ - - - - - - - - - - - - - - - - - - - - - - + + org.apache.maven.plugins + maven-checkstyle-plugin + ${maven-checkstyle-plugin.version} + + + validate + validate + + ${user.dir}/style/ubml_checkstyle.xml + UTF-8 + true + true + false + **/generated/**/* + + + check + + + + -- Gitee From 1ef1cf39187c484be834eb36af1a9f554eb35ab7 Mon Sep 17 00:00:00 2001 From: haoxiaofei Date: Thu, 8 Apr 2021 14:22:26 +0800 Subject: [PATCH 39/61] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=B1=BB=EF=BC=9A?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B8=B8=E9=87=8F=E7=B1=BB=E5=92=8C=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/be/definition/beenum/AuthType.java | 2 +- .../entity/CmFieldRuleNames.java | 20 ++ .../controlruledef/entity/CmRuleNames.java | 22 +++ .../names/CmResourceDescriptionNames.java | 20 ++ .../i18n/names/CmResourceKeyNames.java | 20 ++ .../util/CommonModelExtension.java | 185 ++++++++++++++++++ .../util/generate/CommonObjectGenUtils.java | 26 +++ .../util/generate/ElementGeneratingUtils.java | 43 ++++ .../util/generate/GeneratingUtils.java | 31 +++ 9 files changed, 368 insertions(+), 1 deletion(-) create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmFieldRuleNames.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmRuleNames.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/i18n/names/CmResourceDescriptionNames.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/i18n/names/CmResourceKeyNames.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/CommonModelExtension.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/generate/CommonObjectGenUtils.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/generate/ElementGeneratingUtils.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/generate/GeneratingUtils.java diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/AuthType.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/AuthType.java index f40e1d8..01689dd 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/AuthType.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/AuthType.java @@ -45,7 +45,7 @@ public enum AuthType { private synchronized static java.util.HashMap getMappings() { if (mappings == null) { - mappings = new java.util.HashMap(); + mappings = new java.util.HashMap<>(); } return mappings; } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmFieldRuleNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmFieldRuleNames.java new file mode 100644 index 0000000..9df117d --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmFieldRuleNames.java @@ -0,0 +1,20 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.commonmodel.controlruledef.entity; + +public class CmFieldRuleNames { + public static String CM_FIELD_RULE_OBJECT_TYPE_NAME ="GspCommonModelField"; +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmRuleNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmRuleNames.java new file mode 100644 index 0000000..80de720 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmRuleNames.java @@ -0,0 +1,22 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.commonmodel.controlruledef.entity; + +public class CmRuleNames { + public static String CODE ="CODE"; + public static String CM_RULE_OBJECT_TYPE="CommonModel"; + public static String NAME ="Name"; +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/i18n/names/CmResourceDescriptionNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/i18n/names/CmResourceDescriptionNames.java new file mode 100644 index 0000000..0a8b945 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/i18n/names/CmResourceDescriptionNames.java @@ -0,0 +1,20 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.commonmodel.i18n.names; + +public final class CmResourceDescriptionNames { + public static final String TIP_INFO = "唯一性约束提示信息"; +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/i18n/names/CmResourceKeyNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/i18n/names/CmResourceKeyNames.java new file mode 100644 index 0000000..13c8b37 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/i18n/names/CmResourceKeyNames.java @@ -0,0 +1,20 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.commonmodel.i18n.names; + +public final class CmResourceKeyNames { + public static final String TIP_INFO = "TipInfo"; +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/CommonModelExtension.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/CommonModelExtension.java new file mode 100644 index 0000000..3562848 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/CommonModelExtension.java @@ -0,0 +1,185 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.commonmodel.util; + +import java.util.ArrayList; +import java.util.HashMap; +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.util.DataValidator; +import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonElement; +import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonModel; +import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonObject; +import org.openatom.ubml.model.common.definition.commonmodel.entity.GspCommonElement; +import org.openatom.ubml.model.common.definition.commonmodel.entity.GspCommonModel; +import org.openatom.ubml.model.common.definition.commonmodel.entity.GspCommonObject; + +/** + * CM扩展方法 + * + */ +public final class CommonModelExtension { + + /** + * 获取指定结点的属性字典,其中key 是LabelID + * + * 包含非持久化属性和关联带出的属性 + * + * @param node + * @return + */ + @SuppressWarnings("unchecked") + static HashMap getElements(IGspCommonObject node) { + final String elementDicKey = "NodeElementDic"; + + if (node == null || node.getContainElements() == null) { + return null; + } + GspCommonObject co = (GspCommonObject) ((node instanceof GspCommonObject) ? node : null); + if (co != null) { + if (co.getExtProperties().containsKey(elementDicKey)) { + // (java.util.HashMap) + Object result = co.getExtProperties().get(elementDicKey); + return (HashMap) result; + } + } + + HashMap rez = ((GspCommonObject) node).getAllElementDic(); + if (co != null) { + co.getExtProperties().put(elementDicKey, rez); + } + return rez; + } + + private static void getNodes(IGspCommonObject bizEntityObject, java.util.Map rez) { + if (bizEntityObject.getContainChildObjects() == null) { + return; + } + if (bizEntityObject.getContainChildObjects().size() == 0) { + return; + } + // Java: + for (IGspCommonObject obj : bizEntityObject.getContainChildObjects()) { + getNodes(obj, rez); + rez.put(obj.getCode(), obj); + } + } + + /** + * 递归取所有子Node + * + * @param model + * @return 返回结果集为字典类型,不保证遍历顺序 + */ + public static HashMap getNodes(IGspCommonModel model) { + final String nodeDicKey = "ModelNodesDic"; + + if (model == null || model.getMainObject() == null) { + return null; + } + HashMap result = getExtProperty(model, nodeDicKey); + if (result != null) { + return result; + } + + HashMap rez = new HashMap<>(); + getNodes(model.getMainObject(), rez); + rez.put(model.getMainObject().getCode(), model.getMainObject()); + result = new HashMap<>(rez); + setExtProperty(model, nodeDicKey, result); + return result; + } + + static boolean HasCodeNumberColumn(IGspCommonModel model) { + DataValidator.checkForNullReference(model, "model"); + + GspCommonModel cm = (GspCommonModel) ((model instanceof GspCommonModel) ? model : null); + final String key = "HasCodeNumberColumn"; + if (cm != null && cm.getExtProperties().containsKey(key)) { + return (boolean) cm.getExtProperties().get(key); + } + boolean result = false; + for (IGspCommonField item : ((GspCommonObject) model.getMainObject()).getContainElements()) { + GspCommonElement element = (GspCommonElement) item; + if (element.getBillCodeConfig() != null && element.getBillCodeConfig().getCanBillCode() + && !element.getBillCodeConfig().getBillCodeID().isEmpty()) { + result = true; + break; + } + } + if (cm != null) { + cm.getExtProperties().put(key, result); + } + return result; + } + + /** + * 按照层次遍历的BE结点列表 + * + * @return 结果集使用先根后子方式排序 + */ + public static ArrayList getLevelOrderedNodes(IGspCommonModel model) { + + final String nodesListkey = "ModelLevelOrderedNodes"; + ArrayList nodes = getExtProperty(model, nodesListkey); + if (nodes != null) { + return nodes; + } + + nodes = new ArrayList<>(); + java.util.LinkedList nodeQueue = new java.util.LinkedList<>(); + nodeQueue.offer(model.getMainObject()); + + while (nodeQueue.size() > 0) { + IGspCommonObject node = nodeQueue.poll(); + if (node == null) // TODO ERROR? + { + continue; + } + + nodes.add(node); + if (node.getContainChildObjects().size() <= 0) { + continue; + } + + for (IGspCommonObject child : node.getContainChildObjects()) { + nodeQueue.offer(child); + } + } + setExtProperty(model, nodesListkey, nodes); + return nodes; + } + + @SuppressWarnings("unchecked") + private static T getExtProperty(IGspCommonModel model, String key) { + GspCommonModel cm = (GspCommonModel) ((model instanceof GspCommonModel) ? model : null); + if (cm == null) { + return null; + } + if (cm.getExtProperties().containsKey(key)) { + return (T) cm.getExtProperties().get(key); + } + return null; + } + + private static void setExtProperty(IGspCommonModel model, String key, T value) { + GspCommonModel cm = (GspCommonModel) ((model instanceof GspCommonModel) ? model : null); + if (cm == null) { + return; + } + + cm.getExtProperties().put(key, value); + } +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/generate/CommonObjectGenUtils.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/generate/CommonObjectGenUtils.java new file mode 100644 index 0000000..57b3a6f --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/generate/CommonObjectGenUtils.java @@ -0,0 +1,26 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.commonmodel.util.generate; + +import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonObject; + +public class CommonObjectGenUtils +{ + public static String getGeneratedInterfaceName(IGspCommonObject node) + { + return GeneratingUtils.INTERFACE_PREFIX + node.getCode(); + } +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/generate/ElementGeneratingUtils.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/generate/ElementGeneratingUtils.java new file mode 100644 index 0000000..4113678 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/generate/ElementGeneratingUtils.java @@ -0,0 +1,43 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.commonmodel.util.generate; + +import org.openatom.ubml.model.common.definition.cef.element.GspElementDataType; + +public final class ElementGeneratingUtils { + @SuppressWarnings("rawtypes") + public static Class getNativeType(GspElementDataType elementType) { + switch (elementType) { + case String: + case Text: + return String.class; + case Boolean: + return Boolean.class; + case Integer: + return Integer.class; + case Decimal: + return java.math.BigDecimal.class; + case Date: + case DateTime: + return java.util.Date.class; + case Binary: + return byte[].class; + default: + return null; + } + } + +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/generate/GeneratingUtils.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/generate/GeneratingUtils.java new file mode 100644 index 0000000..3fb4d20 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/generate/GeneratingUtils.java @@ -0,0 +1,31 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.commonmodel.util.generate; + +import org.openatom.ubml.model.common.definition.cef.entity.DataTypeAssemblyInfo; +import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonModel; + +public final class GeneratingUtils { + public static final String INTERFACE_PREFIX = "I"; + + public static DataTypeAssemblyInfo getGeneratingEntityAss(IGspCommonModel cm) { + return cm.getEntityAssemblyInfo(); + } + + public static DataTypeAssemblyInfo getGeneratingApiAssInfo(IGspCommonModel cm) { + return cm.getApiNamespace(); + } +} \ No newline at end of file -- Gitee From a8eb9713a41c429478dde44980e39947b1a77de7 Mon Sep 17 00:00:00 2001 From: Q-Lee Date: Thu, 8 Apr 2021 17:55:53 +0800 Subject: [PATCH 40/61] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=9A=E5=AF=B9model->framework->common=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E4=BB=A3=E7=A0=81=E8=BF=9B=E8=A1=8C=E4=BA=86?= =?UTF-8?q?=E4=BC=98=E5=8C=96,=E4=B8=BB=E8=A6=81=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E4=B8=BA(1)=20=E5=8E=BB=E6=8E=89=E5=A4=9A=E4=BD=99=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=20(2)=20=E8=A7=84=E8=8C=83=E6=96=B9=E6=B3=95=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E5=8F=8A=E9=A6=96=E5=AD=97=E6=AF=8D=E8=A6=81=E5=B0=8F?= =?UTF-8?q?=E5=86=99=20(3)=20=E8=A7=84=E8=8C=83=E5=B8=B8=E9=87=8F=E5=91=BD?= =?UTF-8?q?=E5=90=8D=20(4)=20=E6=B3=A8=E9=87=8A=E6=8E=89pom=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E4=BB=A3=E7=A0=81=E9=A3=8E=E6=A0=BC=E6=89=AB=E6=8F=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/serializer/JsonSerializer.java | 4 +- .../ubml/model/framework/api/FileService.java | 6 --- .../definition/entity/BaseConfig.java | 8 ---- .../entity/MetadataPackageVersion.java | 12 ++--- .../spi/MetadataContentSerializer.java | 4 +- pom.xml | 46 +++++++++---------- 6 files changed, 33 insertions(+), 47 deletions(-) diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/JsonSerializer.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/JsonSerializer.java index 3b5bf38..398f905 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/JsonSerializer.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/JsonSerializer.java @@ -38,7 +38,7 @@ public class JsonSerializer implements MetadataContentSerializer { * @return */ @Override - public JsonNode Serialize(IMetadataContent iMetadataContent) { + public JsonNode serialize(IMetadataContent iMetadataContent) { if (Objects.isNull(iMetadataContent)) { return null; } @@ -54,7 +54,7 @@ public class JsonSerializer implements MetadataContentSerializer { * @return */ @Override - public IMetadataContent DeSerialize(JsonNode jsonNode) { + public IMetadataContent deSerialize(JsonNode jsonNode) { if (Objects.isNull(jsonNode)) { return null; } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/api/FileService.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/api/FileService.java index b0e2955..36f55c6 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/api/FileService.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/api/FileService.java @@ -31,8 +31,6 @@ import java.util.zip.ZipException; */ public interface FileService { - //文件操作 - /** * 文件删除 * @@ -93,8 +91,6 @@ public interface FileService { */ void fileCopy(String sourcePath, String destinationPath) throws IOException; - //文件夹操作 - /** * 文件夹是否存在 * @@ -134,8 +130,6 @@ public interface FileService { */ void deleteAllFilesUnderDirectory(String dirPath) throws IOException; - //路径操作 - /** * 整合路径 * diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/BaseConfig.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/BaseConfig.java index 27b7de7..6556a62 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/BaseConfig.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/BaseConfig.java @@ -24,14 +24,6 @@ package org.openatom.ubml.model.framework.definition.entity; */ public class BaseConfig { - /** - * @author zhongchq - * @description - * @date 19:04 2019/7/23 - * @param - * @throws - * @return - **/ private String name; private String assembly; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageVersion.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageVersion.java index 50062de..e49ffc5 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageVersion.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageVersion.java @@ -31,7 +31,7 @@ public class MetadataPackageVersion { /** * 版本号分隔符 例如版本分隔符为'.',版本号位数为3,版本号形式则为"1.0.0" */ - private static final char SEPARATOR = '.'; + private static final char SEPARATOR_SPOT = '.'; private int[] versionInt; /** @@ -73,7 +73,7 @@ public class MetadataPackageVersion { * @param position 指定位置。最左边位置号为0,向右依次增1. * @param quantity 指定数量 */ - public final void add(int position, int quantity) { + public final void addQuantityByPosition(int position, int quantity) { if (position > VERSION_LENGTH - 1) { throw new RuntimeException("指定版本号位置超出有效范围。"); } @@ -85,7 +85,7 @@ public class MetadataPackageVersion { * * @param position 指定位置。最左边位置号为1,向右依次增1. */ - public final void Add(int position) { + public final void addOneByPosition(int position) { if (position > VERSION_LENGTH) { throw new RuntimeException("指定版本号位置超出有效范围。"); } @@ -97,14 +97,14 @@ public class MetadataPackageVersion { * * @param quantity 指定数量 */ - public final void AddLast(int quantity) { + public final void addQuantityLast(int quantity) { versionInt[VERSION_LENGTH - 1] += quantity; } /** * 版本号末位增1 */ - public final void AddLast() { + public final void addOneLast() { versionInt[VERSION_LENGTH - 1] += 1; } @@ -114,7 +114,7 @@ public class MetadataPackageVersion { * @param another * @return */ - public final int CompareTo(Object another) { + public final int compareTo(Object another) { if (!(another instanceof MetadataPackageVersion)) { throw new RuntimeException("MetadataPackageVersion的CompareTo方法只能传入MetadataPackageVersion类型的参数。"); } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataContentSerializer.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataContentSerializer.java index 2bb1b1f..23bceb1 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataContentSerializer.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataContentSerializer.java @@ -20,7 +20,7 @@ import org.openatom.ubml.model.common.definition.entity.IMetadataContent; public interface MetadataContentSerializer { - JsonNode Serialize(IMetadataContent metadataContent); + JsonNode serialize(IMetadataContent metadataContent); - IMetadataContent DeSerialize(JsonNode contentJObject); + IMetadataContent deSerialize(JsonNode contentJObject); } diff --git a/pom.xml b/pom.xml index a580434..9281e37 100644 --- a/pom.xml +++ b/pom.xml @@ -159,29 +159,29 @@ false - - - org.apache.maven.plugins - maven-checkstyle-plugin - ${maven-checkstyle-plugin.version} - - - validate - validate - - ${user.dir}/style/ubml_checkstyle.xml - UTF-8 - true - true - false - **/generated/**/* - - - check - - - - + + + + + + + + + + + + + + + + + + + + + + + -- Gitee From 3a2792aa5cc78b565b1a03777a0146e0ab57db80 Mon Sep 17 00:00:00 2001 From: Q-Lee <7961837+Q-Lee@user.noreply.gitee.com> Date: Thu, 8 Apr 2021 19:06:15 +0800 Subject: [PATCH 41/61] =?UTF-8?q?!26=20=E4=BC=98=E5=8C=96=EF=BC=9A?= =?UTF-8?q?=E5=AF=B9model->framework=E6=A8=A1=E5=9D=97=E4=B8=8B3=E4=B8=AA?= =?UTF-8?q?=E6=9E=9A=E4=B8=BE=E7=B1=BB=E5=AE=9A=E4=B9=89=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E4=BA=86=E5=91=BD=E5=90=8D=E8=A7=84=E8=8C=83=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=20*=20=E4=BC=98=E5=8C=96=EF=BC=9A=E5=AF=B9model->framework?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=B8=8B3=E4=B8=AA=E6=9E=9A=E4=B8=BE?= =?UTF-8?q?=E7=B1=BB=E5=AE=9A=E4=B9=89=E8=BF=9B=E8=A1=8C=E4=BA=86=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E8=A7=84=E8=8C=83=E4=BF=AE=E6=94=B9=20*=20Merge=20rem?= =?UTF-8?q?ote-tracking=20branch=20'upstream/develop'=20into=20checkstyle?= =?UTF-8?q?=20*=20Merge=20remote-tracking=20branch=20'upstream/develop'=20?= =?UTF-8?q?into=20checkstyle=20*=20=E4=BC=98=E5=8C=96:=20(1)=E8=A7=84?= =?UTF-8?q?=E8=8C=83MavenDependency.java=20=E4=B8=AD=E9=87=8D=E5=86=99equa?= =?UTF-8?q?ls=E7=9A=84=E6=96=B9=E5=BC=8F=20(2)=E9=87=8D=E5=86=99equals?= =?UTF-8?q?=E6=97=B6=E5=BF=85=E9=A1=BB=E9=87=8D=E5=86=99hashCode=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/customize/listener/SgfMdPkgChangedEventListener.java | 2 +- .../framework/definition/entity/MetadataPackageHeader.java | 2 +- .../ubml/model/framework/definition/entity/ProcessMode.java | 4 ++-- .../model/framework/definition/entity/ResourceLocation.java | 4 ++-- .../ubml/model/framework/definition/entity/ResourceType.java | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMdPkgChangedEventListener.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMdPkgChangedEventListener.java index 84a5d90..4408bea 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMdPkgChangedEventListener.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMdPkgChangedEventListener.java @@ -60,7 +60,7 @@ public class SgfMdPkgChangedEventListener implements MdPkgChangedEventListener { private void handleMdPkg(MetadataPackage metadataPackage) { try { - if (!ProcessMode.interpretation.equals(metadataPackage.getHeader().getProcessMode())) { + if (!ProcessMode.INTERPRETATION.equals(metadataPackage.getHeader().getProcessMode())) { //如果不是无需生成代码的元数据包,直接忽略 return; } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageHeader.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageHeader.java index 9363998..f651d23 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageHeader.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageHeader.java @@ -37,7 +37,7 @@ public class MetadataPackageHeader { private ProcessMode processMode; public MetadataPackageHeader() { - setProcessMode(ProcessMode.generation); + setProcessMode(ProcessMode.GENERATION); } public String getName() { diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProcessMode.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProcessMode.java index 37312e6..795745d 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProcessMode.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProcessMode.java @@ -22,10 +22,10 @@ public enum ProcessMode { /** * 生成型 */ - generation, + GENERATION, /** * 解析型 */ - interpretation + INTERPRETATION } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ResourceLocation.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ResourceLocation.java index d194a6c..09a58db 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ResourceLocation.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ResourceLocation.java @@ -20,10 +20,10 @@ public enum ResourceLocation { /** * 前端资源 */ - Frontend, + FRONTEND, /** * 后端资源 */ - Backend + BACKEND } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ResourceType.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ResourceType.java index 1d06f7a..2364dc6 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ResourceType.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ResourceType.java @@ -20,7 +20,7 @@ public enum ResourceType { /** * 消息资源 */ - Message, + MESSAGE, /** * 异常资源 @@ -30,5 +30,5 @@ public enum ResourceType { /** * 元数据资源 */ - Metadata + METADATA } -- Gitee From 0c1ddd9cb1354ec87eae62228bf79c93a110b0a7 Mon Sep 17 00:00:00 2001 From: a1b2c3d4 <8869064+han-liangliang111@user.noreply.gitee.com> Date: Sat, 10 Apr 2021 20:20:52 +0800 Subject: [PATCH 42/61] =?UTF-8?q?!23=201=E3=80=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=9A=E5=A2=9E=E5=8A=A0vo=E7=B1=BB=E7=9A=84CopyRight?= =?UTF-8?q?=EF=BC=9B2=E3=80=81=E4=BF=AE=E5=A4=8D=EF=BC=9A=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=86=B2=E7=AA=81=E5=90=88=E5=B9=B6=20*=20Merge=20bra?= =?UTF-8?q?nch=20'develop'=20of=20https://gitee.com/ubml/ubml-impl=20into?= =?UTF-8?q?=20develop=20*=201=E3=80=81=E4=BF=AE=E5=A4=8D=EF=BC=9A=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E4=BB=A3=E7=A0=81=E5=86=B2=E7=AA=81=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20*=201=E3=80=81optimize:=20add=20copyright=20header=20to=20vo?= =?UTF-8?q?=20class=20*=201=E3=80=81=E4=BC=98=E5=8C=96:=20=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E6=B7=BB=E5=8A=A0i8n=E5=AE=9E=E4=BD=93=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../context/CefResourceExtractContext.java | 67 +++++++++++ .../cef/i18n/context/CefResourceInfo.java | 78 ++++++++++++ .../i18n/context/CefResourceMergeContext.java | 47 ++++++++ .../i18n/context/CefResourcePrefixInfo.java | 38 ++++++ .../context/ICefResourceExtractContext.java | 32 +++++ .../context/ICefResourceMergeContext.java | 37 ++++++ .../extractor/AbstractResourceExtractor.java | 112 ++++++++++++++++++ .../AssoRefFieldResourceExtractor.java | 44 +++++++ .../i18n/extractor/AssoResourceExtractor.java | 57 +++++++++ .../extractor/CefFieldResourceExtractor.java | 102 ++++++++++++++++ .../extractor/DataTypeResourceExtractor.java | 88 ++++++++++++++ .../i18n/merger/AbstractResourceMerger.java | 50 ++++++++ .../merger/AssoRefFieldResourceMerger.java | 29 +++++ .../cef/i18n/merger/AssoResourceMerger.java | 45 +++++++ .../i18n/merger/CefFieldResourceMerger.java | 98 +++++++++++++++ .../i18n/merger/DataTypeResourceMerger.java | 62 ++++++++++ .../names/CefResourceDescriptionNames.java | 22 ++++ .../cef/i18n/names/CefResourceKeyNames.java | 23 ++++ .../definition/DotNetToJavaStringHelper.java | 15 +++ .../model/vo/definition/GspViewModel.java | 15 +++ .../vo/definition/GspViewModelElement.java | 15 +++ .../model/vo/definition/GspViewObject.java | 15 +++ .../action/ActionFormatParameter.java | 20 +++- .../action/IViewModelParameterCollection.java | 16 ++- .../vo/definition/action/MappedBizAction.java | 15 +++ .../vo/definition/action/MappedCdpAction.java | 15 +++ .../action/MappedCdpActionBase.java | 15 +++ .../vo/definition/action/VMActionResult.java | 15 +++ .../vo/definition/action/ViewModelAction.java | 15 +++ .../action/ViewModelActionType.java | 15 +++ .../ChangeSetMappingAction.java | 23 ---- .../ChangeSetReversalMappingAction.java | 23 ---- .../ChangesetMappingAction.java | 38 ++++++ .../ChangesetReversalMappingAction.java | 38 ++++++ .../internalexternalaction/CreateAction.java | 29 +++-- .../DataMappingAction.java | 28 +++-- .../DataReversalMappingAction.java | 28 +++-- .../internalexternalaction/DeleteAction.java | 28 +++-- .../IInternalExtendAction.java | 17 ++- .../internalexternalaction/ModifyAction.java | 27 ++++- .../MultiDeleteAction.java | 28 +++-- .../internalexternalaction/QueryAction.java | 27 ++++- .../RetrieveAction.java | 29 +++-- .../mappedbiz/MappedBizActionParameter.java | 15 +++ .../MappedBizActionParameterCollection.java | 15 +++ .../mappedcdp/MappedCdpActionParameter.java | 15 +++ .../MappedCdpActionParameterCollection.java | 15 +++ .../ViewModelParActualValue.java | 15 +++ .../ViewModelParActualValueType.java | 15 +++ .../viewmodelbase/ViewModelParameter.java | 15 +++ .../ViewModelParameterCollection.java | 15 +++ .../viewmodelbase/ViewModelReturnValue.java | 15 +++ .../ViewModelVoidReturnValue.java | 15 +++ .../collection/VMActionCollection.java | 15 +++ .../collection/VMElementCollection.java | 15 +++ .../collection/ValueHelpConfigCollection.java | 15 +++ .../collection/ViewObjectCollection.java | 15 +++ .../vo/definition/common/ConvertUtils.java | 15 +++ .../vo/definition/common/ElementHelpType.java | 15 +++ .../definition/common/HelpExtendAction.java | 15 +++ .../vo/definition/common/InitVoUtil.java | 15 +++ .../common/InternalExtendActionUtil.java | 15 +++ .../vo/definition/common/LinkBeUtils.java | 15 +++ .../vo/definition/common/MappingType.java | 15 +++ .../vo/definition/common/MetadataType.java | 15 +++ .../vo/definition/common/TemplateVoInfo.java | 15 +++ .../common/VMCollectionParameterType.java | 15 +++ .../vo/definition/common/VMHelpConfig.java | 15 +++ .../vo/definition/common/VMParameterMode.java | 15 +++ .../vo/definition/common/VMParameterType.java | 15 +++ .../vo/definition/common/ValueHelpConfig.java | 15 +++ .../definition/common/ViewModelMapping.java | 15 +++ .../definition/common/copy/CopyContext.java | 15 +++ .../common/mapping/GspQoObjectMapping.java | 15 +++ .../common/mapping/GspVoElementMapping.java | 15 +++ .../mapping/GspVoElementSourceType.java | 15 +++ .../common/mapping/GspVoObjectMapping.java | 15 +++ .../common/mapping/GspVoObjectSourceType.java | 15 +++ .../dataextendinfo/VoDataExtendInfo.java | 15 +++ .../api/GspVoExtendInfoService.java | 15 +++ .../extendinfo/entity/GspVoExtendInfo.java | 15 +++ .../json/ExtendPropertiesDeserializer.java | 15 +++ .../definition/json/ViewModelJsonConst.java | 15 +++ .../json/element/ViewElementDeserializer.java | 15 +++ .../json/element/ViewElementSerializer.java | 15 +++ .../mapping/GspQoObjectMappingSerializer.java | 15 +++ .../GspVoElementMappingDeserializer.java | 15 +++ .../GspVoElementMappingSerializer.java | 15 +++ .../GspVoObjectMappingDeserializer.java | 15 +++ .../mapping/GspVoObjectMappingSerializer.java | 15 +++ .../mapping/ViewModelMappingDeserializer.java | 15 +++ .../mapping/ViewModelMappingSerializer.java | 15 +++ .../model/ValueHelpConfigDeserizlizer.java | 15 +++ .../json/model/ValueHelpConfigSerizlizer.java | 15 +++ .../json/model/ViewModelDeserializer.java | 15 +++ .../json/model/ViewModelSerializer.java | 15 +++ .../model/VoDataExtendInfoDeserializer.java | 15 +++ .../model/VoDataExtendInfoSerializer.java | 15 +++ .../json/object/ViewObjectDeserializer.java | 3 +- .../json/object/ViewObjectSerializer.java | 3 +- .../MappedBizActionDeserializer.java | 15 +++ .../MappedBizActionParaDeserializer.java | 15 +++ .../MappedBizActionParaSerializer.java | 15 +++ .../operation/MappedBizActionSerializer.java | 15 +++ .../MappedCdpActionDeserializer.java | 15 +++ .../operation/MappedCdpActionSerializer.java | 15 +++ .../operation/MappedCdpParaDeserializer.java | 15 +++ .../operation/MappedCdpParaSerializer.java | 15 +++ .../VmActionCollectionDeserializer.java | 15 +++ .../VmActionCollectionSerializer.java | 15 +++ .../json/operation/VmActionDeserializer.java | 15 +++ .../json/operation/VmActionSerializer.java | 15 +++ .../operation/VmParameterDeserializer.java | 15 +++ .../json/operation/VmParameterSerializer.java | 15 +++ .../operation/VmReturnValueDeserializer.java | 15 +++ 115 files changed, 2525 insertions(+), 111 deletions(-) create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceInfo.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourcePrefixInfo.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceExtractContext.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AbstractResourceExtractor.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoRefFieldResourceExtractor.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoResourceExtractor.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/CefFieldResourceExtractor.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/DataTypeResourceExtractor.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AbstractResourceMerger.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoRefFieldResourceMerger.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoResourceMerger.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceDescriptionNames.java create mode 100644 model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceKeyNames.java delete mode 100644 model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangeSetMappingAction.java delete mode 100644 model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangeSetReversalMappingAction.java create mode 100644 model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetMappingAction.java create mode 100644 model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetReversalMappingAction.java diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java new file mode 100644 index 0000000..2a58611 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java @@ -0,0 +1,67 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +import org.openatom.ubml.model.common.definition.cef.util.DataValidator; +import org.openatom.ubml.model.common.definition.entity.I18nResourceItem; +import org.openatom.ubml.model.common.definition.entity.I18nResourceItemCollection; + +/** + * 多语资源项抽取上下文 + */ +public class CefResourceExtractContext implements ICefResourceExtractContext { + private String metaPrefix; + private I18nResourceItemCollection resourceItems; + + public CefResourceExtractContext(String metaPrefix, I18nResourceItemCollection items) { + DataValidator.checkForEmptyString(metaPrefix, "元数据前缀"); + DataValidator.checkForNullReference(items, "国际化资源项"); + this.metaPrefix = metaPrefix; + this.resourceItems = items; + } + + /** + * 获取前缀 + * + * @return + */ + public final String getKeyPrefix() { + return metaPrefix; + } + + /** + * 新增/修改 + * + * @param info + */ + public final void setResourceItem(CefResourceInfo info) { + String key = info.getResourceKey(); + String value = info.getResourceValue(); + String description = info.getDescription(); + + I18nResourceItem resource = GetNewResource(key, value, description); + + resourceItems.add(resource); + } + + private I18nResourceItem GetNewResource(String key, String value, String description) { + I18nResourceItem resourceItem = new I18nResourceItem(); + resourceItem.setKey(key); + resourceItem.setValue(value); + resourceItem.setComment(description); + return resourceItem; + } +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceInfo.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceInfo.java new file mode 100644 index 0000000..9defaf0 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceInfo.java @@ -0,0 +1,78 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +import org.openatom.ubml.model.common.definition.cef.util.DataValidator; + +public class CefResourceInfo { + + public CefResourceInfo(CefResourcePrefixInfo prefixInfo, String resourceKeyPropName, String descriptionPropName, + String resourceValue) { + DataValidator.checkForNullReference(prefixInfo, "PrefixInfo"); + DataValidator.checkForEmptyString(prefixInfo.getDescriptionPrefix(), "DescriptionPrefix"); + DataValidator.checkForEmptyString(prefixInfo.getResourceKeyPrefix(), "ResourceKeyPrefix"); + + DataValidator.checkForEmptyString(resourceKeyPropName, "ResourceKeyPropName"); + DataValidator.checkForEmptyString(descriptionPropName, "DescriptionPropName"); + DataValidator.checkForEmptyString(resourceValue, "ResourceValue"); + + this.prefixInfo = prefixInfo; + this.resourceKeyPropName = resourceKeyPropName; + this.descriptionPropName = descriptionPropName; + this.resourceValue = resourceValue; + } + + private CefResourcePrefixInfo prefixInfo; + + public final CefResourcePrefixInfo getPrefixInfo() { + return prefixInfo; + } + + /** + * 属性名 e.g. NAME + */ + private String resourceKeyPropName; + + public final String getResourceKeyPropName() { + return resourceKeyPropName; + } + + /** + * 描述中属性名 e.g. 名称 + */ + private String descriptionPropName; + + public final String getDescriptionPropName() { + return descriptionPropName; + } + + /** + * 默认语言的值 + */ + private String resourceValue; + + public final String getResourceValue() { + return resourceValue; + } + + public String getResourceKey() { + return getPrefixInfo().getResourceKeyPrefix() + "." + getResourceKeyPropName(); + } + + public String getDescription() { + return getPrefixInfo().getDescriptionPrefix() + "的" + getDescriptionPropName(); + } +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java new file mode 100644 index 0000000..f345968 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java @@ -0,0 +1,47 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +import org.openatom.ubml.model.common.definition.cef.util.DataValidator; +import org.openatom.ubml.model.common.definition.entity.I18nResourceItemCollection; + +public class CefResourceMergeContext implements ICefResourceMergeContext { + + private String metaPrefix; + private I18nResourceItemCollection resourceItems; + + public CefResourceMergeContext(String metaPrefix, I18nResourceItemCollection items) { + DataValidator.checkForEmptyString(metaPrefix, "元数据前缀"); + DataValidator.checkForNullReference(items, "国际化资源项"); + this.metaPrefix = metaPrefix; + this.resourceItems = items; + } + + @Override + public String getKeyPrefix() { + return this.metaPrefix; + } + + @Override + public void setKeyPrefix(String keyPrefix) { + this.metaPrefix = keyPrefix; + } + + public I18nResourceItemCollection getResourceItems() { + return this.resourceItems; + } + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourcePrefixInfo.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourcePrefixInfo.java new file mode 100644 index 0000000..325aa44 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourcePrefixInfo.java @@ -0,0 +1,38 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +public class CefResourcePrefixInfo { + private String resourceKeyPrefix; + private String descriptionPrefix; + + public String getResourceKeyPrefix() { + return resourceKeyPrefix; + } + + public void setResourceKeyPrefix(String resourceKeyPrefix) { + this.resourceKeyPrefix = resourceKeyPrefix; + } + + public String getDescriptionPrefix() { + return descriptionPrefix; + } + + public void setDescriptionPrefix(String descriptionPrefix) { + this.descriptionPrefix = descriptionPrefix; + } +} + diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceExtractContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceExtractContext.java new file mode 100644 index 0000000..9db7d91 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceExtractContext.java @@ -0,0 +1,32 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +public interface ICefResourceExtractContext { + /** + * 获取前缀 + * + * @return + */ + String getKeyPrefix(); + + /** + * 新增/修改 + * + * @param info + */ + void setResourceItem(CefResourceInfo info); +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java new file mode 100644 index 0000000..6d38a26 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java @@ -0,0 +1,37 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +import org.openatom.ubml.model.common.definition.entity.I18nResourceItemCollection; + +public interface ICefResourceMergeContext { + + /** + * 获取前缀 + * + * @return + */ + String getKeyPrefix(); + + void setKeyPrefix(String keyPrefix); + + /** + * 获取资源项 + * + * @return + */ + I18nResourceItemCollection getResourceItems(); +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AbstractResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AbstractResourceExtractor.java new file mode 100644 index 0000000..2c0639d --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AbstractResourceExtractor.java @@ -0,0 +1,112 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; + +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourceInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; + +/** + * 国际化抽取器基类 + */ +public abstract class AbstractResourceExtractor { + /** + * 国际化抽取器基类 + * + * @param context 上下文 + * @param parentResourceInfo 父抽取器的前缀信息 + */ + protected AbstractResourceExtractor(ICefResourceExtractContext context, CefResourcePrefixInfo parentResourceInfo) { + this.context = context; + this.parentResourcePrefixInfo = parentResourceInfo; + } + + protected AbstractResourceExtractor(ICefResourceExtractContext context) { + this(context, null); + } + + /** + * 国际化抽取上下文 + */ + private ICefResourceExtractContext context; + + protected final ICefResourceExtractContext getContext() { + return context; + } + + /** + * 父抽取器的前缀信息 + */ + private CefResourcePrefixInfo parentResourcePrefixInfo; + + protected final CefResourcePrefixInfo getParentResourcePrefixInfo() { + return parentResourcePrefixInfo; + } + + /** + * 当前抽取器的前缀信息 + */ + private CefResourcePrefixInfo currentResourcePrefixInfo; + + protected final CefResourcePrefixInfo getCurrentResourcePrefixInfo() { + return currentResourcePrefixInfo; + } + + private void setCurrentResourcePrefixInfo(CefResourcePrefixInfo value) { + currentResourcePrefixInfo = value; + } + + //#endregion + + /** + * 抽取国际化项入口方法 + */ + public final void extract() { + setCurrentResourcePrefixInfo(buildCurrentPrefix()); + setPrefixInfo(); + extractItems(); + } + + /** + * 抽取 + */ + protected abstract void extractItems(); + + /** + * 构造前缀 + * + * @return + */ + protected abstract CefResourcePrefixInfo buildCurrentPrefix(); + + /** + * 赋值前缀 + */ + protected abstract void setPrefixInfo(); + + /** + * 新增抽取资源项 + * + * @param propName 属性名 + * @param value 值 + * @param descriptionPropName 描述中属性名 + */ + protected final void addResourceInfo(String propName, String value, String descriptionPropName) { + CefResourceInfo info = new CefResourceInfo(getCurrentResourcePrefixInfo(), propName, descriptionPropName, value); + getContext().setResourceItem(info); + } + +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoRefFieldResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoRefFieldResourceExtractor.java new file mode 100644 index 0000000..e428b9d --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoRefFieldResourceExtractor.java @@ -0,0 +1,44 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; + +public abstract class AssoRefFieldResourceExtractor extends CefFieldResourceExtractor { + private IGspCommonField commonField; + + public AssoRefFieldResourceExtractor(IGspCommonField field, ICefResourceExtractContext context, + CefResourcePrefixInfo parentResourceInfo) { + super(field, context, parentResourceInfo); + commonField = field; + } + + protected CefResourcePrefixInfo buildCurrentPrefix() { + if (!commonField.getIsRefElement()) { + throw new RuntimeException("[多语项抽取]非关联带出字段,不应使用AssoRefFieldResourceExtractor进行抽取。"); + + } + if (getParentResourcePrefixInfo() == null) { + throw new RuntimeException("多语项抽取_字段关联信息" + commonField.getParentAssociation() + "无对应的多语前缀信息。"); + } + CefResourcePrefixInfo fieldResourceInfo = new CefResourcePrefixInfo(); + fieldResourceInfo.setResourceKeyPrefix(getParentResourcePrefixInfo().getResourceKeyPrefix() + "." + commonField.getLabelID()); + fieldResourceInfo.setDescriptionPrefix(getParentResourcePrefixInfo().getDescriptionPrefix() + "的关联带出属性'" + commonField.getName() + "'"); + return fieldResourceInfo; + } +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoResourceExtractor.java new file mode 100644 index 0000000..bac49a7 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoResourceExtractor.java @@ -0,0 +1,57 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.element.GspAssociation; +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; + +public abstract class AssoResourceExtractor extends AbstractResourceExtractor { + private GspAssociation asso; + + protected AssoResourceExtractor(GspAssociation asso, ICefResourceExtractContext context, + CefResourcePrefixInfo parentResourceInfo) { + super(context, parentResourceInfo); + this.asso = asso; + } + + protected void extractItems() { + if (asso.getRefElementCollection() != null && asso.getRefElementCollection().size() > 0) { + for (IGspCommonField item : asso.getRefElementCollection()) { + getAssoRefFieldResourceExtractor(getContext(), getCurrentResourcePrefixInfo(), item).extract(); + } + } + } + + protected CefResourcePrefixInfo buildCurrentPrefix() { + if (getParentResourcePrefixInfo() == null) { + throw new RuntimeException("多语项抽取_字段" + asso.getBelongElement().getName() + "无对应的多语前缀信息。"); + } + return getParentResourcePrefixInfo(); + } + + /** + * 赋值节点的国际化项前缀 + */ + protected final void setPrefixInfo() { + asso.setI18nResourceInfoPrefix(getCurrentResourcePrefixInfo().getResourceKeyPrefix()); + } + + protected abstract AssoRefFieldResourceExtractor getAssoRefFieldResourceExtractor( + ICefResourceExtractContext context, CefResourcePrefixInfo assoPrefixInfo, IGspCommonField field); + +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/CefFieldResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/CefFieldResourceExtractor.java new file mode 100644 index 0000000..853037d --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/CefFieldResourceExtractor.java @@ -0,0 +1,102 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.collection.GspAssociationCollection; +import org.openatom.ubml.model.common.definition.cef.collection.GspEnumValueCollection; +import org.openatom.ubml.model.common.definition.cef.element.GspAssociation; +import org.openatom.ubml.model.common.definition.cef.element.GspEnumValue; +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceDescriptionNames; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; + +public abstract class CefFieldResourceExtractor extends AbstractResourceExtractor { + private IGspCommonField commonField; + + protected CefFieldResourceExtractor(IGspCommonField field, ICefResourceExtractContext context, + CefResourcePrefixInfo parentResourceInfo) { + super(context, parentResourceInfo); + commonField = field; + } + + protected final void extractItems() { + + addResourceInfo(CefResourceKeyNames.NAME, commonField.getName(), CefResourceDescriptionNames.NAME); + + //关联枚举 + switch (commonField.getObjectType()) { + case Association: + extractAssoInfo(commonField.getChildAssociations()); + break; + case Enum: + extractEnumValue(commonField.getContainEnumValues()); + break; + case None: + break; + } + + //扩展 + extractExtendProperties(commonField); + } + + /** + * 赋值字段的国际化项前缀 + */ + protected final void setPrefixInfo() { + commonField.setI18nResourceInfoPrefix(getCurrentResourcePrefixInfo().getResourceKeyPrefix()); + } + + protected CefResourcePrefixInfo buildCurrentPrefix() { + if (getParentResourcePrefixInfo() == null) { + throw new RuntimeException("多语项抽取_节点" + commonField.getBelongObject().getName() + "中字段" + commonField.getName() + ",无节点对应的多语前缀信息。"); + } + CefResourcePrefixInfo fieldResourceInfo = new CefResourcePrefixInfo(); + fieldResourceInfo.setResourceKeyPrefix(getParentResourcePrefixInfo().getResourceKeyPrefix() + "." + commonField.getLabelID()); + fieldResourceInfo.setDescriptionPrefix(getParentResourcePrefixInfo().getDescriptionPrefix() + "中'" + commonField.getName() + "'属性"); + return fieldResourceInfo; + } + + private void extractAssoInfo(GspAssociationCollection assos) { + if (assos != null && assos.size() > 0) { + for (GspAssociation item : assos) { + getAssoResourceExtractor(getContext(), getCurrentResourcePrefixInfo(), item).extract(); + } + } + } + + private void extractEnumValue(GspEnumValueCollection enumValues) { + if (enumValues != null && enumValues.size() > 0) { + for (GspEnumValue item : enumValues) { + String keyPropName = item.getValue() + "." + CefResourceKeyNames.DISPLAY_VALUE; + String value = item.getName(); + String descriptionPropName = "枚举信息'" + item.getName() + "'的" + CefResourceDescriptionNames.DISPLAY_VALUE; + addResourceInfo(keyPropName, value, descriptionPropName); + + String enumKey = getCurrentResourcePrefixInfo().getResourceKeyPrefix() + "." + item.getValue(); + item.setI18nResourceInfoPrefix(enumKey); + } + } + } + + protected void extractExtendProperties(IGspCommonField commonField) { + } + + protected abstract AssoResourceExtractor getAssoResourceExtractor(ICefResourceExtractContext context, + CefResourcePrefixInfo fieldPrefixInfo, GspAssociation asso); + +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/DataTypeResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/DataTypeResourceExtractor.java new file mode 100644 index 0000000..290d99b --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/DataTypeResourceExtractor.java @@ -0,0 +1,88 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; + +import org.openatom.ubml.model.common.definition.cef.IFieldCollection; +import org.openatom.ubml.model.common.definition.cef.IGspCommonDataType; +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceDescriptionNames; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; + +public abstract class DataTypeResourceExtractor extends AbstractResourceExtractor { + + private IGspCommonDataType dataType; + + protected DataTypeResourceExtractor(IGspCommonDataType commonDataType, ICefResourceExtractContext context, + CefResourcePrefixInfo parentResourceInfo) { + super(context, parentResourceInfo); + dataType = commonDataType; + } + + protected final void extractItems() { + + addResourceInfo(CefResourceKeyNames.NAME, dataType.getName(), CefResourceDescriptionNames.NAME); + extractDataTypeFields(dataType.getContainElements()); + //扩展 + extractExtendProperties(dataType); + } + + protected final CefResourcePrefixInfo buildCurrentPrefix() { + CefResourcePrefixInfo prefixInfo = new CefResourcePrefixInfo(); + if (getParentResourcePrefixInfo() == null) { + throw new RuntimeException("多语项抽取_节点" + dataType.getName() + "所属模型,无对应的多语前缀信息。"); + } + prefixInfo.setResourceKeyPrefix(getParentResourcePrefixInfo().getResourceKeyPrefix() + "." + dataType.getCode()); + prefixInfo.setDescriptionPrefix(getParentResourcePrefixInfo().getDescriptionPrefix() + "中'" + dataType.getName() + "'实体"); + return prefixInfo; + } + + /** + * 赋值节点的国际化项前缀 + */ + protected final void setPrefixInfo() { + dataType.setI18nResourceInfoPrefix(getCurrentResourcePrefixInfo().getResourceKeyPrefix()); + } + + private void extractDataTypeFields(IFieldCollection fields) { + if (fields == null || fields.size() == 0) { + return; + } + for (IGspCommonField field : fields) { + CefFieldResourceExtractor extractor = getCefFieldResourceExtractor(getContext(), getCurrentResourcePrefixInfo(), field); + extractor.extract(); + } + + } + + /** + * 获取字段抽取器 + * + * @param context + * @return + */ + protected abstract CefFieldResourceExtractor getCefFieldResourceExtractor(ICefResourceExtractContext context, + CefResourcePrefixInfo objPrefixInfo, IGspCommonField field); + + /** + * 抽取扩展项 + * + * @param dataType + */ + protected void extractExtendProperties(IGspCommonDataType dataType) { + } +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AbstractResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AbstractResourceMerger.java new file mode 100644 index 0000000..88b3988 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AbstractResourceMerger.java @@ -0,0 +1,50 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; + +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; + +public abstract class AbstractResourceMerger { + protected AbstractResourceMerger( + ICefResourceMergeContext context, CefResourcePrefixInfo parentResourceInfo) { + this.context = context; + this.parentResourcePrefixInfo = parentResourceInfo; + } + + protected AbstractResourceMerger(ICefResourceMergeContext context) { + this.context = context; + } + + private ICefResourceMergeContext context; + + protected final ICefResourceMergeContext getContext() { + return context; + } + + private CefResourcePrefixInfo parentResourcePrefixInfo; + + protected final CefResourcePrefixInfo getParentResourcePrefixInfo() { + return parentResourcePrefixInfo; + } + + public void merge() { + mergeItems(); + } + + protected abstract void mergeItems(); + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoRefFieldResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoRefFieldResourceMerger.java new file mode 100644 index 0000000..af7d001 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoRefFieldResourceMerger.java @@ -0,0 +1,29 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; + +public abstract class AssoRefFieldResourceMerger extends CefFieldResourceMerger { + private IGspCommonField commonField; + + protected AssoRefFieldResourceMerger(IGspCommonField commonField, + ICefResourceMergeContext context) { + super(commonField, context); + this.commonField = commonField; + } +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoResourceMerger.java new file mode 100644 index 0000000..c2da8c0 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoResourceMerger.java @@ -0,0 +1,45 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.element.GspAssociation; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; + +; + +public abstract class AssoResourceMerger extends AbstractResourceMerger { + private GspAssociation asso; + + protected AssoResourceMerger(GspAssociation asso, + ICefResourceMergeContext context) { + super(context); + this.asso = asso; + } + + @Override + protected void mergeItems() { + if (asso.getRefElementCollection() != null && asso.getRefElementCollection().size() > 0) { + for (IGspCommonField item : asso.getRefElementCollection()) { + getAssoRefFieldResourceMerger(getContext(), item).merge(); + } + } + } + + protected abstract AssoRefFieldResourceMerger getAssoRefFieldResourceMerger( + ICefResourceMergeContext context, IGspCommonField field); + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java new file mode 100644 index 0000000..c13bf1a --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java @@ -0,0 +1,98 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.collection.GspAssociationCollection; +import org.openatom.ubml.model.common.definition.cef.collection.GspEnumValueCollection; +import org.openatom.ubml.model.common.definition.cef.element.GspAssociation; +import org.openatom.ubml.model.common.definition.cef.element.GspEnumValue; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; +import org.openatom.ubml.model.common.definition.cef.increment.merger.MergeUtils; +import org.openatom.ubml.model.common.definition.entity.I18nResourceItemCollection; + +public abstract class CefFieldResourceMerger extends AbstractResourceMerger { + + private IGspCommonField field; + + protected CefFieldResourceMerger(IGspCommonField field, + ICefResourceMergeContext context) { + super(context); + this.field = field; + } + + @Override + protected void mergeItems() { + + //关联枚举 + + switch (field.getObjectType()) { + case Association: + mergeAssoInfo(field); + break; + case Enum: + mergeEnum(field); + break; + case None: + I18nResourceItemCollection resourceItems = getContext().getResourceItems(); + String keyPrefix = MergeUtils.getKeyPrefix(this.field.getI18nResourceInfoPrefix(), CefResourceKeyNames.NAME); + field.setName(resourceItems.getResourceItemByKey(keyPrefix).getValue()); + break; + default: + throw new RuntimeException("暂不支持" + field.getObjectType() + "类型字段的多语合并"); + } + + //扩展 + extractExtendProperties(field); + } + + private void mergeEnum(IGspCommonField field) { + I18nResourceItemCollection resourceItems = getContext().getResourceItems(); + String keyPrefix = MergeUtils + .getKeyPrefix(this.field.getI18nResourceInfoPrefix(), CefResourceKeyNames.NAME); + field.setName(resourceItems.getResourceItemByKey(keyPrefix).getValue()); + GspEnumValueCollection enumValues = field.getContainEnumValues(); + if (enumValues != null && enumValues.size() > 0) { + for (GspEnumValue item : enumValues) { + String enumValueKeyPrefix = MergeUtils + .getKeyPrefix(item.getI18nResourceInfoPrefix(), CefResourceKeyNames.DISPLAY_VALUE); + item.setName(resourceItems.getResourceItemByKey(enumValueKeyPrefix).getValue()); + + } + } + } + + private void mergeAssoInfo(IGspCommonField field) { + I18nResourceItemCollection resourceItems = getContext().getResourceItems(); + String keyPrefix = MergeUtils + .getKeyPrefix(this.field.getI18nResourceInfoPrefix(), CefResourceKeyNames.NAME); + field.setName(resourceItems.getResourceItemByKey(keyPrefix).getValue()); + + GspAssociationCollection assos = field.getChildAssociations(); + if (assos != null && assos.size() > 0) { + for (GspAssociation item : assos) { + getAssoResourceMerger(getContext(), item).merge(); + } + } + } + + protected void extractExtendProperties(IGspCommonField commonField) { + } + + protected abstract AssoResourceMerger getAssoResourceMerger(ICefResourceMergeContext context, GspAssociation asso); + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java new file mode 100644 index 0000000..c640a62 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java @@ -0,0 +1,62 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; + +import org.openatom.ubml.model.common.definition.cef.IFieldCollection; +import org.openatom.ubml.model.common.definition.cef.IGspCommonDataType; +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; +import org.openatom.ubml.model.common.definition.entity.I18nResourceItemCollection; + +import static org.openatom.ubml.model.common.definition.cef.increment.merger.MergeUtils.getKeyPrefix; + +public abstract class DataTypeResourceMerger extends AbstractResourceMerger { + + private IGspCommonDataType dataType; + + protected DataTypeResourceMerger(IGspCommonDataType commonDataType, ICefResourceMergeContext context) { + super(context); + this.dataType = commonDataType; + } + + @Override + protected void mergeItems() { + I18nResourceItemCollection resourceItems = getContext().getResourceItems(); + String keyPrefix = getKeyPrefix(dataType.getI18nResourceInfoPrefix(), CefResourceKeyNames.NAME); + dataType.setName(resourceItems.getResourceItemByKey(keyPrefix).getValue()); + extractDataTypeFields(dataType.getContainElements()); + //扩展 + extractExtendProperties(dataType); + } + + private void extractDataTypeFields(IFieldCollection fields) { + if (fields == null || fields.size() == 0) { + return; + } + for (IGspCommonField field : fields) { + CefFieldResourceMerger merger = getCefFieldResourceMerger(getContext(), field); + merger.merge(); + } + } + + protected abstract CefFieldResourceMerger getCefFieldResourceMerger( + ICefResourceMergeContext context, IGspCommonField field); + + protected void extractExtendProperties(IGspCommonDataType dataType) { + } + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceDescriptionNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceDescriptionNames.java new file mode 100644 index 0000000..ccdc3ad --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceDescriptionNames.java @@ -0,0 +1,22 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.names; + +public final class CefResourceDescriptionNames { + public static final String NAME = "名称"; + + public static final String DISPLAY_VALUE = "枚举显示值"; +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceKeyNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceKeyNames.java new file mode 100644 index 0000000..f16a624 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceKeyNames.java @@ -0,0 +1,23 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.common.definition.cef.i18n.names; + +public final class CefResourceKeyNames { + + public static final String NAME = "Name"; + + public static final String DISPLAY_VALUE = "DisplayValue"; +} \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/DotNetToJavaStringHelper.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/DotNetToJavaStringHelper.java index b3d0914..e714b5d 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/DotNetToJavaStringHelper.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/DotNetToJavaStringHelper.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition; /** diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModel.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModel.java index fb92af4..1699308 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModel.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModel.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModelElement.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModelElement.java index e927498..600eb72 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModelElement.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModelElement.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewObject.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewObject.java index f234dff..b31a65e 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewObject.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewObject.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ActionFormatParameter.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ActionFormatParameter.java index 5909ba6..56ff50f 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ActionFormatParameter.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ActionFormatParameter.java @@ -1,14 +1,24 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action; import java.io.Serializable; /** * The Definition Of Action Format Parameter - * - * @ClassName: ActionFormatParameter - * @Author: Benjamin Gong - * @Date: 2021/1/11 17:13 - * @Version: V1.0 */ public class ActionFormatParameter implements Cloneable, Serializable { /** diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameterCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameterCollection.java index 238dfae..f729bf4 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameterCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameterCollection.java @@ -1,4 +1,18 @@ -//package org.openatom.ubml.model.vo.definition.Interface; +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action; import java.util.List; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedBizAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedBizAction.java index beb9794..0fed61d 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedBizAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedBizAction.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpAction.java index 682984d..8f4cda7 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpAction.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpActionBase.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpActionBase.java index 1c13bc8..a8f3e9b 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpActionBase.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpActionBase.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action; import java.io.Serializable; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/VMActionResult.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/VMActionResult.java index dfca859..d9e4d06 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/VMActionResult.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/VMActionResult.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action; import java.io.Serializable; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelAction.java index 1bfe5a5..f4a2e35 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelAction.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action; import java.io.Serializable; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelActionType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelActionType.java index 6db0574..dd0d0c9 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelActionType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelActionType.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action; /** diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangeSetMappingAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangeSetMappingAction.java deleted file mode 100644 index b667c4d..0000000 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangeSetMappingAction.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.openatom.ubml.model.vo.definition.action.internalexternalaction; - -import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; - -/** - * The Definition Of ChangeSet Mapping Action - * - * @ClassName: ChangeSetMappingAction - * @Author: Benjamin Gong - * @Date: 2021/1/11 17:13 - * @Version: V1.0 - */ -public class ChangeSetMappingAction extends MappedCdpAction implements IInternalExtendAction { - public static final String id = "5798f884-c222-47f4-8bbe-685c7013dee4"; - public static final String code = "ChangeSetMapping"; - public static final String name = "内置变更集Mapping操作"; - - public ChangeSetMappingAction() { - setID(id); - setCode(code); - setName(name); - } -} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangeSetReversalMappingAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangeSetReversalMappingAction.java deleted file mode 100644 index 84c7b49..0000000 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangeSetReversalMappingAction.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.openatom.ubml.model.vo.definition.action.internalexternalaction; - -import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; - -/** - * The Definition Of ChangeSet Reversal Mapping Action - * - * @ClassName: ChangeSetReversalMappingAction - * @Author: Benjamin Gong - * @Date: 2021/1/11 17:13 - * @Version: V1.0 - */ -public class ChangeSetReversalMappingAction extends MappedCdpAction implements IInternalExtendAction { - public static final String id = "301c5991-a32d-4221-88bf-8c9d07bdd884"; - public static final String code = "ChangeSetReversalMapping"; - public static final String name = "内置变更集反向Mapping操作"; - - public ChangeSetReversalMappingAction() { - setID(id); - setCode(code); - setName(name); - } -} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetMappingAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetMappingAction.java new file mode 100644 index 0000000..bad82ff --- /dev/null +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetMappingAction.java @@ -0,0 +1,38 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; + +import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; + +/** + * The Definition Of Changeset Mapping Action + * + * @ClassName: ChangesetMappingAction + * @Author: Benjamin Gong + * @Date: 2021/1/11 17:13 + * @Version: V1.0 + */ +public class ChangesetMappingAction extends MappedCdpAction implements IInternalExtendAction { + public static final String ID = "5798f884-c222-47f4-8bbe-685c7013dee4"; + public static final String CODE = "ChangesetMapping"; + public static final String NAME = "内置变更集Mapping操作"; + public ChangesetMappingAction() + { + setID(ID); + setCode(CODE); + setName(NAME); + } +} \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetReversalMappingAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetReversalMappingAction.java new file mode 100644 index 0000000..d4d3909 --- /dev/null +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetReversalMappingAction.java @@ -0,0 +1,38 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; + +import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; + +/** + * The Definition Of Changeset Reversal Mapping Action + * + * @ClassName: ChangesetReversalMappingAction + * @Author: Benjamin Gong + * @Date: 2021/1/11 17:13 + * @Version: V1.0 + */ +public class ChangesetReversalMappingAction extends MappedCdpAction implements IInternalExtendAction { + public static final String ID = "301c5991-a32d-4221-88bf-8c9d07bdd884"; + public static final String CODE = "ChangesetReversalMapping"; + public static final String NAME = "内置变更集反向Mapping操作"; + + public ChangesetReversalMappingAction() { + setID(ID); + setCode(CODE); + setName(NAME); + } +} \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/CreateAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/CreateAction.java index 29a6186..5a69cf8 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/CreateAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/CreateAction.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; @@ -11,13 +26,13 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Version: V1.0 */ public class CreateAction extends MappedCdpAction implements IInternalExtendAction { - public static final String id = "52479451-8e22-4751-8684-80489ce5786b"; - public static final String code = "Create"; - public static final String name = "内置新增数据操作"; + public static final String ID = "52479451-8e22-4751-8684-80489ce5786b"; + public static final String CODE = "Create"; + public static final String NAME = "内置新增数据操作"; public CreateAction() { - setID(id); - setCode(code); - setName(name); + setID(ID); + setCode(CODE); + setName(NAME); } -} +} \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataMappingAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataMappingAction.java index e9bd1f1..a8906f6 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataMappingAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataMappingAction.java @@ -1,7 +1,21 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; - /** * The Definition Of Data Mapping Action * @@ -11,13 +25,13 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Version: V1.0 */ public class DataMappingAction extends MappedCdpAction implements IInternalExtendAction { - public static final String id = "42221ca3-9ee4-40af-89d2-ff4c8b466ac3"; - public static final String code = "DataMapping"; - public static final String name = "内置数据Mapping操作"; + public static final String ID = "42221ca3-9ee4-40af-89d2-ff4c8b466ac3"; + public static final String CODE = "DataMapping"; + public static final String NAME = "内置数据Mapping操作"; public DataMappingAction() { - setID(id); - setCode(code); - setName(name); + setID(ID); + setCode(CODE); + setName(NAME); } } diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataReversalMappingAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataReversalMappingAction.java index 3ed7219..b12f10f 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataReversalMappingAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataReversalMappingAction.java @@ -1,7 +1,21 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; - /** * The Definition Of Data Reversal Mapping Action * @@ -11,13 +25,13 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Version: V1.0 */ public class DataReversalMappingAction extends MappedCdpAction implements IInternalExtendAction { - public static final String id = "991bf216-f55b-40bf-bb42-1b831b6ef3e9"; - public static final String code = "DataReversalMapping"; - public static final String name = "内置数据反向Mapping操作"; + public static final String ID = "991bf216-f55b-40bf-bb42-1b831b6ef3e9"; + public static final String CODE = "DataReversalMapping"; + public static final String NAME = "内置数据反向Mapping操作"; public DataReversalMappingAction() { - setID(id); - setCode(code); - setName(name); + setID(ID); + setCode(CODE); + setName(NAME); } } diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DeleteAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DeleteAction.java index b1285af..300cdae 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DeleteAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DeleteAction.java @@ -1,7 +1,21 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; - /** * The Definition Of Delete Action * @@ -11,13 +25,13 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Version: V1.0 */ public class DeleteAction extends MappedCdpAction implements IInternalExtendAction { - public static final String id = "9a17e935-7366-489d-b110-0ae103e5648e"; - public static final String code = "Delete"; - public static final String name = "内置删除操作"; + public static final String ID = "9a17e935-7366-489d-b110-0ae103e5648e"; + public static final String CODE = "Delete"; + public static final String NAME = "内置删除操作"; public DeleteAction() { - setID(id); - setCode(code); - setName(name); + setID(ID); + setCode(CODE); + setName(NAME); } } diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/IInternalExtendAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/IInternalExtendAction.java index aa0217f..d52a30b 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/IInternalExtendAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/IInternalExtendAction.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; /** @@ -9,4 +24,4 @@ package org.openatom.ubml.model.vo.definition.action.internalexternalaction; * @Version: V1.0 */ public interface IInternalExtendAction { -} +} \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ModifyAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ModifyAction.java index e6a2e3e..74c6d97 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ModifyAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ModifyAction.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; @@ -11,14 +26,14 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Version: V1.0 */ public class ModifyAction extends MappedCdpAction implements IInternalExtendAction { - public static final String id = "47dd3752-72a3-4c56-81c0-ae8ccfe5eb98"; - public static final String code = "Modify"; - public static final String name = "内置修改操作"; + public static final String ID = "47dd3752-72a3-4c56-81c0-ae8ccfe5eb98"; + public static final String CODE = "Modify"; + public static final String NAME = "内置修改操作"; public ModifyAction() { - setID(id); - setCode(code); - setName(name); + setID(ID); + setCode(CODE); + setName(NAME); } } diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/MultiDeleteAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/MultiDeleteAction.java index 054289d..cdda3f6 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/MultiDeleteAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/MultiDeleteAction.java @@ -1,5 +1,19 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; - import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; /** @@ -11,13 +25,13 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Version: V1.0 */ public class MultiDeleteAction extends MappedCdpAction implements IInternalExtendAction { - public static final String id = "7b1c3c4l-t1a4-4dyc-b75b-7695hcb3we7e"; - public static final String code = "MultiDelete"; - public static final String name = "内置批量删除操作"; + public static final String ID = "7b1c3c4l-t1a4-4dyc-b75b-7695hcb3we7e"; + public static final String CODE = "MultiDelete"; + public static final String NAME = "内置批量删除操作"; public MultiDeleteAction() { - setID(id); - setCode(code); - setName(name); + setID(ID); + setCode(CODE); + setName(NAME); } } diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/QueryAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/QueryAction.java index 0201e77..aea58b6 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/QueryAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/QueryAction.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; @@ -11,14 +26,14 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Version: V1.0 */ public class QueryAction extends MappedCdpAction implements IInternalExtendAction { - public static final String id = "6fe68bfa-7c1b-4d6b-a7ef-14654168ae75"; - public static final String code = "Query"; - public static final String name = "内置查询操作"; + public static final String ID = "6fe68bfa-7c1b-4d6b-a7ef-14654168ae75"; + public static final String CODE = "Query"; + public static final String NAME = "内置查询操作"; public QueryAction() { - setID(id); - setCode(code); - setName(name); + setID(ID); + setCode(CODE); + setName(NAME); } } diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/RetrieveAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/RetrieveAction.java index 677654c..01ad2ec 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/RetrieveAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/RetrieveAction.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; @@ -11,13 +26,13 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Version: V1.0 */ public class RetrieveAction extends MappedCdpAction implements IInternalExtendAction { - public static final String id = "7a02f472-5bbd-424b-9d9e-f82e3f9f448e"; - public static final String code = "Retrieve"; - public static final String name = "内置检索操作"; + public static final String ID = "7a02f472-5bbd-424b-9d9e-f82e3f9f448e"; + public static final String CODE = "Retrieve"; + public static final String NAME = "内置检索操作"; public RetrieveAction() { - setID(id); - setCode(code); - setName(name); + setID(ID); + setCode(CODE); + setName(NAME); } -} +} \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameter.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameter.java index cab0d4e..d6c2416 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameter.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameter.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action.mappedbiz; import org.openatom.ubml.model.vo.definition.action.viewmodelbase.ViewModelParameter; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameterCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameterCollection.java index 3f46f2c..7590e94 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameterCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameterCollection.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action.mappedbiz; import org.openatom.ubml.model.vo.definition.action.viewmodelbase.ViewModelParameterCollection; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameter.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameter.java index 6412337..a482c3a 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameter.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameter.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action.mappedcdp; import org.openatom.ubml.model.vo.definition.action.viewmodelbase.ViewModelParameter; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameterCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameterCollection.java index 3a9242a..b04d48e 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameterCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameterCollection.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action.mappedcdp; import org.openatom.ubml.model.vo.definition.action.viewmodelbase.ViewModelParameterCollection; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValue.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValue.java index 3389831..92d40f0 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValue.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValue.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action.viewmodelbase; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValueType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValueType.java index c4ff944..5773b03 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValueType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValueType.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action.viewmodelbase; /** diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameter.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameter.java index c8a3f7b..4a92884 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameter.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameter.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action.viewmodelbase; import org.openatom.ubml.model.vo.definition.action.IViewModelParameter; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameterCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameterCollection.java index 18c4156..f8bfc61 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameterCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameterCollection.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action.viewmodelbase; import org.openatom.ubml.model.common.definition.cef.collection.BaseList; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelReturnValue.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelReturnValue.java index dc202ce..5c7fc51 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelReturnValue.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelReturnValue.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action.viewmodelbase; import org.openatom.ubml.model.vo.definition.common.VMParameterMode; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelVoidReturnValue.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelVoidReturnValue.java index 777bfe5..8a6efe7 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelVoidReturnValue.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelVoidReturnValue.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.action.viewmodelbase; import org.openatom.ubml.model.vo.definition.common.VMParameterType; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMActionCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMActionCollection.java index 6cea50c..5f7e4ac 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMActionCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMActionCollection.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.collection; import java.io.Serializable; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMElementCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMElementCollection.java index 235e372..0ced6c6 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMElementCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMElementCollection.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.collection; import java.io.Serializable; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ValueHelpConfigCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ValueHelpConfigCollection.java index 8976e7a..2213778 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ValueHelpConfigCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ValueHelpConfigCollection.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.collection; import java.io.Serializable; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ViewObjectCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ViewObjectCollection.java index a773a31..5ee42aa 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ViewObjectCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ViewObjectCollection.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.collection; import java.io.Serializable; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ConvertUtils.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ConvertUtils.java index b8332d4..b3ebb6f 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ConvertUtils.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ConvertUtils.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.common; // //import com.inspur.edp.bef.bizentity.GspBusinessEntity; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ElementHelpType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ElementHelpType.java index 2cf6476..4d45214 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ElementHelpType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ElementHelpType.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.common; /** diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/HelpExtendAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/HelpExtendAction.java index 4227225..7f53d74 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/HelpExtendAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/HelpExtendAction.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.common; import org.openatom.ubml.model.vo.definition.collection.VMActionCollection; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InitVoUtil.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InitVoUtil.java index 057af9c..0f94029 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InitVoUtil.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InitVoUtil.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.common; import org.openatom.ubml.model.common.definition.cef.element.GspElementDataType; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InternalExtendActionUtil.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InternalExtendActionUtil.java index 9519aab..be632ad 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InternalExtendActionUtil.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InternalExtendActionUtil.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.common; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/LinkBeUtils.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/LinkBeUtils.java index 0234efc..0d2e3eb 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/LinkBeUtils.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/LinkBeUtils.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.common; // //import com.inspur.edp.bef.bizentity.GspBizEntityElement; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MappingType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MappingType.java index 5858344..5ebf31b 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MappingType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MappingType.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.common; /** diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MetadataType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MetadataType.java index 7f156be..f98142e 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MetadataType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MetadataType.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.common; /** diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/TemplateVoInfo.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/TemplateVoInfo.java index 2c5a1ea..2b6056d 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/TemplateVoInfo.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/TemplateVoInfo.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.common; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMCollectionParameterType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMCollectionParameterType.java index ae05c7d..7b27d57 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMCollectionParameterType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMCollectionParameterType.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.common; /** diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMHelpConfig.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMHelpConfig.java index 2845593..5a4d6ab 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMHelpConfig.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMHelpConfig.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.common; /** diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterMode.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterMode.java index 8db884b..0cc5941 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterMode.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterMode.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.common; /** diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterType.java index 66046c3..bdf4ead 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterType.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.common; /** diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ValueHelpConfig.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ValueHelpConfig.java index 6e2162c..1dea9a9 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ValueHelpConfig.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ValueHelpConfig.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.common; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ViewModelMapping.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ViewModelMapping.java index 8444bf3..d6c0b5e 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ViewModelMapping.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ViewModelMapping.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.common; import java.io.Serializable; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/copy/CopyContext.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/copy/CopyContext.java index 84f9eb7..b7b65f5 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/copy/CopyContext.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/copy/CopyContext.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.common.copy; import org.openatom.ubml.model.vo.definition.GspViewModel; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspQoObjectMapping.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspQoObjectMapping.java index 248b262..cf3a992 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspQoObjectMapping.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspQoObjectMapping.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.common.mapping; public class GspQoObjectMapping extends GspVoObjectMapping { diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementMapping.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementMapping.java index 955a929..e7f17ec 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementMapping.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementMapping.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.common.mapping; import org.openatom.ubml.model.vo.definition.common.ViewModelMapping; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementSourceType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementSourceType.java index f9c67fb..c500291 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementSourceType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementSourceType.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.common.mapping; /** diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectMapping.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectMapping.java index b8e6558..fed6d98 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectMapping.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectMapping.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.common.mapping; import org.openatom.ubml.model.vo.definition.common.ViewModelMapping; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectSourceType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectSourceType.java index 400158f..256f1b7 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectSourceType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectSourceType.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.common.mapping; /** diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/dataextendinfo/VoDataExtendInfo.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/dataextendinfo/VoDataExtendInfo.java index 5047904..e889942 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/dataextendinfo/VoDataExtendInfo.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/dataextendinfo/VoDataExtendInfo.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.dataextendinfo; import org.openatom.ubml.model.vo.definition.collection.VMActionCollection; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/api/GspVoExtendInfoService.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/api/GspVoExtendInfoService.java index b1d7b7c..d1b3c3d 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/api/GspVoExtendInfoService.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/api/GspVoExtendInfoService.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.extendinfo.api; import java.util.List; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/entity/GspVoExtendInfo.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/entity/GspVoExtendInfo.java index 72579ac..885caf7 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/entity/GspVoExtendInfo.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/entity/GspVoExtendInfo.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.extendinfo.entity; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/ExtendPropertiesDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/ExtendPropertiesDeserializer.java index 006ada2..baf8d16 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/ExtendPropertiesDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/ExtendPropertiesDeserializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json; import com.fasterxml.jackson.core.JsonParser; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/ViewModelJsonConst.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/ViewModelJsonConst.java index a497d66..d20dc30 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/ViewModelJsonConst.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/ViewModelJsonConst.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json; /** * The Serializer Property Names Of diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/element/ViewElementDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/element/ViewElementDeserializer.java index aa560cb..6490a76 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/element/ViewElementDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/element/ViewElementDeserializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.element; import com.fasterxml.jackson.core.JsonParser; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/element/ViewElementSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/element/ViewElementSerializer.java index cf9746d..d63e54c 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/element/ViewElementSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/element/ViewElementSerializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.element; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspQoObjectMappingSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspQoObjectMappingSerializer.java index 900b459..920249f 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspQoObjectMappingSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspQoObjectMappingSerializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.mapping; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoElementMappingDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoElementMappingDeserializer.java index 985c560..5a07823 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoElementMappingDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoElementMappingDeserializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.mapping; import com.fasterxml.jackson.core.JsonParser; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoElementMappingSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoElementMappingSerializer.java index f98c659..97fefac 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoElementMappingSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoElementMappingSerializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.mapping; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoObjectMappingDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoObjectMappingDeserializer.java index aa6c500..48a754e 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoObjectMappingDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoObjectMappingDeserializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.mapping; import com.fasterxml.jackson.core.JsonParser; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoObjectMappingSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoObjectMappingSerializer.java index 9bcc1b9..bba14fd 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoObjectMappingSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoObjectMappingSerializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.mapping; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/ViewModelMappingDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/ViewModelMappingDeserializer.java index a035f3d..347d573 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/ViewModelMappingDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/ViewModelMappingDeserializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.mapping; import com.fasterxml.jackson.core.JsonParser; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/ViewModelMappingSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/ViewModelMappingSerializer.java index ad3d796..6c371b9 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/ViewModelMappingSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/ViewModelMappingSerializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.mapping; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ValueHelpConfigDeserizlizer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ValueHelpConfigDeserizlizer.java index 0f839fc..2afbbb2 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ValueHelpConfigDeserizlizer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ValueHelpConfigDeserizlizer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.model; import com.fasterxml.jackson.core.JsonParser; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ValueHelpConfigSerizlizer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ValueHelpConfigSerizlizer.java index f833942..5dc4a43 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ValueHelpConfigSerizlizer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ValueHelpConfigSerizlizer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.model; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelDeserializer.java index 18b6ef9..5daa3f5 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelDeserializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.model; import com.fasterxml.jackson.core.JsonParser; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelSerializer.java index 0c6124a..262cf66 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelSerializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.model; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/VoDataExtendInfoDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/VoDataExtendInfoDeserializer.java index f6a7db0..5655216 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/VoDataExtendInfoDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/VoDataExtendInfoDeserializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.model; import com.fasterxml.jackson.core.JsonParser; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/VoDataExtendInfoSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/VoDataExtendInfoSerializer.java index 55a5a72..4cd8ff5 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/VoDataExtendInfoSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/VoDataExtendInfoSerializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.model; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/object/ViewObjectDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/object/ViewObjectDeserializer.java index 8f2771b..d9b5632 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/object/ViewObjectDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/object/ViewObjectDeserializer.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2020 org.openatom.ubml Group. + * Copyright © OpenAtom Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.openatom.ubml.model.vo.definition.json.object; import org.openatom.ubml.model.common.definition.commonmodel.entity.GspCommonObject; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/object/ViewObjectSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/object/ViewObjectSerializer.java index 22c19f2..7c9a6be 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/object/ViewObjectSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/object/ViewObjectSerializer.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2020 org.openatom.ubml Group. + * Copyright © OpenAtom Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.openatom.ubml.model.vo.definition.json.object; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionDeserializer.java index 67fdb40..3f4279a 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionDeserializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.operation; import org.openatom.ubml.model.vo.definition.action.MappedBizAction; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionParaDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionParaDeserializer.java index c12bbea..374769e 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionParaDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionParaDeserializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.operation; import org.openatom.ubml.model.vo.definition.action.mappedbiz.MappedBizActionParameter; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionParaSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionParaSerializer.java index 205673c..dca2b83 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionParaSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionParaSerializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.operation; import org.openatom.ubml.model.vo.definition.action.mappedbiz.MappedBizActionParameter; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionSerializer.java index b4eb310..13cdc14 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionSerializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.operation; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpActionDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpActionDeserializer.java index 4a7a2bd..9cfe196 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpActionDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpActionDeserializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.operation; import com.fasterxml.jackson.core.JsonParser; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpActionSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpActionSerializer.java index 93f1026..39e4205 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpActionSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpActionSerializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.operation; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpParaDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpParaDeserializer.java index 48fddef..cccd9d3 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpParaDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpParaDeserializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.operation; import org.openatom.ubml.model.vo.definition.action.mappedcdp.MappedCdpActionParameter; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpParaSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpParaSerializer.java index 4fbac84..e9bbd0b 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpParaSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpParaSerializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.operation; import org.openatom.ubml.model.vo.definition.action.mappedcdp.MappedCdpActionParameter; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionCollectionDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionCollectionDeserializer.java index 62d424d..c285317 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionCollectionDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionCollectionDeserializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.operation; import com.fasterxml.jackson.core.JsonParser; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionCollectionSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionCollectionSerializer.java index 5d5dcdd..f4dd0e1 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionCollectionSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionCollectionSerializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.operation; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionDeserializer.java index 3acfd6a..4409641 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionDeserializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.operation; import static com.fasterxml.jackson.core.JsonToken.FIELD_NAME; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionSerializer.java index c90b555..de77073 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionSerializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.operation; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmParameterDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmParameterDeserializer.java index ea2f553..5699112 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmParameterDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmParameterDeserializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.operation; import static com.fasterxml.jackson.core.JsonToken.FIELD_NAME; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmParameterSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmParameterSerializer.java index 2d9e43f..2238cd4 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmParameterSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmParameterSerializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.operation; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmReturnValueDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmReturnValueDeserializer.java index 7e59ca1..c8e960b 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmReturnValueDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmReturnValueDeserializer.java @@ -1,3 +1,18 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.json.operation; import com.fasterxml.jackson.core.JsonParser; -- Gitee From 09b9304e2a492f41703a0cb860eedb798af77d66 Mon Sep 17 00:00:00 2001 From: mopowoxo Date: Sat, 10 Apr 2021 20:21:56 +0800 Subject: [PATCH 43/61] =?UTF-8?q?!27=20=E4=BC=98=E5=8C=96=EF=BC=9A?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A=EF=BC=8C=E6=BE=84=E6=B8=85?= =?UTF-8?q?=E5=AE=9E=E4=BD=93=E7=B1=BB=E4=BD=9C=E7=94=A8=20*=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=9A=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A=EF=BC=8C?= =?UTF-8?q?=E6=BE=84=E6=B8=85=E5=AE=9E=E4=BD=93=E7=B1=BB=E4=BD=9C=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/ProjectCommonConfigData.java | 3 +++ .../definition/entity/ProjectConfiguration.java | 15 +++++++++++++++ .../entity/ProjectCreateConfigData.java | 3 +++ 3 files changed, 21 insertions(+) diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectCommonConfigData.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectCommonConfigData.java index 8e88bac..94cada6 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectCommonConfigData.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectCommonConfigData.java @@ -15,6 +15,9 @@ */ package org.openatom.ubml.model.framework.definition.entity; +/** + * 工程类型基础配置信息 + */ public class ProjectCommonConfigData { private String typeCode; private String typeName; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectConfiguration.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectConfiguration.java index ffb3b37..018f764 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectConfiguration.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectConfiguration.java @@ -15,9 +15,24 @@ */ package org.openatom.ubml.model.framework.definition.entity; +/** + * 工程配置信息 用于读取配置文件中的工程配置 + */ public class ProjectConfiguration { + + /** + * 工程类型基础配置信息 {@link ProjectCommonConfigData} + */ private ProjectCommonConfigData commonConfigData; + + /** + * 工程类型创建扩展配置信息 {@link ProjectCreateConfigData} + */ private ProjectCreateConfigData createConfigData; + + /** + * 工程类型中包含的开发对象类别 + */ private String includeDevObjTypes; public ProjectCommonConfigData getCommonConfigData() { diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectCreateConfigData.java b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectCreateConfigData.java index b9929a1..724c0f5 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectCreateConfigData.java +++ b/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectCreateConfigData.java @@ -15,5 +15,8 @@ */ package org.openatom.ubml.model.framework.definition.entity; +/** + * 工程类型创建扩展配置信息 + */ public class ProjectCreateConfigData extends BaseConfig { } -- Gitee From 306c30b392fe59c81630932fd32463a177f4e1c0 Mon Sep 17 00:00:00 2001 From: Q-Lee Date: Fri, 16 Apr 2021 14:12:22 +0800 Subject: [PATCH 44/61] =?UTF-8?q?=E4=BC=98=E5=8C=96:=20=E6=9B=B4=E6=96=B0m?= =?UTF-8?q?odel->framework=E6=A8=A1=E5=9D=97=E4=B8=8B=E6=89=80=E6=9C=89?= =?UTF-8?q?=E7=B1=BB=E7=9A=84=E5=8C=85=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../definition/temp/lcm/JitContext.java | 2 +- .../definition/temp/lcm/MdPkgChangedArgs.java | 2 +- .../provider/ExternalApiMetadataBuilder.java | 2 +- .../devtime/core/provider/MetadataUtils.java | 8 ++++---- .../core/utils/MetadataProjectUtils.java | 4 ++-- .../SgfMdPkgChangedEventListener.java | 4 ++-- .../core/serializer/JsonSerializer.java | 2 +- .../core/serializer/TransferSerializer.java | 2 +- .../metadata/api/ConfigData}/BaseConfig.java | 2 +- .../api/ConfigData}/CommonConfigData.java | 2 +- .../api/ConfigData}/FilterConfigData.java | 3 ++- .../api/ConfigData}/I18nConfigData.java | 2 +- .../api/ConfigData}/ManagerConfigData.java | 2 +- .../MdExtRuleSerializerConfigData.java | 2 +- .../ConfigData}/MetadataConfiguration.java | 2 +- .../ConfigData}/MetadataTypeConfigData.java | 2 +- .../api/ConfigData}/ReferenceConfigData.java | 2 +- .../api/ConfigData}/SerializerConfigData.java | 2 +- .../TransferSerializerConfigData.java | 2 +- .../gspproject}/ProjectCommonConfigData.java | 2 +- .../gspproject}/ProjectConfiguration.java | 2 +- .../gspproject}/ProjectCreateConfigData.java | 4 +++- .../metadata/api}/entity/ApiModuleInfo.java | 2 +- .../metadata/api}/entity/ExtractContext.java | 2 +- .../lcm/metadata/api}/entity/FileType.java | 2 +- .../lcm/metadata/api}/entity/GspProject.java | 2 +- .../metadata/api}/entity/I18nResource.java | 2 +- .../metadata/api}/entity/LocalRepoPkg.java | 2 +- .../edp/lcm/metadata/api}/entity/MdPkg.java | 2 +- .../metadata/api}/entity/Metadata4Ref.java | 2 +- .../metadata/api}/entity/Metadata4RefDto.java | 2 +- .../api}/entity/MetadataCompilerContext.java | 2 +- .../entity/MetadataCustomizationFilter.java | 2 +- .../lcm/metadata/api}/entity/MetadataDto.java | 2 +- .../metadata/api}/entity/MetadataFilter.java | 2 +- .../api}/entity/MetadataIndexItemDto.java | 3 ++- .../metadata/api}/entity/MetadataPackage.java | 2 +- .../api}/entity/MetadataPackageDto.java | 2 +- .../api}/entity/MetadataPackageForIndex.java | 2 +- .../api}/entity/MetadataPackageHeader.java | 2 +- .../api}/entity/MetadataPackageReference.java | 2 +- .../api}/entity/MetadataPackageVersion.java | 2 +- .../metadata/api}/entity/MetadataProject.java | 4 ++-- .../api}/entity/MetadataProjectDto.java | 2 +- .../metadata/api}/entity/MetadataType.java | 2 +- .../edp/lcm/metadata/api}/entity/Page.java | 2 +- .../lcm/metadata/api}/entity/ProcessMode.java | 2 +- .../metadata/api}/entity/ProjectHeader.java | 2 +- .../api}/entity/ProjectMetadataCache.java | 2 +- .../api}/entity/ResourceLocation.java | 2 +- .../metadata/api}/entity/ResourceType.java | 2 +- .../metadata/api}/entity/ServiceUnitInfo.java | 2 +- .../entity/extract}/ExtractConfigData.java | 3 ++- .../entity/extract}/ExtractConfigration.java | 2 +- .../LocalMetadataIndexItem.java | 4 +++- .../metadataindex}/MetadataIndexDto.java | 4 +++- .../MetadataIndexRepoItemDto.java | 2 +- .../metadata/api}/mvnEntity/ConfigData.java | 4 ++-- .../mvnEntity/JitRuntimeConfigration.java | 2 +- .../api}/mvnEntity/MavenComponent.java | 2 +- .../api}/mvnEntity/MavenComponents.java | 2 +- .../api}/mvnEntity/MavenPackageRefs.java | 2 +- .../api}/mvnEntity/MetadataInfoFilter.java | 2 +- .../api}/mvnEntity/MetadataInfoInMaven.java | 2 +- .../mvnEntity/MetadataInfoWithVersion.java | 2 +- .../api}/mvnEntity/MetadataMavenInfo.java | 2 +- .../metadata/api}/mvnEntity/MetadataRepo.java | 2 +- .../api}/mvnEntity/ModuleDependencies.java | 2 +- .../api}/mvnEntity/ModuleDependency.java | 2 +- .../api}/mvnEntity/PackageSourceDto.java | 2 +- .../mvnEntity/PackageWithMetadataInfo.java | 2 +- .../api}/mvnEntity/PageMetadataInfo.java | 2 +- .../MetadataInfoFilterWithProcessMode.java | 2 +- .../MetadataInfoInMavenWithProcessMode.java | 4 ++-- ...etadataInfoWithVersionWithProcessMode.java | 2 +- .../MetadataMavenInfoWithProcessMode.java | 4 ++-- ...ackageWithMetadataInfoWithProcessMode.java | 2 +- .../PageMetadataInfoWithProcessMode.java | 2 +- .../metadata/api/service}/FileService.java | 2 +- .../api/service}/RefCommonService.java | 2 +- .../spi/IMetadataReferenceManager.java | 2 +- .../metadata}/spi/MetadataContentManager.java | 2 +- .../spi/MetadataContentSerializer.java | 2 +- .../spi/MetadataTransferSerializer.java | 2 +- .../api/service}/GspProjectService.java | 6 +++--- .../api/service}/MetadataProjectService.java | 12 +++++------ .../api/service}/MetadataService.java | 20 +++++++++---------- .../jittojava/context}/GenerateService.java | 4 ++-- .../edp/jittojava/context}/JitContext.java | 14 ++++++------- .../jittojava/context}/common/FileUtils.java | 2 +- .../common/JitCompilerConfigLoader.java | 6 +++--- .../context}/entity/CompilerConfigData.java | 2 +- .../entity/JitCompilerConfigration.java | 2 +- .../context}/entity/MavenDependency.java | 2 +- .../context}/service/CommonService.java | 2 +- .../context}/temp/EnvironmentUtil.java | 2 +- .../context}/temp/ModuleGenerateInfo.java | 2 +- .../context}/temp/ModuleGenerator.java | 2 +- .../context}/temp/RefCommonServiceImp.java | 4 ++-- .../context}/common/FileUtilsTest.java | 2 +- .../jittojava}/spi/AfterGeneratorAction.java | 2 +- .../inspur/edp/jittojava}/spi/JitAction.java | 4 ++-- .../common/InternalExtendActionUtil.java | 8 ++++---- 103 files changed, 151 insertions(+), 142 deletions(-) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api/ConfigData}/BaseConfig.java (94%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api/ConfigData}/CommonConfigData.java (96%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api/ConfigData}/FilterConfigData.java (88%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api/ConfigData}/I18nConfigData.java (94%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api/ConfigData}/ManagerConfigData.java (94%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api/ConfigData}/MdExtRuleSerializerConfigData.java (94%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api/ConfigData}/MetadataConfiguration.java (97%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api/ConfigData}/MetadataTypeConfigData.java (97%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api/ConfigData}/ReferenceConfigData.java (94%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api/ConfigData}/SerializerConfigData.java (94%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api/ConfigData}/TransferSerializerConfigData.java (94%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api/ConfigData/gspproject}/ProjectCommonConfigData.java (96%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api/ConfigData/gspproject}/ProjectConfiguration.java (96%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api/ConfigData/gspproject}/ProjectCreateConfigData.java (85%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/ApiModuleInfo.java (96%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/ExtractContext.java (96%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/FileType.java (91%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/GspProject.java (98%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/I18nResource.java (97%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/LocalRepoPkg.java (96%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/MdPkg.java (95%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/Metadata4Ref.java (96%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/Metadata4RefDto.java (96%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/MetadataCompilerContext.java (93%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/MetadataCustomizationFilter.java (94%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/MetadataDto.java (98%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/MetadataFilter.java (95%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/MetadataIndexItemDto.java (90%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/MetadataPackage.java (97%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/MetadataPackageDto.java (96%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/MetadataPackageForIndex.java (97%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/MetadataPackageHeader.java (96%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/MetadataPackageReference.java (95%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/MetadataPackageVersion.java (98%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/MetadataProject.java (96%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/MetadataProjectDto.java (97%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/MetadataType.java (97%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/Page.java (95%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/ProcessMode.java (92%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/ProjectHeader.java (94%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/ProjectMetadataCache.java (96%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/ResourceLocation.java (92%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/ResourceType.java (92%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition => com/inspur/edp/lcm/metadata/api}/entity/ServiceUnitInfo.java (95%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api/entity/extract}/ExtractConfigData.java (87%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api/entity/extract}/ExtractConfigration.java (95%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api/entity/metadataindex}/LocalMetadataIndexItem.java (95%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api/entity/metadataindex}/MetadataIndexDto.java (87%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api/entity/metadataindex}/MetadataIndexRepoItemDto.java (96%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api}/mvnEntity/ConfigData.java (84%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api}/mvnEntity/JitRuntimeConfigration.java (93%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api}/mvnEntity/MavenComponent.java (92%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api}/mvnEntity/MavenComponents.java (92%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api}/mvnEntity/MavenPackageRefs.java (95%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api}/mvnEntity/MetadataInfoFilter.java (97%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api}/mvnEntity/MetadataInfoInMaven.java (98%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api}/mvnEntity/MetadataInfoWithVersion.java (98%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api}/mvnEntity/MetadataMavenInfo.java (95%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api}/mvnEntity/MetadataRepo.java (93%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api}/mvnEntity/ModuleDependencies.java (94%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api}/mvnEntity/ModuleDependency.java (94%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api}/mvnEntity/PackageSourceDto.java (94%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api}/mvnEntity/PackageWithMetadataInfo.java (96%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api}/mvnEntity/PageMetadataInfo.java (94%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api}/mvnEntity/withprocessmode/MetadataInfoFilterWithProcessMode.java (97%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api}/mvnEntity/withprocessmode/MetadataInfoInMavenWithProcessMode.java (83%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api}/mvnEntity/withprocessmode/MetadataInfoWithVersionWithProcessMode.java (97%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api}/mvnEntity/withprocessmode/MetadataMavenInfoWithProcessMode.java (83%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api}/mvnEntity/withprocessmode/PackageWithMetadataInfoWithProcessMode.java (96%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/definition/entity => com/inspur/edp/lcm/metadata/api}/mvnEntity/withprocessmode/PageMetadataInfoWithProcessMode.java (94%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/api => com/inspur/edp/lcm/metadata/api/service}/FileService.java (99%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework/api => com/inspur/edp/lcm/metadata/api/service}/RefCommonService.java (95%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework => com/inspur/edp/lcm/metadata}/spi/IMetadataReferenceManager.java (95%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework => com/inspur/edp/lcm/metadata}/spi/MetadataContentManager.java (95%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework => com/inspur/edp/lcm/metadata}/spi/MetadataContentSerializer.java (95%) rename model/framework/common/src/main/java/{org/openatom/ubml/model/framework => com/inspur/edp/lcm/metadata}/spi/MetadataTransferSerializer.java (97%) rename model/framework/devtime-api/src/main/java/{org/openatom/ubml/metamodel/framework/designtime/api => com/inspur/edp/lcm/metadata/api/service}/GspProjectService.java (82%) rename model/framework/devtime-api/src/main/java/{org/openatom/ubml/metamodel/framework/designtime/api => com/inspur/edp/lcm/metadata/api/service}/MetadataProjectService.java (93%) rename model/framework/devtime-api/src/main/java/{org/openatom/ubml/metamodel/framework/designtime/api => com/inspur/edp/lcm/metadata/api/service}/MetadataService.java (94%) rename model/framework/generator-api/src/main/java/{org/openatom/ubml/model/framework/generator/api => com/inspur/edp/jittojava/context}/GenerateService.java (88%) rename model/framework/generator-api/src/main/java/{org/openatom/ubml/model/framework/generator/api => com/inspur/edp/jittojava/context}/JitContext.java (90%) rename model/framework/generator-api/src/main/java/{org/openatom/ubml/model/framework/generator/api => com/inspur/edp/jittojava/context}/common/FileUtils.java (97%) rename model/framework/generator-api/src/main/java/{org/openatom/ubml/model/framework/generator/api => com/inspur/edp/jittojava/context}/common/JitCompilerConfigLoader.java (93%) rename model/framework/generator-api/src/main/java/{org/openatom/ubml/model/framework/generator/api => com/inspur/edp/jittojava/context}/entity/CompilerConfigData.java (94%) rename model/framework/generator-api/src/main/java/{org/openatom/ubml/model/framework/generator/api => com/inspur/edp/jittojava/context}/entity/JitCompilerConfigration.java (96%) rename model/framework/generator-api/src/main/java/{org/openatom/ubml/model/framework/generator/api => com/inspur/edp/jittojava/context}/entity/MavenDependency.java (97%) rename model/framework/generator-api/src/main/java/{org/openatom/ubml/model/framework/generator/api => com/inspur/edp/jittojava/context}/service/CommonService.java (95%) rename model/framework/generator-api/src/main/java/{org/openatom/ubml/model/framework/generator/api => com/inspur/edp/jittojava/context}/temp/EnvironmentUtil.java (92%) rename model/framework/generator-api/src/main/java/{org/openatom/ubml/model/framework/generator/api => com/inspur/edp/jittojava/context}/temp/ModuleGenerateInfo.java (92%) rename model/framework/generator-api/src/main/java/{org/openatom/ubml/model/framework/generator/api => com/inspur/edp/jittojava/context}/temp/ModuleGenerator.java (91%) rename model/framework/generator-api/src/main/java/{org/openatom/ubml/model/framework/generator/api => com/inspur/edp/jittojava/context}/temp/RefCommonServiceImp.java (87%) rename model/framework/generator-api/src/test/java/{org/openatom/ubml/model/framework/generator/api => com/inspur/edp/jittojava/context}/common/FileUtilsTest.java (89%) rename model/framework/generator-spi/src/main/java/{org/openatom/ubml/model/framework/generator => com/inspur/edp/jittojava}/spi/AfterGeneratorAction.java (93%) rename model/framework/generator-spi/src/main/java/{org/openatom/ubml/model/framework/generator => com/inspur/edp/jittojava}/spi/JitAction.java (85%) diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/JitContext.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/JitContext.java index 0196d16..fdba1ee 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/JitContext.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/JitContext.java @@ -17,7 +17,7 @@ package org.openatom.ubml.model.externalapi.definition.temp.lcm; import java.util.Map; import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.framework.definition.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; /** * The type JitContext diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MdPkgChangedArgs.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MdPkgChangedArgs.java index d5c94f4..20d066b 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MdPkgChangedArgs.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MdPkgChangedArgs.java @@ -15,7 +15,7 @@ */ package org.openatom.ubml.model.externalapi.definition.temp.lcm; -import org.openatom.ubml.model.framework.definition.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; /** * The type MdPkgChangedArgs diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ExternalApiMetadataBuilder.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ExternalApiMetadataBuilder.java index b7f87d2..a237f15 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ExternalApiMetadataBuilder.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ExternalApiMetadataBuilder.java @@ -36,7 +36,7 @@ import org.openatom.ubml.model.externalapi.definition.temp.lcm.MetadataService; import org.openatom.ubml.model.externalapi.definition.temp.vo.GspViewModel; import org.openatom.ubml.model.externalapi.provider.viewmodel.utils.SimpleViewModelUtils; import org.openatom.ubml.model.externalapi.provider.viewmodel.utils.ViewModelUtils; -import org.openatom.ubml.model.framework.definition.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; /** * EapiBuilder diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/MetadataUtils.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/MetadataUtils.java index dfa15f7..c1a7879 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/MetadataUtils.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/MetadataUtils.java @@ -18,12 +18,12 @@ package org.openatom.ubml.model.externalapi.devtime.core.provider; import java.io.IOException; import org.openatom.ubml.common.spring.SpringUtils; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.metamodel.framework.designtime.api.GspProjectService; -import org.openatom.ubml.metamodel.framework.designtime.api.MetadataProjectService; +import com.inspur.edp.lcm.metadata.api.service.GspProjectService; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; import org.openatom.ubml.model.common.definition.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.temp.lcm.RefCommonService; -import org.openatom.ubml.model.framework.definition.entity.GspProject; -import org.openatom.ubml.model.framework.definition.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; /** * MetadataUtils diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/utils/MetadataProjectUtils.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/utils/MetadataProjectUtils.java index 76214a9..6ed4aff 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/utils/MetadataProjectUtils.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/utils/MetadataProjectUtils.java @@ -18,10 +18,10 @@ package org.openatom.ubml.model.externalapi.devtime.core.utils; import java.io.IOException; import org.openatom.ubml.common.spring.SpringUtils; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.metamodel.framework.designtime.api.GspProjectService; +import com.inspur.edp.lcm.metadata.api.service.GspProjectService; import org.openatom.ubml.model.common.definition.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.temp.lcm.RefCommonService; -import org.openatom.ubml.model.framework.definition.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; /** * MetadataProjectUtils diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMdPkgChangedEventListener.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMdPkgChangedEventListener.java index 4408bea..3b9824e 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMdPkgChangedEventListener.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMdPkgChangedEventListener.java @@ -32,8 +32,8 @@ import org.openatom.ubml.model.common.definition.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.temp.lcm.MdPkgChangedArgs; import org.openatom.ubml.model.externalapi.definition.temp.lcm.MdPkgChangedEventListener; import org.openatom.ubml.model.externalapi.definition.util.MetadataUtil; -import org.openatom.ubml.model.framework.definition.entity.MetadataPackage; -import org.openatom.ubml.model.framework.definition.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/JsonSerializer.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/JsonSerializer.java index 398f905..1bf3d4f 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/JsonSerializer.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/JsonSerializer.java @@ -20,7 +20,7 @@ import java.util.Objects; import org.openatom.ubml.common.util.JacksonJsonUtil; import org.openatom.ubml.model.common.definition.entity.IMetadataContent; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; -import org.openatom.ubml.model.framework.spi.MetadataContentSerializer; +import com.inspur.edp.lcm.metadata.spi.MetadataContentSerializer; /** * JsonSerializer diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/TransferSerializer.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/TransferSerializer.java index 9ab2c1f..38425d3 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/TransferSerializer.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/TransferSerializer.java @@ -19,7 +19,7 @@ import org.openatom.ubml.common.util.JacksonJsonUtil; import org.openatom.ubml.common.util.StringUtils; import org.openatom.ubml.model.common.definition.entity.IMetadataContent; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; -import org.openatom.ubml.model.framework.spi.MetadataTransferSerializer; +import com.inspur.edp.lcm.metadata.spi.MetadataTransferSerializer; /** * TransferSerializer diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/BaseConfig.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/BaseConfig.java similarity index 94% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/BaseConfig.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/BaseConfig.java index 6556a62..2ef905a 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/BaseConfig.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/BaseConfig.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; /** * @Classname BaseConfig diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/CommonConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/CommonConfigData.java similarity index 96% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/CommonConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/CommonConfigData.java index 86494dc..0117c83 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/CommonConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/CommonConfigData.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; /** * @Classname CommonMetaData diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/FilterConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/FilterConfigData.java similarity index 88% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/FilterConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/FilterConfigData.java index 2de7285..ae0484e 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/FilterConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/FilterConfigData.java @@ -13,8 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; +import com.inspur.edp.lcm.metadata.api.ConfigData.BaseConfig; import java.io.Serializable; /** diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/I18nConfigData.java similarity index 94% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/I18nConfigData.java index 8673fd8..94f5f96 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/I18nConfigData.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; /** * @Classname I18nConfigData diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ManagerConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/ManagerConfigData.java similarity index 94% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ManagerConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/ManagerConfigData.java index c3b20eb..967a1d2 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ManagerConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/ManagerConfigData.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; /** * @Classname ManagerMetaData diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MdExtRuleSerializerConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/MdExtRuleSerializerConfigData.java similarity index 94% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MdExtRuleSerializerConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/MdExtRuleSerializerConfigData.java index e2ba824..147c4a9 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MdExtRuleSerializerConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/MdExtRuleSerializerConfigData.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; public class MdExtRuleSerializerConfigData { diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataConfiguration.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/MetadataConfiguration.java similarity index 97% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataConfiguration.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/MetadataConfiguration.java index 2becc97..0ed7c8c 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataConfiguration.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/MetadataConfiguration.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; import java.io.Serializable; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataTypeConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/MetadataTypeConfigData.java similarity index 97% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataTypeConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/MetadataTypeConfigData.java index c74fa20..9c1ed5e 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataTypeConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/MetadataTypeConfigData.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; /** * Classname MetadataTypeConfigData Description 元数据类型实体 Date 2019/11/26 19:41 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ReferenceConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/ReferenceConfigData.java similarity index 94% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ReferenceConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/ReferenceConfigData.java index 0320e37..4dbb2c1 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ReferenceConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/ReferenceConfigData.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; /** * @Classname ReferenceMetaData diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/SerializerConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/SerializerConfigData.java similarity index 94% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/SerializerConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/SerializerConfigData.java index dba839a..a693afd 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/SerializerConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/SerializerConfigData.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; /** * @Classname SerializerMetaData diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/TransferSerializerConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/TransferSerializerConfigData.java similarity index 94% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/TransferSerializerConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/TransferSerializerConfigData.java index 29ad89e..4ac9518 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/TransferSerializerConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/TransferSerializerConfigData.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; /** * @Classname TransferSerializerMetaData diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectCommonConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCommonConfigData.java similarity index 96% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectCommonConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCommonConfigData.java index 94cada6..42e8535 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectCommonConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCommonConfigData.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData.gspproject; /** * 工程类型基础配置信息 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectConfiguration.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectConfiguration.java similarity index 96% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectConfiguration.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectConfiguration.java index 018f764..d99de0b 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectConfiguration.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectConfiguration.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData.gspproject; /** * 工程配置信息 用于读取配置文件中的工程配置 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectCreateConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCreateConfigData.java similarity index 85% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectCreateConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCreateConfigData.java index 724c0f5..d5617ab 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectCreateConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCreateConfigData.java @@ -13,7 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData.gspproject; + +import com.inspur.edp.lcm.metadata.api.ConfigData.BaseConfig; /** * 工程类型创建扩展配置信息 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ApiModuleInfo.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ApiModuleInfo.java similarity index 96% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ApiModuleInfo.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ApiModuleInfo.java index 093c5af..f4ca45b 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ApiModuleInfo.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ApiModuleInfo.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; /** * Classname ApiModuleInfo Description Api Date 2019/11/26 10:49 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ExtractContext.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ExtractContext.java similarity index 96% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ExtractContext.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ExtractContext.java index 796fd28..e3826d1 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ExtractContext.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ExtractContext.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; public class ExtractContext { diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/FileType.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/FileType.java similarity index 91% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/FileType.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/FileType.java index 8e86584..2cf9a9d 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/FileType.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/FileType.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; public enum FileType { MDPKG, diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/GspProject.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/GspProject.java similarity index 98% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/GspProject.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/GspProject.java index 81db3a3..632da82 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/GspProject.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/GspProject.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import java.util.List; import java.util.Map; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResource.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResource.java similarity index 97% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResource.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResource.java index 5e5380b..3f27556 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResource.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResource.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import org.openatom.ubml.model.common.definition.entity.I18nResourceItemCollection; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/LocalRepoPkg.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/LocalRepoPkg.java similarity index 96% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/LocalRepoPkg.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/LocalRepoPkg.java index 074d693..eb170e7 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/LocalRepoPkg.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/LocalRepoPkg.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import java.util.List; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MdPkg.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MdPkg.java similarity index 95% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MdPkg.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MdPkg.java index c886803..7de11eb 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MdPkg.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MdPkg.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import java.util.HashSet; import java.util.List; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/Metadata4Ref.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4Ref.java similarity index 96% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/Metadata4Ref.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4Ref.java index d7f2975..6801ff1 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/Metadata4Ref.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4Ref.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import org.openatom.ubml.model.common.definition.entity.GspMetadata; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/Metadata4RefDto.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4RefDto.java similarity index 96% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/Metadata4RefDto.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4RefDto.java index a07e4f5..84f87d2 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/Metadata4RefDto.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4RefDto.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; /** * Classname Metadata4RefDto Description TODO Date 2019/11/15 10:18 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataCompilerContext.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataCompilerContext.java similarity index 93% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataCompilerContext.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataCompilerContext.java index 3d47fee..5a44a7b 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataCompilerContext.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataCompilerContext.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; public class MetadataCompilerContext { private String projectPath; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataCustomizationFilter.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataCustomizationFilter.java similarity index 94% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataCustomizationFilter.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataCustomizationFilter.java index 386ff44..83724de 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataCustomizationFilter.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataCustomizationFilter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; /** * 运行时定制元数据过滤器 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataDto.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataDto.java similarity index 98% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataDto.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataDto.java index 7510b8a..4339675 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataDto.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataDto.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import org.openatom.ubml.model.common.definition.entity.MetadataProperties; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataFilter.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataFilter.java similarity index 95% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataFilter.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataFilter.java index 59c228c..25359af 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataFilter.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataFilter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; public class MetadataFilter { private String metadataPostfix; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexItemDto.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataIndexItemDto.java similarity index 90% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexItemDto.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataIndexItemDto.java index faf62b8..2998443 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexItemDto.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataIndexItemDto.java @@ -13,8 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; +import com.inspur.edp.lcm.metadata.api.entity.metadataindex.MetadataIndexRepoItemDto; import java.util.List; /** diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackage.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackage.java similarity index 97% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackage.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackage.java index e9f5101..c750726 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackage.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackage.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import java.util.List; import org.openatom.ubml.model.common.definition.entity.GspMetadata; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageDto.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageDto.java similarity index 96% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageDto.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageDto.java index 499d02c..b747c77 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageDto.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageDto.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; public class MetadataPackageDto { private String packageName; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageForIndex.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageForIndex.java similarity index 97% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageForIndex.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageForIndex.java index a9184fe..252b3de 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageForIndex.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageForIndex.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import java.util.List; import java.util.Map; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageHeader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageHeader.java similarity index 96% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageHeader.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageHeader.java index f651d23..4c77d5d 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageHeader.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageHeader.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; /** * 元数据包的头节点,主要包含元数据包的基本描述信息 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageReference.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageReference.java similarity index 95% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageReference.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageReference.java index 54e3a96..af3ac4d 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageReference.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageReference.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; /** * @Classname MetadataPackageReference diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageVersion.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageVersion.java similarity index 98% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageVersion.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageVersion.java index e49ffc5..7f577d9 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageVersion.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageVersion.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataProject.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProject.java similarity index 96% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataProject.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProject.java index ce17b29..5a2c846 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataProject.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProject.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -import org.openatom.ubml.model.framework.definition.entity.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; /** * 元数据工程实体,对应.mdproj文件 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataProjectDto.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProjectDto.java similarity index 97% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataProjectDto.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProjectDto.java index 9952fc0..3688558 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataProjectDto.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProjectDto.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; public class MetadataProjectDto { private String projectPath; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataType.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataType.java similarity index 97% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataType.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataType.java index b3e10de..7a6c465 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataType.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataType.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import java.io.Serializable; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/Page.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Page.java similarity index 95% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/Page.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Page.java index f309516..14e01ef 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/Page.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Page.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; /** * Classname Page Description 元数据分页 Date 2019/11/26 13:44 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProcessMode.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProcessMode.java similarity index 92% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProcessMode.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProcessMode.java index 795745d..cf6503f 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProcessMode.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProcessMode.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; /** * 处理模式 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectHeader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProjectHeader.java similarity index 94% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectHeader.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProjectHeader.java index 83aacc9..444a9b2 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectHeader.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProjectHeader.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; public class ProjectHeader { diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectMetadataCache.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProjectMetadataCache.java similarity index 96% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectMetadataCache.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProjectMetadataCache.java index 055ab1f..a019400 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectMetadataCache.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProjectMetadataCache.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import java.util.Map; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ResourceLocation.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ResourceLocation.java similarity index 92% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ResourceLocation.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ResourceLocation.java index 09a58db..3dfae1b 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ResourceLocation.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ResourceLocation.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; public enum ResourceLocation { diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ResourceType.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ResourceType.java similarity index 92% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ResourceType.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ResourceType.java index 2364dc6..d65e331 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ResourceType.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ResourceType.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; public enum ResourceType { diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ServiceUnitInfo.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ServiceUnitInfo.java similarity index 95% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ServiceUnitInfo.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ServiceUnitInfo.java index c4ffdd6..f77778b 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ServiceUnitInfo.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ServiceUnitInfo.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; /** * @Classname ServiceUnitInfo diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ExtractConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/extract/ExtractConfigData.java similarity index 87% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ExtractConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/extract/ExtractConfigData.java index afa5f36..24f2893 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ExtractConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/extract/ExtractConfigData.java @@ -13,8 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity.extract; +import com.inspur.edp.lcm.metadata.api.ConfigData.BaseConfig; import java.io.Serializable; /** diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ExtractConfigration.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/extract/ExtractConfigration.java similarity index 95% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ExtractConfigration.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/extract/ExtractConfigration.java index 5a1e516..810ae1a 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ExtractConfigration.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/extract/ExtractConfigration.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity.extract; import java.io.Serializable; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/LocalMetadataIndexItem.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/LocalMetadataIndexItem.java similarity index 95% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/LocalMetadataIndexItem.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/LocalMetadataIndexItem.java index 4065349..82a2ca9 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/LocalMetadataIndexItem.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/LocalMetadataIndexItem.java @@ -13,7 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity.metadataindex; + +import com.inspur.edp.lcm.metadata.api.entity.LocalRepoPkg; /** * Classname LocalMetadataIndexItem Description 本地元数据索引 Date 2019/11/26 15:33 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexDto.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/MetadataIndexDto.java similarity index 87% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexDto.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/MetadataIndexDto.java index 747ce79..5997932 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexDto.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/MetadataIndexDto.java @@ -13,8 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity.metadataindex; +import com.inspur.edp.lcm.metadata.api.entity.MetadataIndexItemDto; +import com.inspur.edp.lcm.metadata.api.entity.Page; import java.util.List; /** diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexRepoItemDto.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/MetadataIndexRepoItemDto.java similarity index 96% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexRepoItemDto.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/MetadataIndexRepoItemDto.java index 493388b..19a9640 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexRepoItemDto.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/MetadataIndexRepoItemDto.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity.metadataindex; /** * Classname MetadataIndexRepoItemDto Description 元数据索引仓库包项 Date 2019/11/26 11:22 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/ConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/ConfigData.java similarity index 84% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/ConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/ConfigData.java index 374bdda..1eac813 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/ConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/ConfigData.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; -import org.openatom.ubml.model.framework.definition.entity.BaseConfig; +import com.inspur.edp.lcm.metadata.api.ConfigData.BaseConfig; /** * @Classname CompilerConfigData diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/JitRuntimeConfigration.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/JitRuntimeConfigration.java similarity index 93% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/JitRuntimeConfigration.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/JitRuntimeConfigration.java index 70dbaf6..266fb2d 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/JitRuntimeConfigration.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/JitRuntimeConfigration.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; public class JitRuntimeConfigration { diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MavenComponent.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponent.java similarity index 92% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MavenComponent.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponent.java index ec5e0c8..a15d856 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MavenComponent.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponent.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MavenComponents.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponents.java similarity index 92% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MavenComponents.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponents.java index d00613d..b4e5e57 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MavenComponents.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponents.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import java.util.List; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MavenPackageRefs.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenPackageRefs.java similarity index 95% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MavenPackageRefs.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenPackageRefs.java index 8b64373..eb8ee3a 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MavenPackageRefs.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenPackageRefs.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; /** * Classname MavenPackageRefs Description Maven依赖关系实体类。保存在mdproj中的元数据依赖包 Date 2019/10/31 11:44 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoFilter.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataInfoFilter.java similarity index 97% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoFilter.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataInfoFilter.java index 983537a..e8ccb7f 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoFilter.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataInfoFilter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; import java.util.List; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoInMaven.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataInfoInMaven.java similarity index 98% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoInMaven.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataInfoInMaven.java index 199884d..673a11d 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoInMaven.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataInfoInMaven.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; public class MetadataInfoInMaven { diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoWithVersion.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataInfoWithVersion.java similarity index 98% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoWithVersion.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataInfoWithVersion.java index b33a5b2..17bf7ba 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoWithVersion.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataInfoWithVersion.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; import java.util.List; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataMavenInfo.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataMavenInfo.java similarity index 95% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataMavenInfo.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataMavenInfo.java index 873b0d2..78b8493 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataMavenInfo.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataMavenInfo.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; public class MetadataMavenInfo { diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataRepo.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataRepo.java similarity index 93% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataRepo.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataRepo.java index e096255..2fa7b08 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataRepo.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataRepo.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; import java.util.List; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/ModuleDependencies.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/ModuleDependencies.java similarity index 94% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/ModuleDependencies.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/ModuleDependencies.java index e2f198c..a24a077 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/ModuleDependencies.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/ModuleDependencies.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; /** * Classname Dependencies Description api module所有依赖 Date 2019/12/11 10:31 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/ModuleDependency.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/ModuleDependency.java similarity index 94% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/ModuleDependency.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/ModuleDependency.java index b7f0d57..4154dba 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/ModuleDependency.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/ModuleDependency.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; /** * Classname Dependency Description 依赖项 Date 2019/12/11 13:43 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PackageSourceDto.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PackageSourceDto.java similarity index 94% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PackageSourceDto.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PackageSourceDto.java index 5a753b2..bb5423c 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PackageSourceDto.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PackageSourceDto.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; /** * Classname PackageSourceDto Description mirrors中的条目 Date 2019/11/26 20:10 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PackageWithMetadataInfo.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PackageWithMetadataInfo.java similarity index 96% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PackageWithMetadataInfo.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PackageWithMetadataInfo.java index d035c6b..239b4e0 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PackageWithMetadataInfo.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PackageWithMetadataInfo.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; import java.util.List; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PageMetadataInfo.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PageMetadataInfo.java similarity index 94% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PageMetadataInfo.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PageMetadataInfo.java index 8951667..bb56a18 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PageMetadataInfo.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PageMetadataInfo.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; import java.util.List; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoFilterWithProcessMode.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataInfoFilterWithProcessMode.java similarity index 97% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoFilterWithProcessMode.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataInfoFilterWithProcessMode.java index f6bf690..4ece798 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoFilterWithProcessMode.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataInfoFilterWithProcessMode.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity.withprocessmode; +package com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode; import java.util.List; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoInMavenWithProcessMode.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataInfoInMavenWithProcessMode.java similarity index 83% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoInMavenWithProcessMode.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataInfoInMavenWithProcessMode.java index 9a1a901..1d19994 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoInMavenWithProcessMode.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataInfoInMavenWithProcessMode.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity.withprocessmode; +package com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode; -import org.openatom.ubml.model.framework.definition.entity.mvnEntity.MetadataInfoInMaven; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataInfoInMaven; public class MetadataInfoInMavenWithProcessMode extends MetadataInfoInMaven { diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoWithVersionWithProcessMode.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataInfoWithVersionWithProcessMode.java similarity index 97% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoWithVersionWithProcessMode.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataInfoWithVersionWithProcessMode.java index 1d72732..f248b91 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoWithVersionWithProcessMode.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataInfoWithVersionWithProcessMode.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity.withprocessmode; +package com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode; import java.util.List; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataMavenInfoWithProcessMode.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataMavenInfoWithProcessMode.java similarity index 83% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataMavenInfoWithProcessMode.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataMavenInfoWithProcessMode.java index 490f3ae..f9fbce5 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataMavenInfoWithProcessMode.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataMavenInfoWithProcessMode.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity.withprocessmode; +package com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode; -import org.openatom.ubml.model.framework.definition.entity.mvnEntity.MetadataMavenInfo; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataMavenInfo; public class MetadataMavenInfoWithProcessMode extends MetadataMavenInfo { diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/PackageWithMetadataInfoWithProcessMode.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/PackageWithMetadataInfoWithProcessMode.java similarity index 96% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/PackageWithMetadataInfoWithProcessMode.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/PackageWithMetadataInfoWithProcessMode.java index 693892e..c697900 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/PackageWithMetadataInfoWithProcessMode.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/PackageWithMetadataInfoWithProcessMode.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity.withprocessmode; +package com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode; import java.util.List; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/PageMetadataInfoWithProcessMode.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/PageMetadataInfoWithProcessMode.java similarity index 94% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/PageMetadataInfoWithProcessMode.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/PageMetadataInfoWithProcessMode.java index 2b8735b..1c50037 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/PageMetadataInfoWithProcessMode.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/PageMetadataInfoWithProcessMode.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity.withprocessmode; +package com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode; import java.util.List; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/api/FileService.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/FileService.java similarity index 99% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/api/FileService.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/FileService.java index 36f55c6..ac5b53f 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/api/FileService.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/FileService.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.api; +package com.inspur.edp.lcm.metadata.api.service; import java.io.File; import java.io.IOException; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/api/RefCommonService.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/RefCommonService.java similarity index 95% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/api/RefCommonService.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/RefCommonService.java index 6c4b93f..7a287e3 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/api/RefCommonService.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/RefCommonService.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.api; +package com.inspur.edp.lcm.metadata.api.service; import org.openatom.ubml.model.common.definition.entity.GspMetadata; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/IMetadataReferenceManager.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/IMetadataReferenceManager.java similarity index 95% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/IMetadataReferenceManager.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/IMetadataReferenceManager.java index 5e45096..af4c35a 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/IMetadataReferenceManager.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/IMetadataReferenceManager.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.spi; +package com.inspur.edp.lcm.metadata.spi; import java.util.List; import org.openatom.ubml.model.common.definition.entity.GspMetadata; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataContentManager.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataContentManager.java similarity index 95% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataContentManager.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataContentManager.java index 24a88cf..c919477 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataContentManager.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataContentManager.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.spi; +package com.inspur.edp.lcm.metadata.spi; import org.openatom.ubml.model.common.definition.entity.GspMetadata; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataContentSerializer.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataContentSerializer.java similarity index 95% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataContentSerializer.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataContentSerializer.java index 23bceb1..ea3c164 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataContentSerializer.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataContentSerializer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.spi; +package com.inspur.edp.lcm.metadata.spi; import com.fasterxml.jackson.databind.JsonNode; import org.openatom.ubml.model.common.definition.entity.IMetadataContent; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataTransferSerializer.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataTransferSerializer.java similarity index 97% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataTransferSerializer.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataTransferSerializer.java index 4887094..8033a2b 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataTransferSerializer.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataTransferSerializer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.spi; +package com.inspur.edp.lcm.metadata.spi; import org.openatom.ubml.model.common.definition.entity.IMetadataContent; diff --git a/model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/GspProjectService.java b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/GspProjectService.java similarity index 82% rename from model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/GspProjectService.java rename to model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/GspProjectService.java index 804b3ab..81c0aee 100644 --- a/model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/GspProjectService.java +++ b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/GspProjectService.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.metamodel.framework.designtime.api; +package com.inspur.edp.lcm.metadata.api.service; import java.io.IOException; import java.util.List; -import org.openatom.ubml.model.framework.definition.entity.GspProject; -import org.openatom.ubml.model.framework.definition.entity.ProjectConfiguration; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.ConfigData.gspproject.ProjectConfiguration; /** * GSP Project工程服务 diff --git a/model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/MetadataProjectService.java b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataProjectService.java similarity index 93% rename from model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/MetadataProjectService.java rename to model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataProjectService.java index 2491428..a4c6366 100644 --- a/model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/MetadataProjectService.java +++ b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataProjectService.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.metamodel.framework.designtime.api; +package com.inspur.edp.lcm.metadata.api.service; import java.io.IOException; import java.util.List; import java.util.Map; -import org.openatom.ubml.model.framework.definition.entity.GspProject; -import org.openatom.ubml.model.framework.definition.entity.MetadataPackageHeader; -import org.openatom.ubml.model.framework.definition.entity.MetadataProject; -import org.openatom.ubml.model.framework.definition.entity.ProcessMode; -import org.openatom.ubml.model.framework.definition.entity.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; /** * @author zhaoleitr 元数据工程服务 diff --git a/model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/MetadataService.java b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataService.java similarity index 94% rename from model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/MetadataService.java rename to model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataService.java index 865f8ff..a4f9ef6 100644 --- a/model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/MetadataService.java +++ b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataService.java @@ -13,21 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.metamodel.framework.designtime.api; +package com.inspur.edp.lcm.metadata.api.service; import java.util.List; import org.openatom.ubml.model.common.definition.entity.GspMetadata; import org.openatom.ubml.model.common.definition.entity.IMdExtRuleContent; import org.openatom.ubml.model.common.definition.entity.MetadataHeader; -import org.openatom.ubml.model.framework.definition.entity.GspProject; -import org.openatom.ubml.model.framework.definition.entity.Metadata4Ref; -import org.openatom.ubml.model.framework.definition.entity.Metadata4RefDto; -import org.openatom.ubml.model.framework.definition.entity.MetadataDto; -import org.openatom.ubml.model.framework.definition.entity.MetadataFilter; -import org.openatom.ubml.model.framework.definition.entity.MetadataIndexItemDto; -import org.openatom.ubml.model.framework.definition.entity.MetadataPackage; -import org.openatom.ubml.model.framework.definition.entity.MetadataProject; -import org.openatom.ubml.model.framework.definition.entity.MetadataType; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4Ref; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataFilter; +import com.inspur.edp.lcm.metadata.api.entity.MetadataIndexItemDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; /** * @author zhaoleitr diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/GenerateService.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/GenerateService.java similarity index 88% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/GenerateService.java rename to model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/GenerateService.java index ecabfe9..b46bbcc 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/GenerateService.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/GenerateService.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api; +package com.inspur.edp.jittojava.context; import java.util.List; -import org.openatom.ubml.model.framework.generator.api.entity.MavenDependency; +import com.inspur.edp.jittojava.context.entity.MavenDependency; /** * @Classname GenerateService diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/JitContext.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/JitContext.java similarity index 90% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/JitContext.java rename to model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/JitContext.java index 5c49acd..8d97580 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/JitContext.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/JitContext.java @@ -13,18 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api; +package com.inspur.edp.jittojava.context; import java.util.HashMap; import java.util.List; import java.util.Map; import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.framework.api.RefCommonService; -import org.openatom.ubml.model.framework.definition.entity.GspProject; -import org.openatom.ubml.model.framework.definition.entity.MetadataProject; -import org.openatom.ubml.model.framework.generator.api.temp.ModuleGenerateInfo; -import org.openatom.ubml.model.framework.generator.api.temp.ModuleGenerator; -import org.openatom.ubml.model.framework.generator.api.temp.RefCommonServiceImp; +import com.inspur.edp.lcm.metadata.api.service.RefCommonService; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.jittojava.context.temp.ModuleGenerateInfo; +import com.inspur.edp.jittojava.context.temp.ModuleGenerator; +import com.inspur.edp.jittojava.context.temp.RefCommonServiceImp; public class JitContext { RefCommonService refCommonService; diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/common/FileUtils.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/common/FileUtils.java similarity index 97% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/common/FileUtils.java rename to model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/common/FileUtils.java index b13a433..fcee79d 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/common/FileUtils.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/common/FileUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api.common; +package com.inspur.edp.jittojava.context.common; import java.io.File; import java.io.FileInputStream; diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/common/JitCompilerConfigLoader.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/common/JitCompilerConfigLoader.java similarity index 93% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/common/JitCompilerConfigLoader.java rename to model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/common/JitCompilerConfigLoader.java index a24ddcb..ddc1370 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/common/JitCompilerConfigLoader.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/common/JitCompilerConfigLoader.java @@ -13,18 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api.common; +package com.inspur.edp.jittojava.context.common; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.inspur.edp.jittojava.context.temp.EnvironmentUtil; import java.io.IOException; import java.nio.file.Paths; import java.util.List; -import org.openatom.ubml.model.framework.generator.api.entity.JitCompilerConfigration; -import org.openatom.ubml.model.framework.generator.api.temp.EnvironmentUtil; +import com.inspur.edp.jittojava.context.entity.JitCompilerConfigration; /** * @Classname JitCompilerConfigLoader diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/CompilerConfigData.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/entity/CompilerConfigData.java similarity index 94% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/CompilerConfigData.java rename to model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/entity/CompilerConfigData.java index 5beb354..df3c2b4 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/CompilerConfigData.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/entity/CompilerConfigData.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api.entity; +package com.inspur.edp.jittojava.context.entity; /** * @Classname CompilerConfigData diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/JitCompilerConfigration.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/entity/JitCompilerConfigration.java similarity index 96% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/JitCompilerConfigration.java rename to model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/entity/JitCompilerConfigration.java index 6a9815a..5f1d46f 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/JitCompilerConfigration.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/entity/JitCompilerConfigration.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api.entity; +package com.inspur.edp.jittojava.context.entity; /** * @Classname JitCompilerConfigration diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/MavenDependency.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/entity/MavenDependency.java similarity index 97% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/MavenDependency.java rename to model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/entity/MavenDependency.java index d5c05dd..a84c31b 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/MavenDependency.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/entity/MavenDependency.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api.entity; +package com.inspur.edp.jittojava.context.entity; /** * @Classname MavenDependency diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/service/CommonService.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/service/CommonService.java similarity index 95% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/service/CommonService.java rename to model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/service/CommonService.java index b914bc6..681eac5 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/service/CommonService.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/service/CommonService.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api.service; +package com.inspur.edp.jittojava.context.service; import java.util.List; diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/EnvironmentUtil.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/EnvironmentUtil.java similarity index 92% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/EnvironmentUtil.java rename to model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/EnvironmentUtil.java index c17ee02..6820c82 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/EnvironmentUtil.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/EnvironmentUtil.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api.temp; +package com.inspur.edp.jittojava.context.temp; /** * The type EnvironmentUtil diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/ModuleGenerateInfo.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/ModuleGenerateInfo.java similarity index 92% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/ModuleGenerateInfo.java rename to model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/ModuleGenerateInfo.java index f8ba977..cdf5c5d 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/ModuleGenerateInfo.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/ModuleGenerateInfo.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api.temp; +package com.inspur.edp.jittojava.context.temp; /** * The type ModuleGenerateInfo diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/ModuleGenerator.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/ModuleGenerator.java similarity index 91% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/ModuleGenerator.java rename to model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/ModuleGenerator.java index 111d3e8..ae417d2 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/ModuleGenerator.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/ModuleGenerator.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api.temp; +package com.inspur.edp.jittojava.context.temp; /** * The type ModuleGenerator diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/RefCommonServiceImp.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/RefCommonServiceImp.java similarity index 87% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/RefCommonServiceImp.java rename to model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/RefCommonServiceImp.java index dc818b1..46e73fc 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/RefCommonServiceImp.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/RefCommonServiceImp.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api.temp; +package com.inspur.edp.jittojava.context.temp; import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.framework.api.RefCommonService; +import com.inspur.edp.lcm.metadata.api.service.RefCommonService; /** * The type RefCommonServiceImp diff --git a/model/framework/generator-api/src/test/java/org/openatom/ubml/model/framework/generator/api/common/FileUtilsTest.java b/model/framework/generator-api/src/test/java/com/inspur/edp/jittojava/context/common/FileUtilsTest.java similarity index 89% rename from model/framework/generator-api/src/test/java/org/openatom/ubml/model/framework/generator/api/common/FileUtilsTest.java rename to model/framework/generator-api/src/test/java/com/inspur/edp/jittojava/context/common/FileUtilsTest.java index 2a48cbf..7f53b07 100644 --- a/model/framework/generator-api/src/test/java/org/openatom/ubml/model/framework/generator/api/common/FileUtilsTest.java +++ b/model/framework/generator-api/src/test/java/com/inspur/edp/jittojava/context/common/FileUtilsTest.java @@ -1,4 +1,4 @@ -package org.openatom.ubml.model.framework.generator.api.common; +package com.inspur.edp.jittojava.context.common; import org.junit.Assert; import org.junit.Test; diff --git a/model/framework/generator-spi/src/main/java/org/openatom/ubml/model/framework/generator/spi/AfterGeneratorAction.java b/model/framework/generator-spi/src/main/java/com/inspur/edp/jittojava/spi/AfterGeneratorAction.java similarity index 93% rename from model/framework/generator-spi/src/main/java/org/openatom/ubml/model/framework/generator/spi/AfterGeneratorAction.java rename to model/framework/generator-spi/src/main/java/com/inspur/edp/jittojava/spi/AfterGeneratorAction.java index 330357d..e16c0a8 100644 --- a/model/framework/generator-spi/src/main/java/org/openatom/ubml/model/framework/generator/spi/AfterGeneratorAction.java +++ b/model/framework/generator-spi/src/main/java/com/inspur/edp/jittojava/spi/AfterGeneratorAction.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.spi; +package com.inspur.edp.jittojava.spi; /** * @Classname AfterGeneratorAction diff --git a/model/framework/generator-spi/src/main/java/org/openatom/ubml/model/framework/generator/spi/JitAction.java b/model/framework/generator-spi/src/main/java/com/inspur/edp/jittojava/spi/JitAction.java similarity index 85% rename from model/framework/generator-spi/src/main/java/org/openatom/ubml/model/framework/generator/spi/JitAction.java rename to model/framework/generator-spi/src/main/java/com/inspur/edp/jittojava/spi/JitAction.java index 19ef3ee..98b7378 100644 --- a/model/framework/generator-spi/src/main/java/org/openatom/ubml/model/framework/generator/spi/JitAction.java +++ b/model/framework/generator-spi/src/main/java/com/inspur/edp/jittojava/spi/JitAction.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.spi; +package com.inspur.edp.jittojava.spi; -import org.openatom.ubml.model.framework.generator.api.JitContext; +import com.inspur.edp.jittojava.context.JitContext; public interface JitAction { void generateApi(JitContext context); diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InternalExtendActionUtil.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InternalExtendActionUtil.java index be632ad..3df5e86 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InternalExtendActionUtil.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InternalExtendActionUtil.java @@ -16,8 +16,8 @@ package org.openatom.ubml.model.vo.definition.common; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; -import org.openatom.ubml.model.vo.definition.action.internalexternalaction.ChangeSetMappingAction; -import org.openatom.ubml.model.vo.definition.action.internalexternalaction.ChangeSetReversalMappingAction; +import org.openatom.ubml.model.vo.definition.action.internalexternalaction.ChangesetMappingAction; +import org.openatom.ubml.model.vo.definition.action.internalexternalaction.ChangesetReversalMappingAction; import org.openatom.ubml.model.vo.definition.action.internalexternalaction.CreateAction; import org.openatom.ubml.model.vo.definition.action.internalexternalaction.DataMappingAction; import org.openatom.ubml.model.vo.definition.action.internalexternalaction.DataReversalMappingAction; @@ -72,9 +72,9 @@ public class InternalExtendActionUtil { case DataReversalMappingActionId: return new DataReversalMappingAction(); case ChangesetReversalMappingActionId: - return new ChangeSetReversalMappingAction(); + return new ChangesetReversalMappingAction(); case ChangesetMappingActionId: - return new ChangeSetMappingAction(); + return new ChangesetMappingAction(); case MultiDeleteActionId: return new MultiDeleteAction(); default: -- Gitee From 01a041661db4a76b4a7d9a66f78a8593b155a914 Mon Sep 17 00:00:00 2001 From: Q-Lee Date: Fri, 16 Apr 2021 15:26:38 +0800 Subject: [PATCH 45/61] =?UTF-8?q?=E4=BC=98=E5=8C=96:=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=BA=86model->common=E6=A8=A1=E5=9D=97=E4=B8=8B=E6=B6=89?= =?UTF-8?q?=E5=8F=8Alcm=E7=B1=BB=E7=9A=84=E5=8C=85=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ubml/model/be/definition/GspBusinessEntity.java | 2 +- .../edp/lcm/metadata/api}/AbstractMetadataContent.java | 2 +- .../inspur/edp/lcm/metadata/api}/IMdExtRuleContent.java | 2 +- .../inspur/edp/lcm/metadata/api}/IMetadataContent.java | 2 +- .../inspur/edp/lcm/metadata/api}/entity/GspMetadata.java | 4 +++- .../edp/lcm/metadata/api}/entity/I18nResourceItem.java | 2 +- .../metadata/api}/entity/I18nResourceItemCollection.java | 2 +- .../inspur/edp/lcm/metadata/api}/entity/MetadataHeader.java | 2 +- .../edp/lcm/metadata/api}/entity/MetadataProperties.java | 2 +- .../edp/lcm/metadata/api}/entity/MetadataReference.java | 2 +- .../lcm/metadata/api}/entity/MetadataReferenceDetail.java | 2 +- .../cef/i18n/context/CefResourceExtractContext.java | 4 ++-- .../cef/i18n/context/CefResourceMergeContext.java | 2 +- .../cef/i18n/context/ICefResourceMergeContext.java | 2 +- .../definition/cef/i18n/merger/CefFieldResourceMerger.java | 2 +- .../definition/cef/i18n/merger/DataTypeResourceMerger.java | 2 +- .../definition/commonmodel/entity/GspCommonModel.java | 2 +- .../model/externalapi/definition/entity/ExternalApi.java | 2 +- .../definition/temp/lcm/CustomizationRtService.java | 2 +- .../definition/temp/lcm/CustomizationService.java | 2 +- .../definition/temp/lcm/DimensionExtendEntity.java | 2 +- .../definition/temp/lcm/IMetadataCacheExtService.java | 2 +- .../definition/temp/lcm/IMetadataReferenceManager.java | 4 ++-- .../definition/temp/lcm/IMetadataRtReferenceManager.java | 4 ++-- .../model/externalapi/definition/temp/lcm/JitContext.java | 2 +- .../definition/temp/lcm/MetadataContentManager.java | 2 +- .../externalapi/definition/temp/lcm/MetadataService.java | 2 +- .../externalapi/definition/temp/lcm/RefCommonService.java | 2 +- .../model/externalapi/definition/util/MetadataUtil.java | 2 +- .../externalapi/devtime/api/ExternalApiMetadataService.java | 2 +- .../devtime/core/initializer/ExternalApiInitializer.java | 2 +- .../devtime/core/manager/ExternalApiProviderManager.java | 2 +- .../devtime/core/provider/ExternalApiMetadataBuilder.java | 4 ++-- .../externalapi/devtime/core/provider/MetadataUtils.java | 2 +- .../devtime/core/provider/SimpleViewModelProvider.java | 2 +- .../devtime/core/provider/ViewModelProvider.java | 2 +- .../devtime/core/refer/ExternalApiReferenceConstraint.java | 4 ++-- .../core/service/ExternalApiMetadataServiceImpl.java | 2 +- .../devtime/core/utils/MetadataProjectUtils.java | 2 +- .../ubml/mode/externalapi/devtime/spi/ResourceProvider.java | 2 +- .../externalapi/provider/viewmodel/BasicActionProvider.java | 2 +- .../externalapi/provider/viewmodel/BasicActionSummary.java | 2 +- .../provider/viewmodel/CustomActionProvider.java | 2 +- .../externalapi/provider/viewmodel/CustomActionSummary.java | 2 +- .../provider/viewmodel/SimpleBasicActionProvider.java | 2 +- .../provider/viewmodel/SimpleBasicActionSummary.java | 2 +- .../provider/viewmodel/SimpleCustomActionProvider.java | 2 +- .../provider/viewmodel/SimpleCustomActionSummary.java | 2 +- .../provider/viewmodel/utils/SimpleViewModelUtils.java | 2 +- .../provider/viewmodel/utils/ViewModelUtils.java | 2 +- .../model/externalapi/generator/ExternalApiRtHandler.java | 4 ++-- .../externalapi/generator/dt/ExternalApiDtHandler.java | 4 ++-- .../generator/dt/ExternalApiJavaCodeGenerator.java | 2 +- .../runtime/api/ExternalApiCustomizedMetadataService.java | 2 +- .../externalapi/runtime/api/ExternalApiMetadataService.java | 2 +- .../runtime/core/constraint/ExternalApiRTRefConstraint.java | 4 ++-- .../runtime/core/customize/entity/CustomizeUnitGetter.java | 2 +- .../customize/listener/SgfMdPkgChangedEventListener.java | 2 +- .../listener/SgfMetadataCacheExtServiceListener.java | 2 +- .../externalapi/runtime/core/serializer/JsonSerializer.java | 2 +- .../runtime/core/serializer/TransferSerializer.java | 2 +- .../DefaultExternalApiCustomizedMetadataService.java | 4 ++-- .../core/service/DefaultExternalApiMetadataService.java | 4 ++-- .../runtime/core/service/ExternalApiJavaCodeHandler.java | 2 +- .../inspur/edp/lcm/metadata/api/entity/I18nResource.java | 2 -- .../inspur/edp/lcm/metadata/api/entity/Metadata4Ref.java | 2 -- .../com/inspur/edp/lcm/metadata/api/entity/MetadataDto.java | 2 -- .../inspur/edp/lcm/metadata/api/entity/MetadataPackage.java | 1 - .../edp/lcm/metadata/api/service/RefCommonService.java | 2 +- .../edp/lcm/metadata/spi/IMetadataReferenceManager.java | 4 ++-- .../inspur/edp/lcm/metadata/spi/MetadataContentManager.java | 2 +- .../edp/lcm/metadata/spi/MetadataContentSerializer.java | 2 +- .../edp/lcm/metadata/spi/MetadataTransferSerializer.java | 2 +- .../edp/lcm/metadata/api/service/MetadataService.java | 6 +++--- .../java/com/inspur/edp/jittojava/context/JitContext.java | 2 +- .../edp/jittojava/context/temp/RefCommonServiceImp.java | 2 +- .../org/openatom/ubml/model/vo/definition/GspViewModel.java | 2 +- 77 files changed, 88 insertions(+), 93 deletions(-) rename model/common/definition/src/main/java/{org/openatom/ubml/model/common/definition/entity => com/inspur/edp/lcm/metadata/api}/AbstractMetadataContent.java (95%) rename model/common/definition/src/main/java/{org/openatom/ubml/model/common/definition/entity => com/inspur/edp/lcm/metadata/api}/IMdExtRuleContent.java (92%) rename model/common/definition/src/main/java/{org/openatom/ubml/model/common/definition/entity => com/inspur/edp/lcm/metadata/api}/IMetadataContent.java (92%) rename model/common/definition/src/main/java/{org/openatom/ubml/model/common/definition => com/inspur/edp/lcm/metadata/api}/entity/GspMetadata.java (97%) rename model/common/definition/src/main/java/{org/openatom/ubml/model/common/definition => com/inspur/edp/lcm/metadata/api}/entity/I18nResourceItem.java (97%) rename model/common/definition/src/main/java/{org/openatom/ubml/model/common/definition => com/inspur/edp/lcm/metadata/api}/entity/I18nResourceItemCollection.java (97%) rename model/common/definition/src/main/java/{org/openatom/ubml/model/common/definition => com/inspur/edp/lcm/metadata/api}/entity/MetadataHeader.java (98%) rename model/common/definition/src/main/java/{org/openatom/ubml/model/common/definition => com/inspur/edp/lcm/metadata/api}/entity/MetadataProperties.java (95%) rename model/common/definition/src/main/java/{org/openatom/ubml/model/common/definition => com/inspur/edp/lcm/metadata/api}/entity/MetadataReference.java (97%) rename model/common/definition/src/main/java/{org/openatom/ubml/model/common/definition => com/inspur/edp/lcm/metadata/api}/entity/MetadataReferenceDetail.java (96%) diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBusinessEntity.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBusinessEntity.java index 9a29627..e5b68b2 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBusinessEntity.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBusinessEntity.java @@ -34,7 +34,7 @@ import org.openatom.ubml.model.be.definition.operation.internalmgraction.Retriev import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonModel; import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonObject; import org.openatom.ubml.model.common.definition.commonmodel.entity.GspCommonModel; -import org.openatom.ubml.model.common.definition.entity.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; /** * The Definition Of Business Entity Metadata diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/AbstractMetadataContent.java b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/AbstractMetadataContent.java similarity index 95% rename from model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/AbstractMetadataContent.java rename to model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/AbstractMetadataContent.java index c401a49..60d83f6 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/AbstractMetadataContent.java +++ b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/AbstractMetadataContent.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.common.definition.entity; +package com.inspur.edp.lcm.metadata.api; /** * The type AbstractMetadataContent diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/IMdExtRuleContent.java b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/IMdExtRuleContent.java similarity index 92% rename from model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/IMdExtRuleContent.java rename to model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/IMdExtRuleContent.java index 753cd45..f84a555 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/IMdExtRuleContent.java +++ b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/IMdExtRuleContent.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.common.definition.entity; +package com.inspur.edp.lcm.metadata.api; /** * The type IMdExtRuleContent diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/IMetadataContent.java b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/IMetadataContent.java similarity index 92% rename from model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/IMetadataContent.java rename to model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/IMetadataContent.java index 69ef985..5c479f7 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/IMetadataContent.java +++ b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/IMetadataContent.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.common.definition.entity; +package com.inspur.edp.lcm.metadata.api; /** * The type IMetadataContent diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/GspMetadata.java b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/GspMetadata.java similarity index 97% rename from model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/GspMetadata.java rename to model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/GspMetadata.java index d56f336..0c470d3 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/GspMetadata.java +++ b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/GspMetadata.java @@ -13,8 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.common.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; +import com.inspur.edp.lcm.metadata.api.IMdExtRuleContent; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; import java.util.ArrayList; import java.util.List; import org.openatom.ubml.common.util.StringUtils; diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/I18nResourceItem.java b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResourceItem.java similarity index 97% rename from model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/I18nResourceItem.java rename to model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResourceItem.java index 3a47639..c5cf118 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/I18nResourceItem.java +++ b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResourceItem.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.common.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; public class I18nResourceItem { diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/I18nResourceItemCollection.java b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResourceItemCollection.java similarity index 97% rename from model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/I18nResourceItemCollection.java rename to model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResourceItemCollection.java index e1ccdec..297efee 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/I18nResourceItemCollection.java +++ b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResourceItemCollection.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.common.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import java.util.ArrayList; diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataHeader.java b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataHeader.java similarity index 98% rename from model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataHeader.java rename to model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataHeader.java index 7dfacd1..b5f9281 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataHeader.java +++ b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataHeader.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.common.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataProperties.java b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProperties.java similarity index 95% rename from model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataProperties.java rename to model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProperties.java index 144d151..2ad3749 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataProperties.java +++ b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProperties.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.common.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; /** * The type MetadataProperties diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataReference.java b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataReference.java similarity index 97% rename from model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataReference.java rename to model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataReference.java index e190ada..5f97035 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataReference.java +++ b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataReference.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.common.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import java.util.ArrayList; import java.util.List; diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataReferenceDetail.java b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataReferenceDetail.java similarity index 96% rename from model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataReferenceDetail.java rename to model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataReferenceDetail.java index 9e75b52..1ad3107 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataReferenceDetail.java +++ b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataReferenceDetail.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.common.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; /** * The type MetadataReferenceDetail diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java index 2a58611..81a2211 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java @@ -16,8 +16,8 @@ package org.openatom.ubml.model.common.definition.cef.i18n.context; import org.openatom.ubml.model.common.definition.cef.util.DataValidator; -import org.openatom.ubml.model.common.definition.entity.I18nResourceItem; -import org.openatom.ubml.model.common.definition.entity.I18nResourceItemCollection; +import com.inspur.edp.lcm.metadata.api.entity.I18nResourceItem; +import com.inspur.edp.lcm.metadata.api.entity.I18nResourceItemCollection; /** * 多语资源项抽取上下文 diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java index f345968..fd47330 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java @@ -16,7 +16,7 @@ package org.openatom.ubml.model.common.definition.cef.i18n.context; import org.openatom.ubml.model.common.definition.cef.util.DataValidator; -import org.openatom.ubml.model.common.definition.entity.I18nResourceItemCollection; +import com.inspur.edp.lcm.metadata.api.entity.I18nResourceItemCollection; public class CefResourceMergeContext implements ICefResourceMergeContext { diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java index 6d38a26..4e25959 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java @@ -15,7 +15,7 @@ */ package org.openatom.ubml.model.common.definition.cef.i18n.context; -import org.openatom.ubml.model.common.definition.entity.I18nResourceItemCollection; +import com.inspur.edp.lcm.metadata.api.entity.I18nResourceItemCollection; public interface ICefResourceMergeContext { diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java index c13bf1a..fbeba12 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java @@ -23,7 +23,7 @@ import org.openatom.ubml.model.common.definition.cef.element.GspEnumValue; import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; import org.openatom.ubml.model.common.definition.cef.increment.merger.MergeUtils; -import org.openatom.ubml.model.common.definition.entity.I18nResourceItemCollection; +import com.inspur.edp.lcm.metadata.api.entity.I18nResourceItemCollection; public abstract class CefFieldResourceMerger extends AbstractResourceMerger { diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java index c640a62..f2658fb 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java @@ -20,7 +20,7 @@ import org.openatom.ubml.model.common.definition.cef.IGspCommonDataType; import org.openatom.ubml.model.common.definition.cef.IGspCommonField; import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; -import org.openatom.ubml.model.common.definition.entity.I18nResourceItemCollection; +import com.inspur.edp.lcm.metadata.api.entity.I18nResourceItemCollection; import static org.openatom.ubml.model.common.definition.cef.increment.merger.MergeUtils.getKeyPrefix; diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java index dafb04d..335e9d7 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java @@ -26,7 +26,7 @@ import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonElement; import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonModel; import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonObject; import org.openatom.ubml.model.common.definition.commonmodel.entity.element.GspCommonAssociation; -import org.openatom.ubml.model.common.definition.entity.AbstractMetadataContent; +import com.inspur.edp.lcm.metadata.api.AbstractMetadataContent; /** * The Definition Of Common Model diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/ExternalApi.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/ExternalApi.java index 4e10bad..e456d5e 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/ExternalApi.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/ExternalApi.java @@ -18,7 +18,7 @@ package org.openatom.ubml.model.externalapi.definition.entity; import java.text.MessageFormat; import java.util.ArrayList; import org.openatom.ubml.common.util.JacksonJsonUtil; -import org.openatom.ubml.model.common.definition.entity.AbstractMetadataContent; +import com.inspur.edp.lcm.metadata.api.AbstractMetadataContent; /** * The Definition of ExternalApi. diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/CustomizationRtService.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/CustomizationRtService.java index b846a98..f56cde3 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/CustomizationRtService.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/CustomizationRtService.java @@ -15,7 +15,7 @@ */ package org.openatom.ubml.model.externalapi.definition.temp.lcm; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; /** * The type CustomizationRtService diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/CustomizationService.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/CustomizationService.java index c2428ba..3737bf7 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/CustomizationService.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/CustomizationService.java @@ -15,7 +15,7 @@ */ package org.openatom.ubml.model.externalapi.definition.temp.lcm; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; /** * The type CustomizationService diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/DimensionExtendEntity.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/DimensionExtendEntity.java index edd24b3..9c58789 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/DimensionExtendEntity.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/DimensionExtendEntity.java @@ -15,7 +15,7 @@ */ package org.openatom.ubml.model.externalapi.definition.temp.lcm; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; /** * The type DimensionExtendEntity diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataCacheExtService.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataCacheExtService.java index 3a63716..7d639d7 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataCacheExtService.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataCacheExtService.java @@ -15,7 +15,7 @@ */ package org.openatom.ubml.model.externalapi.definition.temp.lcm; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; /** * The type IMetadataCacheExtService diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataReferenceManager.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataReferenceManager.java index a6f6961..73e6bd4 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataReferenceManager.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataReferenceManager.java @@ -16,8 +16,8 @@ package org.openatom.ubml.model.externalapi.definition.temp.lcm; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.MetadataReference; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataReference; /** * The type IMetadataReferenceManager diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataRtReferenceManager.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataRtReferenceManager.java index 8eb5d5c..466af3b 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataRtReferenceManager.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataRtReferenceManager.java @@ -16,8 +16,8 @@ package org.openatom.ubml.model.externalapi.definition.temp.lcm; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.MetadataReference; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataReference; /** * The type IMetadataRtReferenceManager diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/JitContext.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/JitContext.java index fdba1ee..b0f5533 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/JitContext.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/JitContext.java @@ -16,7 +16,7 @@ package org.openatom.ubml.model.externalapi.definition.temp.lcm; import java.util.Map; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; /** diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MetadataContentManager.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MetadataContentManager.java index 940b378..2ebc734 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MetadataContentManager.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MetadataContentManager.java @@ -15,7 +15,7 @@ */ package org.openatom.ubml.model.externalapi.definition.temp.lcm; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; /** * The type MetadataContentManager diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MetadataService.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MetadataService.java index 6851172..115cbc8 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MetadataService.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MetadataService.java @@ -16,7 +16,7 @@ package org.openatom.ubml.model.externalapi.definition.temp.lcm; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; /** * The type MetadataService diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/RefCommonService.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/RefCommonService.java index a725d04..9e1de1d 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/RefCommonService.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/RefCommonService.java @@ -15,7 +15,7 @@ */ package org.openatom.ubml.model.externalapi.definition.temp.lcm; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; /** * The type RefCommonService diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/util/MetadataUtil.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/util/MetadataUtil.java index ba09d1f..7c02f09 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/util/MetadataUtil.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/util/MetadataUtil.java @@ -17,7 +17,7 @@ package org.openatom.ubml.model.externalapi.definition.util; import java.util.HashMap; import org.openatom.ubml.common.util.JacksonJsonUtil; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.Constants; /** diff --git a/model/externalapi/devtime-api/src/main/java/org/openatom/ubml/externalapi/devtime/api/ExternalApiMetadataService.java b/model/externalapi/devtime-api/src/main/java/org/openatom/ubml/externalapi/devtime/api/ExternalApiMetadataService.java index 2c90dd1..2c50bb9 100644 --- a/model/externalapi/devtime-api/src/main/java/org/openatom/ubml/externalapi/devtime/api/ExternalApiMetadataService.java +++ b/model/externalapi/devtime-api/src/main/java/org/openatom/ubml/externalapi/devtime/api/ExternalApiMetadataService.java @@ -15,7 +15,7 @@ */ package org.openatom.ubml.externalapi.devtime.api; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.entity.ProviderType; /** diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/initializer/ExternalApiInitializer.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/initializer/ExternalApiInitializer.java index ade603c..bd2c3d4 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/initializer/ExternalApiInitializer.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/initializer/ExternalApiInitializer.java @@ -16,7 +16,7 @@ package org.openatom.ubml.model.externalapi.devtime.core.initializer; import java.util.UUID; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import org.openatom.ubml.model.externalapi.definition.temp.lcm.MetadataContentManager; diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/manager/ExternalApiProviderManager.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/manager/ExternalApiProviderManager.java index 0cf16c5..25e4483 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/manager/ExternalApiProviderManager.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/manager/ExternalApiProviderManager.java @@ -19,7 +19,7 @@ import java.text.MessageFormat; import java.util.List; import java.util.Objects; import org.openatom.ubml.mode.externalapi.devtime.spi.ResourceProvider; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.dto.Summary; import org.openatom.ubml.model.externalapi.definition.entity.Operation; import org.openatom.ubml.model.externalapi.devtime.core.cache.ResourceProviderCache; diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ExternalApiMetadataBuilder.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ExternalApiMetadataBuilder.java index a237f15..8e62abc 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ExternalApiMetadataBuilder.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ExternalApiMetadataBuilder.java @@ -22,8 +22,8 @@ import java.util.UUID; import org.openatom.ubml.common.spring.SpringUtils; import org.openatom.ubml.common.util.JacksonJsonUtil; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.MetadataHeader; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; import org.openatom.ubml.model.externalapi.definition.Constants; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import org.openatom.ubml.model.externalapi.definition.entity.Model; diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/MetadataUtils.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/MetadataUtils.java index c1a7879..fed59e8 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/MetadataUtils.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/MetadataUtils.java @@ -20,7 +20,7 @@ import org.openatom.ubml.common.spring.SpringUtils; import org.openatom.ubml.common.util.StringUtils; import com.inspur.edp.lcm.metadata.api.service.GspProjectService; import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.temp.lcm.RefCommonService; import com.inspur.edp.lcm.metadata.api.entity.GspProject; import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/SimpleViewModelProvider.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/SimpleViewModelProvider.java index 6f67b34..642dd6a 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/SimpleViewModelProvider.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/SimpleViewModelProvider.java @@ -21,7 +21,7 @@ import java.util.stream.Collectors; import org.openatom.ubml.common.util.StringUtils; import org.openatom.ubml.mode.externalapi.devtime.spi.ExternalApiResourceProvider; import org.openatom.ubml.mode.externalapi.devtime.spi.ResourceProvider; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.Constants; import org.openatom.ubml.model.externalapi.definition.dto.Summary; import org.openatom.ubml.model.externalapi.definition.entity.Operation; diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ViewModelProvider.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ViewModelProvider.java index 76513cd..a55e7c3 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ViewModelProvider.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ViewModelProvider.java @@ -19,7 +19,7 @@ import java.util.List; import java.util.stream.Collectors; import org.openatom.ubml.mode.externalapi.devtime.spi.ExternalApiResourceProvider; import org.openatom.ubml.mode.externalapi.devtime.spi.ResourceProvider; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.Constants; import org.openatom.ubml.model.externalapi.definition.dto.Summary; import org.openatom.ubml.model.externalapi.definition.entity.Operation; diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/refer/ExternalApiReferenceConstraint.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/refer/ExternalApiReferenceConstraint.java index 73676aa..576ce59 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/refer/ExternalApiReferenceConstraint.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/refer/ExternalApiReferenceConstraint.java @@ -16,8 +16,8 @@ package org.openatom.ubml.model.externalapi.devtime.core.refer; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.MetadataReference; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataReference; import org.openatom.ubml.model.externalapi.definition.temp.lcm.IMetadataReferenceManager; /** diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/service/ExternalApiMetadataServiceImpl.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/service/ExternalApiMetadataServiceImpl.java index b363efa..cf88b5b 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/service/ExternalApiMetadataServiceImpl.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/service/ExternalApiMetadataServiceImpl.java @@ -19,7 +19,7 @@ import java.util.ArrayList; import java.util.List; import org.openatom.ubml.common.util.StringUtils; import org.openatom.ubml.externalapi.devtime.api.ExternalApiMetadataService; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.Constants; import org.openatom.ubml.model.externalapi.definition.dto.Summary; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/utils/MetadataProjectUtils.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/utils/MetadataProjectUtils.java index 6ed4aff..70b0fec 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/utils/MetadataProjectUtils.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/utils/MetadataProjectUtils.java @@ -19,7 +19,7 @@ import java.io.IOException; import org.openatom.ubml.common.spring.SpringUtils; import org.openatom.ubml.common.util.StringUtils; import com.inspur.edp.lcm.metadata.api.service.GspProjectService; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.temp.lcm.RefCommonService; import com.inspur.edp.lcm.metadata.api.entity.GspProject; diff --git a/model/externalapi/devtime-spi/src/main/java/org/openatom/ubml/mode/externalapi/devtime/spi/ResourceProvider.java b/model/externalapi/devtime-spi/src/main/java/org/openatom/ubml/mode/externalapi/devtime/spi/ResourceProvider.java index 7eb7b0d..8f6add0 100644 --- a/model/externalapi/devtime-spi/src/main/java/org/openatom/ubml/mode/externalapi/devtime/spi/ResourceProvider.java +++ b/model/externalapi/devtime-spi/src/main/java/org/openatom/ubml/mode/externalapi/devtime/spi/ResourceProvider.java @@ -16,7 +16,7 @@ package org.openatom.ubml.mode.externalapi.devtime.spi; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.dto.Summary; import org.openatom.ubml.model.externalapi.definition.entity.Operation; diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/BasicActionProvider.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/BasicActionProvider.java index 4690853..747286c 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/BasicActionProvider.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/BasicActionProvider.java @@ -19,7 +19,7 @@ import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.entity.Operation; import org.openatom.ubml.model.externalapi.definition.entity.Parameter; import org.openatom.ubml.model.externalapi.definition.temp.vo.GspViewModel; diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/BasicActionSummary.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/BasicActionSummary.java index 184ec5d..bdcab4b 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/BasicActionSummary.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/BasicActionSummary.java @@ -19,7 +19,7 @@ import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.dto.Summary; import org.openatom.ubml.model.externalapi.definition.temp.vo.GspViewModel; import org.openatom.ubml.model.externalapi.definition.temp.vo.GspViewObject; diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/CustomActionProvider.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/CustomActionProvider.java index f4d3d35..07bd2d2 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/CustomActionProvider.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/CustomActionProvider.java @@ -17,7 +17,7 @@ package org.openatom.ubml.model.externalapi.provider.viewmodel; import jdk.nashorn.internal.runtime.PropertyMap; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.entity.Operation; import org.openatom.ubml.model.externalapi.definition.entity.Parameter; import org.openatom.ubml.model.externalapi.definition.temp.vo.GspViewModel; diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/CustomActionSummary.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/CustomActionSummary.java index 603a5f0..df51562 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/CustomActionSummary.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/CustomActionSummary.java @@ -18,7 +18,7 @@ package org.openatom.ubml.model.externalapi.provider.viewmodel; import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.dto.Summary; import org.openatom.ubml.model.externalapi.definition.temp.vo.GspViewModel; import org.openatom.ubml.model.externalapi.definition.temp.vo.ViewModelAction; diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleBasicActionProvider.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleBasicActionProvider.java index 8b03e4e..81f3f66 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleBasicActionProvider.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleBasicActionProvider.java @@ -16,7 +16,7 @@ package org.openatom.ubml.model.externalapi.provider.viewmodel; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.entity.Operation; import org.openatom.ubml.model.externalapi.definition.entity.Parameter; import org.openatom.ubml.model.externalapi.definition.temp.vo.GspViewModel; diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleBasicActionSummary.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleBasicActionSummary.java index d986940..a939895 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleBasicActionSummary.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleBasicActionSummary.java @@ -17,7 +17,7 @@ package org.openatom.ubml.model.externalapi.provider.viewmodel; import java.util.ArrayList; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.dto.Summary; /** diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleCustomActionProvider.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleCustomActionProvider.java index 84026fc..f9a7abf 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleCustomActionProvider.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleCustomActionProvider.java @@ -15,7 +15,7 @@ */ package org.openatom.ubml.model.externalapi.provider.viewmodel; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.entity.Operation; import org.openatom.ubml.model.externalapi.definition.entity.Parameter; import org.openatom.ubml.model.externalapi.definition.temp.vo.GspViewModel; diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleCustomActionSummary.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleCustomActionSummary.java index 393cf39..1ea9ed5 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleCustomActionSummary.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleCustomActionSummary.java @@ -18,7 +18,7 @@ package org.openatom.ubml.model.externalapi.provider.viewmodel; import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.dto.Summary; import org.openatom.ubml.model.externalapi.definition.temp.vo.GspViewModel; import org.openatom.ubml.model.externalapi.definition.temp.vo.ViewModelAction; diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/utils/SimpleViewModelUtils.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/utils/SimpleViewModelUtils.java index fb9b606..921499c 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/utils/SimpleViewModelUtils.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/utils/SimpleViewModelUtils.java @@ -17,7 +17,7 @@ package org.openatom.ubml.model.externalapi.provider.viewmodel.utils; import java.util.ArrayList; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.dto.Summary; import org.openatom.ubml.model.externalapi.definition.entity.Operation; import org.openatom.ubml.model.externalapi.provider.viewmodel.SimpleBasicActionProvider; diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/utils/ViewModelUtils.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/utils/ViewModelUtils.java index 67b1b01..c734776 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/utils/ViewModelUtils.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/utils/ViewModelUtils.java @@ -17,7 +17,7 @@ package org.openatom.ubml.model.externalapi.provider.viewmodel.utils; import java.util.ArrayList; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.dto.Summary; import org.openatom.ubml.model.externalapi.definition.entity.Operation; import org.openatom.ubml.model.externalapi.provider.viewmodel.BasicActionProvider; diff --git a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiRtHandler.java b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiRtHandler.java index 6666c8b..a79c59e 100644 --- a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiRtHandler.java +++ b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiRtHandler.java @@ -24,8 +24,8 @@ import java.util.Objects; import java.util.stream.Collectors; import org.openatom.ubml.common.spring.SpringUtils; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; import org.openatom.ubml.model.externalapi.definition.Constants; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import org.openatom.ubml.model.externalapi.definition.entity.Operation; diff --git a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/ExternalApiDtHandler.java b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/ExternalApiDtHandler.java index 8e4efcd..eca40d4 100644 --- a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/ExternalApiDtHandler.java +++ b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/ExternalApiDtHandler.java @@ -22,8 +22,8 @@ import java.util.List; import java.util.Objects; import java.util.stream.Collectors; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; import org.openatom.ubml.model.externalapi.definition.Constants; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import org.openatom.ubml.model.externalapi.definition.entity.Operation; diff --git a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/ExternalApiJavaCodeGenerator.java b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/ExternalApiJavaCodeGenerator.java index 6c577cb..7a6952f 100644 --- a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/ExternalApiJavaCodeGenerator.java +++ b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/ExternalApiJavaCodeGenerator.java @@ -20,7 +20,7 @@ import java.text.MessageFormat; import java.util.Objects; import org.openatom.ubml.common.spring.SpringUtils; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.generator.ExternalApiCompileUtils; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import org.openatom.ubml.model.externalapi.definition.temp.lcm.FileService; diff --git a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiCustomizedMetadataService.java b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiCustomizedMetadataService.java index 1ff536b..8528e4d 100644 --- a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiCustomizedMetadataService.java +++ b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiCustomizedMetadataService.java @@ -15,7 +15,7 @@ */ package org.opeantom.ubml.externalapi.runtime.api; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; /** * 运行时元数据服务接口 diff --git a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiMetadataService.java b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiMetadataService.java index 6df9643..f2a980e 100644 --- a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiMetadataService.java +++ b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiMetadataService.java @@ -15,7 +15,7 @@ */ package org.opeantom.ubml.externalapi.runtime.api; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import org.openatom.ubml.model.externalapi.definition.temp.vo.DimensionInfo; diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/constraint/ExternalApiRTRefConstraint.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/constraint/ExternalApiRTRefConstraint.java index 4bf617f..2f45b81 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/constraint/ExternalApiRTRefConstraint.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/constraint/ExternalApiRTRefConstraint.java @@ -19,8 +19,8 @@ import java.util.ArrayList; import java.util.List; import org.openatom.ubml.common.spring.SpringUtils; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.MetadataReference; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataReference; import org.openatom.ubml.model.externalapi.definition.Constants; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import org.openatom.ubml.model.externalapi.definition.temp.lcm.CustomizationService; diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/entity/CustomizeUnitGetter.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/entity/CustomizeUnitGetter.java index e78f74e..290eeb5 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/entity/CustomizeUnitGetter.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/entity/CustomizeUnitGetter.java @@ -22,7 +22,7 @@ import org.openatom.ubml.common.spring.SpringUtils; import org.openatom.ubml.externalapi.runtime.core.jit.compile.JavaSourceCode; import org.openatom.ubml.externalapi.runtime.core.service.ExternalApiJavaCodeHandler; import org.openatom.ubml.externalapi.runtime.core.service.JavaCodeInfo; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.temp.lcm.CustomizationRtService; import org.openatom.ubml.model.externalapi.definition.util.MetadataUtil; diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMdPkgChangedEventListener.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMdPkgChangedEventListener.java index 3b9824e..9ec8b4f 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMdPkgChangedEventListener.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMdPkgChangedEventListener.java @@ -28,7 +28,7 @@ import org.openatom.ubml.externalapi.runtime.core.customize.deploy.CustomizeDepl import org.openatom.ubml.externalapi.runtime.core.customize.entity.CustomizeUnit; import org.openatom.ubml.externalapi.runtime.core.customize.entity.CustomizeUnitGetter; import org.openatom.ubml.externalapi.runtime.core.customize.entity.CustomizeUnitUtil; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.temp.lcm.MdPkgChangedArgs; import org.openatom.ubml.model.externalapi.definition.temp.lcm.MdPkgChangedEventListener; import org.openatom.ubml.model.externalapi.definition.util.MetadataUtil; diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMetadataCacheExtServiceListener.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMetadataCacheExtServiceListener.java index 103198c..4b4b5bb 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMetadataCacheExtServiceListener.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMetadataCacheExtServiceListener.java @@ -18,7 +18,7 @@ package org.openatom.ubml.externalapi.runtime.core.customize.listener; import org.openatom.ubml.externalapi.runtime.core.customize.deploy.CustomizeDeploy; import org.openatom.ubml.externalapi.runtime.core.customize.entity.CustomizeUnit; import org.openatom.ubml.externalapi.runtime.core.customize.entity.CustomizeUnitGetter; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.temp.lcm.IMetadataCacheExtService; import org.openatom.ubml.model.externalapi.definition.util.MetadataUtil; import org.slf4j.Logger; diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/JsonSerializer.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/JsonSerializer.java index 1bf3d4f..cc78f7b 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/JsonSerializer.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/JsonSerializer.java @@ -18,7 +18,7 @@ package org.openatom.ubml.externalapi.runtime.core.serializer; import com.fasterxml.jackson.databind.JsonNode; import java.util.Objects; import org.openatom.ubml.common.util.JacksonJsonUtil; -import org.openatom.ubml.model.common.definition.entity.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import com.inspur.edp.lcm.metadata.spi.MetadataContentSerializer; diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/TransferSerializer.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/TransferSerializer.java index 38425d3..dc18ae5 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/TransferSerializer.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/TransferSerializer.java @@ -17,7 +17,7 @@ package org.openatom.ubml.externalapi.runtime.core.serializer; import org.openatom.ubml.common.util.JacksonJsonUtil; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import com.inspur.edp.lcm.metadata.spi.MetadataTransferSerializer; diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiCustomizedMetadataService.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiCustomizedMetadataService.java index 889e800..d4c251d 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiCustomizedMetadataService.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiCustomizedMetadataService.java @@ -24,8 +24,8 @@ import org.opeantom.ubml.externalapi.runtime.api.ExternalApiCustomizedMetadataSe import org.openatom.ubml.common.spring.SpringUtils; import org.openatom.ubml.common.util.JacksonJsonUtil; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.MetadataHeader; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; import org.openatom.ubml.model.externalapi.definition.Constants; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import org.openatom.ubml.model.externalapi.definition.entity.Model; diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiMetadataService.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiMetadataService.java index c96165e..c8652e9 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiMetadataService.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiMetadataService.java @@ -24,8 +24,8 @@ import org.opeantom.ubml.externalapi.runtime.api.ExternalApiMetadataService; import org.openatom.ubml.common.spring.SpringUtils; import org.openatom.ubml.common.util.JacksonJsonUtil; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.MetadataHeader; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; import org.openatom.ubml.model.externalapi.definition.Constants; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import org.openatom.ubml.model.externalapi.definition.entity.Model; diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/ExternalApiJavaCodeHandler.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/ExternalApiJavaCodeHandler.java index 886532d..e2d3c44 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/ExternalApiJavaCodeHandler.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/ExternalApiJavaCodeHandler.java @@ -17,7 +17,7 @@ package org.openatom.ubml.externalapi.runtime.core.service; import java.text.MessageFormat; import org.openatom.ubml.common.spring.SpringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.generator.ExternalApiRtCodeGenerator; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import org.openatom.ubml.model.externalapi.definition.temp.lcm.CustomizationRtService; diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResource.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResource.java index 3f27556..af05832 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResource.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResource.java @@ -15,8 +15,6 @@ */ package com.inspur.edp.lcm.metadata.api.entity; -import org.openatom.ubml.model.common.definition.entity.I18nResourceItemCollection; - public class I18nResource { /** diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4Ref.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4Ref.java index 6801ff1..c59a68a 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4Ref.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4Ref.java @@ -15,8 +15,6 @@ */ package com.inspur.edp.lcm.metadata.api.entity; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; - /** * @Classname Metadata4Ref * @Description 元数据及包的实体 diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataDto.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataDto.java index 4339675..abe3b47 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataDto.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataDto.java @@ -15,8 +15,6 @@ */ package com.inspur.edp.lcm.metadata.api.entity; -import org.openatom.ubml.model.common.definition.entity.MetadataProperties; - /** * Classname MetadataDto Description 通过WebApi调用时前端往后端传递元数据信息所用实体 Date 2019/11/14 19:54 * diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackage.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackage.java index c750726..10cc69c 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackage.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackage.java @@ -16,7 +16,6 @@ package com.inspur.edp.lcm.metadata.api.entity; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; /** * @Classname MetadataPackage diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/RefCommonService.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/RefCommonService.java index 7a287e3..1a28f35 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/RefCommonService.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/RefCommonService.java @@ -15,7 +15,7 @@ */ package com.inspur.edp.lcm.metadata.api.service; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; /** * 获取依赖元数据 diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/IMetadataReferenceManager.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/IMetadataReferenceManager.java index af4c35a..3b1aba2 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/IMetadataReferenceManager.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/IMetadataReferenceManager.java @@ -16,8 +16,8 @@ package com.inspur.edp.lcm.metadata.spi; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.MetadataReference; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataReference; public interface IMetadataReferenceManager { List getConstraint(GspMetadata metadata); diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataContentManager.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataContentManager.java index c919477..8963c7e 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataContentManager.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataContentManager.java @@ -15,7 +15,7 @@ */ package com.inspur.edp.lcm.metadata.spi; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; public interface MetadataContentManager { /** diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataContentSerializer.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataContentSerializer.java index ea3c164..7c778aa 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataContentSerializer.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataContentSerializer.java @@ -16,7 +16,7 @@ package com.inspur.edp.lcm.metadata.spi; import com.fasterxml.jackson.databind.JsonNode; -import org.openatom.ubml.model.common.definition.entity.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; public interface MetadataContentSerializer { diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataTransferSerializer.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataTransferSerializer.java index 8033a2b..4e1037e 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataTransferSerializer.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataTransferSerializer.java @@ -15,7 +15,7 @@ */ package com.inspur.edp.lcm.metadata.spi; -import org.openatom.ubml.model.common.definition.entity.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; /** * Classname MetadataTransferSerializer Description 元数据调用的序列化器,转换成各元数据实体 Date 2019/11/18 8:50 diff --git a/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataService.java b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataService.java index a4f9ef6..c8e74e4 100644 --- a/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataService.java +++ b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataService.java @@ -16,9 +16,9 @@ package com.inspur.edp.lcm.metadata.api.service; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.IMdExtRuleContent; -import org.openatom.ubml.model.common.definition.entity.MetadataHeader; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.IMdExtRuleContent; +import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; import com.inspur.edp.lcm.metadata.api.entity.GspProject; import com.inspur.edp.lcm.metadata.api.entity.Metadata4Ref; import com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto; diff --git a/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/JitContext.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/JitContext.java index 8d97580..3687bd3 100644 --- a/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/JitContext.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/JitContext.java @@ -18,7 +18,7 @@ package com.inspur.edp.jittojava.context; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import com.inspur.edp.lcm.metadata.api.service.RefCommonService; import com.inspur.edp.lcm.metadata.api.entity.GspProject; import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; diff --git a/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/RefCommonServiceImp.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/RefCommonServiceImp.java index 46e73fc..bef24d0 100644 --- a/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/RefCommonServiceImp.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/RefCommonServiceImp.java @@ -15,7 +15,7 @@ */ package com.inspur.edp.jittojava.context.temp; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import com.inspur.edp.lcm.metadata.api.service.RefCommonService; /** diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModel.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModel.java index 1699308..2eb0228 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModel.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModel.java @@ -22,7 +22,7 @@ import java.util.HashMap; import java.util.function.Predicate; import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonObject; import org.openatom.ubml.model.common.definition.commonmodel.entity.GspCommonModel; -import org.openatom.ubml.model.common.definition.entity.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; import org.openatom.ubml.model.vo.definition.collection.VMActionCollection; import org.openatom.ubml.model.vo.definition.collection.ValueHelpConfigCollection; import org.openatom.ubml.model.vo.definition.common.TemplateVoInfo; -- Gitee From 5bddd238f8cca48b82908f242c80004858606b00 Mon Sep 17 00:00:00 2001 From: Q-Lee Date: Mon, 26 Apr 2021 15:36:37 +0800 Subject: [PATCH 46/61] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=BF=81=E5=85=A5?= =?UTF-8?q?=EF=BC=9A=E5=B0=86=E8=AE=BE=E8=AE=A1=E6=97=B6devtime-api?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=85=B7=E4=BD=93=E5=AE=9E=E7=8E=B0=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=BF=81=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lcm/metadata/api/entity/GspMetadata.java | 8 + model/framework/common/pom.xml | 43 +- .../api/ConfigData/CommonConfigData.java | 8 +- .../inspur/edp/lcm/metadata/common/Edge.java | 88 ++ .../lcm/metadata/common/FileServiceImp.java | 773 ++++++++++ .../inspur/edp/lcm/metadata/common/Graph.java | 280 ++++ .../edp/lcm/metadata/common/MavenUtils.java | 26 + .../metadata/common/MetadataDtoConverter.java | 210 +++ .../common/MetadataPeopertyUtils.java | 29 + .../metadata/common/MetadataSerializer.java | 165 ++ .../inspur/edp/lcm/metadata/common/Utils.java | 411 +++++ .../edp/lcm/metadata/common/Vertex.java | 272 ++++ .../inspur/edp/lcm/metadata/common/Which.java | 57 + .../configuration/ContentManagerHelper.java | 52 + .../GspProjectConfigurationHelper.java | 43 + .../GspProjectConfigurationLoader.java | 80 + .../configuration/GspProjectExtendHelper.java | 67 + .../configuration/I18nManagerHelper.java | 52 + .../configuration/MavenSettingsLoader.java | 57 + .../MavenSourceRuleConfigLoader.java | 59 + .../configuration/MavenSourceRuleHelper.java | 44 + .../MdExtRuleSerializerHelper.java | 49 + .../configuration/MenuConfigHelper.java | 41 + .../configuration/MenuConfigLoader.java | 57 + .../MetadataConfigurationHelper.java | 37 + .../MetadataConfigurationLoader.java | 85 + .../MetadataSerializerHelper.java | 67 + .../configuration/MetadataServiceHelper.java | 131 ++ .../MetadataTypeConfigLoader.java | 63 + .../configuration/MetadataTypeHelper.java | 50 + .../ProjectCreateManagerHelper.java | 62 + .../RefStrategyConfigLoader.java | 51 + .../configuration/RefStrategyHelper.java | 34 + .../configuration/ReferenceManagerHelper.java | 58 + .../TransferSerializerHelper.java | 69 + .../common/configuration/WorkspaceHelper.java | 54 + .../lcm/metadata/devcommon/ManagerUtils.java | 122 ++ .../api/context/RefCommonContext.java | 28 + .../lcm/metadata/api/entity/bo/BOInfo.java | 133 ++ .../metadata/api/service/MdpkgService.java | 161 ++ .../api/service/MetadataProjectService.java | 14 +- .../metadata/api/service/MetadataService.java | 14 +- model/framework/devtime-core/pom.xml | 40 +- .../metadata/cache/MetadataCacheManager.java | 241 +++ .../cache/MetadataDevCacheManager.java | 95 ++ .../cache/MetadataDistCacheManager.java | 98 ++ .../metadata/cache/MetadataRtDistCache.java | 98 ++ .../lcm/metadata/cache/RtCacheHandler.java | 59 + .../metadata/core/GspProjectCoreService.java | 58 + .../metadata/core/GspProjectServiceImp.java | 52 + .../lcm/metadata/core/I18nCoreService.java | 215 +++ .../edp/lcm/metadata/core/MavenUtilsCore.java | 158 ++ .../metadata/core/MetadataCoreManager.java | 1330 ++++++++++++++++ .../core/MetadataIndexCacheService.java | 346 +++++ .../core/MetadataProjectCoreService.java | 776 ++++++++++ .../core/MetadataProjectServiceImp.java | 253 +++ .../lcm/metadata/core/MetadataServiceImp.java | 340 ++++ .../lcm/metadata/core/PackageCoreService.java | 1361 +++++++++++++++++ .../metadata/core/RefCommonCoreService.java | 97 ++ .../metadata/core/RefCommonServiceImp.java | 47 + .../metadata/core/RestTemplateService.java | 86 ++ .../metadata/core/entity/MdprojInfoDto.java | 39 + .../metadata/core/entity/PackageType.java} | 14 +- .../metadata/core/event/DirEventBroker.java | 43 + .../core/event/DirEventListenerImpl.java | 72 + .../metadata/core/event/DirEventManager.java | 70 + .../core/event/MetadataCreateEventBroker.java | 43 + .../MetadataCreateEventListenerImpl.java | 32 + .../event/MetadataCreateEventManager.java | 70 + .../core/event/MetadataEventBroker.java | 69 + .../core/event/MetadataEventListenerImpl.java | 60 + .../core/event/MetadataEventManager.java | 84 + .../metadata/core/exception/MvnException.java | 25 + .../core/exception/MvnExceptionEnum.java | 20 + .../core/exception/MvnExceptionHandler.java | 118 ++ .../core/exception/MvnExceptionKeyword.java | 40 + .../core/exception/MvnExceptionSolution.java | 36 + .../index/MetadataPackageIndexService.java | 258 ++++ .../MetadataPackageIndexServiceForMaven.java | 47 + ...etadataPackageIndexServiceForPackages.java | 46 + .../index/ProjectMetadataCacheService.java | 354 +++++ .../core/manager/IndexServerManager.java | 65 + .../core/manager/MavenCommandGenerator.java | 83 + .../manager/MavenDeploymentForJarManager.java | 95 ++ .../MavenDeploymentForMdpkgManager.java | 230 +++ .../core/manager/MavenDeploymentManager.java | 50 + .../core/manager/PackageNameManager.java | 79 + .../lcm/metadata/core/manager/PomManager.java | 64 + .../metadata/core/manager/VersionManager.java | 77 + .../persistence/MavenSettingsRepository.java | 66 + .../MetadataProjectRepository.java | 264 ++++ .../core/persistence/MetadataRepository.java | 111 ++ .../core/persistence/PomRepository.java | 156 ++ .../core/persistence/RepositoryFactory.java | 68 + .../core/refi18n/IRefI18nFilter.java} | 17 +- .../core/refi18n/RefI18nMetadataFactory.java | 26 + .../core/refi18n/RefLocationFilter.java | 134 ++ .../core/refi18n/SelfProjectFilter.java | 56 + .../core/sync/CopyToPackagesRunnable.java | 52 + .../core/sync/InstallJarRunnable.java | 111 ++ .../core/sync/InstallSingleJarRunnable.java | 45 + .../common/JitCompilerConfigLoader.java | 4 +- model/framework/runtime-spi/pom.xml | 14 + .../lcm/metadata/spi/event/DirEventArgs.java | 30 + .../metadata/spi/event/DirEventListener.java | 34 + .../metadata/spi/event/MdPkgChangedArgs.java | 27 + .../spi/event/MdPkgChangedEventListener.java | 38 + .../event/MetadataCreateEventListener.java | 34 + .../metadata/spi/event/MetadataEventArgs.java | 40 + .../spi/event/MetadataEventListener.java | 48 + .../extendinfo/entity/GspVoExtendInfo.java | 2 - 111 files changed, 13571 insertions(+), 43 deletions(-) create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Edge.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/FileServiceImp.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Graph.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MavenUtils.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataDtoConverter.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataPeopertyUtils.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataSerializer.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Utils.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Vertex.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Which.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/ContentManagerHelper.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectConfigurationHelper.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectConfigurationLoader.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectExtendHelper.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/I18nManagerHelper.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSettingsLoader.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSourceRuleConfigLoader.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSourceRuleHelper.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MdExtRuleSerializerHelper.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MenuConfigHelper.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MenuConfigLoader.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationHelper.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationLoader.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataSerializerHelper.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataServiceHelper.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataTypeConfigLoader.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataTypeHelper.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/ProjectCreateManagerHelper.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/RefStrategyConfigLoader.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/RefStrategyHelper.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/ReferenceManagerHelper.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/TransferSerializerHelper.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/WorkspaceHelper.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/devcommon/ManagerUtils.java create mode 100644 model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/context/RefCommonContext.java create mode 100644 model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/entity/bo/BOInfo.java create mode 100644 model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MdpkgService.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataCacheManager.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDevCacheManager.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDistCacheManager.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataRtDistCache.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/RtCacheHandler.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/GspProjectCoreService.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/GspProjectServiceImp.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/I18nCoreService.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MavenUtilsCore.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataIndexCacheService.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectCoreService.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectServiceImp.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataServiceImp.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageCoreService.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RefCommonCoreService.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RefCommonServiceImp.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RestTemplateService.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/entity/MdprojInfoDto.java rename model/framework/{generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/EnvironmentUtil.java => devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/entity/PackageType.java} (74%) create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/DirEventBroker.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/DirEventListenerImpl.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/DirEventManager.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventBroker.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventListenerImpl.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventManager.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataEventBroker.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataEventListenerImpl.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataEventManager.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnException.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionEnum.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionHandler.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionKeyword.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionSolution.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexService.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexServiceForMaven.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexServiceForPackages.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/ProjectMetadataCacheService.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/IndexServerManager.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenCommandGenerator.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForJarManager.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForMdpkgManager.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentManager.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/PackageNameManager.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/PomManager.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/VersionManager.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MavenSettingsRepository.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataProjectRepository.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataRepository.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/PomRepository.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/RepositoryFactory.java rename model/framework/{generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/RefCommonServiceImp.java => devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/IRefI18nFilter.java} (66%) create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/RefI18nMetadataFactory.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/RefLocationFilter.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/SelfProjectFilter.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/CopyToPackagesRunnable.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/InstallJarRunnable.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/InstallSingleJarRunnable.java create mode 100644 model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/DirEventArgs.java create mode 100644 model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/DirEventListener.java create mode 100644 model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MdPkgChangedArgs.java create mode 100644 model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MdPkgChangedEventListener.java create mode 100644 model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MetadataCreateEventListener.java create mode 100644 model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MetadataEventArgs.java create mode 100644 model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MetadataEventListener.java diff --git a/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/GspMetadata.java b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/GspMetadata.java index 0c470d3..5dff0e6 100644 --- a/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/GspMetadata.java +++ b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/GspMetadata.java @@ -150,6 +150,14 @@ public class GspMetadata { this.properties = properties; } + public String getPreviousVersion() { + return previousVersion; + } + + public String getVersion() { + return version; + } + @Override public Object clone() { GspMetadata metadata = new GspMetadata(); diff --git a/model/framework/common/pom.xml b/model/framework/common/pom.xml index 9412f6e..9b9df9a 100644 --- a/model/framework/common/pom.xml +++ b/model/framework/common/pom.xml @@ -12,6 +12,12 @@ ubml-model-framework-common ${project.version} ubml-model-framework-common + + + 8 + 8 + + org.openatom.ubml @@ -19,11 +25,38 @@ 0.9.0-SNAPSHOT compile + + org.apache.maven + maven-model + 3.6.1 + compile + + + io.iec.edp + caf-boot-commons-environment + 0.3.7-SNAPSHOT + + + com.inspur.edp + lcm-metadata-spi + 0.1.25 + compile + + + org.apache.maven + maven-settings + 3.6.1 + + + io.iec.edp + caf-boot-commons-layeringcache + 0.3.2 + + + com.inspur.edp + workspace-api + 0.1.1 + - - 8 - 8 - - \ No newline at end of file diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/CommonConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/CommonConfigData.java index 0117c83..460470a 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/CommonConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/CommonConfigData.java @@ -22,8 +22,8 @@ package com.inspur.edp.lcm.metadata.api.ConfigData; * @Created by zhongchq * @Version 1.0 */ -public class CommonConfigData { +public class CommonConfigData { private String type; private String assembly; private String typeCode; @@ -62,12 +62,12 @@ public class CommonConfigData { this.typeName = typeName; } - public boolean isCreatingResourceMetadata() { + public boolean getIsCreatingResourceMetadata() { return isCreatingResourceMetadata; } - public void setCreatingResourceMetadata(boolean creatingResourceMetadata) { - isCreatingResourceMetadata = creatingResourceMetadata; + public void setIsCreatingResourceMetadata(boolean isCreatingResourceMetadata) { + this.isCreatingResourceMetadata = isCreatingResourceMetadata; } } diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Edge.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Edge.java new file mode 100644 index 0000000..9260e88 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Edge.java @@ -0,0 +1,88 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common; + +/** + * 连接两个顶点的边 + * + * @author xusy + */ +public class Edge { + + /** + * beginVertex是边的起始顶点
普通情况是不用显示地存储beginVertex,但是生成最小生成树时需要 + */ + private Vertex beginVertex; + + /** + * 由于Edge是存储在Vertex中的,所以包含这个边的vertex是开始点 endVertex是结束点 + */ + private Vertex endVertex; + + /** + * 边的权值 + */ + private double weight; + + /** + * 创建边 + * + * @param beginVertex 边的开始点 + * @param endVertex 边的结束点 + * @param weight 边的权值 + */ + public Edge(Vertex beginVertex, Vertex endVertex, double weight) { + this.beginVertex = beginVertex; + this.endVertex = endVertex; + this.weight = weight; + } + + /** + * 返回边的开始点 + * + * @return + */ + public Vertex getBeginVertex() { + return beginVertex; + } + + /** + * 返回边的结束点 + * + * @return + */ + public Vertex getEndVertex() { + return endVertex; + } + + /** + * 返回边的权值 + * + * @return + */ + public double getWeight() { + return weight; + } + + /** + * 设置边的权值 + * + * @param weight + */ + public void setWeight(double weight) { + this.weight = weight; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/FileServiceImp.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/FileServiceImp.java new file mode 100644 index 0000000..2063e00 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/FileServiceImp.java @@ -0,0 +1,773 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common; + +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.common.configuration.WorkspaceHelper; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Enumeration; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipException; +import java.util.zip.ZipFile; + +import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; + +/** + * @author zhaoleitr + */ +public class FileServiceImp implements FileService { + + /** + * 文件删除操作 + * + * @param fullPath 文件路径 + */ + @Override + public void fileDelete(String fullPath) throws IOException { + File file = new File(fullPath); + if (!file.isFile()) { + final String message = + "This is not a file " + fullPath + "."; + throw new IOException(message); + } + file.delete(); + } + + /** + * 文件更新操作 + * + * @param fullPath 文件路径 + * @param content 文件内容 + */ + @Override + public void fileUpdate(String fullPath, String content) { + try { + byte[] buffer = content.getBytes(StandardCharsets.UTF_8); + FileOutputStream fos = new FileOutputStream(fullPath, true); + fos.write(buffer); + fos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @Override + public void fileUpdate(String fullPath, String content, boolean append) { + try { + byte[] buffer = content.getBytes(StandardCharsets.UTF_8); + FileOutputStream fos = new FileOutputStream(fullPath, append); + fos.write(buffer); + fos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * 判断文件是否存在 + * + * @param fullPath 文件路径 + * @return 文件存在返回true,不存在返回false + */ + @Override + public boolean isFileExist(String fullPath) { + File file = new File(fullPath); + return file.isFile(); + } + + /** + * 文件重命名操作 + * + * @param oldFileName 旧文件名 + * @param newFileName 新文件名 + */ + @Override + public void fileRename(String oldFileName, String newFileName) throws IOException { + File oldfile = new File(oldFileName); + if (oldfile.isFile()) { + if (newFileName == null || newFileName.length() <= 0) { + return; + } + if (!(oldfile.renameTo(new File(newFileName)))) { + final String message = + "Can not rename file " + "old name: " + oldFileName + " new name: " + newFileName + "."; + throw new IOException(message); + } + } + } + + /** + * 读取文件内容,返回文件内容的字符串。 + * + * @param path 文件路径 + * @return 文件内容字符串 + */ + @Override + public String fileRead(String path) { + String encoding = "UTF-8"; + File file = new File(path); + long fileLength = file.length(); + String fileContents = null; + try { + byte[] filecontent = new byte[(int) fileLength]; + FileInputStream in = new FileInputStream(file); + in.read(filecontent); + in.close(); + + //判断有没有utf-8 bom头。有则去除。 + fileContents = new String(filecontent, encoding); + if (fileContents.startsWith("\ufeff")) { + + fileContents = fileContents.substring(1); + + } + } catch (UnsupportedEncodingException e) { + System.err.println("The OS does not support " + encoding); + e.printStackTrace(); + return null; + } catch (IOException e) { + e.printStackTrace(); + } + return fileContents; + } + + /** + * @param sourcePath 原路径 + * @param destinationPath 目标路径 + */ + @Override + public void fileCopy(String sourcePath, String destinationPath) throws IOException { + if (sourcePath != null && destinationPath != null) { + Files.copy(Paths.get(sourcePath), Paths.get(destinationPath), REPLACE_EXISTING); + } + } + + /** + * @param path 文件夹路径 + * @return 文件夹存在,返回true,否则返回false + */ + @Override + public boolean isDirectoryExist(String path) { + return (new File(path)).isDirectory(); + } + + /** + * 获取所有目录 + * + * @param path 文件夹路径 + * @return 文件夹下所有文件目录 + */ + @Override + public List getDirectorys(String path) { + //初始化制定路径 + File file = new File(path); + List fileList = new ArrayList<>(); + if (file.isDirectory()) { + File[] files = file.listFiles(); + for (File value : files) { + if (value.isDirectory()) { + fileList.add(value); + } + } + } + return fileList; + } + + /** + * 返回某一文件夹下的所有文件,如果这个路径下没有文件,那么返回空list由调用者进行判断处理 + * + * @param path 文件夹路径 + * @return 文件夹下所有文件 + */ + @Override + public List getAllFiles(String path) { + List filesInFolder = new ArrayList<>(); + File file = new File(path); + // 如果这个路径下没有文件,那么返回空list由调用者进行判断处理 + File[] allfiles = file.listFiles(); + if (allfiles == null) { + return filesInFolder; + } + for (File f : allfiles) { + if (f.isFile()) { + filesInFolder.add(f); + } + } + + return filesInFolder; + } + + /** + * 创建文件夹 + * + * @param dirPath 文件夹路径 + */ + @Override + public void createDirectory(String dirPath) { + File file = new File(dirPath); + file.mkdirs(); + } + + /** + * 删除某文件夹下的所有文件以及文件夹 1.是文件:则删除 2.是目录:则“自动”递归删除指定目录下的所有文件和文件夹 + * + * @param dirPath 文件或文件夹路径 + */ + @Override + public void deleteAllFilesUnderDirectory(String dirPath) throws IOException { + File file = new File(dirPath); + forceDelete(file); + } + + private static void forceDelete(final File file) throws IOException { + if (file.isDirectory()) { + deleteDirectory(file); + } else { + final boolean filePresent = file.exists(); + if (!file.delete()) { + if (!filePresent) { + throw new FileNotFoundException("File does not exist: " + file); + } + final String message = + "Unable to delete file: " + file; + throw new IOException(message); + } + } + } + + private static boolean isSymlink(final File file) throws IOException { + Path path = file.toPath().toRealPath(); + boolean flag = !path.equals(file.toPath().toAbsolutePath()); + return flag; + } + + /** + * Deletes a directory recursively. + * + * @param directory 文件夹路径 + */ + private static void deleteDirectory(final File directory) throws IOException { + if (!directory.exists()) { + return; + } + if (isSymlink(directory)) { + directory.delete(); + return; + } + + cleanDirectory(directory); + + if (!directory.delete()) { + deleteByDos(directory.getAbsolutePath()); + } + + if (directory.exists()) { + final String message = + "Unable to delete directory " + directory + "."; + throw new IOException(message); + } + } + + public static void cleanDirectory(final File directory) throws IOException { + final File[] files = verifiedListFiles(directory); + + IOException exception = null; + for (final File file : files) { + try { + forceDelete(file); + } catch (final IOException ioe) { + exception = ioe; + } + } + + if (null != exception) { + throw exception; + } + } + + private static File[] verifiedListFiles(final File directory) throws IOException { + if (!directory.exists()) { + final String message = directory + " does not exist"; + throw new IllegalArgumentException(message); + } + + if (!directory.isDirectory()) { + final String message = directory + " is not a directory"; + throw new IllegalArgumentException(message); + } + + final File[] files = directory.listFiles(); + // null if security restricted + if (files == null) { + throw new IOException("Failed to list contents of " + directory); + } + return files; + } + + /** + * 整合路径 + * + * @param path1 path1 + * @param path2 path2 + * @return 整合后路径 + */ + @Override + public String getCombinePath(String path1, String path2) { + String path = Paths.get(path1).resolve(path2).toString(); + return handlePath(path); + } + + /** + * 获取后缀信息 + * + * @param path 文件路径 + * @return + */ + @Override + public String getExtension(String path) { + File file = new File(path); + return getExtension(file); + } + + /** + * 获取后缀信息 + * + * @param path 文件 + * @return 文件后缀 + */ + @Override + public String getExtension(File path) { + if (path.isDirectory()) { + final String message = path + " is a directory"; + throw new IllegalArgumentException(message); + } + String fileName = path.getName(); + int point = fileName.lastIndexOf("."); + int length = fileName.length(); + if (point == -1 || point == length - 1) { + return ""; + } else { + return fileName.substring(point, length); + } + } + + /** + * 获取无后缀的路径信息 + * + * @param path 文件路径 + * @return 无后缀的路径信息 + */ + @Override + public String getFileNameWithoutExtension(String path) { + path = handlePath(path); + File file = new File(path); + return getFileNameWithoutExtension(file); + } + + /** + * 获取无后缀的路径信息 + * + * @param path 路径信息 + * @return 无后缀的路径信息 + */ + @Override + public String getFileNameWithoutExtension(File path) { + if (path.isDirectory()) { + final String message = path + " is a directory"; + throw new IllegalArgumentException(message); + } + String fileName = path.getName(); + int point = fileName.lastIndexOf("."); + if (point == -1) { + return fileName; + } else { + return fileName.substring(0, point); + } + } + + @Override + public void createFile(String path, String filename) { + String filePath = path + File.separator + filename; + createFile(filePath); + } + + @Override + public void createFile(String filePath) { + File file = new File(filePath); + if (!file.exists()) { + try { + file.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + /** + * 文件名称 + * + * @param path 文件路径 + * @return 文件名称 + */ + @Override + public String getFileName(String path) { + return (new File(path)).getName(); + } + + /** + * 获取路径名 + * + * @param path 文件夹路径 + * @return 文件夹名 + */ + @Override + public String getDirectoryName(String path) { + return (new File(path)).getParent(); + } + + /** + * 获取目录分隔符 + * + * @return 目录分隔符 + */ + @Override + public char getDirectorySeparatorChar() { + return File.separatorChar; + } + + @Override + public String getDevRootPath() { + return WorkspaceHelper.getInstance().getDevRootPath(); + } + + @Override + public boolean deleteDirectory(String fullPath) throws IOException { + File file = new File(fullPath); + if (!file.isDirectory()) { + final String message = + "This is not a Directory " + fullPath + "."; + throw new IOException(message); + } + return file.delete(); + } + + @Override + public boolean renameDirectory(String fromDir, String toDir) throws IOException { + File from = new File(fromDir); + if ((!from.exists() || !from.isDirectory())) { + final String message = + "Directory does not exist: " + fromDir; + throw new IOException(message); + } + File to = new File(toDir); + return from.renameTo(to); + } + + @Override + public Path forceMoveDir(String fromDir, String toDir) throws IOException { + Path fromPath = Paths.get(fromDir); + Path toPath = Paths.get(toDir); + return Files.move(fromPath, toPath.resolve(fromPath.getFileName()), REPLACE_EXISTING); + } + + /** + * @param proPath 路径信息 + * @return 工程路径 + */ + @Override + public String getProjectPath(String proPath) { + if (!proPath.endsWith("java")) { + proPath = proPath + "/java"; + } + //java目录下进行判断。 + File file = new File(proPath); + if (file.isDirectory()) { + File[] files = file.listFiles(); + if (files.length == 0) { + return null; + } + //遍历java目录下目录 + for (File value : files) { + //对目录进行判断 + if (value.isDirectory()) { + File[] fileInPoject = value.listFiles(); + for (File file1 : fileInPoject) { + if (file1.isFile() && file1.toString().contains("pom.xml")) { + return file1.getParent().substring(file1.toString().indexOf("java")); + } + } + } + } + } + return null; + } + + @Override + public List getJarPath(String proPath) { + if (!proPath.endsWith("java")) { + proPath = proPath + "/java"; + } + Path path = Paths.get(proPath); + List filename = new ArrayList<>(); + try { + Files.walkFileTree(path + , new SimpleFileVisitor() { + // 访问文件时触发 + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + if (file.toString().endsWith(".jar")) { + String filepaths = file.toString(); + if (filepaths.contains("out") || filepaths.contains("target")) { + filename.add(handlePath(filepaths.substring(filepaths.indexOf("java")))); + } + return FileVisitResult.CONTINUE; + } + return FileVisitResult.CONTINUE; + } +// +// // 访问目录时触发 +// @Override +// public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { +// if (dir.endsWith("target")) { +// String targetpath = dir.getParent().toAbsolutePath().toString().su +// targetpath.substring("java"); +// list.add(targetpath); +// } +// System.out.println("正在访问:" + dir + " 目录"); +// return FileVisitResult.CONTINUE; +// } + }); + } catch (IOException e) { + e.printStackTrace(); + } + Collections.sort(filename); + return filename; + } + + @Override + public String getApiModulePath(String proPath) { + if (!proPath.endsWith("java")) { + proPath = proPath + "/java"; + } + //java目录下进行判断。 + File file = new File(proPath); + if (file.isDirectory()) { + File[] files = file.listFiles(); + if (files.length == 0) { + return null; + } + //遍历java目录下目录 + for (File value : files) { + //对目录进行判断 + if (value.isDirectory()) { + File[] fileInPoject = value.listFiles(); + for (File file1 : fileInPoject) { + if (file1.isDirectory() && file1.toString().endsWith("api")) { + return handlePath(file1.toString()); + } + } + } + } + } + return null; + } + + public static String handlePath(String path) { + return path.replace("\\", "/"); + } + + // 将指定的zip文件解压到指定目录下,其中:zipName:文件名,targetDirName:需解压到的目录 + @Override + public void upzipFile(String zipName, String targetDirName) throws ZipException { + if (!targetDirName.endsWith(File.separator)) { + targetDirName += File.separator; + } + try { + // 根据zip文件创建ZipFile对象,此类的作用是从zip文件读取条目 + ZipFile zipFile = new ZipFile(targetDirName + "/" + zipName); + ZipEntry zn; + String entryName; + String targetFileName; + byte[] buffer = new byte[4096]; + int bytes_read; + Enumeration entrys = zipFile.entries(); // 获取ZIP文件里所有的文件条目的名字 + while (entrys.hasMoreElements()) { // 循环遍历所有的文件条目的名字 + zn = (ZipEntry) entrys.nextElement(); + entryName = zn.getName(); // 获得每一条文件的名字 + targetFileName = targetDirName + entryName; + if (zn.isDirectory()) { + new File(targetFileName).mkdirs(); // 如果zn是一个目录,则创建目录 + continue; + } else { + new File(targetFileName).getParentFile().mkdirs();// 如果zn是文件,则创建父目录 + } + File targetFile = new File(targetFileName); // 否则创建文件 +// System.out.println("正在创建文件:" + targetFile.getAbsolutePath()); + FileOutputStream os = new FileOutputStream(targetFile);// 打开文件输出流 + InputStream is = zipFile.getInputStream(zn); // 从ZipFile对象中打开entry的输入流 + while ((bytes_read = is.read(buffer)) != -1) { + os.write(buffer, 0, bytes_read); + } + os.close(); // 关闭流 + is.close(); + } +// System.out.println("解压缩"+zipName+"成功!"); + } catch (IOException err) { + throw new ZipException("解压缩" + zipName + "失败: " + err); + } + } + + @Override + public List getAllProjectsDirectories(String path, List projectsList, String proFlag) { + File[] files = (new File(path)).listFiles(); + if (files == null) { + return projectsList; + } + for (File file : files) { + if (file.isFile() && + file.getName().equals(proFlag)) { + projectsList.add(file.getParent()); + } + + if (file.isDirectory() && ( + !"node_modules".equals(file.getName()) || !"packages".equals(file.getName()) || !"maven".equals(file.getName()))) { + getAllProjectsDirectories(file.getAbsolutePath(), projectsList, proFlag); + } + } + + return projectsList; + } + + @Override + public void folderCopy(String sourcePath, String destinationPath) { + try { + (new File(destinationPath)).mkdirs(); + File souceFile = new File(sourcePath); + String[] file = souceFile.list(); + File temp; + for (String s : file) { + if (sourcePath.endsWith(File.separator)) { + temp = new File(sourcePath + s); + } else { + temp = new File(sourcePath + File.separator + s); + } + + if (temp.isFile()) { + FileInputStream input = new FileInputStream(temp); + + FileOutputStream output = new FileOutputStream(destinationPath + File.separator + temp.getName()); + byte[] b = new byte[5120]; + int len; + while ((len = input.read(b)) != -1) { + output.write(b, 0, len); + } + output.flush(); + output.close(); + input.close(); + updateLastModified(destinationPath + File.separator + temp.getName(), temp.lastModified()); + } + if (temp.isDirectory()) { + folderCopy(sourcePath + File.separator + s, destinationPath + File.separator + s); + } + } + + } catch (Exception e) { + throw new RuntimeException("复制目录出错!", e); + } + } + + private void updateLastModified(String filePath, long lastModified) { + new File(filePath).setLastModified(lastModified); + } + + public boolean startWith(String a, String b) { + if (a == null || b == null) { + return false; + } + a = Utils.handlePath(a).replace("//", "/"); + b = Utils.handlePath(b).replace("//", "/"); + if (a.indexOf(':') > -1 && b.indexOf(':') > -1) { + if (a.substring(0, 1).toLowerCase().equals(b.substring(0, 1).toLowerCase())) { + a = a.substring(a.indexOf(':') + 1); + b = b.substring(b.indexOf(':') + 1); + } else { + return false; + } + } else if (a.indexOf(':') > -1) { + a = a.substring(a.indexOf(':') + 1); + } else if (b.indexOf(':') > -1) { + b = b.substring(b.indexOf(':') + 1); + } + + return a.startsWith(b); + } + + public String getRelPath(String a, String b) { + a = Utils.handlePath(a).replace("//", "/"); + b = Utils.handlePath(b).replace("//", "/"); + ; + if (a.indexOf(':') > -1) { + a = a.substring(a.indexOf(':') + 1); + } + if (a.endsWith("/")) { + a = a.substring(0, a.length() - 1); + } + + if (b.indexOf(':') > -1) { + b = b.substring(b.indexOf(':') + 1); + } + if (b.endsWith("/")) { + b = b.substring(0, b.length() - 1); + } + return a.substring(b.length() + 1); + } + + private static void deleteByDos(String path) { + String osName = System.getProperty("os.name"); + if (osName.contains("Windows")) { + try { + String cmd = "cmd /c rd /s/q " + path; + Process p = Runtime.getRuntime().exec(cmd); + p.waitFor(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + public static String combinePath(String startPath, String... paths) { + Path combinedPath = Paths.get(startPath); + for (String path : paths) { + combinedPath = combinedPath.resolve(path); + } + return combinedPath.toString().replace("\\", "/"); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Graph.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Graph.java new file mode 100644 index 0000000..d8c74fa --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Graph.java @@ -0,0 +1,280 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common; + +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Stack; + +/** + * 邻接矩阵的图类 + * + * @param + * @author xusy + */ +public class Graph { + + /** + * 用来存储顶点 T做为标识,vertext作为实际的顶点 + */ + private Map> vertexMap; + + /** + * 图中边的数目
顶点的数目可以用vertexMap.size() + */ + private int edgeCount; + + /** + * 图是否为有向图
如果是有向图,则为true + */ + boolean isDirect; + + /** + * 图的构造函数 + * + * @param isDirect 图是否为有向图
如果是有向图,则为true + */ + public Graph(boolean isDirect) { + vertexMap = new LinkedHashMap<>(); + edgeCount = 0; + this.isDirect = isDirect; + } + + //下面与图的顶点相关 + + /** + * 返回图中的顶点个数 + * + * @return + */ + public int getVertexCount() { + return vertexMap.size(); + } + + /** + * 返回图的顶点的迭代器 + * + * @return + */ + public Iterator> getVertexIterator() { + return vertexMap.values().iterator(); + } + + /** + * 在图中插入节点,节点的标识为label,节点的权值为cost + * + * @param label + * @param cost 如果不需要节点的权值,则设0即可 + * @return 如果图中不存在该节点,则插入,返回true
如果图中已经存在该节点,则更新权值,返回false + */ + public boolean addVertex(T label, double cost) { + Vertex vertex = vertexMap.get(label); + if (vertex != null) { + //如果图中已经存在该节点,则更新权值,返回false + vertex.setCost(cost); + return false; + } + //如果图中不存在该节点,则插入,返回true + vertex = new Vertex(label, cost); + vertexMap.put(label, vertex); + return true; + } + + //下面与图的边相关 + + /** + * 返回图中所有的边的个数
如果为有向图,则是所有的有向边的个数
如果为无向图,则视一条边为两条相反的有向边,相当于返回无向边的个数*2 + * + * @return + */ + public int getEdgeCount() { + Iterator> iterator = getVertexIterator(); + int count = 0; + while (iterator.hasNext()) { + Vertex vertex = iterator.next(); + count = count + vertex.getEdgeCount(); + } + return count; + } + + /** + * 返回图中标识为label的顶点作为出发点的边的个数 + * + * @param label + * @return 如果为有向图,则返回标识为label的顶点作为出发点的边的个数 如果为无向图,则返回标识为label的顶点相连接的边的个数 如果图中没有这个顶点,返回-1 + */ + public int getEdgeCount(T label) { + Vertex vertex = vertexMap.get(label); + if (vertex == null) { + //如果图中没有这个顶点,返回-1 + return -1; + } + //返回途中标识为label的顶点作为出发点的边的个数 + return vertex.getEdgeCount(); + } + + /** + * 返回图中标识为label的顶点作为出发点的边的迭代器 + * + * @param label + * @return 如果没有这个顶点,返回null + */ + public Iterator getEdgeIterator(T label) { + Vertex vertex = vertexMap.get(label); + if (vertex == null) { + //如果图中没有这个顶点,返回null + return null; + } + return vertex.getEdgeIterator(); + } + + /** + * 在图中加入一条边,如果isDirect为true,则为有向图,则
建立一条以begin作为标识的节点开始的边,以end作为标识的节点结束,边的权值为weight
+ * 如果isDirect为false,则为无向图,则
建立两条边,一条以begin开始,到end ,一条以end开始,到begin + * + * @param begin + * @param end + * @param weight 如果不需要边的权值,可以设为0 + * @return 如果没有对应的边,则加入对应的边,返回true
如果有对应的边,则更新weight,返回false 如果没有以begin或者end标识的顶点,则直接返回false + */ + public boolean addEdge(T begin, T end, double weight) { + Vertex beginVertex = vertexMap.get(begin); + Vertex endVertex = vertexMap.get(end); + if (beginVertex == null || endVertex == null) { + //如果没有以begin或者end标识的顶点,则直接返回false + return false; + } + //有向图和无向图都要建立begin到end的边 + //如果顶点已经与endVertex连接,那么将会更新权值,result=false + //如果顶点没有与endVertex相连,则互相连接,result=true + boolean result = beginVertex.connect(endVertex, weight); + if (result) { + edgeCount++; + } + if (!isDirect) { + //如果不是有向图,则建立两条边,一条以end开始,到begin + endVertex.connect(beginVertex, weight); + if (result) { + edgeCount++; + } + } + return result; + } + + /** + * 在图中删除一条边,如果isDirect为true,则为有向图,则
删除一条以begin作为标识的节点开始的边,以end作为标识的节点结束
如果isDirect为false,则为无向图,则
+ * 删除两条边,一条以begin开始,到end ,一条以end开始,到begin + * + * @param begin + * @param end + * @return 如果有对应的边,则删除对应的边,返回true
如果没有有对应的边,则直接返回false 如果没有以begin或者end标识的顶点,则直接返回false + */ + public boolean removeEdge(T begin, T end) { + Vertex beginVertex = vertexMap.get(begin); + Vertex endVertex = vertexMap.get(end); + if (beginVertex == null || endVertex == null) { + //如果没有以begin或者end标识的顶点,则直接返回false + return false; + } + //有向图和无向图都要删除begin到end的边 + //如果顶点已经与endVertex连接,那么将会删除这条边,返回true + //如果顶点没有与endVertex连接,则啥都不做,返回false + boolean result = beginVertex.disconnect(endVertex); + if (result) { + edgeCount--; + } + if (!isDirect) { + //如果不是有向图,则删除两条边,一条以end开始,到begin + endVertex.disconnect(beginVertex); + if (result) { + edgeCount--; + } + } + return result; + } + + //下面与打印相关 + + /** + * 打印图的概况,所有顶点,所有边 + */ + public void printGraph() { + Iterator> iteratorVertex = getVertexIterator(); + Iterator iteratorEdge; + Vertex vertex; + Edge edge; + T label; + System.out.println("图是否为有向图:" + isDirect + ",图的顶点个数:" + getVertexCount() + ",图的总边个数:" + getEdgeCount()); + while (iteratorVertex.hasNext()) { + vertex = iteratorVertex.next(); + label = vertex.getLabel(); + iteratorEdge = vertex.getEdgeIterator(); + System.out.println("顶点:" + label + ",以这个顶点为出发点的边的个数:" + getEdgeCount(label) + ",该顶点的权值为:" + vertex.getCost()); + while (iteratorEdge.hasNext()) { + edge = iteratorEdge.next(); + System.out.print("边:从 " + label + " 到 " + edge.getEndVertex().getLabel() + " ,权值:" + edge.getWeight() + " "); + } + System.out.println(); + } + System.out.println(); + } + + //下面与拓扑排序相关 + + /** + * 返回一个出度为0(以该点出发的边数为0或者以该点出发的边的结束点都被访问过了),而且没有被访问过的顶点 + * + * @return 如果没有,则返回null + */ + public Vertex getNextTuopoVertex() { + Vertex vertex; + Iterator> iterator = getVertexIterator(); + while (iterator.hasNext()) { + vertex = iterator.next(); + if ((vertex.isVisited() == false) && (vertex.getUnvisitedVertex() == null)) { + //返回一个出度为0(以该点出发的边数为0或者以该点出发的边的结束点都被访问过了),而且没有被访问过的顶点 + return vertex; + } + } + //如果没有,则返回null + return null; + } + + /** + * 返回拓扑排序,返回的stack,第一个pop出的是第一个要做的顶点,最后一个是最后一个才能做的顶点 + * + * @return + */ + public Stack> getTopoSort() { +// clearVisitStatus(); + Stack> stack = new Stack<>(); + Vertex vertex; + while (true) { + vertex = getNextTuopoVertex(); + if (vertex == null) { + //如果得不到下一个出度为0的节点,直接返回stack + System.out.println("拓扑排序结束"); + return stack; + } + //顶点入栈并被访问,遍历完成后,出栈就可以获得图的一个拓扑序列 + stack.push(vertex); + vertex.visit(); + System.out.println("拓扑排序:入栈节点:" + vertex.getLabel()); + } + } + +} \ No newline at end of file diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MavenUtils.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MavenUtils.java new file mode 100644 index 0000000..54b43bc --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MavenUtils.java @@ -0,0 +1,26 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common; + +public class MavenUtils { + public static final String pomFile = "pom.xml"; + + public static final String tempFolder = "temp"; + + public static final String resourcesDir = "src/main/resources"; + + public static final String snapShot = "SNAPSHOT"; +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataDtoConverter.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataDtoConverter.java new file mode 100644 index 0000000..3afbc00 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataDtoConverter.java @@ -0,0 +1,210 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.inspur.edp.lcm.metadata.api.AbstractMetadataContent; +import com.inspur.edp.lcm.metadata.api.IMdExtRuleContent; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataReference; +import com.inspur.edp.lcm.metadata.common.configuration.MdExtRuleSerializerHelper; +import com.inspur.edp.lcm.metadata.common.configuration.MetadataSerializerHelper; +import com.inspur.edp.lcm.metadata.common.configuration.TransferSerializerHelper; +import com.inspur.edp.lcm.metadata.spi.MdExtendRuleSerializer; +import com.inspur.edp.lcm.metadata.spi.MetadataContentSerializer; +import com.inspur.edp.lcm.metadata.spi.MetadataTransferSerializer; +import java.io.IOException; +import java.util.ArrayList; +import org.springframework.util.ObjectUtils; + +/** + * Classname MetadataDtoConverter Description 元数据转换器 Date 2019/11/14 20:02 + * + * @author zhongchq + * @version 1.0 + */ +public class MetadataDtoConverter { + + public static MetadataDto asDto(GspMetadata metadata) { + if (metadata == null) { + return null; + } + MetadataDto metadataDto = new MetadataDto(); + metadataDto.setBizobjectID(metadata.getHeader().getBizObjectId()); + metadataDto.setType(metadata.getHeader().getType()); + metadataDto.setId(metadata.getHeader().getId()); + metadataDto.setCode(metadata.getHeader().getCode()); + metadataDto.setName(metadata.getHeader().getName()); + metadataDto.setNameSpace(metadata.getHeader().getNameSpace()); + metadataDto.setFileName(metadata.getHeader().getFileName()); + metadataDto.setLanguage(metadata.getHeader().getLanguage()); + metadataDto.setRelativePath(metadata.getRelativePath()); + //GspMetadata没有此属性 + metadataDto.setTranslating(metadata.getHeader().getTranslating()); + metadataDto.setExtendProperty(metadata.getExtendProperty()); + metadataDto.setExtendable(metadata.getHeader().isExtendable()); + metadataDto.setExtented(metadata.isExtended()); + metadataDto.setPreviousVersion(metadata.getPreviousVersion()); + metadataDto.setVersion(metadata.getVersion()); + String ref = ""; + ObjectMapper objectMapper = Utils.getMapper(); + if (metadata.getRefs() != null && metadata.getRefs().size() > 0) { + try { + metadataDto.setRefs(objectMapper.writeValueAsString(metadata.getRefs())); + + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + + } + if (metadata.getContent() != null) { + + String transferStr = null; + JsonNode jsonNode; + MetadataTransferSerializer transferSerializer = TransferSerializerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (!ObjectUtils.isEmpty(transferSerializer)) { + transferStr = transferSerializer.serialize(metadata.getContent()); + } else { + MetadataContentSerializer metadataContentSerializer = MetadataSerializerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (metadataContentSerializer == null) { + throw new RuntimeException("未能正常获取元数据传输序列化器,请检查配置。元数据为:" + metadata.getHeader().getCode()); + } + jsonNode = metadataContentSerializer.serialize(metadata.getContent()); + + try { + transferStr = objectMapper.writeValueAsString(jsonNode); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + } + + metadataDto.setContent(transferStr); + } + if (metadata.getExtendRule() != null) { + MdExtendRuleSerializer serializer = MdExtRuleSerializerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (serializer != null) { + JsonNode jsonNode = serializer.serialize(metadata.getExtendRule()); + + String transferStr = null; + try { + transferStr = objectMapper.writeValueAsString(jsonNode); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + metadataDto.setExtendRule(transferStr); + } + } + + asMetadata(null); + return metadataDto; + } + + public static GspMetadata asMetadata(MetadataDto metadataDto) { + if (metadataDto == null) { + return null; + } + GspMetadata metadata = new GspMetadata(); + metadata.setHeader(new MetadataHeader()); + metadata.getHeader().setId(metadataDto.getId()); + metadata.getHeader().setBizObjectId(metadataDto.getBizobjectID()); + metadata.getHeader().setNameSpace(metadataDto.getNameSpace()); + metadata.getHeader().setType(metadataDto.getType()); + metadata.getHeader().setFileName(metadataDto.getFileName()); + metadata.setRelativePath(metadataDto.getRelativePath()); + metadata.getHeader().setLanguage(metadataDto.getLanguage()); + metadata.getHeader().setTranslating(metadataDto.isTranslating); + metadata.setExtendProperty(metadataDto.getExtendProperty()); + metadata.getHeader().setExtendable(metadataDto.isExtendable()); + metadata.setExtended(metadataDto.isExtented()); + metadata.setPreviousVersion(metadataDto.getPreviousVersion()); + metadata.setVersion(metadataDto.getVersion()); + ObjectMapper objectMapper = Utils.getMapper(); + if (metadataDto.getRefs() != null && metadataDto.getRefs() != "") { + try { + metadata.setRefs(objectMapper.readValue(metadataDto.getRefs(), new TypeReference>() { + })); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } else { + metadata.setRefs(new ArrayList<>()); + } + + IMetadataContent content = null; + if (metadataDto.getContent() != null) { + MetadataTransferSerializer transferSerializer = TransferSerializerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (!ObjectUtils.isEmpty(transferSerializer)) { + content = transferSerializer.deserialize(metadataDto.getContent()); + } else { + //反序列化 + MetadataContentSerializer metadataContentSerializer = MetadataSerializerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (metadataContentSerializer == null) { + throw new RuntimeException("未能正常获取元数据传输序列化器,请检查配置"); + } + + JsonNode contentObj; + try { + contentObj = objectMapper.readTree(metadataDto.getContent()); + } catch (Exception e) { + throw new RuntimeException(e); + } + + content = metadataContentSerializer.deSerialize(contentObj); + } + + metadata.setContent(content); + } + if (metadataDto.getExtendRule() != null) { + MdExtendRuleSerializer serializer = MdExtRuleSerializerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (serializer != null) { + JsonNode contentObj; + try { + contentObj = objectMapper.readTree(metadataDto.getContent()); + } catch (Exception e) { + throw new RuntimeException(e); + } + + IMdExtRuleContent extRule = serializer.deSerialize(contentObj); + metadata.setExtendRule(extRule); + } + } + + AbstractMetadataContent abstractMetadataContent = null; + + try { + abstractMetadataContent = (AbstractMetadataContent) metadata.getContent(); + } catch (RuntimeException e) { + } + + if (abstractMetadataContent != null) { + metadata.getHeader().setCode(abstractMetadataContent.getCode() == null ? metadataDto.getCode() : abstractMetadataContent.getCode()); + metadata.getHeader().setName(abstractMetadataContent.getName() == null ? metadataDto.getName() : abstractMetadataContent.getName()); + } else { + metadata.getHeader().setCode(metadataDto.getCode()); + metadata.getHeader().setName(metadataDto.getName()); + } + + return metadata; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataPeopertyUtils.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataPeopertyUtils.java new file mode 100644 index 0000000..f0f64a6 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataPeopertyUtils.java @@ -0,0 +1,29 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common; + +public class MetadataPeopertyUtils { + public static String header = "Header"; + public static String content = "Content"; + public static String extendRule = "ExtendRule"; + public static String refs = "Refs"; + public static String extendProperty = "ExtendProperty"; + public static String properties = "Properties"; + public static String version = "Version"; + public static String previousVersion = "PreviousVersion"; + public static String relativePath = "RelativePath"; + public static String extended = "Extended"; +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataSerializer.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataSerializer.java new file mode 100644 index 0000000..b30d142 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataSerializer.java @@ -0,0 +1,165 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.inspur.edp.lcm.metadata.api.IMdExtRuleContent; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.common.configuration.MdExtRuleSerializerHelper; +import com.inspur.edp.lcm.metadata.common.configuration.MetadataSerializerHelper; +import com.inspur.edp.lcm.metadata.spi.MdExtendRuleSerializer; +import com.inspur.edp.lcm.metadata.spi.MetadataContentSerializer; +import io.iec.edp.caf.commons.layeringcache.serializer.RedisDataSerializer; +import java.io.IOException; + +public class MetadataSerializer implements RedisDataSerializer { + private ObjectMapper mapper = Utils.getMapper(); + + @Override + public T deserialize(String fileString, Class clazz) { + if (fileString == null || fileString.isEmpty()) { + return null; + } + try { + IMetadataContent metadataContent; + JsonNode metadataObj = mapper.readTree(fileString); + GspMetadata metadata = buildMetadataBaseInfo(metadataObj); + + //IMetdataContent需要调用各元数据反序列化 + MetadataContentSerializer manager = MetadataSerializerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (manager == null) { + throw new RuntimeException("未能正常获取元数据序列化器,请检查配置,元数据类型为:" + metadata.getHeader().getType()); + } else { + JsonNode content = metadataObj.findValue(MetadataPeopertyUtils.content); + String contentStr = handleJsonString(content.toString()); + JsonNode handledContent = mapper.readTree(contentStr); + metadataContent = manager.deSerialize(handledContent); + } + metadata.setContent(metadataContent); + JsonNode extRule = metadataObj.findValue(MetadataPeopertyUtils.extendRule); + if (extRule != null) { + MdExtendRuleSerializer mdExtRulemanager = MdExtRuleSerializerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (mdExtRulemanager != null) { + JsonNode handledContent = mapper.readTree(extRule.toString()); + IMdExtRuleContent extRuleContent = mdExtRulemanager.deSerialize(handledContent); + metadata.setExtendRule(extRuleContent); + } + } + + return (T) metadata; + } catch (RuntimeException | IOException e) { + e.printStackTrace(); + throw new RuntimeException("反序列化元数据失败", e); + } + } + + public GspMetadata buildMetadataBaseInfo(JsonNode metadataObj) { + GspMetadata metadata; + try { + String headerStr = metadataObj.findValue(MetadataPeopertyUtils.header).toString(); + JsonNode refNode = metadataObj.findValue(MetadataPeopertyUtils.refs); + String constraintsStr; + if (refNode == null) { + constraintsStr = "[]"; + } else { + constraintsStr = refNode.toString(); + } + + JsonNode extendPropertyNode = metadataObj.findValue(MetadataPeopertyUtils.extendProperty); + JsonNode extendedNode = metadataObj.findValue(MetadataPeopertyUtils.extended); + JsonNode properties = metadataObj.findValue(MetadataPeopertyUtils.properties); + JsonNode version = metadataObj.findValue(MetadataPeopertyUtils.version); + JsonNode previousVersion = metadataObj.findValue(MetadataPeopertyUtils.previousVersion); + JsonNode relativePath = metadataObj.findValue(MetadataPeopertyUtils.relativePath); + String extendPropertyStr = (extendPropertyNode == null) ? "\"\"" : extendPropertyNode.toString(); + String metadataStr = String.format("{\"%s\":%s,\"%s\":%s,\"%s\":null,\"%s\":%s,\"%s\":%s,\"%s\":%s,\"%s\":%s,\"%s\":%s,\"%s\":%s,\"%s\":null}", + MetadataPeopertyUtils.header, headerStr, MetadataPeopertyUtils.refs, constraintsStr, MetadataPeopertyUtils.content, MetadataPeopertyUtils.extendProperty, + extendPropertyStr, MetadataPeopertyUtils.extended, extendedNode, MetadataPeopertyUtils.properties, properties, MetadataPeopertyUtils.version, version, + MetadataPeopertyUtils.previousVersion, previousVersion, MetadataPeopertyUtils.relativePath, relativePath, MetadataPeopertyUtils.extendRule); + metadata = this.mapper.readValue(metadataStr, GspMetadata.class); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + + return metadata; + } + + public static ObjectMapper getMapper() { + ObjectMapper mapper = new ObjectMapper(); + mapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE); + mapper.configure(JsonGenerator.Feature.IGNORE_UNKNOWN, true); + mapper.configure(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN, true); + mapper.configure(JsonParser.Feature.ALLOW_MISSING_VALUES, true); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);//大小写脱敏 默认为false 需要改为tru + return mapper; + } + + private static String handleJsonString(String contentJson) { + if (contentJson.startsWith("\"{\\\"")) { + + contentJson = contentJson.replace("\\\"", "\""); + while (contentJson.startsWith("\"")) { + contentJson = contentJson.substring(1, contentJson.length() - 1); + } + } + return contentJson; + } + + @Override + public String serialize(Object o) { + GspMetadata metadata = (GspMetadata) o; + MetadataContentSerializer manager = MetadataSerializerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (manager == null) { + throw new RuntimeException("未能正常获取" + metadata.getHeader().getType() + "的序列化器,请检查配置"); + } + JsonNode jsonNode = manager.serialize(metadata.getContent()); + JsonNode extRuleNode = null; + if (metadata.getExtendRule() != null) { + MdExtendRuleSerializer mdExtRulemanager = MdExtRuleSerializerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (mdExtRulemanager != null) { + extRuleNode = mdExtRulemanager.serialize(metadata.getExtendRule()); + } + } + + ObjectMapper objectMapper = Utils.getMapper(); + GspMetadata newMetadata = (GspMetadata) metadata.clone(); + String metadataStr = null; + try { + metadataStr = objectMapper.writeValueAsString(newMetadata); + JsonNode metadataObj = objectMapper.readTree(metadataStr); + ObjectNode objNode = (ObjectNode) metadataObj; + objNode.set(MetadataPeopertyUtils.content, jsonNode); + objNode.set(MetadataPeopertyUtils.extendRule, extRuleNode); + metadataStr = objectMapper.writeValueAsString(objNode); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return metadataStr; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Utils.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Utils.java new file mode 100644 index 0000000..3932b5e --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Utils.java @@ -0,0 +1,411 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; +import com.inspur.edp.lcm.metadata.common.configuration.GspProjectExtendHelper; +import com.inspur.edp.lcm.metadata.common.configuration.MetadataTypeConfigLoader; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; +import org.codehaus.plexus.util.StringUtils; + +public class Utils { + private static final Lock lock = new ReentrantLock(); + //元数据工程后缀 + private static String metadataProjSuffix; + // pom后缀 + private static String pomSuffix; + // 元数据包version前缀 + private static String versionPrefix; + // 元数据包临时version后缀 + private static String versionSuffix; + //csproj工程后缀 + private static String csprojSuffix; + //GSP工程描述文件名称 + private static String gspProjectName; + //元数据包后缀 + private static String metadataPackageExtension; + //元数据包清单文件 + private static String manifestFileName; + //原始数据修改时间文件 + private static String sourceDataFileName; + // 强制更新依赖jar包标识文件 + private static String mavenUpdateFlagFileName; + + private static String metadataPath; + /** + * 获取maven工程名称。 + */ + private static String mavenProName; + /** + * edpParentVersion + */ + private static String edpParentVersion; + private static List metadataPostfixTypes; + + public Utils() { + } + + public static String getMetadataProjSuffix() { + return ".mdproj"; + } + + public static String getPomSuffix() { + return ".pom"; + } + + public static String getVersionPrefix() { + return "m"; + } + + public static String getVersionSuffix() { + return "-SNAPSHOT"; + } + + public static String getCsprojSuffix() { + return ".csproj"; + } + + public static String getGspProjectName() { + return "gspproject.json"; + } + + public static String getMetadataProjPath() { + return "metadata"; + } + + public static String getMetadataPackageExtension() { + return ".mdpkg"; + } + + public static String getManifestFileName() { + return "manifest.json"; + } + + public static String getSourceDataFileName() { + return "sourcedata.json"; + } + + public static String getMavenUpdateFlagFileName() { + return "mavenupdateflag.txt"; + } + + public static String getMetadataBinPath() { + return "bin"; + } + + public static String getApiSourceDir() { + return "java/code/api/src"; + } + + public static String getApiTargetDir() { + return "java/code/api/target"; + } + + public static String getCompModuleDir() { + return "java/code/comp"; + } + + public static String getRuntimeSourceDir() { + return "java/code/runtime/src"; + } + + public static String getSrcJavaPath() { + return "src/main/java"; + } + + public static String getResourcesPath() { + return "src/main/resources"; + } + + public static String getPomFile() { + return "pom.xml"; + } + + public static String getJavaProjectPath() { + return "java"; + } + + public static String getZipSuffix() { + return ".zip"; + } + + public static String getJarSuffix() { + return ".jar"; + } + + public static String getLanguageMetadataFileExtention() { + return ".lres"; + } + + public static String getPublishPath() { + return "publish"; + } + + public static String getJstackPath() { + return "jstack"; + } + + public static String getCodePath() { + return "code"; + } + + public static String getTargetPath() { + return "target"; + } + + public static String getLibsPath() { + return "libs"; + } + + // 获取启动jar对应的路径 + public static String getStartupPath() { + return EnvironmentUtil.getStartupPath(); + } + + // 获取安装盘的基路径 + public static String getBasePath() { + return EnvironmentUtil.getBasePath(); + } + + // 获取安装盘的基路径 + public static String getBasePath(boolean isDeployTool) { + String basePath; + if (isDeployTool) { + basePath = FileServiceImp.combinePath(EnvironmentUtil.getStartupPath(), "../../../../"); + } else { + basePath = EnvironmentUtil.getBasePath(); + } + return basePath; + } + + // 获取Server运行时路径,对应当前的jstack + public static String getServerRTPath() { + return EnvironmentUtil.getServerRTPath(); + } + + public static String getMavenProName() { + if (mavenProName == null || mavenProName.isEmpty()) { + return GspProjectExtendHelper.getInstance().getMavenProjectName(); + } + return null; + } + + public static String getEdpParentVersion() { + if (mavenProName == null || mavenProName.isEmpty()) { + return GspProjectExtendHelper.getInstance().getEdpParentVersion(); + } + return null; + } + + public static String handlePath(String path) { + return path.replace("\\", "/"); + } + + public static String handlePackageName(String packageName) { + String packageFullName; + if (!packageName.contains(getMetadataPackageExtension())) { + packageFullName = packageName + getMetadataPackageExtension(); + } else { + packageFullName = packageName; + } + + return packageFullName; + } + + public static ObjectMapper getMapper() { + ObjectMapper mapper = new ObjectMapper(); + mapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE); + mapper.configure(JsonGenerator.Feature.IGNORE_UNKNOWN, true); + mapper.configure(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN, true); + mapper.configure(JsonParser.Feature.ALLOW_MISSING_VALUES, true); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);//大小写脱敏 默认为false 需要改为tru + mapper.configure(SerializationFeature.INDENT_OUTPUT, true); + return mapper; + } + + public static List getMetadataPostfixTypes() { + if (metadataPostfixTypes != null && metadataPostfixTypes.size() > 0) { + return metadataPostfixTypes; + } + lock.lock(); + try { + if (metadataPostfixTypes != null && metadataPostfixTypes.size() > 0) { + return metadataPostfixTypes; + } + metadataPostfixTypes = new ArrayList<>(); + MetadataTypeConfigLoader loader = new MetadataTypeConfigLoader(); + List typeList = loader.loadMetadataConfigurations(); + typeList.forEach(type -> + { + metadataPostfixTypes.add(type.getPostfix()); + }); + return metadataPostfixTypes; + } catch (Exception e) { + e.printStackTrace(); + } finally { + lock.unlock(); + } + + return null; + } + + /** + * 将源文件/文件夹生成指定格式的压缩文件,格式zip + * + * @param resourcesPath 源文件/文件夹 + * @param targetPath 目的压缩文件保存路径 + * @param targetName 目的压缩文件名 + */ + public static void compress(String resourcesPath, String targetPath, String targetName) { + //源文件 + File resourcesFile = new File(resourcesPath); + //目的 + File targetFile = new File(targetPath); + //如果目的路径不存在,则新建 + if (!targetFile.exists()) { + targetFile.mkdirs(); + } + //目的压缩文件名 + targetName = targetName + ".mdpkg"; + try { + FileOutputStream outputStream = new FileOutputStream(FileServiceImp.combinePath(targetPath, targetName)); + ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(outputStream)); + + createCompressedFile(out, resourcesFile, ""); + + out.close(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * 生成压缩文件。如果是文件夹,则使用递归,进行文件遍历、压缩 如果是文件,直接压缩 + * + * @param out 输出流 + * @param file 目标文件 + * @param dir 文件路径 + */ + public static void createCompressedFile(ZipOutputStream out, File file, String dir) { + //如果当前的是文件夹,则进行进一步处理 + if (file.isDirectory()) { + //得到文件列表信息 + File[] files = file.listFiles(); + try { + //将文件夹添加到下一级打包目录 + out.putNextEntry(new ZipEntry(dir + "/")); + } catch (Exception e) { + throw new RuntimeException(e); + } + + dir = dir.length() == 0 ? "" : dir + "/"; + + //循环将文件夹中的文件打包 + for (int i = 0; i < files.length; i++) { + createCompressedFile(out, files[i], dir + files[i].getName()); //递归处理 + } + } else { //当前的是文件,打包处理 + try { + //文件输入流 + FileInputStream fis = new FileInputStream(file); + + out.putNextEntry(new ZipEntry(dir)); + //进行写操作 + int j = 0; + byte[] buffer = new byte[1024]; + while ((j = fis.read(buffer)) > 0) { + out.write(buffer, 0, j); + } + //关闭输入流 + fis.close(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + public static void writeValue(String mdPath, MetadataProject mdProj) { + try (FileOutputStream fileOutputStream = new FileOutputStream(mdPath)) { + ObjectMapper objectMapper = getMapper(); + objectMapper.enable(SerializationFeature.INDENT_OUTPUT); + objectMapper.writeValue(fileOutputStream, mdProj); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static boolean nameValidating(String name) { + if (StringUtils.isEmpty(name)) { + return false; + } else if (name.trim().length() > 255) { + return false; + } else { + return StringUtils.indexOfAny(name.trim(), getInValidCharacter()) == -1; + } + } + + public static String[] getInValidCharacter() { + return new String[] {"\\", "/", ":", "*", "?", "\"", "<", ">", "|", "&", "@", "\"", "‘", "’", "“", "”", "%", ";", ";"}; + } + + public static boolean isNullOrEmpty(String str) { + return str == null || str.isEmpty(); + } + + public static boolean isNullOrEmpty(List list) { + return list == null || list.size() == 0; + } + + public static void checkNPE(Object obj, String msg) { + if (obj == null) { + throw new RuntimeException(msg); + } + } + + public static void checkEmpty(String str, String msg) { + if (isNullOrEmpty(str)) { + throw new RuntimeException(msg); + } + } + + public static String getMetadataPath() { + return metadataPath; + } + + public static void setMetadataPath(String metadataPath) { + Utils.metadataPath = metadataPath; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Vertex.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Vertex.java new file mode 100644 index 0000000..aaacd01 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Vertex.java @@ -0,0 +1,272 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common; + +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +/** + * 邻接矩阵的顶点类 + * + * @param + * @author xusy + */ +public class Vertex { + + /** + * 能够标识这个定点的属性,可以用不同类型来标识顶点如String,Integer.... + */ + private T label; + + /** + * 这个定点对应的边
如果为有向图,则代表以这个定点为起点的边 + */ + private List edgeList; + + /** + * 表示这个顶点是否已被访问,在bfs和dfs中会被使用到 + */ + private boolean visited; + + /** + * 该顶点的前驱节点
在求图中某两个顶点之间的最短路径时,在从起始顶点遍历过程中,需要记录下遍历到某个顶点时的前驱顶点 + */ + private Vertex previousVertex; + + /** + * 这个定点的权值(注意不是边的权值) + */ + private double cost; + + /** + * 创建顶点 + * + * @param label 这个顶点的标识 + * @param cost 这个顶点的权值 + */ + public Vertex(T label, double cost) { + this.label = label; + //用链表存储边 + edgeList = new LinkedList<>(); + visited = false; + previousVertex = null; + this.cost = cost; + } + + //下面与顶点的标识相关 + + /** + * 返回顶点的标识 + * + * @return + */ + public T getLabel() { + return label; + } + + /** + * 根据顶点的标识确定是否是同一个顶点 + */ + @Override + public boolean equals(Object otherVertex) { + boolean result; + //如果otherVertex为空或者类不同,直接返回false + if (otherVertex == null || getClass() != otherVertex.getClass()) { + return false; + } + Vertex other = (Vertex) otherVertex; + //根据label确定是否是同一个顶点 + result = label.equals(other.getLabel()); + return result; + } + + //下面与顶点的边相关 + + /** + * 返回边的迭代器 + * + * @return + */ + public Iterator getEdgeIterator() { + return edgeList.iterator(); + } + + /** + * 返回是否有以这个顶点为出发点的边数 + * + * @return + */ + public int getEdgeCount() { + return edgeList.size(); + } + + /** + * 将这个顶点与endVertex连接,边的权值为weight + * + * @param endVertex + * @param weight + * @return 如果顶点已经与endVertex连接,那么将会更新权值,返回false
如果顶点没有与endVertex相连,则互相连接,返回true + */ + public boolean connect(Vertex endVertex, double weight) { + Iterator iterator = getEdgeIterator(); + Edge edge = null; + Vertex vertex = null; + while (iterator.hasNext()) { + edge = iterator.next(); + vertex = edge.getEndVertex(); + if (vertex.equals(endVertex)) { + //如果顶点已经与endVertex连接,那么将会更新权值,返回false + edge.setWeight(weight); + return false; + } + } + //如果顶点没有与endVertex相连,则互相连接,返回true + edge = new Edge(this, endVertex, weight); + edgeList.add(edge); + return true; + } + + /** + * 将这个顶点与endVertex连接的边删除 + * + * @param endVertex + * @return 如果顶点已经与endVertex连接,那么将会删除这条边,返回true
如果顶点没有与endVertex连接,则啥都不做,返回false + */ + public boolean disconnect(Vertex endVertex) { + Iterator iterator = getEdgeIterator(); + Edge edge = null; + Vertex vertex = null; + while (iterator.hasNext()) { + edge = iterator.next(); + vertex = edge.getEndVertex(); + if (vertex.equals(endVertex)) { + //如果顶点已经与endVertex连接,那么将会删除这条边,返回true + //edgeList.remove(edge); + iterator.remove(); + return true; + } + } + //如果顶点没有与endVertex连接,则啥都不做,返回false + return false; + } + + /** + * 返回是否有以这个顶点为出发点,以endVertex为结束点的边 + * + * @return 如果有,返回那条边
如果没有,返回null + */ + public Edge hasNeighbourVertex(Vertex endVertex) { + Iterator iterator = getEdgeIterator(); + Edge edge = null; + Vertex vertex = null; + while (iterator.hasNext()) { + edge = iterator.next(); + vertex = edge.getEndVertex(); + if (vertex.equals(endVertex)) { + //如果顶点已经与endVertex连接,那么将返回这个边 + return edge; + } + } + //没有则返回null + return null; + } + + //下面是与顶点是否被访问相关 + + /** + * 返回顶点是否被访问 + * + * @return + */ + public boolean isVisited() { + return visited; + } + + /** + * 访问这个顶点 + */ + public void visit() { + visited = true; + } + + /** + * 不访问这个顶点,或者说是清除访问状态 + */ + public void unVisit() { + visited = false; + } + + /** + * 获得以这个顶点为出发点,相邻的第一个没有被访问的顶点 + * + * @return 如果没有,返回null
如果有,返回对应的顶点 + */ + public Vertex getUnvisitedVertex() { + Iterator iterator = getEdgeIterator(); + Edge edge = null; + Vertex vertex = null; + while (iterator.hasNext()) { + edge = iterator.next(); + vertex = edge.getEndVertex(); + if (vertex.isVisited() == false) { + return vertex; + } + } + //没有则返回null + return null; + } + + //下面与前驱节点相关 + + /** + * 返回顶点的前驱节点 + * + * @return + */ + public Vertex getPreviousVertex() { + return previousVertex; + } + + /** + * 设置顶点的前驱节点 + * + * @param previousVertex + */ + public void setPreviousVertex(Vertex previousVertex) { + this.previousVertex = previousVertex; + } + + //下面与顶点的权值相关 + + /** + * 返回顶点的权值 + * + * @return + */ + public double getCost() { + return cost; + } + + /** + * 设置顶点的权值 + * + * @param cost + */ + public void setCost(double cost) { + this.cost = cost; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Which.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Which.java new file mode 100644 index 0000000..cc7d44e --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Which.java @@ -0,0 +1,57 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common; + +import java.io.File; +import java.io.IOException; +import java.net.JarURLConnection; +import java.net.URISyntaxException; +import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; + +/** + * @author zhaoleitr + */ +public class Which { + public static File jarFile(final Class clazz) throws IOException { + final String resourceName = clazz.getName().replace(".", "/") + ".class"; + URL resource = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public URL run() { + return clazz.getClassLoader().getResource(resourceName); + } + }); + if (resource == null) { + throw new IllegalArgumentException("Cannot get bootstrap path from " + clazz + " class location, aborting"); + } + + if (resource.getProtocol().equals("jar")) { + try { + JarURLConnection c = (JarURLConnection) resource.openConnection(); + URL jarFile = c.getJarFileURL(); + try { + return new File(jarFile.toURI()); + } catch (URISyntaxException e) { + return new File(jarFile.getPath()); + } + } catch (IOException e) { + throw new IllegalArgumentException("Cannot open jar file " + resource, e); + } + } else + throw new IllegalArgumentException("Don't support packaging " + resource + " , please contribute !"); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/ContentManagerHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/ContentManagerHelper.java new file mode 100644 index 0000000..90733c6 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/ContentManagerHelper.java @@ -0,0 +1,52 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.MetadataConfiguration; +import com.inspur.edp.lcm.metadata.spi.MetadataContentManager; +import java.util.Objects; + +public class ContentManagerHelper extends MetadataConfigurationLoader { + private static ContentManagerHelper sigleton = null; + + public ContentManagerHelper() { + } + + public static ContentManagerHelper getInstance() { + if (sigleton == null) { + sigleton = new ContentManagerHelper(); + } + return sigleton; + } + + public MetadataContentManager getManager(String typeName) { + MetadataContentManager manager = null; + MetadataConfiguration metadataConfigurationData = getMetadataConfigurationData(typeName); + if (!Objects.isNull(metadataConfigurationData) && !Objects.isNull(metadataConfigurationData.getManager())) { + Class managerClass; + try { + if (metadataConfigurationData.getManager() != null) { + managerClass = Class.forName(metadataConfigurationData.getManager().getName()); + manager = (MetadataContentManager) managerClass.newInstance(); + } + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + return manager; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectConfigurationHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectConfigurationHelper.java new file mode 100644 index 0000000..2137bd4 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectConfigurationHelper.java @@ -0,0 +1,43 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.gspproject.ProjectConfiguration; +import java.util.List; + +public class GspProjectConfigurationHelper extends GspProjectConfigurationLoader { + + private static GspProjectConfigurationHelper sigleton = null; + + public GspProjectConfigurationHelper() { + } + + public static GspProjectConfigurationHelper getInstance() { + if (sigleton == null) { + sigleton = new GspProjectConfigurationHelper(); + } + return sigleton; + } + + public List getGspProjectConfigurations() { + return super.loadGspProjectConfigurations(); + } + + @Override + public ProjectConfiguration getGspProjectConfigurationData(String typeName) { + return super.getGspProjectConfigurationData(typeName); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectConfigurationLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectConfigurationLoader.java new file mode 100644 index 0000000..05f70cf --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectConfigurationLoader.java @@ -0,0 +1,80 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.gspproject.ProjectConfiguration; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.io.IOException; +import java.io.Serializable; +import java.util.List; + +/** + * @Classname MetadataConfigurationLoader + * @Description 配置文件实体 + * @Date 2019/7/23 14:44 + * @Created by zhongchq + * @Version 1.0 + */ +public class GspProjectConfigurationLoader implements Serializable { + + public static List gspProjectConfigurations; + private static String fileName = "config/platform/common/lcm_gspprojectextend.json"; + private static final String sectionName = "ProjectConfiguration"; + + public GspProjectConfigurationLoader() { + loadGspProjectConfigurations(); + } + + /** + * @param + * @return java.util.List + * @throws + * @author zhongchq + * @description 类初始化时反序列化Json到实体 + * @date 15:40 2019/7/23 + **/ + protected List loadGspProjectConfigurations() { + MetadataServiceHelper metadataServiceHelper = new MetadataServiceHelper(); + try { + FileServiceImp fileService = new FileServiceImp(); + fileName = fileService.getCombinePath(EnvironmentUtil.getServerRTPath(), fileName); + if (gspProjectConfigurations == null || gspProjectConfigurations.size() <= 0) { + gspProjectConfigurations = metadataServiceHelper.getProjectConfiguration(fileName, sectionName); + return gspProjectConfigurations; + } else { + return gspProjectConfigurations; + } + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + protected ProjectConfiguration getGspProjectConfigurationData(String typeName) { + loadGspProjectConfigurations(); + if (gspProjectConfigurations != null && gspProjectConfigurations.size() > 0) { + for (ProjectConfiguration data : gspProjectConfigurations) { + if (data.getCommonConfigData().getTypeCode().equalsIgnoreCase(typeName)) { + return data; + } + } + } else { + return null; + } + return null; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectExtendHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectExtendHelper.java new file mode 100644 index 0000000..585cd27 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectExtendHelper.java @@ -0,0 +1,67 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import io.iec.edp.caf.common.environment.EnvironmentUtil; + +/** + * Classname GspProjectExtendHelper Description TODO Date 2019/10/28 11:20 + * + * @author zhongchq + * @version 1.0 + */ +public class GspProjectExtendHelper { + private final String gspProjectExtend = "config/platform/common/lcm_gspprojectextend.json"; + private final String archetypePom = "platform/dev/main/libs/resources/archetypefront/src/main/resources/archetype-resources/pom.xml"; + private static GspProjectExtendHelper singleton = null; + + FileService fileService = new FileServiceImp(); + + public GspProjectExtendHelper() { + + } + + public static GspProjectExtendHelper getInstance() { + if (singleton == null) { + singleton = new GspProjectExtendHelper(); + } + return singleton; + } + + public String getMavenProjectName() { + MetadataServiceHelper metadataServiceHelper = new MetadataServiceHelper(); + try { + final String combinePath = fileService.getCombinePath(EnvironmentUtil.getServerRTPath(), gspProjectExtend); + return metadataServiceHelper.getMavenProjectName(combinePath); + } catch (Exception e) { + throw new RuntimeException(e); + } + + } + + public String getEdpParentVersion() { + MetadataServiceHelper metadataServiceHelper = new MetadataServiceHelper(); + try { + final String combinePath = fileService.getCombinePath(EnvironmentUtil.getServerRTPath(), archetypePom); + return metadataServiceHelper.getEdpParentVersion(combinePath); + } catch (Exception e) { + throw new RuntimeException(e); + } + + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/I18nManagerHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/I18nManagerHelper.java new file mode 100644 index 0000000..153ad4c --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/I18nManagerHelper.java @@ -0,0 +1,52 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.MetadataConfiguration; +import com.inspur.edp.lcm.metadata.spi.MetadataI18nService; + +public class I18nManagerHelper extends MetadataConfigurationLoader { + private static I18nManagerHelper instance; + + private I18nManagerHelper() { + } + + public static I18nManagerHelper getInstance() { + if (instance == null) + instance = new I18nManagerHelper(); + return instance; + } + + public MetadataI18nService getI18nManager(String typeCode) { + MetadataI18nService service = null; + //todo 具体的获取i18nManager的具体逻辑 + MetadataI18nService manager = null; + MetadataConfiguration data = getMetadataConfigurationData(typeCode); + if (data != null && data.getI18nConfigData() != null) { + Class cls = null; + try { + if (data.getI18nConfigData() != null) { + cls = Class.forName(data.getI18nConfigData().getName()); + service = (MetadataI18nService) cls.newInstance(); + } + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + return service; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSettingsLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSettingsLoader.java new file mode 100644 index 0000000..c130641 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSettingsLoader.java @@ -0,0 +1,57 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import java.io.FileInputStream; +import java.io.IOException; +import org.apache.maven.settings.Settings; +import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +/** + * Classname MavenSettingsSerializerHelper Description maven settings.xml加载器 Date 2020/1/6 19:12 + * + * @author zhongchq + * @version 1.0 + */ +public class MavenSettingsLoader { + + private static String absoluteSettingsPath; + private static String settingsPath = "/.m2/settings.xml"; + + public static Settings getSettings() throws IOException, XmlPullParserException { + FileServiceImp fileService = new FileServiceImp(); + //可兼容linux + String userHome = System.getProperty("user.home"); + if (fileService.isFileExist(userHome + settingsPath)) { + absoluteSettingsPath = userHome + settingsPath; + } + if (absoluteSettingsPath != null && fileService.isFileExist(absoluteSettingsPath)) { + SettingsXpp3Reader settingsXpp3Reader = new SettingsXpp3Reader(); + return settingsXpp3Reader.read(new FileInputStream(absoluteSettingsPath)); + } + return null; + } + +/* String localRepository; + MavenSettingsLoader(){ + String os = System.getProperty("user.home"); + if (FileUtils.isFileExist(os + settingsPath)) { + absoluteSettingsPath = os + settingsPath; + } + }*/ +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSourceRuleConfigLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSourceRuleConfigLoader.java new file mode 100644 index 0000000..06d293c --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSourceRuleConfigLoader.java @@ -0,0 +1,59 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.List; +import java.util.Map; +import lombok.Getter; +import lombok.Setter; + +/** + * @Classname MavenSourceRuleConfigLoader + * @Description TODO + * @Date 2019/12/2 19:13 + * @Created by liu_bintr + * @Version 1.0 + */ +public class MavenSourceRuleConfigLoader { + private static String fileName = "config/platform/common/lcm_mavensourcerule.json"; + private static String sectionName = "rule"; + + @Setter + @Getter + public static Map> mavenSourceRuleConfigurations; + + public MavenSourceRuleConfigLoader() { + fileName = Paths.get(EnvironmentUtil.getServerRTPath()).resolve(fileName).toString(); + } + + protected Map> loadSourceRuleConfigration() { + MetadataServiceHelper metadataServiceHelper = new MetadataServiceHelper(); + try { + if (mavenSourceRuleConfigurations == null || mavenSourceRuleConfigurations.size() <= 0) { + mavenSourceRuleConfigurations = metadataServiceHelper.getMavenSourceRule(fileName, sectionName); + return mavenSourceRuleConfigurations; + } else { + return mavenSourceRuleConfigurations; + } + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSourceRuleHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSourceRuleHelper.java new file mode 100644 index 0000000..7c74a8e --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSourceRuleHelper.java @@ -0,0 +1,44 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +import java.util.List; +import java.util.Map; + +/** + * Classname MetadataTypeHelper Description TODO Date 2019/11/25 16:24 + * + * @author zhongchq + * @version 1.0 + */ +public class MavenSourceRuleHelper extends MavenSourceRuleConfigLoader { + + private static MavenSourceRuleHelper singleton = null; + + public MavenSourceRuleHelper() { + } + + public static MavenSourceRuleHelper getInstance() { + if (singleton == null) { + singleton = new MavenSourceRuleHelper(); + } + return singleton; + } + + public Map> getMavenSourceRuleMap() { + return loadSourceRuleConfigration(); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MdExtRuleSerializerHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MdExtRuleSerializerHelper.java new file mode 100644 index 0000000..20e4bc4 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MdExtRuleSerializerHelper.java @@ -0,0 +1,49 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.MetadataConfiguration; +import com.inspur.edp.lcm.metadata.spi.MdExtendRuleSerializer; + +public class MdExtRuleSerializerHelper extends MetadataConfigurationLoader { + private static MdExtRuleSerializerHelper singleton = null; + + private MdExtRuleSerializerHelper(){ + } + + public static MdExtRuleSerializerHelper getInstance(){ + if (singleton == null){ + singleton = new MdExtRuleSerializerHelper(); + } + return singleton; + } + + public MdExtendRuleSerializer getManager(String typeName) { + MdExtendRuleSerializer manager = null; + MetadataConfiguration data = getMetadataConfigurationData(typeName); + if (data != null&&data.getMdExtRuleSerializer()!=null){ + Class cls = null; + try { + cls = Class.forName(data.getMdExtRuleSerializer().getName()); + manager = (MdExtendRuleSerializer)cls.newInstance(); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + return manager; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MenuConfigHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MenuConfigHelper.java new file mode 100644 index 0000000..457e1d0 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MenuConfigHelper.java @@ -0,0 +1,41 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +public class MenuConfigHelper extends MenuConfigLoader { + + private static MetadataConfigurationHelper sigleton = null; + + public MenuConfigHelper() { + } + + public static MetadataConfigurationHelper getInstance() { + if (sigleton == null) { + sigleton = new MetadataConfigurationHelper(); + } + return sigleton; + } + + @Override + public String getMenuExtendConfiguration(Boolean status) { + return super.getMenuExtendConfiguration(status); + } + + @Override + public void setMenuConfiguration(String configuration) { + super.setMenuConfiguration(configuration); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MenuConfigLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MenuConfigLoader.java new file mode 100644 index 0000000..9d5d34b --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MenuConfigLoader.java @@ -0,0 +1,57 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.nio.file.Paths; + +public class MenuConfigLoader { + + private static String menuFileName = "web/platform/dev/main/web/webide/ide.module.ngfactory"; + private static String menuExtendFileName = "config/platform/common/lcm_menuextend.conf"; + private static FileServiceImp fileService = new FileServiceImp(); + + public MenuConfigLoader() { + } + + static String menuConfiguration; + static String menuExtendConfiguration; + + public String getMenuExtendConfiguration(Boolean status) { + String fileName = Paths.get(EnvironmentUtil.getServerRTPath()).resolve(menuExtendFileName).toString(); + String contents = null; + + contents = fileService.fileRead(fileName); + + String flag = status == true ? "on:" : "off:"; + menuExtendConfiguration = contents.substring(contents.indexOf(flag) + flag.length(), contents.indexOf("\n", contents.indexOf(flag)) - 1); + return menuExtendConfiguration; + } + + public void setMenuConfiguration(String configuration) { + String fileName = Paths.get(EnvironmentUtil.getBasePath()).resolve(menuFileName).toString(); + String contents = null; + + contents = fileService.fileRead(fileName); + + String extendOnMenu = getMenuExtendConfiguration(true); + String extendOffMenu = getMenuExtendConfiguration(false); + String oldString = contents.contains(extendOffMenu) ? extendOffMenu : extendOnMenu; + String contentsUpdated = contents.replace(oldString, configuration); + fileService.fileUpdate(fileName, contentsUpdated, false); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationHelper.java new file mode 100644 index 0000000..d180b41 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationHelper.java @@ -0,0 +1,37 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.MetadataConfiguration; + +public class MetadataConfigurationHelper extends MetadataConfigurationLoader { + + private static MetadataConfigurationHelper sigleton = null; + + public MetadataConfigurationHelper() { + } + + public static MetadataConfigurationHelper getInstance() { + if (sigleton == null) { + sigleton = new MetadataConfigurationHelper(); + } + return sigleton; + } + + public MetadataConfiguration getMetadataConfigurationData(String typeName) { + return super.getMetadataConfigurationData(typeName); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationLoader.java new file mode 100644 index 0000000..ae28f17 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationLoader.java @@ -0,0 +1,85 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.MetadataConfiguration; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.io.IOException; +import java.io.Serializable; +import java.util.List; +import lombok.Getter; +import lombok.Setter; + +/** + * @Classname MetadataConfigurationLoader + * @Description 配置文件实体 + * @Date 2019/7/23 14:44 + * @Created by zhongchq + * @Version 1.0 + */ +public class MetadataConfigurationLoader implements Serializable { + + @Setter + @Getter + public static List metadataConfigurations; + private static String fileName = "config/platform/common/lcm_metadataextend.json"; + private static final String sectionName = "MetadataConfiguration"; + + public MetadataConfigurationLoader() { + loadMetadataConfigurations(); + } + + /** + * @param + * @return java.util.List + * @throws + * @author zhongchq + * @description 类初始化时反序列化Json到实体 + * @date 15:40 2019/7/23 + **/ + protected List loadMetadataConfigurations() { + MetadataServiceHelper metadataServiceHelper = new MetadataServiceHelper(); + try { + FileServiceImp fileService = new FileServiceImp(); + fileName = fileService.getCombinePath(EnvironmentUtil.getServerRTPath(), fileName); + + if (metadataConfigurations == null || metadataConfigurations.size() <= 0) { + metadataConfigurations = metadataServiceHelper.getMetadataConfigurationList(fileName, sectionName); + return metadataConfigurations; + } else { + return metadataConfigurations; + } + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + protected MetadataConfiguration getMetadataConfigurationData(String typeName) { + loadMetadataConfigurations(); + if (metadataConfigurations != null && metadataConfigurations.size() > 0) { + for (MetadataConfiguration data : metadataConfigurations) { + if (data.getCommon().getTypeCode().equalsIgnoreCase(typeName)) { + return data; + } + } + } else { + return null; + } + return null; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataSerializerHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataSerializerHelper.java new file mode 100644 index 0000000..4ef908d --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataSerializerHelper.java @@ -0,0 +1,67 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.MetadataConfiguration; +import com.inspur.edp.lcm.metadata.spi.MetadataContentSerializer; + +/** + * @Classname MetadataSerializerHelper + * @Description 元数据序列化器帮助 + * @Date 2019/7/24 9:31 + * @Created by zhongchq + * @Version 1.0 + */ +public class MetadataSerializerHelper extends MetadataConfigurationLoader { + + private static MetadataSerializerHelper singleton = null; + + public MetadataSerializerHelper() { + } + + public static MetadataSerializerHelper getInstance() { + if (singleton == null) { + singleton = new MetadataSerializerHelper(); + } + return singleton; + } + + /** + * @param typeName + * @return com.inspur.edp.lcm.metadata.spi.MetadataContentSerializer + * @throws + * @author zhongchq + * @description 返回各元数据序列化器 + * @date 9:34 2019/7/24 + **/ + public MetadataContentSerializer getManager(String typeName) { + MetadataContentSerializer manager = null; + MetadataConfiguration data = getMetadataConfigurationData(typeName); + if (data != null) { + Class cls = null; + try { + if (data.getSerializer() != null) { + cls = Class.forName(data.getSerializer().getName()); + manager = (MetadataContentSerializer) cls.newInstance(); + } + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + return manager; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataServiceHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataServiceHelper.java new file mode 100644 index 0000000..da4b380 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataServiceHelper.java @@ -0,0 +1,131 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.inspur.edp.lcm.metadata.api.ConfigData.MetadataConfiguration; +import com.inspur.edp.lcm.metadata.api.ConfigData.gspproject.ProjectConfiguration; +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; +import com.inspur.edp.lcm.metadata.api.entity.compiler.MetadataCompilerConfiguration; +import com.inspur.edp.lcm.metadata.api.entity.extract.ExtractConfigration; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import org.apache.maven.model.Model; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; + +/** + * @Classname MetadataServiceHelper + * @Description 元数据服务工具 + * @Date 2019/7/20 14:20 + * @Created by zhongchq + * @Version 1.0 + */ +public class MetadataServiceHelper { + ObjectMapper objectMapper = new ObjectMapper(); + String fileContents; + private static FileServiceImp fileService = new FileServiceImp(); + + //默认构造器 + public MetadataServiceHelper() { + objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + objectMapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); + } + + public List getMetadataConfigurationList(String path, + String sectionName) throws IOException { + fileContents = fileService.fileRead(path); + JsonNode jsonNode = objectMapper.readTree(fileContents); + String metadataConfiguration = jsonNode.findValue(sectionName).toString(); + return objectMapper.readValue(metadataConfiguration, new TypeReference>() { + }); + } + + public List getMetadataTypeList(String path, String sectionName) throws IOException { + fileContents = fileService.fileRead(path); + JsonNode jsonNode = objectMapper.readTree(fileContents); + String metadataConfiguration = jsonNode.findValue(sectionName).toString(); + return objectMapper.readValue(metadataConfiguration, new TypeReference>() { + }); + } + + public List getExtractConfigrationList(String fileName, + String sectionName) throws IOException { + fileContents = fileService.fileRead(fileName); + JsonNode jsonNode = objectMapper.readTree(fileContents); + String metadataConfiguration = jsonNode.findValue(sectionName).toString(); + return objectMapper.readValue(metadataConfiguration, new TypeReference>() { + }); + } + + public List getCompileConfigrationList(String fileName, + String sectionName) throws IOException { + fileContents = fileService.fileRead(fileName); + JsonNode jsonNode = objectMapper.readTree(fileContents); + String metadataConfiguration = jsonNode.findValue(sectionName).toString(); + return objectMapper.readValue(metadataConfiguration, new TypeReference>() { + }); + } + + public String getMavenProjectName(String gspProjectExtend) throws IOException { + fileContents = fileService.fileRead(gspProjectExtend); + JsonNode jsonNode = objectMapper.readTree(fileContents); + return jsonNode.findValue("MavenProjectName").asText(); + } + + public Map> getMavenSourceRule(String fileName, String sectionName) throws IOException { + fileContents = fileService.fileRead(fileName); + JsonNode jsonNode = objectMapper.readTree(fileContents); + String metadataConfiguration = jsonNode.findValue(sectionName).toString(); + return objectMapper.readValue(metadataConfiguration, new TypeReference>>() { + }); + } + + public String getEdpParentVersion(String pomPath) throws IOException { + FileInputStream fis = null; + try { + fis = new FileInputStream(pomPath); + MavenXpp3Reader reader = new MavenXpp3Reader(); + Model model = reader.read(fis); + return model.getParent().getVersion(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (!(null == fis)) { + fis.close(); + } + } + return null; + } + + public List getProjectConfiguration(String path, + String sectionName) throws IOException { + fileContents = fileService.fileRead(path); + JsonNode jsonNode = objectMapper.readTree(fileContents); + String metadataConfiguration = jsonNode.findValue(sectionName).toString(); + return objectMapper.readValue(metadataConfiguration, new TypeReference>() { + }); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataTypeConfigLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataTypeConfigLoader.java new file mode 100644 index 0000000..7d21034 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataTypeConfigLoader.java @@ -0,0 +1,63 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.io.IOException; +import java.io.Serializable; +import java.util.List; + +/** + * @Classname MetadataTypeConfigLoader + * @Description 元数据类型 + * @Date 2019/7/23 15:03 + * @Created by zhongchq + * @Version 1.0 + */ +public class MetadataTypeConfigLoader implements Serializable { + + private String fileName = "config/platform/common/lcm_metadataextend.json"; + private String sectionName = "MetadataType"; + + private List metadataTypeList; + + public MetadataTypeConfigLoader() { + loadMetadataConfigurations(); + } + + /** + * @return java.util.List + * @author zhongchq 类初始化时反序列化Json到实体 + **/ + public List loadMetadataConfigurations() { + MetadataServiceHelper metadataServiceHelper = new MetadataServiceHelper(); + try { + if (metadataTypeList != null && metadataTypeList.size() > 0) { + return metadataTypeList; + } + FileService fileService = new FileServiceImp(); + fileName = fileService.getCombinePath(EnvironmentUtil.getServerRTPath(), fileName); + metadataTypeList = metadataServiceHelper.getMetadataTypeList(fileName, sectionName); + return metadataTypeList; + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataTypeHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataTypeHelper.java new file mode 100644 index 0000000..7ad3262 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataTypeHelper.java @@ -0,0 +1,50 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; +import java.util.List; + +/** + * Classname MetadataTypeHelper Description TODO Date 2019/11/25 16:24 + * + * @author zhongchq + * @version 1.0 + */ +public class MetadataTypeHelper extends MetadataTypeConfigLoader { + + private static MetadataTypeHelper singleton = null; + + public MetadataTypeHelper() { + } + + public static MetadataTypeHelper getInstance() { + if (singleton == null) { + singleton = new MetadataTypeHelper(); + } + return singleton; + } + + public List getMetadataTypes() { + return loadMetadataConfigurations(); + } + + public MetadataType getMetadataType(String typeCode) { + List metadataTypeList = loadMetadataConfigurations(); + MetadataType metadataType = metadataTypeList.stream().filter(type -> type.getTypeCode().equals(typeCode)).findFirst().orElse(null); + return metadataType; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/ProjectCreateManagerHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/ProjectCreateManagerHelper.java new file mode 100644 index 0000000..fa793ba --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/ProjectCreateManagerHelper.java @@ -0,0 +1,62 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.gspproject.ProjectConfiguration; +import com.inspur.edp.lcm.metadata.spi.IProjectCreateManager; +import java.util.List; +import java.util.Objects; +import org.springframework.util.StringUtils; + +public class ProjectCreateManagerHelper extends GspProjectConfigurationLoader { + private static ProjectCreateManagerHelper instance; + + public static ProjectCreateManagerHelper getInstance() { + if (Objects.isNull(instance)) { + instance = new ProjectCreateManagerHelper(); + } + return instance; + } + + private ProjectCreateManagerHelper() { + + } + + /// + /// 返回各元数据序列化器 + /// + /// + /// + public IProjectCreateManager getManager(String typeName) { + IProjectCreateManager manager = null; + ProjectConfiguration data = getGspProjectConfigurationData(typeName); + if (!Objects.isNull(data) && !Objects.isNull(data.getCreateConfigData()) && !StringUtils.isEmpty(data.getCreateConfigData().getName())) { + Class cls = null; + try { + cls = Class.forName(data.getCreateConfigData().getName()); + manager = (IProjectCreateManager) cls.newInstance(); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + return manager; + } + + public List getProjectTypeList() { + return loadGspProjectConfigurations(); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/RefStrategyConfigLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/RefStrategyConfigLoader.java new file mode 100644 index 0000000..fa955aa --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/RefStrategyConfigLoader.java @@ -0,0 +1,51 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.io.IOException; +import java.nio.file.Paths; + +public class RefStrategyConfigLoader { + + private String refStrategy; + private String fileName = "config/platform/dev/main/ref_strategy.json"; + private String sectionName = "strategy"; + ObjectMapper objectMapper = new ObjectMapper(); + + public RefStrategyConfigLoader() { + } + + protected String loadRefStrategy() { + fileName = Paths.get(EnvironmentUtil.getServerRTPath()).resolve(fileName).toString(); + try { + if (refStrategy != null) { + return refStrategy; + } + FileServiceImp fileService = new FileServiceImp(); + String fileContents = fileService.fileRead(fileName); + JsonNode jsonNode = objectMapper.readTree(fileContents); + refStrategy = jsonNode.findValue(sectionName).toString(); + return refStrategy; + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/RefStrategyHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/RefStrategyHelper.java new file mode 100644 index 0000000..6a3384e --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/RefStrategyHelper.java @@ -0,0 +1,34 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +public class RefStrategyHelper extends RefStrategyConfigLoader { + private static RefStrategyHelper singleton = null; + + public RefStrategyHelper() { + } + + public static RefStrategyHelper getInstance() { + if (singleton == null) { + singleton = new RefStrategyHelper(); + } + return singleton; + } + + public String getRefStrategy() { + return loadRefStrategy(); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/ReferenceManagerHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/ReferenceManagerHelper.java new file mode 100644 index 0000000..f99d5af --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/ReferenceManagerHelper.java @@ -0,0 +1,58 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.MetadataConfiguration; +import com.inspur.edp.lcm.metadata.spi.IMetadataReferenceManager; + +public class ReferenceManagerHelper extends MetadataConfigurationLoader { + private static ReferenceManagerHelper instance; + + public static ReferenceManagerHelper getInstance() { + if (instance == null) { + instance = new ReferenceManagerHelper(); + } + return instance; + } + + /// + /// 构造器 + /// + private ReferenceManagerHelper() { + + } + + /// + /// 返回各元数据序列化器 + /// + /// + /// + public IMetadataReferenceManager getManager(String typeName) { + IMetadataReferenceManager manager = null; + MetadataConfiguration data = getMetadataConfigurationData(typeName); + if (data != null && data.getReference() != null) { + Class cls = null; + try { + cls = Class.forName(data.getReference().getName()); + manager = (IMetadataReferenceManager) cls.newInstance(); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + return manager; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/TransferSerializerHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/TransferSerializerHelper.java new file mode 100644 index 0000000..28438d5 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/TransferSerializerHelper.java @@ -0,0 +1,69 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.MetadataConfiguration; +import com.inspur.edp.lcm.metadata.spi.MetadataTransferSerializer; +import org.springframework.util.ObjectUtils; +import org.springframework.util.StringUtils; + +/** + * Classname TransferSerializerHelper Description 传输序列化器帮助类 Date 2019/11/18 8:55 + * + * @author zhongchq + * @version 1.0 + */ +public class TransferSerializerHelper extends MetadataConfigurationLoader { + + private static TransferSerializerHelper singleton = null; + + public TransferSerializerHelper() { + } + + public static TransferSerializerHelper getInstance() { + if (singleton == null) { + singleton = new TransferSerializerHelper(); + } + return singleton; + } + + /** + * @param typeName + * @return com.inspur.edp.lcm.metadata.spi.MetadataContentSerializer + * @throws + * @author zhongchq + * @description 返回各元数据序列化器 + * @date 9:34 2019/7/24 + **/ + public MetadataTransferSerializer getManager(String typeName) { + MetadataTransferSerializer manager = null; + MetadataConfiguration data = getMetadataConfigurationData(typeName); + if (data != null) { + Class cls = null; + try { + if (!ObjectUtils.isEmpty(data.getTransferSerializer()) && !StringUtils.isEmpty(data.getTransferSerializer().getName())) { + cls = Class.forName(data.getTransferSerializer().getName()); + manager = (MetadataTransferSerializer) cls.newInstance(); + } + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + return manager; + } + +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/WorkspaceHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/WorkspaceHelper.java new file mode 100644 index 0000000..310f841 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/WorkspaceHelper.java @@ -0,0 +1,54 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.configuration; + +import com.inspur.edp.lcm.workspace.api.WorkSpaceService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; + +/** + * @author zhaoleitr + */ +public class WorkspaceHelper { + private WorkSpaceService wsService; + private static WorkspaceHelper singleton; + + public WorkspaceHelper() { + wsService = SpringBeanUtils.getBean(WorkSpaceService.class); + } + + public static WorkspaceHelper getInstance() { + if (singleton == null) { + singleton = new WorkspaceHelper(); + } + return singleton; + } + + public String getDevRootPath() { +// return "F:\\projects"; + return wsService.getUserBasePath().replace("\\", "/"); + /* + MetadataServiceHelper metadataServiceHelper = new MetadataServiceHelper(); + try { + + final String combinePath = FileUtils.getCombinePath(caf_boot_home, workspacePath); + return metadataServiceHelper.getDevRootPath(combinePath); + return metadataServiceHelper.getDevRootPath(workspacePath); + } catch (Exception e) { + throw new RuntimeException(e); + } + */ + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/devcommon/ManagerUtils.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/devcommon/ManagerUtils.java new file mode 100644 index 0000000..020a72c --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/devcommon/ManagerUtils.java @@ -0,0 +1,122 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.devcommon; + +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.configuration.WorkspaceHelper; + +public class ManagerUtils { + public static final String Spring_Shell_Flag_Name = "spring-shell"; + public static final String Spring_Shell_Flag_True = "1"; + public static final boolean Shell_Flag = Spring_Shell_Flag_True.equals(System.getProperty(Spring_Shell_Flag_Name)); + private static final FileServiceImp fileService = new FileServiceImp(); + /** + * 获取开发根路径 + */ + private static String devRootPath; + private static String mavenStoragePath; + private static String metadataPackageLocation; + + public static String getDevRootPath() { + if (Shell_Flag) { + return devRootPath; + } + return WorkspaceHelper.getInstance().getDevRootPath(); + } + + public static void setDevRootPath(String path) { + if (Shell_Flag) { + devRootPath = path; + } + + } + + public static String getMetadataPackageLocation() { + if (Shell_Flag) { + return metadataPackageLocation; + } + return fileService.getCombinePath(getDevRootPath(), "packages"); + } + + public static void setMetadataPackageLocation(String metadataPackageLoc) { + if (Shell_Flag) { + metadataPackageLocation = metadataPackageLoc; + } + } + + /** + * @param path 获取绝对路径 + * @return + */ + public static String getAbsolutePath(String path) { + path = handlePath(path); + if (Shell_Flag) { + if (isAbsolutePath(path)) { + return path; + } else { + throw new RuntimeException("当前路径不是绝对路径,请确认。当前路径为:" + path); + } + + } + String devRootPath = handlePath(getDevRootPath()); + if (path.startsWith(devRootPath)) { + if (isAbsolutePath(path)) { + return path; + } else { + throw new RuntimeException("当前路径不是绝对路径,请确认。当前路径为:" + path); + } + } else if (path.startsWith("/") || path.startsWith("\\")) { + path = path.substring(1); + } + if (path.startsWith("/")) { + path = path.substring(1); + } + String absolutePath = fileService.getCombinePath(devRootPath, path); + // TODO 判断路径是否存在 + return handlePath(absolutePath); + } + + public static boolean isAbsolutePath(String path) { + return handlePath(path).startsWith("/") || path.contains(":/"); + } + + public static String handlePath(String path) { + return path.replace("\\", "/"); + } + + public static String getMavenStoragePath() { + if (Shell_Flag) { + return mavenStoragePath; + } + return fileService.getCombinePath(getDevRootPath(), "maven"); + } + + public static void setMavenStoragePath(String mavenStorageP) { + if (Shell_Flag) { + mavenStoragePath = mavenStorageP; + } + } + + public static String getRalativePath(String relativeFullPath) { + String relativePath; + if (!getDevRootPath().isEmpty() && fileService.startWith(relativeFullPath, getDevRootPath())) { + relativePath = fileService.getRelPath(relativeFullPath, getDevRootPath()); + } else { + relativePath = relativeFullPath; + } + return relativePath; + } +} diff --git a/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/context/RefCommonContext.java b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/context/RefCommonContext.java new file mode 100644 index 0000000..6e3b9c9 --- /dev/null +++ b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/context/RefCommonContext.java @@ -0,0 +1,28 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.api.context; + +public class RefCommonContext { + private static boolean invokeAtDesignTime = false; + + public static boolean isInvokeAtDesignTime() { + return invokeAtDesignTime; + } + + public static void setInvokeAtDesignTime(boolean invokeAtDesignTime) { + RefCommonContext.invokeAtDesignTime = invokeAtDesignTime; + } +} diff --git a/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/entity/bo/BOInfo.java b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/entity/bo/BOInfo.java new file mode 100644 index 0000000..c736c4c --- /dev/null +++ b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/entity/bo/BOInfo.java @@ -0,0 +1,133 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.api.entity.bo; + +import java.util.Date; + +public class BOInfo { + /// + /// BO中项目数量 + /// + /// + private int projectCount; + + /// + /// BO中后端项目数量 + /// + /// + private int backendProjectCount; + + /// + /// BO中前端项目数量 + /// + /// + private int frontendProjectCount; + + /// + /// BO中项目最后修改时间 + /// + /// + private Date boProjectLastModifyTime; + + /// + /// BO ID + /// + /// + private String id; + + /// + /// BO Code + /// + /// + private String code; + + /// + /// BO Name + /// + /// + private String name; + + public int getProjectCount() { + return projectCount; + } + + public void setProjectCount(int projectCount) { + this.projectCount = projectCount; + } + + public int getBackendProjectCount() { + return backendProjectCount; + } + + public void setBackendProjectCount(int backendProjectCount) { + this.backendProjectCount = backendProjectCount; + } + + public int getFrontendProjectCount() { + return frontendProjectCount; + } + + public void setFrontendProjectCount(int frontendProjectCount) { + this.frontendProjectCount = frontendProjectCount; + } + + public Date getBoProjectLastModifyTime() { + return boProjectLastModifyTime; + } + + public void setBoProjectLastModifyTime(Date boProjectLastModifyTime) { + this.boProjectLastModifyTime = boProjectLastModifyTime; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + /// + /// BO 描述 + /// + /// + private String description; + +} diff --git a/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MdpkgService.java b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MdpkgService.java new file mode 100644 index 0000000..5e35945 --- /dev/null +++ b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MdpkgService.java @@ -0,0 +1,161 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.api.service; + +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenComponents; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataRepo; +import java.io.IOException; +import java.util.List; + +/** + * 元数据包服务 + * + * @author zhaoleitr + */ +public interface MdpkgService { + + /** + * 安装元数据接口。 + * + * @param groupId groupId + * @param artifactId artifactId + * @param version 版本 + * @param path 工程路径 + * @param forceUpdateFlag 是否强制更新 + * @throws IOException IO异常 + */ + void installMdpkg(String groupId, String artifactId, String version, String path, + Boolean forceUpdateFlag) throws IOException; + + /** + * 卸载元数据接口。 + * + * @param projPath 工程路径 + * @param packName maven包名 + */ + void uninstallMdpkg(String projPath, String packName); + + /** + * 部署jar到nexus私服中。 step1:将元数据包打包中jar中。 step2:推送 + * + * @param proPath 元数据工程路径 + * @param repoId 仓库标识 + * @param dependencyVersion 依赖版本 + */ + void deployMdpkg(String proPath, String repoId, String dependencyVersion); + + /** + * 获取当前环境中配置的maven配置,从settings.xml配置仓库,settings.xml还得配置用户名与密码 + * + * @return MetadataRepo 返回列表 + */ + MetadataRepo getRepoList(); + + /** + * 添加工程依赖 + * + * @param pompath pom文件路径 + * @param groupId groupId + * @param artifactId artifactId + * @param version 版本 + * @throws IOException IO异常 + */ + void addProjectDependency(String pompath, String groupId, String artifactId, String version) throws IOException; + + /** + * 编译 + * + * @param path 工程路径 + * @param modules 编译模块列表 + */ + void compile(String path, String modules); + + /** + * 编译工程下所有模块 + * + * @param path 工程路径 + */ + void compileAll(String path); + + /** + * 重新安装依赖工程 + * + * @param path 工程路径 + * @param force 是否强制更新 工程路径 + */ + void restore(String path, Boolean force); + + /** + * 给工程添加依赖并拉取 + * + * @param path + * @param metadataPackages + */ + void addDepedencyAndRestore(String path, List metadataPackages); + + /** + * 发布正式版本包 + * + * @param path 工程路径 + * @param version 工程版本号 + * @param repoId 仓库id + * @param revert 版本撤回 + * @param dependenciesVersion 依赖的统一版本号 + * @throws IOException IO异常 + */ + void deployReleaseMdVersion(String path, String version, String repoId, boolean revert, + String dependenciesVersion) throws IOException; + + /** + * 发布临时版本包 + * + * @param path 工程路径 + * @param version 工程版本号 + * @param repoId 仓库id + * @param revert 版本撤回 + * @throws IOException IO异常 + **/ + void deploySnapshotMdVersion(String path, String repoId, String version, boolean revert) throws IOException; + + /** + * 获取maven包最新版本 + * + * @param groupId groupId + * @param artifactId artifactId + * @return maven包最新版本 + */ + String getMavenPackageLatestVersion(String groupId, String artifactId); + + /** + * 根据包名获取maven包的GroupId和ArtifactId + * + * @param mdpkgName 元数据包名 + * @return maven依赖关系列表 + */ + MavenPackageRefs getGAByMdpkgName(String mdpkgName); + + /** + * 获取单个Maven包的版本列表 + * + * @param sourceId 包源标识 + * @param packName 包名 + * @return 版本列表 + */ + MavenComponents getVersionsOfSinglePackage(String sourceId, String packName); + + void batchOperate(String path, List operations); +} diff --git a/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataProjectService.java b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataProjectService.java index a4c6366..9968a67 100644 --- a/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataProjectService.java +++ b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataProjectService.java @@ -15,14 +15,15 @@ */ package com.inspur.edp.lcm.metadata.api.service; -import java.io.IOException; -import java.util.List; -import java.util.Map; import com.inspur.edp.lcm.metadata.api.entity.GspProject; import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageHeader; import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.entity.bo.BOInfo; import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import java.io.IOException; +import java.util.List; +import java.util.Map; /** * @author zhaoleitr 元数据工程服务 @@ -123,6 +124,8 @@ public interface MetadataProjectService { */ String getProjPath(String path); + String getAbsolutePath(String path); + /** * @param path 文件夹路径路径 * @param projPathList 工程路径列表 @@ -227,4 +230,9 @@ public interface MetadataProjectService { String getBoPath(String path); boolean isInterpretation(String path); + + List getBOInfo(String[] boids); + + void changeProcessMode(String path, ProcessMode processMode); + } diff --git a/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataService.java b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataService.java index c8e74e4..1180eab 100644 --- a/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataService.java +++ b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataService.java @@ -15,19 +15,19 @@ */ package com.inspur.edp.lcm.metadata.api.service; -import java.util.List; -import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import com.inspur.edp.lcm.metadata.api.IMdExtRuleContent; -import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; +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.entity.Metadata4Ref; import com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto; import com.inspur.edp.lcm.metadata.api.entity.MetadataDto; import com.inspur.edp.lcm.metadata.api.entity.MetadataFilter; +import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; import com.inspur.edp.lcm.metadata.api.entity.MetadataIndexItemDto; import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; import com.inspur.edp.lcm.metadata.api.entity.MetadataType; +import java.util.List; /** * @author zhaoleitr @@ -67,6 +67,14 @@ public interface MetadataService { */ GspMetadata loadMetadata(String metadataFileName, String path); + /** + * 根据元数据元数据路径,获取元数据 + * + * @param metadataPath 元数据文件路径,包含名称 + * @return 元数据内容实体 + */ + GspMetadata loadMetadata(String metadataPath); + /** * 根据元数据id和路径获取元数据内容,仅支持获取工程下的元数据 * diff --git a/model/framework/devtime-core/pom.xml b/model/framework/devtime-core/pom.xml index be59842..9483ce1 100644 --- a/model/framework/devtime-core/pom.xml +++ b/model/framework/devtime-core/pom.xml @@ -8,10 +8,46 @@ 0.9.0-SNAPSHOT 4.0.0 - ubml-model-framework-devtime-core ${project.version} - ubml-model-framework-devtime-core + + + org.openatom.ubml + ubml-model-framework-devtime-api + 0.9.0-SNAPSHOT + compile + + + io.iec.edp + caf-business-object-api + 0.1.4 + + + com.inspur.edp + lcm-logging-service + 0.1.4 + + + com.inspur.edp + ide-setting-core + 0.1.4 + + + io.iec.edp + caf-boot-starter-context + 0.3.2 + + + com.inspur.edp + i18n-resource-api + 0.1.2 + + + com.inspur.edp + metadata-to-java-context + 0.1.3 + + \ No newline at end of file diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataCacheManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataCacheManager.java new file mode 100644 index 0000000..984b22c --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataCacheManager.java @@ -0,0 +1,241 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.cache; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageReference; +import com.inspur.edp.lcm.metadata.api.entity.MetadataReference; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.locks.ReentrantLock; + +/** + * 元数据运行时缓存 + */ +public class MetadataCacheManager { + + //元数据包基本信息 + private static final Map medataPackageInfo = new HashMap<>(); + //元数据包清单列表信息 + private static final Map> metadataManifestInfo = new HashMap<>(); + //元数据基础信息 + private static final Map metadataInfo = new HashMap<>(); + //元数据依赖关系 + private static final Map metadataDependence = new HashMap<>(); + //元数据与元数据包名的映射关系 + private static final Map metadataPathMapping = new HashMap<>(); + //所有的元数据包信息 + private static final Map> allMetadataPackageInfo = new HashMap<>(); + //所有的元数据信息 + private static final Map> allMetadataInfo = new HashMap<>(); + private static Map> metadataListCache = new HashMap<>(); + private static final ReentrantLock lock = new ReentrantLock(); + + MetadataCacheManager() { + } + + public static void removeMetadataInfo(String key) { + lock.lock(); + try { + metadataInfo.remove(key); + } finally { + lock.unlock(); + } + } + + public static Object getMetadataInfo(String metadataKey) { + lock.lock(); + try { + return metadataInfo.get(metadataKey); + } finally { + lock.unlock(); + } + } + + public static void addMetadataInfo(String key, GspMetadata metadata) { + lock.lock(); + try { + metadataInfo.put(key, metadata); + } finally { + lock.unlock(); + } + } + + public static void removeMDDependence(String key) { + lock.lock(); + try { + metadataDependence.remove(key); + } finally { + lock.unlock(); + } + } + + public static void addMDDependence(String key, List refs) { + lock.lock(); + try { + metadataDependence.put(key, refs); + } finally { + lock.unlock(); + } + } + + public static void removeMetadataPackageInfo(String key) { + lock.lock(); + try { + medataPackageInfo.remove(key); + } finally { + lock.unlock(); + } + } + + public static void addMetadataPackageInfo(String key, MetadataPackage value) { + lock.lock(); + try { + medataPackageInfo.put(key, value); + } finally { + lock.unlock(); + } + } + + public static Object getMetadataPackageInfo(String key) { + lock.lock(); + try { + return medataPackageInfo.get(key); + } finally { + lock.unlock(); + } + } + + public static void removeMDManifestInfo(String key) { + lock.lock(); + try { + metadataManifestInfo.remove(key); + } finally { + lock.unlock(); + } + } + + public static void addMDManifestInfo(String key, List value) { + lock.lock(); + try { + metadataManifestInfo.put(key, value); + } finally { + lock.unlock(); + } + } + + public static Object getMDManifestInfo(String key) { + lock.lock(); + try { + return metadataManifestInfo.get(key); + } finally { + lock.unlock(); + } + } + + public static void removeMPDependence(String key) { + lock.lock(); + try { + metadataDependence.remove(key); + } finally { + lock.unlock(); + } + } + + public static void addMPDependence(String key, List value) { + lock.lock(); + try { + metadataDependence.put(key, value); + } finally { + lock.unlock(); + } + } + + public static Object getMetadataPathMapping(String key) { + lock.lock(); + try { + return metadataPathMapping.get(key); + } finally { + lock.unlock(); + } + } + + public static void addMetadataPathMapping(String key, String value) { + lock.lock(); + try { + metadataPathMapping.put(key, value); + } finally { + lock.unlock(); + } + } + + public static void removeMetadataPathMapping(String key) { + lock.lock(); + try { + metadataPathMapping.remove(key); + } finally { + lock.unlock(); + } + } + + public static Object getAllMetadataPackageInfo(String key) { + lock.lock(); + try { + return allMetadataPackageInfo.get(key); + } finally { + lock.unlock(); + } + } + + public static void addAllMetadataPackageInfo(String key, List value) { + lock.lock(); + try { + allMetadataPackageInfo.put(key, value); + } finally { + lock.unlock(); + } + } + + public static void removeAllMetadataPackageInfo(String key) { + lock.lock(); + try { + allMetadataPackageInfo.remove(key); + } finally { + lock.unlock(); + } + } + + public static Object getAllMetadataInfo(String key) { + lock.lock(); + try { + return allMetadataInfo.get(key); + } finally { + lock.unlock(); + } + } + + public static void addAllMetadataInfo(String key, List value) { + lock.lock(); + try { + allMetadataInfo.put(key, value); + } finally { + lock.unlock(); + } + } + +} \ No newline at end of file diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDevCacheManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDevCacheManager.java new file mode 100644 index 0000000..70e53a7 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDevCacheManager.java @@ -0,0 +1,95 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.cache; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.ProjectMetadataCache; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.locks.ReentrantLock; + +/** + * 元数据设计时缓存 + */ +public class MetadataDevCacheManager { + + MetadataDevCacheManager() { + } + + //某个工程中的元数据列表 + private static Map> metadataListInProject = new HashMap(); + //工程中元数据所在位置缓存 + private static Map projectMetadataCacheMap = new ConcurrentHashMap(); + + // 用来存储元数据设计时服务上下文信息,放到分布式缓存,保证服务重启不丢失。 +// private String metadataContextServerNode = "MetadataContextServer"; + private static ReentrantLock lock = new ReentrantLock(); + + public static List getMetadataListInProject(String key) { + lock.lock(); + try { + return metadataListInProject.get(key); + } finally { + lock.unlock(); + } + } + + public static void removeMetadataListInProject(String key) { + metadataListInProject.remove(key); + } + + public static void setMetadataListInProjectCache(String projectPath, List metadataList) { + lock.lock(); + try { + metadataListInProject.put(projectPath, metadataList); + } finally { + lock.unlock(); + } + } + + public static void clearMetadataListCache() { + metadataListInProject.clear(); + } + + public static void removeProjectMetadataCacheMap(String key) { + lock.lock(); + try { + projectMetadataCacheMap.remove(key); + } finally { + lock.unlock(); + } + } + + public static Object getProjectMetadataCacheMap(String key) { + lock.lock(); + try { + return projectMetadataCacheMap.get(key); + } finally { + lock.unlock(); + } + } + + public static void setProjectMetadataCacheMap(String key, ProjectMetadataCache projectMetadataCache) { + lock.lock(); + try { + projectMetadataCacheMap.put(key, projectMetadataCache); + } finally { + lock.unlock(); + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDistCacheManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDistCacheManager.java new file mode 100644 index 0000000..34c16a7 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDistCacheManager.java @@ -0,0 +1,98 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.cache; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.common.MetadataSerializer; +import io.iec.edp.caf.commons.layeringcache.cache.Cache; +import io.iec.edp.caf.commons.layeringcache.cache.LayeringCache; +import io.iec.edp.caf.commons.layeringcache.manager.CacheManager; +import io.iec.edp.caf.commons.layeringcache.setting.LayeringCacheSetting; +import io.iec.edp.caf.commons.layeringcache.support.ExpireMode; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.lang.reflect.Field; +import java.util.concurrent.TimeUnit; + +public class MetadataDistCacheManager { + private static Cache metadataCache; + + private static Cache l2MetadataCache; + + public static String SECOND_CACHE = "secondCache"; + + public static Cache getMetadataCache() { + if (metadataCache == null) { + CacheManager cacheManager = SpringBeanUtils.getBean(CacheManager.class); + //声明当前要使用的缓存配置 + LayeringCacheSetting layeringCacheSetting = new LayeringCacheSetting.Builder() + //开启一级缓存 + .enableFirstCache() + //一级缓存过期策略(可选写入后过期、访问后过期) + .firstCacheExpireMode(ExpireMode.ACCESS) + //一级缓存过期时间 + .firstCacheExpireTime(24) + //一级缓存过期时间单位 + .firstCacheTimeUnit(TimeUnit.HOURS) + //一级缓存初始容量 + .firstCacheInitialCapacity(3000) + //一级缓存最大容量(到达最大容量后 开始驱逐低频缓存) + .firstCacheMaximumSize(6000) + //开启二级缓存 + .enableSecondCache() + //二级缓存过期时间 + .secondCacheExpireTime(12) + //二级缓存时间单位 + .secondCacheTimeUnit(TimeUnit.HOURS) + //二级缓存序列化器 + .dataSerializer(new MetadataSerializer()) + //缓存配置说明 + .depict("元数据缓存配置").build(); + //获取缓存实例 + metadataCache = cacheManager.getCache("metadataCache", layeringCacheSetting); + } + + return metadataCache; + } + + public static Cache getL2MetadataCache() { + if (l2MetadataCache == null) { + Field field; + try { + field = LayeringCache.class.getDeclaredField(SECOND_CACHE); + field.setAccessible(true); + l2MetadataCache = (Cache) field.get(getMetadataCache()); + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + } + return l2MetadataCache; + } + + public static void put(String key, GspMetadata metadata, String level) { + Cache cache = getMetadataCache(); + if (SECOND_CACHE.equals(level)) { + cache = getL2MetadataCache(); + if (cache == null) { + cache = getMetadataCache(); + } + } + cache.put(key, metadata); + } + + public static GspMetadata get(String key) { + return getMetadataCache().get(key, GspMetadata.class); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataRtDistCache.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataRtDistCache.java new file mode 100644 index 0000000..836009e --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataRtDistCache.java @@ -0,0 +1,98 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.cache; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.common.MetadataSerializer; +import io.iec.edp.caf.commons.layeringcache.cache.Cache; +import io.iec.edp.caf.commons.layeringcache.cache.LayeringCache; +import io.iec.edp.caf.commons.layeringcache.manager.CacheManager; +import io.iec.edp.caf.commons.layeringcache.setting.LayeringCacheSetting; +import io.iec.edp.caf.commons.layeringcache.support.ExpireMode; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.lang.reflect.Field; +import java.util.concurrent.TimeUnit; + +public class MetadataRtDistCache { + private static Cache metadataCache; + + private static Cache l2MetadataCache; + + public static String SECOND_CACHE = "secondCache"; + + public static Cache getMetadataCache() { + if (metadataCache == null) { + CacheManager cacheManager = SpringBeanUtils.getBean(CacheManager.class); + //声明当前要使用的缓存配置 + LayeringCacheSetting layeringCacheSetting = new LayeringCacheSetting.Builder() + //开启一级缓存 + .enableFirstCache() + //一级缓存过期策略(可选写入后过期、访问后过期) + .firstCacheExpireMode(ExpireMode.ACCESS) + //一级缓存过期时间 + .firstCacheExpireTime(24) + //一级缓存过期时间单位 + .firstCacheTimeUnit(TimeUnit.HOURS) + //一级缓存初始容量 + .firstCacheInitialCapacity(3000) + //一级缓存最大容量(到达最大容量后 开始驱逐低频缓存) + .firstCacheMaximumSize(5000) + //开启二级缓存 + .enableSecondCache() + //二级缓存过期时间 + .secondCacheExpireTime(12) + //二级缓存时间单位 + .secondCacheTimeUnit(TimeUnit.HOURS) + //二级缓存序列化器 + .dataSerializer(new MetadataSerializer()) + //缓存配置说明 + .depict("元数据缓存配置").build(); + //获取缓存实例 + metadataCache = cacheManager.getCache("metadataRtCache", layeringCacheSetting); + } + + return metadataCache; + } + + public static Cache getL2MetadataCache() { + if (l2MetadataCache == null) { + Field field; + try { + field = LayeringCache.class.getDeclaredField(SECOND_CACHE); + field.setAccessible(true); + l2MetadataCache = (Cache) field.get(getMetadataCache()); + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + } + return l2MetadataCache; + } + + public static void put(String key, GspMetadata metadata, String level) { + Cache cache = getMetadataCache(); + if (SECOND_CACHE.equals(level)) { + cache = getL2MetadataCache(); + if (cache == null) { + cache = getMetadataCache(); + } + } + cache.put(key, metadata); + } + + public static GspMetadata get(String key) { + return getMetadataCache().get(key, GspMetadata.class); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/RtCacheHandler.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/RtCacheHandler.java new file mode 100644 index 0000000..eb31dda --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/RtCacheHandler.java @@ -0,0 +1,59 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.cache; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.common.context.RuntimeContext; + +public class RtCacheHandler { + + public static final String allMetadataInfoCacheKey = "allMetadata"; + public static final String allPackagesCacheKey = "allPackages"; + + public static void updateMetadataPackageCache(String packageKey, MetadataPackage package_Renamed) { + if (package_Renamed.getHeader() != null) { + MetadataCacheManager.removeMetadataPackageInfo(packageKey); + MetadataCacheManager.addMetadataPackageInfo(packageKey, package_Renamed); + } + if (package_Renamed.getMetadataList() != null) { + MetadataCacheManager.removeMDManifestInfo(packageKey); + MetadataCacheManager.addMDManifestInfo(packageKey, package_Renamed.getMetadataList()); + } + if (package_Renamed.getReference() != null) { + MetadataCacheManager.removeMPDependence(packageKey); + MetadataCacheManager.addMPDependence(packageKey, package_Renamed.getReference()); + } + } + + public static void updateMetadataCache(String metadataKey, GspMetadata metadata) { + MetadataCacheManager.removeMetadataInfo(metadataKey); + MetadataCacheManager.addMetadataInfo(metadataKey, metadata); + if (metadata.getRefs() != null) { + MetadataCacheManager.removeMDDependence(metadataKey); + MetadataCacheManager.addMDDependence(metadataKey, metadata.getRefs()); + } + } + + public static String getMetadataCacheKey(String metadataID, String mpInfoKey) { + return mpInfoKey + metadataID; + } + + private static String getTenantCacheKey(String key) { + String tenantID = RuntimeContext.getTenantID(); + return tenantID + key; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/GspProjectCoreService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/GspProjectCoreService.java new file mode 100644 index 0000000..e30c2d2 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/GspProjectCoreService.java @@ -0,0 +1,58 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.inspur.edp.lcm.metadata.api.ConfigData.gspproject.ProjectConfiguration; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.common.configuration.GspProjectConfigurationHelper; +import java.io.IOException; +import java.util.List; + +/** + * @author zhaoleitr + */ +public class GspProjectCoreService { + private final FileServiceImp fileService = new FileServiceImp(); + + public GspProject getGspProjectInfo(String absolutePath) { + if (absolutePath.isEmpty()) { + throw new RuntimeException("路径不能为空"); + } + String projPath = MetadataProjectCoreService.getCurrent().getProjPath(absolutePath); + String fullName = fileService.getCombinePath(projPath, Utils.getGspProjectName()); + if (!fileService.isFileExist(fullName)) { + throw new RuntimeException("文件" + fullName + "不存在"); + } + String projStr = fileService.fileRead(Utils.handlePath(fullName)); + + ObjectMapper objectMapper = Utils.getMapper(); + GspProject project; + try { + project = objectMapper.readValue(projStr, GspProject.class); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException("序列化" + fullName + "失败", e); + } + return project; + } + + public List getGspProjectTypeInfo() { + return GspProjectConfigurationHelper.getInstance().getGspProjectConfigurations(); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/GspProjectServiceImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/GspProjectServiceImp.java new file mode 100644 index 0000000..405fcb9 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/GspProjectServiceImp.java @@ -0,0 +1,52 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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; + +import com.inspur.edp.lcm.metadata.api.ConfigData.gspproject.ProjectConfiguration; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.service.GspProjectService; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import java.util.List; + +/** + * GSP工程服务 + * + * @author zhaoleitr + */ +public class GspProjectServiceImp implements GspProjectService { + + private GspProjectCoreService gspProjectCoreService = new GspProjectCoreService(); + + /** + * 获取GSP工程的基本信息 + * + * @param path 工程路径 + * @return Gsp工程 + */ + @Override + public GspProject getGspProjectInfo(String path) { + if (path.isEmpty()) { + throw new RuntimeException("路径不能为空"); + } + String absolutePath = ManagerUtils.getAbsolutePath(path); + return gspProjectCoreService.getGspProjectInfo(absolutePath); + } + + @Override + public List getGspProjectTypeInfo() { + return gspProjectCoreService.getGspProjectTypeInfo(); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/I18nCoreService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/I18nCoreService.java new file mode 100644 index 0000000..a781878 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/I18nCoreService.java @@ -0,0 +1,215 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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; + +import com.inspur.edp.i18n.resource.api.II18nResourceDTManager; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.I18nResource; +import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataReference; +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.common.configuration.I18nManagerHelper; +import com.inspur.edp.lcm.metadata.common.configuration.MetadataTypeHelper; +import com.inspur.edp.lcm.metadata.spi.MetadataI18nService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.File; +import java.nio.file.Paths; +import java.util.List; +import java.util.UUID; +import java.util.stream.Collectors; + +public class I18nCoreService { + private static I18nCoreService sigleton = null; + + private final MetadataCoreManager metadataCoreManager = new MetadataCoreManager(); + + private final String RESOURCE_METADATA_TYPE = "ResourceMetadata"; + private final String LINGUISTIC_RESOURCE_METADATA_TYPE = "LinguisticResource"; + + public static I18nCoreService getInstance() { + if (sigleton == null) { + sigleton = new I18nCoreService(); + } + return sigleton; + } + + public GspMetadata extractResourceMetadata(GspMetadata metadata, String absolutePath) { + GspMetadata baseMetadata; + File metadataFile = new File(absolutePath); + if (metadata.getHeader().getTranslating()) { + baseMetadata = metadataCoreManager.loadMetadata(metadataFile.getName(), metadataFile.getParent()); + } else { + baseMetadata = metadata; + } + // 根据基础元数据抽取元数据 + GspMetadata resourceMetadata = buildResourceMetadata(baseMetadata, absolutePath); + String dirPath = metadataFile.getParent(); + // 建立基础元数据与资源元数据的关联关系 + MetadataReference ref = buildRefs(baseMetadata, resourceMetadata); + if (metadata.getRefs() != null && metadata.getRefs().stream().noneMatch(r -> r.getDependentMetadata().getId().equals(ref.getDependentMetadata().getId()))) { + metadata.getRefs().add(ref); + } + + String resouceMetadataPath = Paths.get(dirPath).resolve(resourceMetadata.getHeader().getFileName()).toString(); + if (metadataCoreManager.isMetadataExist(resouceMetadataPath)) { + metadataCoreManager.saveMetadata(resourceMetadata, resouceMetadataPath); + } else { + metadataCoreManager.createMetadata(dirPath, resourceMetadata); + } + + return resourceMetadata; + } + + public boolean isI18nMetadata(GspMetadata metadata) { + return metadata.getHeader().getTranslating(); + } + + private GspMetadata buildResourceMetadata(GspMetadata metadata, String absolutePath) { + I18nResource resouceItem = getResouceItem(metadata); + // 判断是否存在资源元数据 + String resourceMetadataFileName = getResourceMetadataFileName(metadata); + String resourceMetadataPath = Paths.get(new File(absolutePath).getParent()).resolve(resourceMetadataFileName).toString(); + MetadataCoreManager metadataCoreManager = new MetadataCoreManager(); + boolean metadataExist = metadataCoreManager.isMetadataExist(resourceMetadataPath); + GspMetadata resourceMetadata; + File file = new File(resourceMetadataPath); + if (metadataExist) { + resourceMetadata = metadataCoreManager.loadMetadata(resourceMetadataFileName, file.getParent()); + } else { + resourceMetadata = new GspMetadata(); + MetadataHeader header = new MetadataHeader(); + header.setId(UUID.randomUUID().toString()); + FileServiceImp fileService = new FileServiceImp(); + String fileNameWithoutExtension = fileService.getFileNameWithoutExtension(resourceMetadataFileName); + header.setCode(fileNameWithoutExtension); + header.setName(fileNameWithoutExtension); + header.setFileName(resourceMetadataFileName); + header.setNameSpace(metadata.getHeader().getNameSpace()); + header.setBizObjectId(metadata.getHeader().getBizObjectId()); + header.setType(RESOURCE_METADATA_TYPE); + resourceMetadata.setHeader(header); + } + II18nResourceDTManager i18nResourceDTManager = SpringBeanUtils.getBean(II18nResourceDTManager.class); + i18nResourceDTManager.getResourceMetadata(resourceMetadata, resouceItem); + return resourceMetadata; + } + + private MetadataReference buildRefs(GspMetadata baseMetadata, GspMetadata resouceMetadata) { + MetadataReference metadataReference = new MetadataReference(); + metadataReference.setMetadata(baseMetadata.getHeader()); + metadataReference.setDependentMetadata(resouceMetadata.getHeader()); + if (baseMetadata.getRefs().stream().noneMatch(item -> item.getDependentMetadata().getId().equals(resouceMetadata.getHeader().getId()))) { + baseMetadata.getRefs().add(metadataReference); + } + return metadataReference; + } + + private I18nResource getResouceItem(GspMetadata metadata) { + MetadataI18nService manager = getI18nManager(metadata.getHeader().getType()); + I18nResource resourceItem = manager.getResourceItem(metadata); + return resourceItem; + } + + private MetadataI18nService getI18nManager(String type) { + MetadataI18nService i18nManager = I18nManagerHelper.getInstance().getI18nManager(type); + if (i18nManager == null) { + throw new RuntimeException("获取当前元数据国际化扩展实现类失败,当前元数据类型为" + type); + } + return i18nManager; + } + + private String getResourceMetadataFileName(GspMetadata metadata) { + String metadataSuffix = getMetadataSuffix(metadata.getHeader().getType()); + String resourceMetadataSuffix = getMetadataSuffix(RESOURCE_METADATA_TYPE); + return metadata.getHeader().getCode() + metadataSuffix + resourceMetadataSuffix; + } + + private String getMetadataSuffix(String type) { + MetadataType metadataType = MetadataTypeHelper.getInstance().getMetadataTypes().stream().filter(mt -> type.equals(mt.getTypeCode())).findFirst().orElse(null); + Utils.checkNPE(metadataType, "此类型元数据:" + type + ",在配置文件中不存在。"); + return metadataType.getPostfix(); + } + + public void extractLanguageMetadata(GspMetadata metadata, GspMetadata resourceMetadata, String path) { + GspMetadata i18nResourceMetadata = buildResourceMetadata(metadata, path); + if (i18nResourceMetadata != null) { + i18nResourceMetadata.getHeader().setLanguage(metadata.getHeader().getLanguage()); + saveLanguageMetadata(metadata, resourceMetadata, i18nResourceMetadata, path); + } + } + + public GspMetadata getI18nMetadata(String fileName, String absolutePath, String language) { + GspMetadata metadata = metadataCoreManager.loadMetadata(fileName, absolutePath); + List i18nResourceList = getResourceWithMetadata(metadata, language); + MetadataI18nService i18nManager = I18nManagerHelper.getInstance().getI18nManager(metadata.getHeader().getType()); + if (i18nManager != null) { + return i18nManager.merge(metadata, i18nResourceList); + } + return metadata; + } + + private List getResourceWithMetadata(GspMetadata metadata, String language) { + II18nResourceDTManager i18nResourceDTManager = SpringBeanUtils.getBean(II18nResourceDTManager.class); + List i18nResourceList = i18nResourceDTManager.getI18nResource(metadata, language); + List collect = i18nResourceList.stream().filter(resource -> resource.getLanguage().equals(language)).collect(Collectors.toList()); + return collect; + } + + private void saveLanguageMetadata(GspMetadata metadata, GspMetadata resourceMetadata, + GspMetadata i18nResourceMetadata, String path) { + // 判断是否存在资源元数据 + String languageMetadataFileName = getLanguageMetadataFileName(metadata); + String languageMetadataPath = Paths.get(new File(path).getParent()).resolve(languageMetadataFileName).toString(); + MetadataCoreManager metadataCoreManager = new MetadataCoreManager(); + boolean metadataExist = metadataCoreManager.isMetadataExist(languageMetadataPath); + GspMetadata languageMetadata; + File file = new File(languageMetadataPath); + if (metadataExist) { + languageMetadata = metadataCoreManager.loadMetadata(languageMetadataFileName, file.getParent()); + } else { + languageMetadata = new GspMetadata(); + MetadataHeader header = new MetadataHeader(); + header.setId(UUID.randomUUID().toString()); + FileServiceImp fileService = new FileServiceImp(); + String fileNameWithoutExtension = fileService.getFileNameWithoutExtension(languageMetadataFileName); + header.setCode(fileNameWithoutExtension); + header.setName(fileNameWithoutExtension); + header.setFileName(languageMetadataFileName); + header.setNameSpace(metadata.getHeader().getNameSpace()); + header.setBizObjectId(metadata.getHeader().getBizObjectId()); + header.setType(LINGUISTIC_RESOURCE_METADATA_TYPE); + languageMetadata.setHeader(header); + } + II18nResourceDTManager i18nResourceDTManager = SpringBeanUtils.getBean(II18nResourceDTManager.class); + IMetadataContent content = i18nResourceDTManager.extract(resourceMetadata, i18nResourceMetadata); + languageMetadata.setContent(content); + if (metadataExist) { + metadataCoreManager.createMetadata(languageMetadataPath, languageMetadata); + } else { + metadataCoreManager.saveMetadata(languageMetadata, languageMetadataPath); + } + } + + private String getLanguageMetadataFileName(GspMetadata metadata) { + String language = metadata.getHeader().getLanguage(); + String metadataSuffix = getMetadataSuffix(metadata.getHeader().getType()); + String linguisticMetadataSuffix = getMetadataSuffix(LINGUISTIC_RESOURCE_METADATA_TYPE); + return metadata.getHeader().getCode() + metadataSuffix + "." + language + linguisticMetadataSuffix; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MavenUtilsCore.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MavenUtilsCore.java new file mode 100644 index 0000000..f69739e --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MavenUtilsCore.java @@ -0,0 +1,158 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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; + +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.configuration.MavenSettingsLoader; +import com.inspur.edp.lcm.metadata.common.logging.MvnStreamConsumer; +import com.inspur.edp.lcm.metadata.core.exception.MvnExceptionHandler; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import lombok.extern.slf4j.Slf4j; +import org.apache.maven.shared.invoker.DefaultInvocationRequest; +import org.apache.maven.shared.invoker.DefaultInvoker; +import org.apache.maven.shared.invoker.InvocationRequest; +import org.apache.maven.shared.invoker.InvocationResult; +import org.apache.maven.shared.utils.cli.CommandLineException; +import org.codehaus.plexus.util.StringUtils; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +/** + * @author zhaoleitr + */ +@Slf4j +public class MavenUtilsCore { + private String mavenHomePath; + + private final DefaultInvoker invoker; + + private final InvocationRequest request; + + private final MvnStreamConsumer mvnStreamConsumer; + + private String errorMessage; + + public MavenUtilsCore() { + invoker = new DefaultInvoker(); + request = new DefaultInvocationRequest(); + mvnStreamConsumer = new MvnStreamConsumer(); + } + + public boolean exeMavenCommand(String javaCodePath, String mavenPath, String goal) { + initInvoker(); + + invoker.setWorkingDirectory(new File(javaCodePath)); + + List goals = handleGoul(goal, mavenPath); + request.setGoals(goals); + + try { + mvnStreamConsumer.setExceptionString(""); + InvocationResult result = invoker.execute(request); + int resultNum = result.getExitCode(); + if (resultNum == 0) { + return true; + } + + if (resultNum == 1) { + final String exceptionString = mvnStreamConsumer.getExceptionString(); + if (!exceptionString.isEmpty()) { + MvnExceptionHandler mvnExceptionHandler = new MvnExceptionHandler(); + errorMessage = ""; + errorMessage = mvnExceptionHandler.handleMessage(exceptionString); + errorMessage = errorMessage.isEmpty() ? "maven编译失败,具体错误请参考日志服务[ERROR]部分" : errorMessage; + } + + CommandLineException executionException = result.getExecutionException(); + if (executionException != null) { + throw executionException; + } + return false; + } + } catch (Exception e) { + log.error("执行maven命令失败", e); + e.printStackTrace(); + } + return false; + } + + public String getLocalRepository() { + try { + String localRepository = MavenSettingsLoader.getSettings().getLocalRepository(); + if (localRepository != null) { + return localRepository; + } + } catch (IOException | XmlPullParserException e) { + throw new RuntimeException("获取maven本地仓库地址出错,请检查settings.xml配置", e); + } + return null; + } + + public String getErrorMessage() { + return errorMessage; + } + + private void initMavenHomePath() { + if (!StringUtils.isEmpty(mavenHomePath)) { + return; + } + + if (System.getenv("MAVEN_HOME") != null) { + mavenHomePath = System.getenv("MAVEN_HOME"); + } else if (System.getenv("M2_HOME") != null) { + mavenHomePath = System.getenv("M2_HOME"); + + invoker.setMavenHome(new File(System.getenv("M2_HOME"))); + } else { + String systemPath = System.getenv("Path"); + if (systemPath != null) { + String[] paths = systemPath.split("\\;"); + for (String path : paths) { + if (path.contains("maven")) { + mavenHomePath = path.substring(0, path.length() - 4); + } + } + } + } + if (StringUtils.isEmpty(mavenHomePath)) { + throw new IllegalArgumentException("请配置maven环境变量!MAVEN_HOME=...."); + } + } + + private List handleGoul(String goal, String mavenPath) { + List goals = new ArrayList<>(); + + StringBuilder goalSb = new StringBuilder(goal); + String settingsPath = mavenPath + File.separator + "config" + File.separator + "settings.xml"; + FileServiceImp fileService = new FileServiceImp(); + if (fileService.isFileExist(settingsPath)) { + goalSb.append(" -s ").append(settingsPath); + } else { + log.warn("配置文件" + settingsPath + "不存在,使用默认settings.xml配置"); + } + + goals.add(goalSb.toString()); + return goals; + } + + private void initInvoker() { + initMavenHomePath(); + invoker.setMavenHome(new File(mavenHomePath)); + request.setOutputHandler(mvnStreamConsumer).setBatchMode(true); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java new file mode 100644 index 0000000..046de4e --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java @@ -0,0 +1,1330 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.inspur.edp.lcm.metadata.api.ConfigData.CommonConfigData; +import com.inspur.edp.lcm.metadata.api.ConfigData.MetadataConfiguration; +import com.inspur.edp.lcm.metadata.api.context.RefCommonContext; +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.entity.Metadata4Ref; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataFilter; +import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataIndexItemDto; +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.MetadataReference; +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.entity.ProjectHeader; +import com.inspur.edp.lcm.metadata.api.entity.metadataindex.LocalMetadataIndexItem; +import com.inspur.edp.lcm.metadata.api.entity.metadataindex.MetadataIndexRepoItemDto; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataInfoFilter; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataInfoWithVersion; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataMavenInfo; +import com.inspur.edp.lcm.metadata.api.mvnEntity.PackageSourceDto; +import com.inspur.edp.lcm.metadata.api.mvnEntity.PageMetadataInfo; +import com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode.MetadataInfoFilterWithProcessMode; +import com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode.MetadataInfoWithVersionWithProcessMode; +import com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode.MetadataMavenInfoWithProcessMode; +import com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode.PageMetadataInfoWithProcessMode; +import com.inspur.edp.lcm.metadata.api.service.MdpkgService; +import com.inspur.edp.lcm.metadata.cache.MetadataDevCacheManager; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.MetadataDtoConverter; +import com.inspur.edp.lcm.metadata.common.MetadataSerializer; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.common.configuration.ContentManagerHelper; +import com.inspur.edp.lcm.metadata.common.configuration.MavenSourceRuleHelper; +import com.inspur.edp.lcm.metadata.common.configuration.MetadataConfigurationHelper; +import com.inspur.edp.lcm.metadata.common.configuration.MetadataTypeHelper; +import com.inspur.edp.lcm.metadata.common.configuration.ReferenceManagerHelper; +import com.inspur.edp.lcm.metadata.core.event.DirEventBroker; +import com.inspur.edp.lcm.metadata.core.event.MetadataCreateEventBroker; +import com.inspur.edp.lcm.metadata.core.event.MetadataEventBroker; +import com.inspur.edp.lcm.metadata.core.manager.IndexServerManager; +import com.inspur.edp.lcm.metadata.core.persistence.RepositoryFactory; +import com.inspur.edp.lcm.metadata.core.refi18n.IRefI18nFilter; +import com.inspur.edp.lcm.metadata.core.refi18n.RefI18nMetadataFactory; +import com.inspur.edp.lcm.metadata.spi.IMetadataReferenceManager; +import com.inspur.edp.lcm.metadata.spi.MetadataContentManager; +import com.inspur.edp.lcm.metadata.spi.event.DirEventArgs; +import com.inspur.edp.lcm.metadata.spi.event.MetadataEventArgs; +import com.inspur.lcm.metadata.logging.LoggerDisruptorQueue; +import io.iec.edp.caf.boot.context.CAFContext; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipInputStream; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.CollectionUtils; +import org.codehaus.plexus.util.StringUtils; + +/** + * @author zhaoleitr + */ +@Slf4j +public class MetadataCoreManager { + + private final FileServiceImp fileService = new FileServiceImp(); + private final MetadataProjectCoreService metadataProjectCoreService = new MetadataProjectCoreService(); + private final GspProjectCoreService gspProjectCoreService = new GspProjectCoreService(); + private final PackageCoreService packageCoreService = new PackageCoreService(); + private final Lock lock = new ReentrantLock(); + private static MetadataCoreManager current; + + public static MetadataCoreManager getCurrent() { + if (current == null) { + current = new MetadataCoreManager(); + } + return current; + } + + public void initializeMetadataEntity(GspMetadata metadata) { + metadata.getHeader().setId(UUID.randomUUID().toString()); + MetadataContentManager manager = ContentManagerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (manager != null) { + manager.build(metadata); + } + } + + public void createMetadata(String absolutePath, GspMetadata metadata) { + // 元数据名称 + String suffix = MetadataTypeHelper.getInstance().getMetadataType(metadata.getHeader().getType()).getPostfix(); + String name = metadata.getHeader().getCode() + suffix; + String fullPath = fileService.getCombinePath(absolutePath, name); + if (isMetadataExist(fullPath)) { + throw new RuntimeException("元数据目录" + absolutePath + "已存在元数据" + name); + } + + // 组装依赖 + buildMetadataRef(metadata); + + // 事件准备 + MetadataCreateEventBroker broker = SpringBeanUtils.getBean(MetadataCreateEventBroker.class); + MetadataEventArgs args = new MetadataEventArgs(); + args.setMetadata(metadata); + args.setPath(absolutePath); + + // 2. 保存前事件 + broker.fireMetadataCreatingEvent(args); + + RepositoryFactory.getInstance().getMetadataRepository().create(metadata, fullPath); + + // TODO创建后,需要清除元数据缓存 + // 4. 保存后事件 + broker.fireMetadataCreatedEvent(args); + } + + public void saveMetadata(GspMetadata metadata, String path) { + String dirPath = new File(path).getParent(); + + // 设置上下文路径 + Utils.setMetadataPath(dirPath); + + // 1. 组装元数据依赖关系节点 + buildMetadataRef(metadata); + + // 事件准备 + MetadataEventBroker broker = SpringBeanUtils.getBean(MetadataEventBroker.class); + MetadataEventArgs args = new MetadataEventArgs(); + args.setMetadata(metadata); + args.setPath(dirPath); + + // 2. 保存前事件 + broker.fireMetadataSavingEvent(args); + + // 获取元数据的配置信息 + MetadataConfiguration metadataConfiguration = MetadataConfigurationHelper.getInstance().getMetadataConfigurationData(metadata.getHeader().getType()); + CommonConfigData commonData = metadataConfiguration.getCommon(); + // 资源元数据 + I18nCoreService i18nCoreService = new I18nCoreService(); + if (i18nCoreService.isI18nMetadata(metadata)) { + GspMetadata resourceMetadata = i18nCoreService.extractResourceMetadata(metadata, path); + i18nCoreService.extractLanguageMetadata(metadata, resourceMetadata, path); + return; + } + + // 普通元数据需要抽取资源元数据 + if (commonData.getIsCreatingResourceMetadata() && !i18nCoreService.isI18nMetadata(metadata)) { + i18nCoreService.extractResourceMetadata(metadata, path); + } + + // 3. 把元数据保存到文件 + RepositoryFactory.getInstance().getMetadataRepository().save(metadata, path); + + // 4. 保存后事件 + broker.fireMetadataSavedEvent(args); + } + + public GspMetadata loadMetadata(String metadataFileName, String absolutePath) { + String metadataPath = fileService.getCombinePath(absolutePath, metadataFileName); + GspMetadata metadata = loadMetadata(metadataPath); + return metadata; + } + + public GspMetadata loadMetadata(String absolutePath) { + GspMetadata metadata; + if (!isMetadataExist(absolutePath)) { + throw new RuntimeException(String.format("file not exist, filePath is %s", absolutePath)); + } + try { + RefCommonContext.setInvokeAtDesignTime(true); + metadata = RepositoryFactory.getInstance().getMetadataRepository().load(absolutePath); + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + RefCommonContext.setInvokeAtDesignTime(false); + } + return metadata; + } + + public GspMetadata loadMetadataByMetadataId(String metadataId, String absolutePath) { + final List metadataList = getMetadataList(absolutePath); + GspMetadata metadata = metadataList.stream().filter(md -> md.getHeader().getId().equals(metadataId)).findFirst().orElse(null); + Utils.checkNPE(metadata, "工程" + absolutePath + "中找不到元数据" + metadataId); + metadata = loadMetadata(metadata.getHeader().getFileName(), metadata.getRelativePath()); + return metadata; + } + + public GspMetadata loadMetadataInBo(String absoluteMetadataPath, String absoluteProjPath) { + absoluteProjPath = metadataProjectCoreService.getProjPath(absoluteProjPath); + GspProject currentGspProjectInfo = gspProjectCoreService.getGspProjectInfo(absoluteProjPath); + GspProject metadataGspProjectInfo = gspProjectCoreService.getGspProjectInfo(absoluteMetadataPath); + if (!currentGspProjectInfo.getMetadataPackageName().equals(metadataGspProjectInfo.getMetadataPackageName())) { + updateBoRef(metadataGspProjectInfo, absoluteMetadataPath, absoluteProjPath); + } + File file = new File(absoluteMetadataPath); + return loadMetadata(file.getName(), file.getParent()); + } + + private void updateBoRef(GspProject gspProjInfo, String metadataFullPath, String currentProjPath) { + String projectPath = Paths.get("..").resolve(gspProjInfo.getMetadataProjectName().toLowerCase()).toString(); + updateProjectReference(currentProjPath, gspProjInfo.getMetadataPackageName() + Utils.getMetadataPackageExtension(), projectPath); + + checkCircle(currentProjPath); + MetadataProject metadataProject = metadataProjectCoreService.getMetadataProjInfo(metadataFullPath); + MetadataProject currentMetadataProject = metadataProjectCoreService.getMetadataProjInfo(currentProjPath); + metadataProjectCoreService.updateRefs(currentProjPath, currentMetadataProject, metadataProject.getMetadataPackageInfo()); + + String[] projectNameSpace = gspProjInfo.getProjectNameSpace().split("\\."); + String groupId; + if (projectNameSpace.length == 1) { + groupId = "com." + projectNameSpace[0].toLowerCase(); + } else { + groupId = "com." + (projectNameSpace[0] + "." + projectNameSpace[1]).toLowerCase(); + } + String artifactId = (gspProjInfo.getAppCode() + "-" + gspProjInfo.getServiceUnitCode() + "-" + gspProjInfo.getMetadataProjectName().replace("bo-", "") + "-api").toLowerCase(); + String packageVersion = "m0.1.0-SNAPSHOT"; + updateMavenReference(currentProjPath, groupId, artifactId, packageVersion); + } + + private void updateMavenReference(String currentProjPath, String groupId, String artifactId, + String packageVersion) { + MavenPackageRefs mavenPackageRefs = new MavenPackageRefs(); + mavenPackageRefs.setGroupId(groupId); + mavenPackageRefs.setArtifactId(artifactId); + mavenPackageRefs.setVersion(packageVersion); + MetadataProject metadataProject = metadataProjectCoreService.getMetadataProjInfo(currentProjPath); + metadataProjectCoreService.updateMavenRefs(currentProjPath, metadataProject, mavenPackageRefs); + } + + private void checkCircle(String currentProjPath) { + List chainOfRef = new ArrayList<>(); + GspProject gspProjectInfo = new GspProjectCoreService().getGspProjectInfo(currentProjPath); + + chainOfRef.add(gspProjectInfo.getMetadataProjectName().toLowerCase()); + try { + getCircle(currentProjPath, chainOfRef); + } catch (Exception e) { + throw e; + } + } + + private void getCircle(String projectPath, List chainOfRef) { + MetadataProject metadataProject = metadataProjectCoreService.getMetadataProjInfo(projectPath); + String curProjectName = metadataProject.getName().toLowerCase(); + if (metadataProject.getProjectRefs() != null && metadataProject.getProjectRefs().size() > 0) { + metadataProject.getProjectRefs().forEach(projRef -> { + String projectName = projRef.getProjectPath().replace("..\\", "").toLowerCase(); + String chain = chainOfRef.stream().filter(r -> r.endsWith(curProjectName) && Arrays.asList(r.split("->")).contains(projectName)).findFirst().orElse(null); + if (chain != null) { + chain += "->" + projectName; + throw new RuntimeException("检测到循环引用:" + chain); + } + List refs = chainOfRef.stream().filter(r -> r.endsWith(curProjectName)).collect(Collectors.toList()); + refs.forEach(r -> chainOfRef.add(r + "->" + projectName)); + List refsToRemove = chainOfRef.stream().filter(r -> r.endsWith(curProjectName)).collect(Collectors.toList()); + refsToRemove.forEach(r -> chainOfRef.remove(r)); + + String refProjectPath = Paths.get(metadataProjectCoreService.getProjPath(projectPath)).resolve(projRef.getProjectPath()).toString(); + getCircle(refProjectPath, chainOfRef); + }); + } + } + + private void updateProjectReference(String currentProjPath, String packageName, String packagePath) { + ProjectHeader projectHeader = new ProjectHeader(); + projectHeader.setName(fileService.getFileNameWithoutExtension(packageName)); + projectHeader.setProjectPath(packagePath); + MetadataProject metadataProject = metadataProjectCoreService.getMetadataProjInfo(currentProjPath); + metadataProjectCoreService.updateProjectRefs(currentProjPath, metadataProject, projectHeader); + } + + public GspMetadata getRefMetadata(String metadataID, String absolutePath) { + if (absolutePath != null && !absolutePath.isEmpty()) { + Utils.setMetadataPath(absolutePath); + } + RefCommonServiceImp refCommonService = new RefCommonServiceImp(); + return refCommonService.getRefMetadata(metadataID); + } + + public GspMetadata getMetadataWithoutContent(String absolutePath) { + return RepositoryFactory.getInstance().getMetadataRepository().getMetadataWithoutContent(absolutePath); + } + + public void deleteMetadata(String absolutePath, String metadataFileName) { + String fullPath = fileService.getCombinePath(absolutePath, metadataFileName); + if (!isMetadataExist(fullPath)) { + return; + } + // 如果不是元数据,则直接删除文件,如ts文件 + if (!isMetadata(fullPath)) { + try { + fileService.fileDelete(fullPath); + } catch (IOException e) { + e.printStackTrace(); + } + return; + } + + GspMetadata metadataWithoutContent = getMetadataWithoutContent(fullPath); + + // 事件准备 + MetadataEventBroker broker = SpringBeanUtils.getBean(MetadataEventBroker.class); + MetadataEventArgs args = new MetadataEventArgs(); + args.setMetadata(metadataWithoutContent); + args.setPath(fullPath); + + // 删除前事件 + broker.fireMetadataDeletingEvent(args); + + RepositoryFactory.getInstance().getMetadataRepository().delete(fullPath); + + broker.fireMetadataDeletedEvent(args); + } + + public void deleteFolder(String absolutePath) { + DirEventBroker broker = SpringBeanUtils.getBean(DirEventBroker.class); + DirEventArgs args = new DirEventArgs(); + args.setPath(absolutePath); + + broker.fireDirDeletingEvent(args); + + try { + fileService.deleteAllFilesUnderDirectory(absolutePath); + } catch (IOException e) { + e.printStackTrace(); + } + + broker.fireDirDeletedEvent(args); + } + + public void renameMetadata(String oldFileName, String newFileName, String absolutePath) { + if (oldFileName.equals(newFileName)) { + return; + } + String oldFilePath = fileService.getCombinePath(absolutePath, oldFileName); + if (!isMetadataExist(oldFilePath)) { + throw new RuntimeException("元数据不存在:" + oldFilePath); + } + String newFilePath = fileService.getCombinePath(absolutePath, newFileName); + if (!isMetadataExist(newFilePath)) { + throw new RuntimeException("新元数据已存在:" + newFilePath); + } + + validateMetadataCode(newFileName.substring(0, newFileName.lastIndexOf("\\.")), false); + RepositoryFactory.getInstance().getMetadataRepository().rename(oldFilePath, newFilePath); + + // 修改文件内容,将 元数据头结点元数据名称一起修改 + GspMetadata metadata = loadMetadata(newFileName, absolutePath); + metadata.getHeader().setName(newFileName.substring(0, newFileName.lastIndexOf("\\."))); + RepositoryFactory.getInstance().getMetadataRepository().save(metadata, newFilePath); + } + + private void validateMetadataCode(String code, boolean isLanguageMetadata) { + if (code.length() > 255) { + throw new RuntimeException("编号不可长于255个字符:" + code); + } + String rexStr = isLanguageMetadata ? "^[a-zA-Z_-\\x7f-\\xff][a-zA-Z0-9-._\\x7f-\\xff]*$" : "^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9._\\x7f-\\xff]*$"; + if (!Pattern.matches(rexStr, code)) { + throw new RuntimeException("编号含有违法字符:" + code); + } + } + + public List getMetadataListInBo(String projPath, List metadataTypes) { + List projectsInBo = metadataProjectCoreService.getProjectsInBo(projPath); + + // 生成型只能引用生成型,解析型可以引用生成型和解析型 + final MetadataProject metadataProjInfo = metadataProjectCoreService.getMetadataProjInfo(projPath); + boolean isGenerationFlag = metadataProjInfo.getMetadataPackageInfo().getProcessMode() == null || metadataProjInfo.getMetadataPackageInfo().getProcessMode().equals(ProcessMode.GENERATION); + + if (isGenerationFlag) { + projectsInBo = projectsInBo.stream().filter(project -> { + MetadataProject metadataProjInfoInBo = metadataProjectCoreService.getMetadataProjInfo(project); + return metadataProjInfoInBo.getMetadataPackageInfo().getProcessMode() == null || metadataProjInfoInBo.getMetadataPackageInfo().getProcessMode().equals(ProcessMode.GENERATION); + }).collect(Collectors.toList()); + } + + // 获取列表,生成型只能引用生成型,解析型可以引用生成型和解析型 + List metadataList = new ArrayList<>(); + projectsInBo.forEach(project -> { + MetadataProject metadataProjInfoInBo = metadataProjectCoreService.getMetadataProjInfo(project); + if (isGenerationFlag) { + boolean isEachProjectGenerationFlag = metadataProjInfoInBo.getMetadataPackageInfo().getProcessMode() == null || metadataProjInfoInBo.getMetadataPackageInfo().getProcessMode().equals(ProcessMode.GENERATION); + if (!isEachProjectGenerationFlag) { + return; + } + } + String metadataProjPath = project + File.separator + Utils.getMetadataProjPath(); + List result = getMetadataList(metadataProjPath, metadataTypes); + for (GspMetadata metadata : result) { + MetadataDto metadataDto = MetadataDtoConverter.asDto(metadata); + metadataDto.setProjectName(new File(project).getName()); + metadataDto.setProcessMode(metadataProjInfoInBo.getMetadataPackageInfo().getProcessMode() == null ? ProcessMode.GENERATION.toString() : metadataProjInfoInBo.getMetadataPackageInfo().getProcessMode().toString()); + metadataList.add(metadataDto); + } + }); + return metadataList; + } + + public List getMetadataList(String absolutePath, List metadataTypes) { + // 编译时缓存可用 + List metadataList = MetadataDevCacheManager.getMetadataListInProject(absolutePath); + if (metadataList != null) { + return metadataList; + } + metadataList = new ArrayList<>(); + List paths = new ArrayList<>(); + //获取目录下的所有文件路径 + RepositoryFactory.getInstance().getMetadataRepository().getMetadatasUnderDir(paths, absolutePath); + List metadataAllTypes = Utils.getMetadataPostfixTypes(); + List metadataTypeList = (metadataTypes == null || metadataTypes.size() == 0) ? metadataAllTypes : metadataTypes; + for (String path : paths) { + String extension = fileService.getExtension(path).toLowerCase(); + String result = metadataTypeList.stream().filter(item -> item.toLowerCase().equals(extension)).findAny().orElse(null); + if (result != null) { + GspMetadata metadataWithoutContent = getMetadataWithoutContent(path); + if (metadataWithoutContent != null) { + metadataList.add(metadataWithoutContent); + } + } + } + return metadataList; + } + + public List getMetadataTypeList() { + return MetadataTypeHelper.getInstance().getMetadataTypes(); + } + + public boolean isMetadataExist(String absolutePath) { + return fileService.isFileExist(absolutePath); + } + + public boolean isMetadataExistInProject(String projPath, String metadataID) { + MetadataProject metadataProjInfo = metadataProjectCoreService.getMetadataProjInfo(projPath); + if (Objects.isNull(metadataProjInfo)) { + return false; + } + List metadataList = getMetadataList(metadataProjInfo.getProjectPath()); + return metadataList.stream().anyMatch(metadata -> metadata.getHeader().getId().equals(metadataID)); + } + + public String getRefPath(String absolutePath) { + MetadataProject metadataProjInfo = metadataProjectCoreService.getMetadataProjInfo(absolutePath); + return fileService.getCombinePath(metadataProjInfo.getProjectPath(), Utils.getMetadataBinPath()); + } + + public MetadataHeader getRefMetadataHeader(String metadataID, String absolutePath) { + GspMetadata metadata = getRefMetadata(metadataID, absolutePath); + Utils.checkNPE(metadata, "在工程" + absolutePath + "及其依赖中,无法找到元数据" + metadataID); + return metadata.getHeader(); + } + + public List getResourceMetadata(String metadataId, String proPath) { + final List metadataList = getMetadataList(proPath); + GspMetadata metadata = new GspMetadata(); + if (metadataList != null) { + for (GspMetadata item : metadataList) { + if (item.getHeader().getId().equals(metadataId)) { + metadata = item; + break; + } + } + } + List metadataHeader = new ArrayList<>(); + if (metadata.getRefs() != null) { + metadata.getRefs().forEach(item -> { + if ("ResourceMetadata".equals(item.getDependentMetadata().getType())) { + metadataHeader.add(item.getDependentMetadata()); + } + }); + } + return metadataHeader; + } + + public void setMetadataUri(String absolutePath) { + Utils.setMetadataPath(absolutePath); + } + + public GspMetadata getI18nMetadata(String fileName, String absolutePath, String language) { + I18nCoreService i18nCoreService = new I18nCoreService(); + return i18nCoreService.getI18nMetadata(fileName, absolutePath, language); + } + + public List getRefI18nMetadata(String resourceMdID, String resourceFileName, String path, + String mavenPath, String packagePath) { + RefI18nMetadataFactory refI18nMetadataFactory = new RefI18nMetadataFactory(); + IRefI18nFilter filter = refI18nMetadataFactory.createFilter(resourceMdID, path); + return filter.getRefI18nMetadata(resourceMdID, resourceFileName, path, mavenPath, packagePath); + } + + public List getMetadataList(String absolutePath) { + //先从缓存获取 + String projPath = metadataProjectCoreService.getProjPath(absolutePath); + if (StringUtils.isEmpty(projPath)) { + return null; + } + String projectName = new File(projPath).getName(); + List metadataListCache = MetadataDevCacheManager.getMetadataListInProject(projectName); + if (!CollectionUtils.isEmpty(metadataListCache)) { + return metadataListCache; + } + List metadataList = new ArrayList<>(); + List paths = new ArrayList<>(); + //获取目录下的所有文件路径 + RepositoryFactory.getInstance().getMetadataRepository().getMetadatasUnderDir(paths, absolutePath); + List metadataAllTypes = Utils.getMetadataPostfixTypes(); + for (String path : paths) { + //获取文件后缀名 + String extension = fileService.getExtension(path).toLowerCase(); + boolean flag = false; + for (String item : metadataAllTypes) { + if (item.toLowerCase().equals(extension)) { + flag = true; + break; + } + } + if (flag) { + GspMetadata metadataWithoutContent = getMetadataWithoutContent(path); + if (metadataWithoutContent != null) { + metadataList.add(metadataWithoutContent); + } + } + } +// if (!CollectionUtils.isEmpty(metadataList)) { +// MetadataDevCacheManager.setMetadataListInProjectCache(projectName, metadataList); +// } + return metadataList; + } + + public MetadataPackage getMetadataPackageInfo(String packageFileName, String packagePath) { + String packageFullName = Utils.handlePackageName(packageFileName); + + String absolutePath = fileService.getCombinePath(packagePath, packageFullName); + if (fileService.isFileExist(absolutePath)) { + MetadataPackage metadataPackage = getMetadataPackage(packagePath, absolutePath); + metadataPackage.getHeader().setLocation(Utils.handlePath(packagePath)); + return metadataPackage; + } else { + List dirs = fileService.getDirectorys(packagePath); + for (File dir : dirs) { + String targetFile = fileService.getCombinePath(dir.getPath(), packageFullName); + if (fileService.isFileExist(targetFile)) { + MetadataPackage metadataPackage = getMetadataPackage(packagePath, targetFile); + metadataPackage.getHeader().setLocation(Utils.handlePath(dir.getPath())); + return metadataPackage; + } + } + } + + return null; + } + + public List getMetadataListByRefedMetadataId(String path, String metadataId) { + List metadataList = new ArrayList<>(); + List projPaths = metadataProjectCoreService.getProjPathsInBoByRefedProjPath(path); + projPaths.add(path); + projPaths.forEach(projPath -> { + List metadataListInProject = getMetadataList(projPath); + metadataList.addAll(metadataListInProject.stream().filter(metadata -> { + if (metadata.getRefs() == null) { + return false; + } + return metadata.getRefs().stream().anyMatch(ref -> ref.getDependentMetadata().getId().equals(metadataId)); + }).collect(Collectors.toList())); + }); + return metadataList; + } + + public boolean isMetadataRefed(String path) { + if (!isMetadata(path)) { + return false; + } + final GspMetadata metadataWithoutContent = getMetadataWithoutContent(path); + final String projPath = metadataProjectCoreService.getProjPath(path); + final Map> metadataHashMapByRefedMetadataId = getMetadataHashMapByRefedMetadataId(projPath, metadataWithoutContent.getHeader().getId()); + boolean isMetadataRefedFlag = metadataHashMapByRefedMetadataId != null && metadataHashMapByRefedMetadataId.size() > 0; + if (isMetadataRefedFlag) { + metadataHashMapByRefedMetadataId.forEach((projName, metadataList) -> { + metadataList.forEach(metadata -> { + String log = "[LCM Warning]工程【" + projName + "】中的元数据【" + metadata.getHeader().getFileName() + "】依赖了此元数据"; + LoggerDisruptorQueue.publishEvent(log, CAFContext.current.getUserId()); + }); + }); + } + return isMetadataRefedFlag; + } + + private boolean isMetadata(String path) { + List metadataTypeList = getMetadataTypeList(); + return metadataTypeList.stream().anyMatch(metadataType -> path.endsWith(metadataType.getPostfix())); + } + + private Map> getMetadataHashMapByRefedMetadataId(String path, String metadataId) { + Map> metadataHashMap = new HashMap<>(); + List projPaths = metadataProjectCoreService.getProjPathsInBoByRefedProjPath(path); + projPaths.add(path); + projPaths.forEach(projPath -> { + List metadataListInProject = getMetadataList(projPath); + List metadataList = metadataListInProject.stream().filter(metadata -> { + if (metadata.getRefs() == null) { + return false; + } + return metadata.getRefs().stream().anyMatch(ref -> ref.getDependentMetadata().getId().equals(metadataId)); + }).collect(Collectors.toList()); + if (metadataList != null && metadataList.size() > 0) { + metadataHashMap.put(new File(projPath).getName(), metadataList); + } + }); + return metadataHashMap; + } + + public Metadata4Ref getMetadataFromPackage(String packageName, String packagePath, String metadataId) { + String packageFullName = Utils.handlePackageName(packageName); + + MetadataPackage packageInfo = getMetadataPackageInfo(packageFullName, packagePath); + if (packageInfo == null) { + return null; + } + GspMetadata metadata = null; + String absolutePath = fileService.getCombinePath(packageInfo.getHeader().getLocation(), packageFullName); + for (GspMetadata item : packageInfo.getMetadataList()) { + if (item.getHeader().getId().equals(metadataId)) { + + lock.lock(); + try { + StringBuilder sb = new StringBuilder(); + File file = new File(absolutePath); + ZipFile zf = new ZipFile(file); + InputStream in = new BufferedInputStream(new FileInputStream(absolutePath)); + Charset utf8 = StandardCharsets.UTF_8; + ZipInputStream zin = new ZipInputStream(in, utf8); + ZipEntry ze; + while ((ze = zin.getNextEntry()) != null) { + BufferedReader br = new BufferedReader( + new InputStreamReader(zf.getInputStream(ze), utf8)); + try { + if (fileService.getFileName(ze.toString()).equals(fileService.getFileName(item.getRelativePath()))) { + String line; + while ((line = br.readLine()) != null) { + sb.append(line); + } + } + } catch (IOException e) { +// e.printStackTrace(); + throw new IOException("读取元数据失败", e); + } finally { + br.close(); + } + } + zin.closeEntry(); + zin.close(); + in.close(); + zf.close(); + metadata = new MetadataSerializer().deserialize(sb.toString(), GspMetadata.class); + + } catch (IOException | RuntimeException e) { + log.error("反序列化元数据失败,路径为:" + packagePath + "包名为:" + packageName, e); +// e.printStackTrace(); + throw new RuntimeException("反序列化元数据失败,路径为:" + packagePath + "包名为:" + packageName, e); + } finally { + lock.unlock(); +// } + } + } + } + Metadata4Ref metadataDt = new Metadata4Ref(); + metadataDt.setPackageHeader(packageInfo.getHeader()); + metadataDt.setMetadata(metadata); + + return metadataDt; + } + + public MetadataProject getMetadataProjInfo(String absolutePath) { + String assemblyName = ""; + MetadataProject project; + String projPath = MetadataProjectCoreService.getCurrent().getProjPath(absolutePath); + String metadataPath = fileService.getCombinePath(projPath, Utils.getMetadataProjPath()); + if (fileService.isDirectoryExist(metadataPath)) { + GspProject gspProject = new GspProjectCoreService().getGspProjectInfo(absolutePath); + assemblyName = gspProject.getMetadataPackageName(); + } + project = metadataProjectCoreService.getMetadataProjInfo(projPath); + project.setCsprojAssemblyName(assemblyName); + return project; + } + + public List getRemoteMetadataIndexList(String text, String path, String selectedPackageSource, + List typeList, boolean page, int pageSize, int pageIndex, boolean isFilterByRefs, + boolean conflictAvoidFlag) { + Utils.checkEmpty(path, "获取的路径为空:" + path); + MetadataProject metadataProjInfo = getMetadataProjInfo(path); + + if (metadataProjInfo != null) { + if (isFilterByRefs && (metadataProjInfo.getMavenPackageRefs() == null || metadataProjInfo.getMavenPackageRefs().size() == 0)) { + return new ArrayList<>(); + } + } + + try { + String pageWebapiOfIndexServer = IndexServerManager.getInstance().getPageWebapiOfIndexServerWithProcessMode(); + // pageWebapiOfIndexServer = pageWebapiOfIndexServer.replace("10.24.15.33", "localhost"); + ProcessMode processMode = metadataProjInfo.getMetadataPackageInfo().getProcessMode() == null ? ProcessMode.GENERATION : metadataProjInfo.getMetadataPackageInfo().getProcessMode(); + MetadataInfoFilterWithProcessMode filter = getMetadataInfoFilter(text, typeList, page, pageSize, pageIndex, selectedPackageSource, path, isFilterByRefs, processMode); + PageMetadataInfoWithProcessMode pageMetadataInfoWithProcessMode = RestTemplateService.instance.getObjectByPost(pageWebapiOfIndexServer, filter); + List metadataInfos = pageMetadataInfoWithProcessMode.getMetadataInfos(); + return buildIndexDtoFromMetadataInfoWithVersionWithProcessMode(metadataInfos); + + } catch (Exception e) { + String pageWebapiOfIndexServer = IndexServerManager.getInstance().getPageWebapiOfIndexServer(); + // pageWebapiOfIndexServer = pageWebapiOfIndexServer.replace("10.24.15.33", "localhost"); + MetadataInfoFilter filter = getMetadataInfoFilter(text, typeList, page, pageSize, pageIndex, selectedPackageSource, path, isFilterByRefs); + PageMetadataInfo pageMetadataInfo = RestTemplateService.instance.getObjectByPost(pageWebapiOfIndexServer, filter); + List metadataInfos = pageMetadataInfo.getMetadataInfos(); + return buildIndexDtoFromMetadataInfoWithVersion(metadataInfos); + } + } + + public void throwMetadataNotFoundException(String metadataId) { + final MetadataInfoWithVersion metadataInfoWithVersion = getIndexByMetadataId(metadataId); + StringBuilder sb = new StringBuilder(); + sb.append("未找到元数据:"); + sb.append(metadataId); + if (metadataInfoWithVersion != null) { + sb.append(",元数据Code为:"); + sb.append(metadataInfoWithVersion.getMetadataCode()); + sb.append(",元数据包名为:"); + sb.append(metadataInfoWithVersion.getPackageCode()).append(Utils.getMetadataPackageExtension()); + } + String msg = sb.toString(); + log.error(msg); + throw new RuntimeException(msg); + } + + private MetadataInfoWithVersion getIndexByMetadataId(String metadataId) { + String metadataWebapiOfIndexServer = IndexServerManager.getInstance().getMetadataWebapiOfIndexServer() + "?metadataId=" + metadataId; + List metadataInfoWithVersionList = RestTemplateService.instance.getObjectByGet(metadataWebapiOfIndexServer); + if (metadataInfoWithVersionList != null && metadataInfoWithVersionList.size() > 0) { + return metadataInfoWithVersionList.get(0); + } + return null; + } + + public List getLocalMetadataList(String text, String absolutePath, List typeList, + boolean page, int pageSize, int pageIndex, String packagePath) { + List mds = new ArrayList<>(); + // 根据索引,返回元数据dto列表 + List localMdIndexList = MetadataIndexCacheService.getInstance().getLocalPackagesMdIndexDic(packagePath); + + if (localMdIndexList == null || localMdIndexList.size() < 1) { + return mds; + } + + // 解析型 + final MetadataProject metadataProjInfo = getMetadataProjInfo(absolutePath); + boolean isGenerationFlag = metadataProjInfo.getMetadataPackageInfo().getProcessMode() == null || metadataProjInfo.getMetadataPackageInfo().getProcessMode().equals(ProcessMode.GENERATION); + + if (isGenerationFlag) { + localMdIndexList = localMdIndexList.stream().filter(localMetadataIndexItem -> localMetadataIndexItem.getProcessMode() == null || localMetadataIndexItem.getProcessMode().equals(ProcessMode.GENERATION.toString())).collect(Collectors.toList()); + } + + String packageNameExcluded = ""; + if (!(absolutePath == null || absolutePath.isEmpty())) { + MetadataProject projInfo = metadataProjectCoreService.getMetadataProjInfo(absolutePath); + if (projInfo != null) { + packageNameExcluded = projInfo.getMetadataPackageInfo().getName(); + } + if (!page) { + for (LocalMetadataIndexItem localMdIndex : localMdIndexList) { + if (isPackMd(localMdIndex, typeList, text, packageNameExcluded)) { + MetadataIndexItemDto dto = assemblyMetadataIndexItemDto(localMdIndex); + mds.add(dto); + } + } + } else { + int count = 0; + int skip = pageIndex * pageSize; + int max = pageSize + skip; + for (LocalMetadataIndexItem localMdIndex : localMdIndexList) { + if (count >= max) { + break; + } + if (isPackMd(localMdIndex, typeList, text, packageNameExcluded)) { + count++; + if (count <= skip) { + continue; + } + MetadataIndexItemDto dto = assemblyMetadataIndexItemDto(localMdIndex); + mds.add(dto); + } + } + + } + } + return mds; + } + + public Metadata4RefDto pickMetadataIndex(int scopeType, String absolutePath, + MetadataIndexItemDto metadataIndexItemDto, boolean isNeedMdDto, String packagePath, String mavenPath) { + Metadata4Ref result; + switch (scopeType) { + case 1: + result = pickLocalMdIndex(absolutePath, metadataIndexItemDto, isNeedMdDto, packagePath); + break; + // 远程maven中的元数据包 + case 2: + result = pickRemoteMdIndex(absolutePath, metadataIndexItemDto, isNeedMdDto, packagePath, mavenPath); + break; + // 已引用的元数据包 + case 3: + result = pickRefedMdIndex(absolutePath, metadataIndexItemDto, isNeedMdDto, packagePath, mavenPath); + break; + default: + throw new IllegalArgumentException("Scope is invalid."); + } + if (result == null) { + return null; + } + MetadataDto metadataDto = MetadataDtoConverter.asDto(result.getMetadata()); + Metadata4RefDto dto = new Metadata4RefDto(); + dto.setPackageHeader(result.getPackageHeader()); + dto.setMetadata(metadataDto); + return dto; + } + + public String getIndexServerStatus(String ip, String port) { + final String testStatusWebapiIndexServer = IndexServerManager.getInstance().getTestStatusWebapiOfIndexServer(ip, port); + return RestTemplateService.instance.getStatusByGet(testStatusWebapiIndexServer); + } + + public void buildMetadataRef(GspMetadata metadata) { + //TODO:考虑添加依赖关系是否变更标志,现在每次都需要获取依赖关系保存 + //构造元数据依赖关系 + IMetadataReferenceManager refManager = ReferenceManagerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (refManager != null) { + List refsCollection = refManager.getConstraint(metadata); + metadata.setRefs(refsCollection); + } + } + + private Metadata4Ref pickRefedMdIndex(String currentPath, MetadataIndexItemDto metadataIndexItemDto, + boolean isNeedMdDto, String packagePath, String mavenPath) { + validateRemoteMdIndex(metadataIndexItemDto); + MetadataProject metadataProject = getMetadataProjInfo(currentPath); + Utils.checkNPE(metadataProject, "Path is invalid project folder:" + currentPath); + + String groupId = metadataIndexItemDto.getRepoPkg().get(0).getGroupId(); + String artifactId = metadataIndexItemDto.getRepoPkg().get(0).getArtifactId(); + String version = metadataIndexItemDto.getRepoPkg().get(0).getVersion(); + + MavenPackageRefs ref = new MavenPackageRefs(); + ref.setGroupId(groupId); + ref.setArtifactId(artifactId); + ref.setVersion(version); + boolean installFlag = packageCoreService.getInstallFlag(ref, false, mavenPath, packagePath); + if (installFlag) { + try { + packageCoreService.installMdpkg(groupId, artifactId, version, currentPath, true, mavenPath, packagePath); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + Metadata4Ref metadata = null; + if (isNeedMdDto) { + String metadataPackagePath = fileService.getCombinePath(mavenPath, groupId + '-' + artifactId + '-' + version); + metadata = getMetadataFromPackage(metadataIndexItemDto.getMdPkgName(), metadataPackagePath, metadataIndexItemDto.getId()); + Utils.checkNPE(metadata, metadataPackagePath + "中的原数据包" + metadataIndexItemDto.getMdPkgName() + "不包含此元数据:" + metadataIndexItemDto.getId()); + } + + return metadata; + } + + private Metadata4Ref pickRemoteMdIndex(String currentPath, MetadataIndexItemDto metadataIndexItemDto, + boolean isNeedMdDto, String packagePath, String mavenPath) { + validateRemoteMdIndex(metadataIndexItemDto); + MetadataProject metadataProject = getMetadataProjInfo(currentPath); + Utils.checkNPE(metadataProject, "Path is invalid project folder:" + currentPath); + + String groupId = metadataIndexItemDto.getRepoPkg().get(0).getGroupId(); + String artifactId = metadataIndexItemDto.getRepoPkg().get(0).getArtifactId(); + String version = metadataIndexItemDto.getRepoPkg().get(0).getVersion(); + + MavenPackageRefs ref = new MavenPackageRefs(); + ref.setGroupId(groupId); + ref.setArtifactId(artifactId); + ref.setVersion(version); + + // 安装的包是生成型的才需要安装jar + boolean isGenerationFlag = metadataIndexItemDto.getProcessMode() == null || metadataIndexItemDto.getProcessMode().isEmpty() || metadataIndexItemDto.getProcessMode().equals(ProcessMode.GENERATION.toString()); + boolean installFlag = packageCoreService.getInstallFlag(ref, true, mavenPath, packagePath); + if (installFlag) { + try { + packageCoreService.installMdpkg(groupId, artifactId, version, currentPath, isGenerationFlag, mavenPath, packagePath); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + Metadata4Ref metadata = null; + if (isNeedMdDto) { + String metadataPackagePath = fileService.getCombinePath(mavenPath, groupId + '-' + artifactId + '-' + version); + metadata = getMetadataFromPackage(metadataIndexItemDto.getMdPkgName(), metadataPackagePath, metadataIndexItemDto.getId()); + Utils.checkNPE(metadata, metadataPackagePath + "中的原数据包" + metadataIndexItemDto.getMdPkgName() + "不包含此元数据:" + metadataIndexItemDto.getId()); + } + + MetadataPackageHeader metadataPackageHeader = new MetadataPackageHeader(); + metadataPackageHeader.setName(fileService.getFileNameWithoutExtension(metadataIndexItemDto.getMdPkgName())); + metadataPackageHeader.setVersion(new MetadataPackageVersion("1.0.0")); + ProcessMode processMode = isGenerationFlag ? ProcessMode.GENERATION : ProcessMode.INTERPRETATION; + metadataPackageHeader.setProcessMode(processMode); + metadataProjectCoreService.updateRefs(currentPath, metadataProject, metadataPackageHeader); + metadataProjectCoreService.updateMavenRefs(currentPath, metadataProject, ref); + + return metadata; + } + + private void validateRemoteMdIndex(MetadataIndexItemDto metadataIndexItemDto) { + if (metadataIndexItemDto.getRepoPkg() == null || metadataIndexItemDto.getRepoPkg().size() < 1) { + throw new IllegalArgumentException("未指定仓库包。"); + } + } + + private Metadata4Ref pickLocalMdIndex(String currentPath, MetadataIndexItemDto metadataIndexItemDto, + boolean isNeedMdDto, String packagePath) { + String mdPkgName = metadataIndexItemDto.getMdPkgName(); + String mdPkgFullName = mdPkgName + Utils.getMetadataPackageExtension(); + // 获取工程信息 + MetadataProject metadataProject = getMetadataProjInfo(currentPath); + Utils.checkNPE(metadataProject, "Path is invalid project folder:" + currentPath); + // 本地是否存在 + if (!MetadataIndexCacheService.getInstance().isExistInLocalPackages(mdPkgName)) { + throw new IllegalArgumentException("Local package: " + mdPkgName + " not exists"); + } + + Metadata4Ref metadata = null; + if (isNeedMdDto) { + String metadataPackagePath = fileService.getCombinePath(packagePath, mdPkgFullName); + metadata = getMetadataFromPackage(mdPkgFullName, metadataPackagePath, metadataIndexItemDto.getId()); + Utils.checkNPE(metadata, metadataPackagePath + "中的元数据包" + metadataIndexItemDto.getMdPkgName() + "不包含此元数据:" + metadataIndexItemDto.getId()); + } + + MetadataPackageHeader metadataPackageHeader = new MetadataPackageHeader(); + metadataPackageHeader.setName(mdPkgName); + metadataPackageHeader.setVersion(new MetadataPackageVersion("1.0.0")); + metadataProjectCoreService.updateRefs(currentPath, metadataProject, metadataPackageHeader); + + return metadata; + } + + private List buildIndexDtoFromMetadataInfoWithVersion( + List versions) { + if (versions.size() < 1) { + return new ArrayList<>(); + } + List dtos = new ArrayList<>(); + versions.forEach(version -> { + MetadataIndexItemDto indexDto = new MetadataIndexItemDto(); + indexDto.setId(version.getMetadataId()); + indexDto.setCode(version.getMetadataCode()); + indexDto.setName(version.getMetadataName()); + indexDto.setNameSpace(version.getMetadataNamespace()); + indexDto.setType(version.getMetadataType()); + indexDto.setBizobjectID(version.getMdBizobjectId()); + indexDto.setLanguage(version.getMetadataLanguage()); + indexDto.setTranslating(version.getMetadataIsTranslating() != null && "true".equals(version.getMetadataIsTranslating())); + indexDto.setMdPkgName(version.getPackageCode() + ".mdpkg"); + List metadataIndexRepoItemDtoList = new ArrayList<>(); + version.getMavenInfos().forEach(maveninfo -> { + MetadataIndexRepoItemDto metadataIndexRepoItemDto = new MetadataIndexRepoItemDto(); + metadataIndexRepoItemDto.setGroupId(maveninfo.getMavenPackageGroupId()); + metadataIndexRepoItemDto.setArtifactId(maveninfo.getMavenPackageArtifactId()); + metadataIndexRepoItemDto.setVersion("m" + maveninfo.getMavenPackageVersion()); + metadataIndexRepoItemDto.setUrl(maveninfo.getMavenPackageUrl()); + metadataIndexRepoItemDto.setProcessMode(ProcessMode.GENERATION.toString()); + metadataIndexRepoItemDtoList.add(metadataIndexRepoItemDto); + }); + if ((version.getMavenInfos() == null || version.getMavenInfos().size() < 1)) { + indexDto.setRepoPkg(new ArrayList<>()); + } else { + indexDto.setRepoPkg(metadataIndexRepoItemDtoList); + } + dtos.add(indexDto); + }); + return dtos; + } + + private List buildIndexDtoFromMetadataInfoWithVersionWithProcessMode( + List versions) { + if (versions.size() < 1) { + return new ArrayList<>(); + } + List dtos = new ArrayList<>(); + versions.forEach(version -> { + MetadataIndexItemDto indexDto = new MetadataIndexItemDto(); + indexDto.setId(version.getMetadataId()); + indexDto.setCode(version.getMetadataCode()); + indexDto.setName(version.getMetadataName()); + indexDto.setNameSpace(version.getMetadataNamespace()); + indexDto.setType(version.getMetadataType()); + indexDto.setBizobjectID(version.getMdBizobjectId()); + indexDto.setLanguage(version.getMetadataLanguage()); + indexDto.setTranslating(version.getMetadataIsTranslating() != null && "true".equals(version.getMetadataIsTranslating())); + indexDto.setMdPkgName(version.getPackageCode() + ".mdpkg"); + indexDto.setProcessMode(version.getProcessMode()); + List metadataIndexRepoItemDtoList = new ArrayList<>(); + version.getMavenInfos().forEach(maveninfo -> { + MetadataIndexRepoItemDto metadataIndexRepoItemDto = new MetadataIndexRepoItemDto(); + metadataIndexRepoItemDto.setGroupId(maveninfo.getMavenPackageGroupId()); + metadataIndexRepoItemDto.setArtifactId(maveninfo.getMavenPackageArtifactId()); + metadataIndexRepoItemDto.setVersion("m" + maveninfo.getMavenPackageVersion()); + metadataIndexRepoItemDto.setUrl(maveninfo.getMavenPackageUrl()); + metadataIndexRepoItemDto.setProcessMode(maveninfo.getProcessMode()); + metadataIndexRepoItemDtoList.add(metadataIndexRepoItemDto); + }); + if ((version.getMavenInfos() == null || version.getMavenInfos().size() < 1)) { + indexDto.setRepoPkg(new ArrayList<>()); + } else { + indexDto.setRepoPkg(metadataIndexRepoItemDtoList); + } + dtos.add(indexDto); + }); + return dtos; + } + + private MetadataInfoFilter getMetadataInfoFilter(String text, List typePostfixList, boolean page, + int pageSize, int pageIndex, String selectedPackageSource, String projPath, boolean isFilterByRefs) { + + MetadataInfoFilter metadataInfoFilter = new MetadataInfoFilter(); + metadataInfoFilter.setCodeOrName(text); + metadataInfoFilter.setPageable(page); + metadataInfoFilter.setPageSize(pageSize); + metadataInfoFilter.setPageIndex(pageIndex); + // 检查类型是否正确 + List metadataTypes = new ArrayList<>(); + if (typePostfixList != null && typePostfixList.size() > 0) { + List typeList = getMetadataTypeList(); + typeList.forEach(type -> { + if (typePostfixList.contains(type.getPostfix().toLowerCase())) { + metadataTypes.add(type.getTypeCode().toLowerCase()); + } + }); + metadataInfoFilter.setMetadataTypes(metadataTypes); + } + // packageSources + List packageSrouceList = new ArrayList<>(); + if (selectedPackageSource != null && !selectedPackageSource.isEmpty()) { + MdpkgService mdpkgService = SpringBeanUtils.getBean(MdpkgService.class); + List packageSourceDtoList = mdpkgService.getRepoList().getRepoList(); + if ("All".equals(selectedPackageSource)) { + for (PackageSourceDto packageSourceDto : packageSourceDtoList) { + packageSrouceList.add(packageSourceDto.getSourceUrl()); + } + } else { + for (PackageSourceDto packageSourceDto : packageSourceDtoList) { + if (packageSourceDto.getId() != null) { + if (packageSourceDto.getId().equals(selectedPackageSource)) { + packageSrouceList.add(packageSourceDto.getSourceUrl()); + } + } + } + } + metadataInfoFilter.setPackageSources(getEntitySources(packageSrouceList)); + } + + // 获取自己的metadataCode + MetadataProject projInfo = null; + if (!(projPath == null || projPath.isEmpty())) { + projInfo = getMetadataProjInfo(projPath); + metadataInfoFilter.setPackageCodeExcluded(projInfo.getMetadataPackageInfo().getName()); + } + + // 获取MavenRefPackages + List refsList = new ArrayList<>(); + if (projInfo != null && isFilterByRefs) { + if (projInfo.getMavenPackageRefs() != null && projInfo.getMavenPackageRefs().size() > 0) { + for (MavenPackageRefs ref : projInfo.getMavenPackageRefs()) { + MetadataMavenInfo packageRef = new MetadataMavenInfo(); + packageRef.setMavenPackageGroupId(ref.getGroupId()); + packageRef.setMavenPackageArtifactId(ref.getArtifactId()); + packageRef.setMavenPackageVersion(ref.getVersion().substring(1)); + refsList.add(packageRef); + } + } + } + metadataInfoFilter.setRefPackages(refsList); + + return metadataInfoFilter; + } + + private MetadataInfoFilterWithProcessMode getMetadataInfoFilter(String text, List typePostfixList, + boolean page, int pageSize, int pageIndex, String selectedPackageSource, String projPath, + boolean isFilterByRefs, ProcessMode processMode) { + MetadataInfoFilterWithProcessMode metadataInfoFilterWithProcessMode = new MetadataInfoFilterWithProcessMode(); + metadataInfoFilterWithProcessMode.setCodeOrName(text); + metadataInfoFilterWithProcessMode.setPageable(page); + metadataInfoFilterWithProcessMode.setPageSize(pageSize); + metadataInfoFilterWithProcessMode.setPageIndex(pageIndex); + // 检查类型是否正确 + List metadataTypes = new ArrayList<>(); + if (typePostfixList != null && typePostfixList.size() > 0) { + List typeList = getMetadataTypeList(); + typeList.forEach(type -> { + if (typePostfixList.contains(type.getPostfix().toLowerCase())) { + metadataTypes.add(type.getTypeCode().toLowerCase()); + } + }); + metadataInfoFilterWithProcessMode.setMetadataTypes(metadataTypes); + } + // packageSources + List packageSrouceList = new ArrayList<>(); + if (selectedPackageSource != null && !selectedPackageSource.isEmpty()) { + MdpkgService mdpkgService = SpringBeanUtils.getBean(MdpkgService.class); + List packageSourceDtoList = mdpkgService.getRepoList().getRepoList(); + if ("All".equals(selectedPackageSource)) { + for (PackageSourceDto packageSourceDto : packageSourceDtoList) { + packageSrouceList.add(packageSourceDto.getSourceUrl()); + } + } else { + for (PackageSourceDto packageSourceDto : packageSourceDtoList) { + if (packageSourceDto.getId() != null) { + if (packageSourceDto.getId().equals(selectedPackageSource)) { + packageSrouceList.add(packageSourceDto.getSourceUrl()); + } + } + } + } + metadataInfoFilterWithProcessMode.setPackageSources(getEntitySources(packageSrouceList)); + } + + // 获取自己的metadataCode + MetadataProject projInfo = null; + if (!(projPath == null || projPath.isEmpty())) { + projInfo = getMetadataProjInfo(projPath); + metadataInfoFilterWithProcessMode.setPackageCodeExcluded(projInfo.getMetadataPackageInfo().getName()); + } + + // 获取MavenRefPackages + List refsList = new ArrayList<>(); + if (projInfo != null && isFilterByRefs) { + if (projInfo.getMavenPackageRefs() != null && projInfo.getMavenPackageRefs().size() > 0) { + for (MavenPackageRefs ref : projInfo.getMavenPackageRefs()) { + MetadataMavenInfoWithProcessMode packageRef = new MetadataMavenInfoWithProcessMode(); + packageRef.setMavenPackageGroupId(ref.getGroupId()); + packageRef.setMavenPackageArtifactId(ref.getArtifactId()); + packageRef.setMavenPackageVersion(ref.getVersion().substring(1)); + refsList.add(packageRef); + } + } + } + metadataInfoFilterWithProcessMode.setRefPackages(refsList); + + metadataInfoFilterWithProcessMode.setProcessMode(processMode.equals(ProcessMode.GENERATION) ? ProcessMode.GENERATION.toString() : "All"); + + return metadataInfoFilterWithProcessMode; + } + + private List getEntitySources(List packageSrouceList) { + List entitySources = new ArrayList<>(); + Map> mavenSourceRule = MavenSourceRuleHelper.getInstance().getMavenSourceRuleMap(); + if (mavenSourceRule != null && mavenSourceRule.size() > 0) { + for (String source : packageSrouceList) { + String key = source.split("/")[source.split("/").length - 1]; + if (mavenSourceRule.containsKey(key)) { + entitySources.addAll(mavenSourceRule.get(key)); + } else { + entitySources.add(source); + } + } + } + return entitySources.stream().distinct().collect(Collectors.toList()); + } + + private boolean isPackMd(LocalMetadataIndexItem item, List typeList, String text, + String packageNameExcluded) { + + boolean isPack = false; + if (typeList == null || typeList.contains(fileService.getExtension(item.getFileName().toLowerCase()))) { + if (item.getMdPkgName().equals(packageNameExcluded)) { + return false; + } + if (text == null || text.isEmpty()) { + isPack = true; + } else { + if (isMath(item.getCode(), text)) { + isPack = true; + } else if (isMath(item.getName(), text)) { + isPack = true; + } else if (isMath(item.getMdPkgName(), text)) { + isPack = true; + } else if (isMath(item.getNameSpace(), text)) { + isPack = true; + } + } + } + return isPack; + } + + private boolean isMath(String a, String b) { + if (a == null || a.isEmpty()) { + return false; + } + return a.toLowerCase().contains(b.toLowerCase()); + } + + private MetadataIndexItemDto assemblyMetadataIndexItemDto(LocalMetadataIndexItem mdIndexDto) { + MetadataIndexItemDto dto = new MetadataIndexItemDto(); + dto.setId(mdIndexDto.getId()); + dto.setName(mdIndexDto.getName()); + dto.setCode(mdIndexDto.getCode()); + dto.setFileName(mdIndexDto.getFileName()); + dto.setNameSpace(mdIndexDto.getNameSpace()); + dto.setMdPkgName(mdIndexDto.getMdPkgName()); + dto.setType(mdIndexDto.getType()); + dto.setRelativePath(mdIndexDto.getRelativePath()); + String processMode = mdIndexDto.getProcessMode() == null || mdIndexDto.getProcessMode().isEmpty() || mdIndexDto.getProcessMode().equals(ProcessMode.GENERATION.toString()) ? ProcessMode.GENERATION.toString() : ProcessMode.INTERPRETATION.toString(); + dto.setProcessMode(processMode); + if (mdIndexDto.getRepoPkg() != null) { + MetadataIndexRepoItemDto metadataIndexRepoItemDto = new MetadataIndexRepoItemDto(); + metadataIndexRepoItemDto.setGroupId(mdIndexDto.getRepoPkg().getGroupId()); + metadataIndexRepoItemDto.setArtifactId(mdIndexDto.getRepoPkg().getArtifactId()); + metadataIndexRepoItemDto.setVersion(mdIndexDto.getRepoPkg().getVersion()); + List list = new ArrayList<>(); + list.add(metadataIndexRepoItemDto); + dto.setRepoPkg(list); + } + return dto; + } + + private MetadataPackage getMetadataPackage(String defaultPackagePath, String absolutePath) { + lock.lock(); + try { + StringBuilder sb = new StringBuilder(); + File file = new File(absolutePath); + ZipFile zf = new ZipFile(file); + InputStream in = new BufferedInputStream(new FileInputStream(absolutePath)); + Charset utf8 = StandardCharsets.UTF_8; + ZipInputStream zin = new ZipInputStream(in, utf8); + ZipEntry ze; + while ((ze = zin.getNextEntry()) != null) { + try (BufferedReader br = new BufferedReader( + new InputStreamReader(zf.getInputStream(ze), utf8))) { + if (ze.toString().equals(Utils.getManifestFileName())) { + String line; + while ((line = br.readLine()) != null) { + sb.append(line); + } + } + } catch (IOException e) { + throw new IOException("读取元数据失败", e); + } + } + zin.closeEntry(); + zin.close(); + in.close(); + zf.close(); + ObjectMapper objectMapper = Utils.getMapper(); + return objectMapper.readValue(sb.toString(), MetadataPackage.class); + } catch (IOException e) { + throw new RuntimeException("反序列化元数据失败", e); + } finally { + lock.unlock(); + } + } + + public boolean validateRepeatName(String absolutePath, String fileName) { + String combinePath = fileService.getCombinePath(absolutePath, fileName); + return !isMetadataExist(combinePath); + } + + public List getMetadataByFilter(String absolutePath, MetadataFilter metadataFilter) { + List typeList = new ArrayList<>(); + if (metadataFilter.getMetadataPostfix() != null && !metadataFilter.getMetadataPostfix().isEmpty()) { + String[] types = metadataFilter.getMetadataPostfix().split(","); + typeList = Arrays.asList(types); + } + List metadataList = getMetadataList(absolutePath, typeList); + // TODO 加上各元数据自己的过滤器 + return metadataList; + } + + public void removeMetadataListCache(String absoluteProjPath) { + MetadataProjectCoreService projectCoreService = new MetadataProjectCoreService(); + String projPath = projectCoreService.getProjPath(absoluteProjPath); + if (!StringUtils.isEmpty(projPath)) { + String projName = (new File(projPath)).getName(); + MetadataDevCacheManager.removeMetadataListInProject(projName); + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataIndexCacheService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataIndexCacheService.java new file mode 100644 index 0000000..a977bd6 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataIndexCacheService.java @@ -0,0 +1,346 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.LocalRepoPkg; +import com.inspur.edp.lcm.metadata.api.entity.MdPkg; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.entity.metadataindex.LocalMetadataIndexItem; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; +import lombok.extern.slf4j.Slf4j; + +/** + * 元数据索引服务 + * + * @author zhaoleitr + */ +@Slf4j +public class MetadataIndexCacheService { + private static MetadataIndexCacheService singleton = null; + + private final FileServiceImp fileServiceImp = new FileServiceImp(); + + private MetadataIndexCacheService() { + resetLocalPackagesMdIndex(); + resetLocalRepoCacheMdIndex(); + } + + public static MetadataIndexCacheService getInstance() { + if (singleton == null) { + singleton = new MetadataIndexCacheService(); + } + return singleton; + } + + /** + * 本地元数据包中元数据<元数据标识,元数据信息缓存项> + */ + private Map localPackagesMdIndexDic; + /** + * <元数据包编码.mdpkg, 元数据标识列表>,规则元数据包code + */ + private Map localPackagesMdPkgIndexDic; + + /** + * 本地NugetPkg缓存中元数据索引 <元数据标识_nuget version,元数据信息缓存项> + */ + private Map localRepoCacheMdIndexDic; + + /** + * + */ + private Map localRepoCacheMdPkgIndexDic; + + /** + * + */ + public List getLocalPackagesMdIndexDic(String packagePath) { + refreshLocalPackageMdIndex(packagePath); + return new ArrayList<>(localPackagesMdIndexDic.values()); + } + + private static Lock lock = new ReentrantLock(); + private Map localRepoCachePkgIndexDic; + + public Map getLocalRepoCachePkgIndexDic() { +// refreshLocalRepoCache(); + return new ConcurrentHashMap<>(localRepoCachePkgIndexDic); + } + + private void refreshLocalRepoCache(String mavenPath) { + lock.lock(); + try { + // 1. 对比本地元数据包是否为最新,是否有增删 + String mavenPackageLocation = mavenPath; + if (fileServiceImp.isDirectoryExist(mavenPackageLocation)) { + resetLocalRepoCacheMdIndex(); + return; + } + Map mavenPkgDirs = new HashMap(); + fileServiceImp.getDirectorys(mavenPackageLocation).forEach(dir -> { + mavenPkgDirs.put(dir.getName(), dir); + }); + // nuget包缓存索引信息 + List localMavenPkgCacheIndexList = new ArrayList<>(); + for (Map.Entry key : localRepoCachePkgIndexDic.entrySet()) { + localMavenPkgCacheIndexList.add(key.getKey()); + } + // 2. 如果1中有更新,更新索引 + // 删掉的 + if (mavenPkgDirs.size() < 1) { + if (localMavenPkgCacheIndexList.size() > 0) { + resetLocalRepoCacheMdIndex(); + } + } else if (localMavenPkgCacheIndexList.size() > 0) { + for (String mavenPkgIndex : localMavenPkgCacheIndexList) { + if (!mavenPkgDirs.containsKey(mavenPkgIndex)) { + deleteLocalRepoCachePkgIndex(mavenPkgIndex); + } + } + } + // 新增的 +// if (mavenPkgDirs.size() > 0) { +// for(Map.Entry entry : mavenPkgDirs.entrySet()){ +// String mavenPkgDir = entry.getKey(); +// String mavenPkgPath = entry.getValue(); +// } +// } + } finally { + lock.unlock(); + } + } + + private void deleteLocalRepoCachePkgIndex(String mavenPkgName) { + lock.lock(); + try { + toDeleteLocalRepoCachePkgIndex(mavenPkgName); + } finally { + lock.unlock(); + } + + } + + private void toDeleteLocalRepoCachePkgIndex(String mavenPkgName) { + LocalRepoPkg localRepoPkg = localRepoCachePkgIndexDic.get(mavenPkgName); + if (localRepoPkg != null && localRepoPkg.getMdPkgs() != null && localRepoPkg.getMdPkgs().size() > 0) { + localPackagesMdPkgIndexDic.remove(mavenPkgName); + for (MdPkg mdPkg : localRepoPkg.getMdPkgs()) { + MdPkg mdpkg = localRepoCacheMdPkgIndexDic.get(makeKey(mdPkg.getMdPkgName(), localRepoPkg.getVersion())); + if (mdpkg != null && mdpkg.getMetadataIds() != null && mdpkg.getMetadataIds().size() > 0) { + localRepoCacheMdPkgIndexDic.remove(makeKey(mdPkg.getMdPkgName(), localRepoPkg.getVersion())); + mdpkg.getMetadataIds().forEach(id -> { + if (localPackagesMdIndexDic.get(id) != null) { + localRepoCacheMdIndexDic.remove(makeKey(id, localRepoPkg.getVersion())); + } + }); + } + } +// mdPkg.getMetadataIds().forEach(id->{ +// if (localPackagesMdIndexDic.get(id) != null) { +// localPackagesMdIndexDic.remove(id); +// } +// }); + } + } + + private String makeKey(String a, String b) { + return a + "_" + b; + } + + private void resetLocalRepoCacheMdIndex() { + localRepoCacheMdIndexDic = new ConcurrentHashMap<>(); + localRepoCacheMdPkgIndexDic = new ConcurrentHashMap<>(); + localRepoCachePkgIndexDic = new ConcurrentHashMap<>(); + } + + /*** + * 更新pakcages目录索引 + * @author zhongchq + **/ + private void refreshLocalPackageMdIndex(String packagePath) { + lock.lock(); + // 1. 对比本地元数据包是否为最新,是否有增删 + try { + String metadataPackageLocation = packagePath; + if (!fileServiceImp.isDirectoryExist(metadataPackageLocation)) { + resetLocalPackagesMdIndex(); + return; + } + List mdPkgDirInfoNames = fileServiceImp.getDirectorys(metadataPackageLocation); + //缓存目录下元数据文件名 + List mdPkgFileInfoNames = new ArrayList<>(); + mdPkgDirInfoNames.forEach(dirname -> { + fileServiceImp.getAllFiles(dirname.toString()).forEach(file -> { + mdPkgFileInfoNames.add(file.getName()); + }); + }); + // 元数据包文件索引信息 + List localMdPkgCodeList = new ArrayList<>(); + for (Map.Entry key : localPackagesMdPkgIndexDic.entrySet()) { + localMdPkgCodeList.add(key.getKey()); + } + // 2. 如果1中有更新,更新索引 + // 删掉的 + if (mdPkgFileInfoNames.size() < 1) { + if (localMdPkgCodeList.size() > 0) { + resetLocalPackagesMdIndex(); + } + } else if (localMdPkgCodeList.size() > 0) { + localMdPkgCodeList.forEach(mdPkgCode -> { + if (!mdPkgFileInfoNames.contains(mdPkgCode)) { + deleteLocalPackagesMdPkgIndex(mdPkgCode); + } + }); + } + // 新增的 + if (mdPkgFileInfoNames.size() > 0) { + mdPkgFileInfoNames.forEach(mdPkgFileInfoName -> { + if (!localMdPkgCodeList.contains(mdPkgFileInfoName)) { + MetadataPackage mdPkg; + mdPkg = new MetadataCoreManager().getMetadataPackageInfo(mdPkgFileInfoName, packagePath); + try { + if (!(mdPkg.getMetadataList() == null || + mdPkg.getMetadataList().size() < 1)) { + List items = new ArrayList<>(); + for (GspMetadata gspMetadata : mdPkg.getMetadataList()) { + items.add(assemblyLocalMdIndexItem(gspMetadata, mdPkg, null)); + } + MdPkg mdPkgCache = assemblyLocalMdPkg(mdPkg, items); + addLocalPackagesMdIndex(mdPkgCache, items); + } + } catch (Exception e) { + log.error("Parse Error: " + mdPkgFileInfoName); + e.printStackTrace(); + } + } + }); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + lock.unlock(); + } + } + + private void addLocalPackagesMdIndex(MdPkg mdPkg, List items) { + lock.lock(); + try { + localPackagesMdPkgIndexDic.put(mdPkg.getMdPkgName() + Utils.getMetadataPackageExtension(), mdPkg); + if (items != null && items.size() > 0) { + items.forEach(item -> { + localPackagesMdIndexDic.put(item.getId(), item); + }); + } + } finally { + lock.unlock(); + } + } + + private MdPkg assemblyLocalMdPkg(MetadataPackage mdPkg, List items) { + + List depMdPkgs = new ArrayList<>(); + if (mdPkg.getReference() != null && mdPkg.getReference().size() > 0) { + mdPkg.getReference().forEach(mdRef -> { + MdPkg md = new MdPkg(); + md.setMdPkgName(mdRef.getDepententPackage().getName()); + depMdPkgs.add(md); + }); + } + MdPkg result = new MdPkg(); + result.setMdPkgName(mdPkg.getHeader().getName()); + result.setDepMdPkgs(depMdPkgs); + HashSet hashSet = new HashSet<>(); + items.forEach(item -> { + hashSet.add(item.getId()); + }); + result.setMetadataIds(items.size() < 1 ? new HashSet<>() : hashSet); + return result; + } + + private LocalMetadataIndexItem assemblyLocalMdIndexItem(GspMetadata md, MetadataPackage mdPkg, + LocalRepoPkg repoPkg) { + if (md == null) { + return null; + } + if (md.getHeader() == null) { + return null; + } + LocalMetadataIndexItem item = new LocalMetadataIndexItem(); + item.setId(md.getHeader().getId()); + item.setCode(md.getHeader().getCode()); + item.setName(md.getHeader().getName()); + item.setNameSpace(md.getHeader().getNameSpace()); + item.setFileName(md.getHeader().getFileName()); + item.setType(md.getHeader().getType()); + item.setMdPkgName(mdPkg.getHeader().getName()); + item.setProcessMode(mdPkg.getHeader().getProcessMode() == null ? ProcessMode.GENERATION.toString() : mdPkg.getHeader().getProcessMode().toString()); + item.setRelativePath(md.getRelativePath()); + if (repoPkg != null) { + item.setRepoPkg(repoPkg); + } + return item; + } + + private void deleteLocalPackagesMdPkgIndex(String mdPkgName) { + lock.lock(); + try { + MdPkg mdPkg = localPackagesMdPkgIndexDic.get(mdPkgName); + if (mdPkg != null) { + localPackagesMdPkgIndexDic.remove(mdPkgName); + mdPkg.getMetadataIds().forEach(id -> { + if (localPackagesMdIndexDic.get(id) != null) { + localPackagesMdIndexDic.remove(id); + } + }); + } + } finally { + lock.unlock(); + } + } + + private void resetLocalPackagesMdIndex() { + lock.lock(); + try { + localPackagesMdIndexDic = new ConcurrentHashMap<>(); + localPackagesMdPkgIndexDic = new ConcurrentHashMap<>(); + } finally { + lock.unlock(); + } + } + + public boolean isExistInLocalPackages(String pkgName) { + + if (pkgName == null || pkgName.isEmpty()) { + return false; + } + if (!pkgName.endsWith(Utils.getMetadataPackageExtension())) { + pkgName = pkgName + Utils.getMetadataPackageExtension(); + } + return localPackagesMdPkgIndexDic.containsKey(pkgName); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectCoreService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectCoreService.java new file mode 100644 index 0000000..327e871 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectCoreService.java @@ -0,0 +1,776 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.entity.ProjectHeader; +import com.inspur.edp.lcm.metadata.api.entity.bo.BOInfo; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Graph; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.common.Vertex; +import com.inspur.edp.lcm.metadata.core.entity.MdprojInfoDto; +import com.inspur.edp.lcm.metadata.core.persistence.RepositoryFactory; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import io.iec.edp.caf.businessobject.api.entity.DevBasicBoInfo; +import io.iec.edp.caf.businessobject.api.service.DevBasicInfoService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.File; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Stack; +import java.util.concurrent.ConcurrentHashMap; +import lombok.var; +import org.codehaus.plexus.util.StringUtils; + +public class MetadataProjectCoreService { + private static MetadataProjectCoreService current; + + public static MetadataProjectCoreService getCurrent() { + if (current == null) { + current = new MetadataProjectCoreService(); + } + return current; + } + + private final FileServiceImp fileService = new FileServiceImp(); + + public void create(String projectPath, String projectName, String projectNameSpace, String packageName, + String processMode) { + try { + MetadataProject metadataProject = RepositoryFactory.getInstance().getMetadataProjectRepository().assmbllyMetadataProj(projectName, projectNameSpace, packageName); + + // 解析型 + metadataProject.getMetadataPackageInfo().setProcessMode(ProcessMode.valueOf(processMode)); + + String metadataProjStr = buildMetadataProjectStr(metadataProject); + + RepositoryFactory.getInstance().getMetadataProjectRepository().add(projectPath, metadataProjStr); + } catch (Exception e) { + throw new RuntimeException("元数据工程创建报错", e); + } + } + + public void createGspProject(String absolutePath, GspProject projectData) { + // 将GSPProject实体转为文件流 + String projectStr = buildGspProjectStr(projectData); + //全路径 + String projectPath = Paths.get(absolutePath).resolve(Utils.getGspProjectName()).toString(); + RepositoryFactory.getInstance().getMetadataProjectRepository().add(projectPath, projectStr); + } + + private String buildMetadataProjectStr(MetadataProject metadataProject) { + try { + ObjectMapper mapper = Utils.getMapper(); + return mapper.writeValueAsString(metadataProject); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + } + + private String buildGspProjectStr(GspProject gspProject) { + try { + ObjectMapper mapper = Utils.getMapper(); + return mapper.writeValueAsString(gspProject); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + } + + public void rename(String absolutePath, String oldName, String newName) { + try { + Utils.checkEmpty(oldName, "oldName"); + Utils.checkEmpty(newName, "newName"); + Utils.checkEmpty(absolutePath, "absolutePath"); + String oldFilePath = Paths.get(absolutePath).resolve(oldName).toString(); + //要重命名的文件不存在 + if (!fileService.isFileExist(oldFilePath)) { + throw new RuntimeException("文件不存在" + oldFilePath); + } else if (!Utils.nameValidating(newName)) { + throw new RuntimeException("文件命名不规范" + newName); + } else if (oldName.equals(newName)) { + return; + } + + String newFilePath = Paths.get(absolutePath).resolve(newName).toString(); + //已经存在新名称的文件 + if (fileService.isFileExist(newFilePath)) { + throw new RuntimeException("文件已经存在" + newFilePath); + } + //重命名 + fileService.fileRename(oldFilePath, newFilePath); + //修改文件内容 + //RepositoryFactory.getInstance().getMetadataProjectRepository().updateBaseInfo(newFilePath, newName); + } catch (Exception e) { + throw new RuntimeException("工程重命名失败", e); + } + } + + public MetadataProject getMetadataProjInfo(String absolutePath) { + String projPath = getProjPath(absolutePath); + if (StringUtils.isEmpty(projPath)) { + return null; + } + absolutePath = fileService.getCombinePath(projPath, Utils.getMetadataProjPath()); + if (isExistProjFile(absolutePath)) { + return getMetadataProjDirectly(absolutePath); + } else { + List projPathList = new LinkedList<>(); + return getMetadataProjRecursively(absolutePath, projPathList); + } + } + + public ProcessMode getProcessMode(String absolutePath) { + final MetadataProject metadataProjInfo = getMetadataProjInfo(absolutePath); + Utils.checkNPE(metadataProjInfo, "无法获取元数据工程信息:" + absolutePath); + return metadataProjInfo.getMetadataPackageInfo().getProcessMode() == null ? ProcessMode.GENERATION : metadataProjInfo.getMetadataPackageInfo().getProcessMode(); + } + + public boolean metadataChangesDetected(String absolutePath) { + Map metadataModifiedTime = getMetadataModifiedTime(absolutePath); + Map> sourceDataModifiedTime = getSourceDataModifiedTime(absolutePath); + if (sourceDataModifiedTime.get("metadata").size() == metadataModifiedTime.size()) { + for (String key : metadataModifiedTime.keySet()) { + if (!metadataModifiedTime.get(key).equals(sourceDataModifiedTime.get("metadata").get(key))) { + return true; + } + } + } else { + return true; + } + return false; + } + + public boolean isExistProjFile(String absolutePath) { + List files = fileService.getAllFiles(absolutePath); + if (files == null || files.size() == 0) { + return false; + } + for (File file : files) { + if (file.getName().equals(Utils.getGspProjectName())) { + return true; + } + } + + return false; + } + + public MetadataProject getMetadataProjRecursively(String absolutePath, List projectPath) { + if (absolutePath.isEmpty()) { + return null; + } + + List files = fileService.getAllFiles(absolutePath); + // 目录下没文件,继续往上级目录下找 + if (files == null || files.size() == 0) { + String parentPath = absolutePath.substring(0, absolutePath.lastIndexOf('/')); + return getMetadataProjRecursively(parentPath, projectPath); + } else { + // 遍历目录下的文件 + for (File item : files) { + if (fileService.getExtension(Utils.handlePath(item.getPath())).equals(Utils.getMetadataProjSuffix())) { + if (!projectPath.contains(Utils.handlePath(item.getPath()))) { + projectPath.add(Utils.handlePath(item.getPath())); + } + } + } + if (projectPath.size() == 1) { // 如果找到工程文件且仅有一个则返回不再查找 + String projStr = fileService.fileRead(projectPath.get(0)); + + String projPath = projectPath.get(0).substring(0, projectPath.get(0).lastIndexOf('/')); + String projFileName = projectPath.get(0).substring(projectPath.get(0).lastIndexOf('/') + 1); + ObjectMapper objectMapper = Utils.getMapper(); + MetadataProject project; + try { + project = objectMapper.readValue(projStr, MetadataProject.class); + project.setProjectPath(projPath); + project.setProjectFileName(projFileName); + project.setCsprojAssemblyName(project.getMetadataPackageInfo().getName()); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + return project; + } else if (projectPath.size() > 1) { // 如果同一目录下有两个工程文件,则不知道更新哪个,抛异常 + try { + throw new IOException("同一目录下有两个工程文件"); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } else { // 没找到,则继续往上层查找 + String parentPath = absolutePath.substring(0, absolutePath.lastIndexOf('/')); + if (parentPath.isEmpty()) { + return null; + } + return getMetadataProjRecursively(parentPath, projectPath); + } + } + } + + public Map getMetadataModifiedTime(String absolutePath) { + Map metadataModifiedTime = new HashMap<>(); + List metadataPaths = new ArrayList<>(); + //获取目录下的所有文件路径 + RepositoryFactory.getInstance().getMetadataRepository().getMetadatasUnderDir(metadataPaths, absolutePath); + for (String metadataPath : metadataPaths) { + String extension = fileService.getExtension(metadataPath).toLowerCase(); + String result = Utils.getMetadataPostfixTypes().stream().filter(item -> item.toLowerCase().equals(extension)).findAny().orElse(null); + if (result != null) { + String metadataAbsoulutePath = Utils.handlePath(metadataPath); + metadataModifiedTime.put(metadataAbsoulutePath.replace(absolutePath, "."), new File(metadataAbsoulutePath).lastModified()); + } + } + return metadataModifiedTime; + } + + public boolean codeChangesDetected(String absolutePath, String type) { + Map codeModifiedTime = new HashMap<>(); + if ("api_src".equals(type)) { + Map apiSrcModifiedTime = getCodeModifiedTime(absolutePath, "api_src"); + return apiSrcModifiedTime == null || apiSrcModifiedTime.size() == 0 || apiSrcModifiedTime.containsKey("nofile"); + } + + if ("api".equals(type)) { + Map apiSrcModifiedTime = getCodeModifiedTime(absolutePath, "api_src"); + Map apiTargetModifiedTime = getCodeModifiedTime(absolutePath, "api_target"); + codeModifiedTime.putAll(apiSrcModifiedTime); + codeModifiedTime.putAll(apiTargetModifiedTime); + } else { + codeModifiedTime = getCodeModifiedTime(absolutePath, type); + } + Map> sourceDataModifiedTime = getSourceDataModifiedTime(absolutePath); + if (sourceDataModifiedTime.get(type) != null && sourceDataModifiedTime.get(type).size() == codeModifiedTime.size()) { + for (String key : codeModifiedTime.keySet()) { + if (!codeModifiedTime.get(key).equals(sourceDataModifiedTime.get(type).get(key))) { + return true; + } + } + } else { + return true; + } + return false; + } + + public Map> getSourceDataModifiedTime(String absolutePath) { + return RepositoryFactory.getInstance().getMetadataProjectRepository().getSourceData(absolutePath).get("modifiedtime"); + } + + public void setSourceDataModifiedTime(String projPath, List types) { + try { + Map>> sourceDataModifiedTime = getSourceDataModifiedTime(projPath, types); + RepositoryFactory.getInstance().getMetadataProjectRepository().setSourceData(projPath, sourceDataModifiedTime); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void getRefProjPaths(String absolutePath, List refProjPaths) { + absolutePath = getProjPath(absolutePath); + MetadataProject metadataProjInfo = getMetadataProjInfo(absolutePath); + if (metadataProjInfo != null && metadataProjInfo.getProjectRefs() != null && metadataProjInfo.getProjectRefs().size() > 0) { + for (ProjectHeader projectHeader : metadataProjInfo.getProjectRefs()) { + String refProjPath = fileService.getCombinePath(absolutePath, projectHeader.getProjectPath()); + if (fileService.isDirectoryExist(refProjPath) && !refProjPaths.contains(refProjPath)) { + refProjPaths.add(refProjPath); + getRefProjPaths(refProjPath, refProjPaths); + } + } + } + } + + public List getBuildOrder(Map mdprojInfoDtos) { + List projectsBuildOrder = new ArrayList<>(); + + Graph graph = new Graph<>(true); + for (String mdpkgName : mdprojInfoDtos.keySet()) { + graph.addVertex(mdpkgName, 0); + getDirectedGraph(mdpkgName, graph, mdprojInfoDtos); + } + + Stack> buildOrder = graph.getTopoSort(); + for (Vertex vertex : buildOrder) { + projectsBuildOrder.add(mdprojInfoDtos.get(vertex.getLabel()).getProjPath()); + } + return projectsBuildOrder; + } + + private void getDirectedGraph(String mdpkgName, Graph graph, Map mdprojInfoDtos) { + MetadataProject metadataProjInfo = mdprojInfoDtos.get(mdpkgName).getMetadataProject(); + if (metadataProjInfo.getMetadataPackageRefs() != null && metadataProjInfo.getMetadataPackageRefs().size() > 0) { + for (MetadataPackageHeader metadataPackageHeader : metadataProjInfo.getMetadataPackageRefs()) { + if (mdprojInfoDtos.containsKey(metadataPackageHeader.getName()) && graph.addVertex(metadataPackageHeader.getName(), 0)) { + graph.addEdge(mdpkgName, metadataPackageHeader.getName(), 0); + getDirectedGraph(metadataPackageHeader.getName(), graph, mdprojInfoDtos); + } + } + } + } + + public List getBuildOrder(String absolutePath) { + List projectsBuildOrder = new ArrayList<>(); + + MetadataProject metadataProjInfo = getMetadataProjInfo(absolutePath); + if (metadataProjInfo == null || metadataProjInfo.getProjectRefs() == null || metadataProjInfo.getProjectRefs().size() == 0 || metadataProjInfo.getMavenPackageRefs() == null || metadataProjInfo.getMavenPackageRefs().size() == 0) { + projectsBuildOrder.add(absolutePath); + return projectsBuildOrder; + } + + Graph graph = new Graph<>(true); + graph.addVertex(absolutePath, 0); + getDirectedGraph(absolutePath, graph); + Stack> buildOrder = graph.getTopoSort(); + for (Vertex vertex : buildOrder) { + projectsBuildOrder.add(vertex.getLabel()); + } + return projectsBuildOrder; + } + + private void getDirectedGraph(String projPath, Graph graph) { + MetadataProject metadataProjInfo = getMetadataProjInfo(projPath); + if (metadataProjInfo != null && metadataProjInfo.getProjectRefs() != null && metadataProjInfo.getProjectRefs().size() > 0 && metadataProjInfo.getMavenPackageRefs() != null && metadataProjInfo.getMavenPackageRefs().size() > 0) { + for (ProjectHeader projectHeader : metadataProjInfo.getProjectRefs()) { + String depProjPath = Utils.handlePath(fileService.getCombinePath(projPath, projectHeader.getProjectPath())); + if (fileService.isDirectoryExist(depProjPath)) { + graph.addVertex(depProjPath, 0); + graph.addEdge(projPath, depProjPath, 0); + getDirectedGraph(depProjPath, graph); + } + } + } + } + + public void updateMavenRefVersion(String projPath, MetadataProject metadataProj, + MavenPackageRefs mavenPackageRefs) { + if (metadataProj.getMavenPackageRefs() == null) { + metadataProj.setMavenPackageRefs(new ArrayList<>()); + } + boolean findIt = false; + if (metadataProj.getMavenPackageRefs().size() > 0) { + for (MavenPackageRefs mavenPackageRef : metadataProj.getMavenPackageRefs()) { + if (mavenPackageRef.getArtifactId().equals(mavenPackageRefs.getArtifactId())) { + if (mavenPackageRef.getVersion().equals(mavenPackageRefs.getVersion())) { + return; + } + findIt = true; + mavenPackageRef.setVersion(mavenPackageRefs.getVersion()); + break; + } + } + } + if (!findIt) { + metadataProj.getMavenPackageRefs().add(mavenPackageRefs); + } + Utils.writeValue(projPath, metadataProj); + } + + public void updateRefs(String projPath, MetadataProject metadataProj, MetadataPackageHeader packageHeader) { + RepositoryFactory.getInstance().getMetadataProjectRepository().updateRefs(projPath, metadataProj, packageHeader); + } + + public void updateProjectRefs(String projPath, MetadataProject metadataProj, ProjectHeader projectHeader) { + RepositoryFactory.getInstance().getMetadataProjectRepository().updateProjectRefs(projPath, metadataProj, projectHeader); + } + + public void updateMavenRefs(String projPath, MetadataProject metadataProj, MavenPackageRefs packageRefs) { + RepositoryFactory.getInstance().getMetadataProjectRepository().updateMavenRefs(projPath, metadataProj, packageRefs); + } + + public Map>> getSourceDataModifiedTime(String absolutePath, + List types) { + + Map>> sourceDataModifiedTime = RepositoryFactory.getInstance().getMetadataProjectRepository().getSourceData(absolutePath); + if (types.contains("metadata")) { + Map metadataModifiedTime = getMetadataModifiedTime(absolutePath); + sourceDataModifiedTime.get("modifiedtime").put("metadata", metadataModifiedTime); + } + if (types.contains("api_src")) { + Map apiSrcModifiedTime = getCodeModifiedTime(absolutePath, "api_src"); + sourceDataModifiedTime.get("modifiedtime").put("api_src", apiSrcModifiedTime); + } + if (types.contains("api")) { + Map apiModifiedTime = new HashMap<>(); + Map apiSrcModifiedTime = getCodeModifiedTime(absolutePath, "api_src"); + Map apiTargetModifiedTime = getCodeModifiedTime(absolutePath, "api_target"); + apiModifiedTime.putAll(apiSrcModifiedTime); + apiModifiedTime.putAll(apiTargetModifiedTime); + sourceDataModifiedTime.get("modifiedtime").put("api", apiModifiedTime); + } + if (types.contains("comp")) { + Map compModifiedTime = getCodeModifiedTime(absolutePath, "comp"); + sourceDataModifiedTime.get("modifiedtime").put("comp", compModifiedTime); + } + if (types.contains("runtime")) { + Map runtimeModifiedTime = getCodeModifiedTime(absolutePath, "runtime"); + sourceDataModifiedTime.get("modifiedtime").put("runtime", runtimeModifiedTime); + } + return sourceDataModifiedTime; + } + + public Map getCodeModifiedTime(String absolutePath, String type) { + Map codeModifiedTime = new HashMap<>(); + String relativePath = ""; + switch (type) { + case "api_src": + relativePath = Utils.getApiSourceDir(); + break; + case "api_target": + relativePath = Utils.getApiTargetDir(); + break; + case "comp": + relativePath = Utils.getCompModuleDir(); + break; + case "runtime": + relativePath = Utils.getRuntimeSourceDir(); + break; + default: + break; + } + String codePath = fileService.getCombinePath(absolutePath, relativePath); + if (!fileService.isDirectoryExist(codePath)) { + codeModifiedTime.put("nofile", (long) 0); + return codeModifiedTime; + } + //获取目录下的所有文件路径 + List filePaths = new ArrayList<>(); + getAllFilesUnderDir(filePaths, codePath); + for (String filePath : filePaths) { + codeModifiedTime.put(filePath.replace(absolutePath, "."), new File(filePath).lastModified()); + } + return codeModifiedTime; + } + + public boolean containsCode(String absolutePath, String type) { + String relativePath = ""; + if ("comp".equals(type)) { + relativePath = Utils.getCompModuleDir(); + } + String codePath = fileService.getCombinePath(absolutePath, relativePath + File.separator + "src"); + List filePaths = new ArrayList<>(); + getAllFilesUnderDir(filePaths, codePath); + for (String filePath : filePaths) { + if (filePath.endsWith(".java")) { + return true; + } + } + return false; + } + + /*** + * 根据传过来的文件或者文件夹相对路径,获取当前文件或者文件夹所在的工程目录。查找当前目录或者上级目录。不检查下级目录。 + * @author zhongchq + * @param absolutePath + * 绝对路径 + * @return java.lang.String + **/ + public String getProjPath(String absolutePath) { + if (absolutePath == null || absolutePath.isEmpty()) { + return null; + } + String projPath; + // 如果是文件 + File file = new File(absolutePath); + absolutePath = file.isFile() ? file.getParent() : absolutePath; + + // 当前目录是否是工程目录 + projPath = isExistGspProjFileInCurPath(absolutePath) ? absolutePath : getProjPath(file.getParent()); + + return projPath; + } + + public boolean isExistGspProjFileInCurPath(String absolutePath) { + List files = fileService.getAllFiles(absolutePath); + if (files.size() == 0) { + return false; + } + for (File file : files) { + if (fileService.getFileName(Utils.handlePath(file.toString())).equals(Utils.getGspProjectName())) { + return true; + } + } + return false; + } + + public List getProjectsInBo(String projPath) { + List projects = new ArrayList<>(); + String boPath = new File(projPath).getParent(); + final File[] files = new File(boPath).listFiles(); + if (files == null) { + return projects; + } + for (File file : files) { + if (isExistGspProjFileInCurPath(file.getPath())) { + projects.add(file.getAbsolutePath()); + } + } + return projects; + } + + public String getMdprojPath(String projPath) { + List files = fileService.getAllFiles(projPath + File.separator + Utils.getMetadataProjPath()); + for (File file : files) { + if (fileService.getExtension(file.getPath()).equals(Utils.getMetadataProjSuffix())) { + return file.getPath(); + } + } + return null; + } + + public String getMdpkgPath(String projPath) { + List files = fileService.getAllFiles(projPath + File.separator + Utils.getMetadataProjPath() + File.separator + Utils.getMetadataBinPath()); + for (File file : files) { + if (fileService.getExtension(file.getPath()).equals(Utils.getMetadataPackageExtension())) { + return file.getPath(); + } + } + return null; + } + + public String getMavenUpdateFlag(String projPath) { + return RepositoryFactory.getInstance().getMetadataProjectRepository().getMavenUpdateFlag(projPath); + } + + public void setMavenUpdateFlag(String projPath, Boolean flag) { + RepositoryFactory.getInstance().getMetadataProjectRepository().setMavenUpdateFlag(projPath, flag); + } + + public String getMdpkgNameExistInBo(String projPath, String mdpkgName) { + List projectsInBo = getProjectsInBo(projPath); + projectsInBo.remove(projPath); + for (String project : projectsInBo) { + MetadataProject metadataProjInfo = getMetadataProjInfo(project); + if (metadataProjInfo != null && mdpkgName.equals(metadataProjInfo.getMetadataPackageInfo().getName())) { + return project; + } + } + return null; + } + + private MetadataProject getMetadataProjDirectly(String path) { + MetadataProject project = new MetadataProject(); + List files = fileService.getAllFiles(path); + if (files.size() == 0) { + return null; + } + for (File file : files) { + if (fileService.getExtension(file.getPath()).equals(Utils.getMetadataProjSuffix())) { + String projStr; + try { + projStr = fileService.fileRead(Utils.handlePath(file.getPath())); + ObjectMapper objectMapper = Utils.getMapper(); + project = objectMapper.readValue(projStr, MetadataProject.class); + String projPath = Utils.handlePath(file.getPath()).substring(0, Utils.handlePath(file.getPath()).lastIndexOf('/')); + String projFileName = Utils.handlePath(file.getPath()).substring(Utils.handlePath(file.getPath()).lastIndexOf('/') + 1); + project.setProjectPath(projPath); + project.setProjectFileName(projFileName); + project.setCsprojAssemblyName(project.getMetadataPackageInfo().getName()); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + } + + return project; + } + + private void getAllFilesUnderDir(List filePathList, String dirPath) { + List dirs = fileService.getDirectorys(dirPath); + if (dirs.size() > 0) { + for (File dir : dirs) { + String dirName = fileService.getFileName(Utils.handlePath(dir.getPath())); + String temPath = dirPath + "/" + dirName; + getAllFilesUnderDir(filePathList, temPath); + } + } + var paths = fileService.getAllFiles(dirPath); + if (paths.size() > 0) { + for (File path : paths) { + filePathList.add(Utils.handlePath(path.getPath())); + } + } + } + + public List getProjPathsInBoByRefedProjPath(String projPath) { + List projPaths = new ArrayList<>(); + File project = new File(getProjPath(projPath)); + File bo = project.getParentFile(); + File[] projectsInBo = bo.listFiles(); + for (File file : projectsInBo) { + try { + final MetadataProject metadataProjInfo = getMetadataProjInfo(file.getPath()); + if (metadataProjInfo.getProjectRefs() != null && metadataProjInfo.getProjectRefs().size() > 0) { + if (metadataProjInfo.getProjectRefs().stream().anyMatch(ref -> ref.getProjectPath().endsWith(project.getName()))) { + projPaths.add(file.getPath()); + } + } + } catch (Exception e) { + } + } + return projPaths; + } + + public void getProjPathsInPath(String path, List projPaths) { + List files = fileService.getAllFiles(path); + List dirs = fileService.getDirectorys(path); + if (files != null && files.size() > 0) { + for (File file : files) { + String extension = fileService.getFileName(file.getPath()); + if (extension.toLowerCase().equals(Utils.getGspProjectName())) { + projPaths.add(file.getParent()); + return; + } + } + } + if (dirs != null && dirs.size() > 0) { + dirs.forEach(item -> getProjPathsInPath(item.getPath(), projPaths)); + } + } + + public Map transformToMdprojInfoDto(List projPaths) { + Map mdprojInfos = new ConcurrentHashMap<>(); + projPaths.stream().parallel().forEach(projPath -> { + MetadataProject metadataProjInfo = getMetadataProjInfo(projPath); + if (metadataProjInfo != null) { + MdprojInfoDto mdprojInfoDto = new MdprojInfoDto(); + mdprojInfoDto.setMetadataProject(metadataProjInfo); + mdprojInfoDto.setProjPath(projPath); + mdprojInfos.put(metadataProjInfo.getMetadataPackageInfo().getName(), mdprojInfoDto); + } + }); + return mdprojInfos; + } + + public boolean isExistProjFileRecursively(String absolutePath) { + // 如果是文件 + File file = new File(absolutePath); + if (file.isFile()) { + absolutePath = file.getParent(); + } + boolean exist = isExistGspProjFileInCurPath(absolutePath); + if (exist) { + return true; + } + + // 获取下级目录 + File[] files = new File(absolutePath).listFiles(); + for (File subDir : files) { + exist = isExistProjFileRecursively(subDir.getPath()); + if (exist) { + return true; + } + } + return false; + } + + public String getBoPath(String absolutePath) { + String projPath = getProjPath(absolutePath); + return new File(projPath).getParent(); + } + + public boolean isInterpretation(String absolutePath) { + ProcessMode processMode = getProcessMode(absolutePath); + return ProcessMode.INTERPRETATION.equals(processMode); + } + + public List getBOInfo(String[] boids) { + List boInfoList = new ArrayList<>(); + for (String boId : boids) { + DevBasicBoInfo devBasicBOInfo = SpringBeanUtils.getBean(DevBasicInfoService.class).getDevBasicBoInfo(boId); + String boPath = devBasicBOInfo.getAppCode() + "/" + devBasicBOInfo.getSuCode() + "/" + devBasicBOInfo.getBoInfo().getCode(); + Map projPaths = getPathOfBOProjects(ManagerUtils.getAbsolutePath(boPath)); + if (projPaths != null && projPaths.size() > 0) { + BOInfo boInfo = new BOInfo(); + boInfo.setId(boId); + for (String projPath : projPaths.values()) { + try { + GspProject gspProjectInfo = new GspProjectCoreService().getGspProjectInfo(projPath); + switch (gspProjectInfo.getProjectType()) { + case "backend": + boInfo.setBackendProjectCount(boInfo.getBackendProjectCount() + 1); + break; + case "frontend": + boInfo.setFrontendProjectCount(boInfo.getFrontendProjectCount() + 1); + break; + } + } catch (Exception e) { + System.out.println("无法读取工程" + projPath + "的信息。"); + } + } + boInfo.setProjectCount(projPaths.size()); + boInfoList.add(boInfo); + } + } + return boInfoList; + } + + public String getJavaCompProjectPath(String absolutePath) { + String projPath = getProjPath(absolutePath); + return Paths.get(projPath).resolve(Utils.getCompModuleDir()).resolve(Utils.getSrcJavaPath()).toString(); + } + + private Map getPathOfBOProjects(String boPath) { + Map paths = new HashMap<>(); + File boFile = new File(boPath); + if (boFile.isDirectory() && boFile.exists()) { + File[] files = boFile.listFiles(pathname -> pathname.isDirectory()); + for (File file : files) { + boolean isProjectFlag = new File(Paths.get(file.getPath()).resolve(Utils.getGspProjectName()).toString()).exists(); + if (isProjectFlag) { + paths.put(file.getName(), file.getPath()); + } + } + } + return paths; + } + + public ConcurrentHashMap transformToMdprojInfoDto(ArrayList projPaths) { + ConcurrentHashMap mdprojInfos = new ConcurrentHashMap<>(); + projPaths.stream().parallel().forEach(projPath -> { + MetadataProject metadataProjInfo = getMetadataProjInfo(projPath); + if (metadataProjInfo != null) { + MdprojInfoDto mdprojInfoDto = new MdprojInfoDto(); + mdprojInfoDto.setMetadataProject(metadataProjInfo); + mdprojInfoDto.setProjPath(projPath); + mdprojInfos.put(metadataProjInfo.getMetadataPackageInfo().getName(), mdprojInfoDto); + } + }); + return mdprojInfos; + } + + public void changeProcessMode(String absolutePath, ProcessMode processMode) { + String projPath = getProjPath(absolutePath); + GspProjectCoreService gspProjectCoreService = new GspProjectCoreService(); + GspProject gspProjectInfo = gspProjectCoreService.getGspProjectInfo(projPath); + if (!"frontend".equals(gspProjectInfo.getProjectType())) { + throw new RuntimeException("暂时仅支持前端工程转变处理模式"); + } + MetadataProject metadataProjInfo = getMetadataProjInfo(projPath); + metadataProjInfo.getMetadataPackageInfo().setProcessMode(processMode); + RepositoryFactory.getInstance().getMetadataProjectRepository().updateMetadataProject(projPath, metadataProjInfo); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectServiceImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectServiceImp.java new file mode 100644 index 0000000..ed88181 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectServiceImp.java @@ -0,0 +1,253 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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; + +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.entity.bo.BOInfo; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import java.io.File; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import org.springframework.util.StringUtils; + +/** + * 元数据工程服务 + * + * @author zhaoleitr + */ +public class MetadataProjectServiceImp implements MetadataProjectService { + + private final MetadataProjectCoreService projectCoreService = new MetadataProjectCoreService(); + + @Override + public boolean isExistProjFile(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return projectCoreService.isExistProjFile(absolutePath); + + } + + @Override + public void rename(String path, String oldName, String newName) { + try { + Utils.checkEmpty(oldName, "oldName"); + Utils.checkEmpty(newName, "newName"); + Utils.checkEmpty(path, "path"); + //全路径 + String absolutePath = ManagerUtils.getAbsolutePath(path); + projectCoreService.rename(absolutePath, oldName, newName); + } catch (Exception e) { + throw new RuntimeException("元数据工程重命名失败", e); + } + } + + @Override + public MetadataProject getMetadataProjInfo(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + MetadataProject metadataProjInfo = projectCoreService.getMetadataProjInfo(absolutePath); + return metadataProjInfo; + } + + @Override + public String getJavaCompProjectPath(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return projectCoreService.getJavaCompProjectPath(absolutePath); + } + + @Override + public MetadataProject getMetadataProjRecursively(String path, List projectPath) { + return projectCoreService.getMetadataProjRecursively(path, projectPath); + } + + @Override + public void create(String path, String projectName, String projectNameSpace, String packageName, + String processMode) { + try { + //全路径 + String absolutePath = ManagerUtils.getAbsolutePath(path); + String projectNameLower = projectName.toLowerCase(); + handleDefaultPath(absolutePath, projectNameLower); + String projectPath = Paths.get(absolutePath).resolve(projectNameLower).resolve(Utils.getMetadataProjPath()).resolve(projectName + Utils.getMetadataProjSuffix()).toString(); + projectCoreService.create(projectPath, projectName, projectNameSpace, packageName, processMode); + } catch (Exception e) { + throw new RuntimeException("元数据工程创建失败", e); + } + } + + private void handleDefaultPath(String projPath, String projName) { + String projFullPath = Paths.get(projPath).resolve(projName).toString(); + FileServiceImp fileServiceImp = new FileServiceImp(); + if (!fileServiceImp.isDirectoryExist(projFullPath)) { + fileServiceImp.createDirectory(projFullPath); + } + + String metadataProjPath = Paths.get(projFullPath).resolve(Utils.getMetadataProjPath()).toString(); + if (!fileServiceImp.isDirectoryExist(metadataProjPath)) { + fileServiceImp.createDirectory(metadataProjPath); + } + } + + @Override + public void createGspProject(String path, GspProject projectData) { + if (StringUtils.isEmpty(path)) { + throw new RuntimeException("路径不能为空"); + } + ; + //全路径 + String absolutePath = ManagerUtils.getAbsolutePath(path); + projectCoreService.createGspProject(absolutePath, projectData); + } + + @Override + public void updateMavenRefs(String projPath, MetadataProject metadataProj, MavenPackageRefs packageRefs) { + projectCoreService.updateMavenRefs(projPath, metadataProj, packageRefs); + } + + @Override + public void updateMavenRefVersion(String projPath, MetadataProject metadataProj, + MavenPackageRefs mavenPackageRefs) { + projectCoreService.updateMavenRefVersion(projPath, metadataProj, mavenPackageRefs); + } + + @Override + public void updateRefs(String projPath, MetadataProject metadataProj, MetadataPackageHeader packageHeader) { + projectCoreService.updateRefs(projPath, metadataProj, packageHeader); + } + + @Override + public void updateRefs(String projPath, MetadataPackageHeader packageHeader) { + MetadataProject metadataProjInfo = getMetadataProjInfo(projPath); + updateRefs(projPath, metadataProjInfo, packageHeader); + } + + @Override + public String getProjPath(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String projPath = projectCoreService.getProjPath(absolutePath); + return projPath; + } + + @Override + public String getAbsolutePath(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return absolutePath; + } + + @Override + public void getRefProjPaths(String projPath, List refProjPaths) { + String absolutePath = ManagerUtils.getAbsolutePath(projPath); + projectCoreService.getRefProjPaths(absolutePath, refProjPaths); + } + + @Override + public List getBuildOrder(String path) { + String projPath = getProjPath(path); + return projectCoreService.getBuildOrder(projPath); + } + + @Override + public Map> getSourceDataModifiedTime(String projPath) { + String absolutePath = ManagerUtils.getAbsolutePath(projPath); + return projectCoreService.getSourceDataModifiedTime(absolutePath); + } + + @Override + public void setSourceDataModifiedTime(String projPath, List types) { + String absolutePath = ManagerUtils.getAbsolutePath(projPath); + projectCoreService.setSourceDataModifiedTime(absolutePath, types); + } + + @Override + public boolean metadataChangesDetected(String projPath) { + String absolutePath = ManagerUtils.getAbsolutePath(projPath); + return projectCoreService.metadataChangesDetected(absolutePath); + } + + @Override + public boolean codeChangesDetected(String projPath, String type) { + String absolutePath = ManagerUtils.getAbsolutePath(projPath); + return projectCoreService.codeChangesDetected(absolutePath, type); + } + + @Override + public String getMavenUpdateFlag(String projPath) { + String absolutePath = ManagerUtils.getAbsolutePath(projPath); + return projectCoreService.getMavenUpdateFlag(absolutePath); + } + + @Override + public ProcessMode getProcessMode(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return projectCoreService.getProcessMode(absolutePath); + } + + @Override + public List getProjPathsInPath(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + List projPaths = new ArrayList<>(); + projectCoreService.getProjPathsInPath(absolutePath, projPaths); + return projPaths; + } + + @Override + public void setMavenUpdateFlag(String projPath, Boolean flag) { + String absolutePath = ManagerUtils.getAbsolutePath(projPath); + projectCoreService.setMavenUpdateFlag(absolutePath, flag); + } + + @Override + public String getMdpkgNameExistInBo(String path, String mdpkgName) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String projPathExist = projectCoreService.getMdpkgNameExistInBo(absolutePath, mdpkgName); + return projPathExist != null ? new File(projPathExist).getName() : projPathExist; + } + + @Override + public boolean isExistProjFileRecursively(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return projectCoreService.isExistProjFileRecursively(absolutePath); + } + + @Override + public String getBoPath(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return ManagerUtils.getRalativePath(projectCoreService.getBoPath(absolutePath)); + } + + @Override + public boolean isInterpretation(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return projectCoreService.isInterpretation(absolutePath); + } + + @Override + public List getBOInfo(String[] boids) { + return projectCoreService.getBOInfo(boids); + } + + public void changeProcessMode(String path, ProcessMode processMode) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + projectCoreService.changeProcessMode(absolutePath, processMode); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataServiceImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataServiceImp.java new file mode 100644 index 0000000..bc1bd51 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataServiceImp.java @@ -0,0 +1,340 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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; + +import com.inspur.edp.lcm.metadata.api.IMdExtRuleContent; +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.entity.Metadata4Ref; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataFilter; +import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataIndexItemDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; +import com.inspur.edp.lcm.metadata.api.service.GspProjectService; +import com.inspur.edp.lcm.metadata.api.service.MetadataService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.List; +import java.util.Objects; +import lombok.extern.slf4j.Slf4j; + +/** + * @author zhaoleitr + */ +@Slf4j +public class MetadataServiceImp implements MetadataService { + private final GspProjectService gspProjectService = new GspProjectServiceImp(); + private final MetadataProjectCoreService metadataProjectService = new MetadataProjectCoreService(); + private final MetadataCoreManager metadataCoreManager = new MetadataCoreManager(); + + @Override + public GspMetadata initializeMetadataEntity(GspMetadata metadata) { + metadataCoreManager.initializeMetadataEntity(metadata); + return metadata; + } + + @Override + public void createMetadata(String path, GspMetadata metadata) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + metadataCoreManager.createMetadata(absolutePath, metadata); + } + + @Override + public GspMetadata loadMetadata(String metadataFileName, String path) { + Utils.checkEmpty(metadataFileName, "parameter value is empty,paramter is metadataFileName"); + Utils.checkEmpty(path, "parameter value is empty,paramter is path"); + String absolutePath = ManagerUtils.getAbsolutePath(path); + GspMetadata metadata; + try { + metadata = metadataCoreManager.loadMetadata(metadataFileName, absolutePath); + } catch (Exception e) { + String ralativePath = ManagerUtils.getRalativePath(absolutePath) + "/" + metadataFileName; + throw new RuntimeException(String.format("找不到元数据,元数据路径为:%s", ralativePath)); + } + metadata.setRelativePath(ManagerUtils.getRalativePath(metadata.getRelativePath())); + return metadata; + } + + @Override + public GspMetadata loadMetadata(String metadataPath) { + Utils.checkEmpty(metadataPath, "parameter value is empty,paramter is metadataPath"); + String absolutePath = ManagerUtils.getAbsolutePath(metadataPath); + GspMetadata metadata; + try { + metadata = metadataCoreManager.loadMetadata(absolutePath); + } catch (Exception e) { + String ralativePath = ManagerUtils.getRalativePath(absolutePath); + throw new RuntimeException(String.format("找不到元数据,元数据路径为:%s", ralativePath)); + } + metadata.setRelativePath(ManagerUtils.getRalativePath(metadata.getRelativePath())); + return metadata; + } + + @Override + public GspMetadata loadMetadataByMetadataId(String metadataId, String path) { + Utils.checkEmpty(metadataId, "parameter value is empty,paramter is metadataFileName"); + Utils.checkEmpty(path, "parameter value is empty,paramter is path"); + String absolutePath = ManagerUtils.getAbsolutePath(path); + return metadataCoreManager.loadMetadataByMetadataId(metadataId, absolutePath); + } + + @Override + public GspMetadata loadMetadataInBo(String metadataFullPath, String currentProjPath) { + String absoluteMetadataPath = ManagerUtils.getAbsolutePath(metadataFullPath); + String absoluteProjPath = ManagerUtils.getAbsolutePath(currentProjPath); + GspMetadata metadata = metadataCoreManager.loadMetadataInBo(absoluteMetadataPath, absoluteProjPath); + metadata.setRelativePath(ManagerUtils.getRalativePath(metadata.getRelativePath())); + return metadata; + } + + @Override + public GspMetadata getRefMetadata(String spacePath, String metadataID) { + if (!spacePath.isEmpty()) { + spacePath = ManagerUtils.getAbsolutePath(spacePath); + } + return metadataCoreManager.getRefMetadata(metadataID, spacePath); + } + + @Override + public GspMetadata getMetadataWithoutContent(String fullPath) { + String absolutePath = ManagerUtils.getAbsolutePath(fullPath); + GspMetadata metadata = metadataCoreManager.getMetadataWithoutContent(absolutePath); + metadata.setRelativePath(ManagerUtils.getRalativePath(metadata.getRelativePath())); + return metadata; + } + + @Override + public void deleteMetadata(String path, String metadataFileName) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + metadataCoreManager.deleteMetadata(absolutePath, metadataFileName); + } + + @Override + public void deleteFolder(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + metadataCoreManager.deleteFolder(absolutePath); + } + + @Override + public void renameMetadata(String oldFileName, String newFileName, String metadataFilePath) { + String absolutePath = ManagerUtils.getAbsolutePath(metadataFilePath); + metadataCoreManager.renameMetadata(oldFileName, newFileName, absolutePath); + } + + @Override + public List getMetadataList(String spacePath, List metadataTypes) { + String absolutePath = ManagerUtils.getAbsolutePath(spacePath); + List result = metadataCoreManager.getMetadataList(absolutePath, metadataTypes); + return result; + } + + @Override + public List getMetadataListInBo(String path, List metadataTypes) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + List metadataListInBo = metadataCoreManager.getMetadataListInBo(metadataProjectService.getProjPath(absolutePath), metadataTypes); + return metadataListInBo; + } + + @Override + public List getMetadataByFilter(String path, MetadataFilter metadataFilter) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + List metadataByFilter = metadataCoreManager.getMetadataByFilter(absolutePath, metadataFilter); + return metadataByFilter; + } + + @Override + public boolean validateRepeatName(String path, String fileName) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return metadataCoreManager.validateRepeatName(absolutePath, fileName); + } + + @Override + public List getMetadataTypeList() { + return metadataCoreManager.getMetadataTypeList(); + } + + @Override + public boolean isMetadataExist(String path, String metadataFileName) { + String absolutePath = Paths.get(ManagerUtils.getAbsolutePath(path)).resolve(metadataFileName).toString(); + return metadataCoreManager.isMetadataExist(absolutePath); + } + + @Override + public boolean isMetadataExistInProject(String path, String metadataID) { + String projPath = metadataProjectService.getProjPath(ManagerUtils.getAbsolutePath(path)); + return metadataCoreManager.isMetadataExistInProject(projPath, metadataID); + } + + @Override + public String getRefPath(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return metadataCoreManager.getRefPath(absolutePath); + } + + @Override + public MetadataHeader getRefMetadataHeader(String metadataID, String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return metadataCoreManager.getRefMetadataHeader(metadataID, absolutePath); + } + + @Override + public List getMetadataList(String spacePath) { + String absolutePath = ManagerUtils.getAbsolutePath(spacePath); + List result = metadataCoreManager.getMetadataList(absolutePath); + return result; + } + + @Override + public MetadataPackage getMetadataPackageInfo(String packageFileName, String packagePath) { + if (packagePath.isEmpty()) { + packagePath = ManagerUtils.getMetadataPackageLocation(); + } + + return metadataCoreManager.getMetadataPackageInfo(packageFileName, packagePath); + } + + @Override + public List getMetadataListByRefedMetadataId(String path, String metadataId) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String metadataPath = new FileServiceImp().getCombinePath(metadataProjectService.getProjPath(absolutePath), Utils.getMetadataProjPath()); + return metadataCoreManager.getMetadataListByRefedMetadataId(metadataPath, metadataId); + } + + @Override + public Metadata4Ref getMetadataFromPackage(String packageName, String packagePath, String metadataID) { + + if (packagePath.isEmpty()) { + packagePath = ManagerUtils.getMetadataPackageLocation(); + } + return metadataCoreManager.getMetadataFromPackage(packageName, packagePath, metadataID); + } + + @Override + public MetadataProject getMetadataProjInfo(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return metadataCoreManager.getMetadataProjInfo(absolutePath); + } + + @Override + public List getRemoteMetadataIndexList(String text, String path, String selectedPackageSource, + List typeList, boolean page, int pageSize, int pageIndex, boolean isFilterByRefs, + boolean conflictAvoidFlag) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return metadataCoreManager.getRemoteMetadataIndexList(text, absolutePath, selectedPackageSource, typeList, page, pageSize, pageIndex, isFilterByRefs, conflictAvoidFlag); + } + + @Override + public List getLocalMetadataList(String text, String path, List typeList, + boolean page, int pageSize, int pageIndex) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return metadataCoreManager.getLocalMetadataList(text, absolutePath, typeList, page, pageSize, pageIndex, ManagerUtils.getMetadataPackageLocation()); + } + + @Override + public Metadata4RefDto pickMetadataIndex(int scopeType, String currentPath, + MetadataIndexItemDto metadataIndexItemDto, boolean isNeedMdDto) { + String absolutePath = ManagerUtils.getAbsolutePath(currentPath); + if (scopeType == 1 || scopeType == 2) { + absolutePath = metadataProjectService.getProjPath(absolutePath); + } + return metadataCoreManager.pickMetadataIndex(scopeType, absolutePath, metadataIndexItemDto, isNeedMdDto, ManagerUtils.getMetadataPackageLocation(), ManagerUtils.getMavenStoragePath()); + } + + @Override + public GspProject getGspProjectInfo(String path) { + try { + return gspProjectService.getGspProjectInfo(path); + } catch (IOException e) { + log.error("获取工程信息失败,请检查工程路径"); + e.printStackTrace(); + } + return null; + } + + @Override + public List getResourceMetadata(String metadataId, String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + MetadataProject projInfo = metadataProjectService.getMetadataProjInfo(absolutePath); + return metadataCoreManager.getResourceMetadata(metadataId, projInfo.getProjectPath()); + } + + @Override + public void setMetadataUri(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + metadataCoreManager.setMetadataUri(absolutePath); + } + + @Override + public GspMetadata getI18nMetadata(String fileName, String path, String language) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return metadataCoreManager.getI18nMetadata(fileName, absolutePath, language); + } + + @Override + public List GetRefI18nMetadata(String resourceMdID, String resourceFileName, String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String packagePath = ManagerUtils.getMetadataPackageLocation(); + String mavenPath = ManagerUtils.getMavenStoragePath(); + return metadataCoreManager.getRefI18nMetadata(resourceMdID, resourceFileName, absolutePath, mavenPath, packagePath); + } + + @Override + public void saveMetadata(GspMetadata metadata, String fullPath) { + String absolutePath = ManagerUtils.getAbsolutePath(fullPath); + metadataCoreManager.saveMetadata(metadata, absolutePath); + } + + @Override + public String getIndexServerStatus(String ip, String port) { + return metadataCoreManager.getIndexServerStatus(ip, port); + } + + @Override + public IMdExtRuleContent getMdExtRule(String metadataId, String path) { + GspMetadata metadata = loadMetadataByMetadataId(metadataId, path); + if (!Objects.isNull(metadata)) { + return metadata.getExtendRule(); + } + return null; + } + + @Override + public void saveMdExtRule(String metadataId, String path, IMdExtRuleContent extendRule) { + try { + GspMetadata metadata = loadMetadataByMetadataId(metadataId, path); + if (Objects.isNull(metadata)) { + throw new RuntimeException("不存在ID为" + metadataId + ",路径为" + path + "的元数据"); + } + metadata.setExtendRule(extendRule); + saveMetadata(metadata, path); + } catch (Exception e) { + throw new RuntimeException("保存元数据扩展规则报错", e); + } + } + + @Override + public boolean isMetadataRefed(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return metadataCoreManager.isMetadataRefed(absolutePath); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageCoreService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageCoreService.java new file mode 100644 index 0000000..773820a --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageCoreService.java @@ -0,0 +1,1361 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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; + +import com.inspur.edp.ide.setting.api.entity.MavenSettings; +import com.inspur.edp.ide.setting.api.entity.MavenSettingsMirror; +import com.inspur.edp.ide.setting.api.entity.MavenSettingsServer; +import com.inspur.edp.ide.setting.api.service.MavenService; +import com.inspur.edp.jittojava.context.GenerateService; +import com.inspur.edp.lcm.metadata.api.entity.ApiModuleInfo; +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.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.ProcessMode; +import com.inspur.edp.lcm.metadata.api.entity.ProjectHeader; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenComponent; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenComponents; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataInfoInMaven; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataRepo; +import com.inspur.edp.lcm.metadata.api.mvnEntity.PackageSourceDto; +import com.inspur.edp.lcm.metadata.api.mvnEntity.PackageWithMetadataInfo; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.MavenUtils; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.core.entity.MdprojInfoDto; +import com.inspur.edp.lcm.metadata.core.entity.PackageType; +import com.inspur.edp.lcm.metadata.core.exception.MvnException; +import com.inspur.edp.lcm.metadata.core.exception.MvnExceptionEnum; +import com.inspur.edp.lcm.metadata.core.manager.IndexServerManager; +import com.inspur.edp.lcm.metadata.core.manager.MavenCommandGenerator; +import com.inspur.edp.lcm.metadata.core.manager.MavenDeploymentForMdpkgManager; +import com.inspur.edp.lcm.metadata.core.manager.PackageNameManager; +import com.inspur.edp.lcm.metadata.core.manager.PomManager; +import com.inspur.edp.lcm.metadata.core.manager.VersionManager; +import com.inspur.edp.lcm.metadata.core.persistence.RepositoryFactory; +import com.inspur.edp.lcm.metadata.core.sync.CopyToPackagesRunnable; +import com.inspur.edp.lcm.metadata.core.sync.InstallJarRunnable; +import com.inspur.edp.lcm.metadata.core.sync.InstallSingleJarRunnable; +import com.inspur.lcm.metadata.logging.LoggerDisruptorQueue; +import io.iec.edp.caf.boot.context.CAFContext; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; +import java.util.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipInputStream; +import lombok.extern.slf4j.Slf4j; +import org.apache.maven.model.Dependency; +import org.apache.maven.model.DeploymentRepository; +import org.apache.maven.model.DistributionManagement; +import org.apache.maven.model.Model; +import org.apache.maven.model.Parent; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.apache.maven.model.io.xpp3.MavenXpp3Writer; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.util.StringUtils; +import org.springframework.web.client.RestTemplate; + +/** + * @author zhaoleitr + */ +@Slf4j +public class PackageCoreService { + + private FileServiceImp fileServiceImp = new FileServiceImp(); + private MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + private MetadataProjectCoreService metadataProjectCoreService = new MetadataProjectCoreService(); + + private String downloadPath; + private final DecimalFormat df; + private MetadataProject metadataProject; + private final Lock lock = new ReentrantLock(); + private final RestTemplate restTemplate = new RestTemplate(); + private ApiModuleInfo apiModuleInfo = null; + private List downloadMdpkgPaths; + private List publicMirrors = new ArrayList<>(); + private String alimavenFlag = "maven.aliyun.com"; + private Map depModules; + + public PackageCoreService() { + String path = System.getenv("Path"); + if (path != null) { + String[] allPath = path.split(";"); + for (String s : allPath) { + if (s.contains("maven")) { + s = s.substring(0, s.length() - 4); + System.setProperty("MAVEN_HOME", s); + } + } + } + df = new DecimalFormat("0.000"); + + depModules = new HashMap<>(); + depModules.put("comp", "api"); + depModules.put("core", "comp"); + depModules.put("runtime", "core"); + MavenSettingsMirror gspMirror = new MavenSettingsMirror("gsp-releases-repo", "gsp-releases", "https://repos.iec.io/repository/maven-gsp-releases/", "gsp-rep"); + MavenSettingsMirror bfMirror = new MavenSettingsMirror("bf-releases-repo", "bf-releases", "https://repos.iec.io/repository/maven-bf-releases/", "bf-rep"); + publicMirrors.add(gspMirror); + publicMirrors.add(bfMirror); + + } + + // 解析型工程编译comp构件 + public void compile(String absolutePath, String modules, String mavenPath) { + if ("all".equals(modules) || "comp".equals(modules)) { + // 编译前检查代码是否含有代码,以及代码是否变更 + boolean containsCodeFlag = metadataProjectCoreService.containsCode(absolutePath, "comp"); + if (!containsCodeFlag) { + return; + } + boolean codeChangedFlag = metadataProjectCoreService.codeChangesDetected(absolutePath, "comp"); + if (!codeChangedFlag) { + return; + } + } + + String javaProjPath = fileServiceImp.getCombinePath(absolutePath, "java" + File.separator + "code"); + final MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + if (!mavenUtilsCore.exeMavenCommand(javaProjPath, mavenPath, handleCompileGoal(modules))) { + final String errorMessage = mavenUtilsCore.getErrorMessage(); + throw new MvnException(MvnExceptionEnum.GSP_LCM_MVN_0001.toString(), errorMessage, new RuntimeException(errorMessage)); + } + + if ("all".equals(modules) || "comp".equals(modules)) { + // 编译后更新代码变更记录 + afterCompile(absolutePath); + } + } + + public void batchOperation(String absolutePath, String mavenPath, List operations) { + List projPaths = new ArrayList<>(); + metadataProjectCoreService.getProjPathsInPath(absolutePath, projPaths); + Map mdprojInfoDtos = metadataProjectCoreService.transformToMdprojInfoDto(projPaths); + List buildOrder = metadataProjectCoreService.getBuildOrder(mdprojInfoDtos); + GenerateService generateService = SpringBeanUtils.getBean(GenerateService.class); + List errorMsgs = new ArrayList<>(); + for (String projPath : buildOrder) { + try { + String start = "开始操作:" + projPath + "-----------------"; + LoggerDisruptorQueue.publishEvent("[LCM Info]" + start, CAFContext.current.getUserId()); + if (operations.contains("generate")) { + generateService.generate(projPath); + } + if (operations.contains("compile")) { + compile(projPath, "api,core,comp", mavenPath); + } + String end = "完成操作:" + projPath + "-----------------"; + LoggerDisruptorQueue.publishEvent("[LCM Info]" + end, CAFContext.current.getUserId()); + } catch (Exception e) { + String excep = "异常结束:" + projPath + "-----------------"; + LoggerDisruptorQueue.publishEvent("[LCM Error]" + excep, CAFContext.current.getUserId()); + StringBuilder sb = new StringBuilder(); + sb.append(projPath); + sb.append(":"); + sb.append(e.getMessage()); + errorMsgs.add(sb.toString()); + e.printStackTrace(); + } + } + try { + // 防止其他的日志输出比这个晚。 + Thread.sleep(3000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + if (!errorMsgs.isEmpty()) { + String log = ("[LCM Error]以下工程批量操作失败,请排除问题后重新编译:"); + LoggerDisruptorQueue.publishEvent(log, CAFContext.current.getUserId()); + for (String msg : errorMsgs) { + LoggerDisruptorQueue.publishEvent("[LCM Error]" + msg, CAFContext.current.getUserId()); + } + } else { + LoggerDisruptorQueue.publishEvent("[LCM Success]批量操作完成。", CAFContext.current.getUserId()); + } + } + + public void restore(String absolutePath, Boolean force, String mavenPath, String packagePath) { + if (Utils.isNullOrEmpty(absolutePath)) { + throw new IllegalArgumentException("工程路径不能为空"); + } + MetadataProjectCoreService projectCoreService = new MetadataProjectCoreService(); + absolutePath = projectCoreService.getProjPath(absolutePath); + MetadataProject metadataProjInfo = projectCoreService.getMetadataProjInfo(absolutePath); + Utils.checkNPE(metadataProjInfo, "获取元数据工程信息失败,工程路径为:" + absolutePath); + + List mavenPackageRefsList = metadataProjInfo.getMavenPackageRefs(); + if (Utils.isNullOrEmpty(mavenPackageRefsList)) { + return; + } + + // bo间工程引用 + List projectHeaderList = metadataProjInfo.getProjectRefs(); + removeProjectRefs(absolutePath, mavenPackageRefsList, projectHeaderList); + + boolean installFlag; + List needInstallPackages = new ArrayList<>(); + for (MavenPackageRefs ref : mavenPackageRefsList) { + installFlag = getInstallFlag(ref, force, mavenPath, packagePath); + if (installFlag) { + needInstallPackages.add(ref); + } + } + try { + log.info("元数据开始下载"); + doRestore(needInstallPackages, absolutePath, force, mavenPath, packagePath); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void addDependencyAndRestore(String absolutePath, List metadataPackages, String mavenPath, + String packagePath) { + String projPath = metadataProjectCoreService.getProjPath(absolutePath); + MetadataProject metadataProject = metadataProjectCoreService.getMetadataProjInfo(projPath); + metadataPackages.forEach(item -> { + MavenPackageRefs mavenPackageRefs = handleMavenPackageName(item); + MetadataPackageHeader packageHeader = handleMetadataPackageName(item); + //1、更新maven依赖 + metadataProjectCoreService.updateMavenRefs(projPath, metadataProject, mavenPackageRefs); + //2、更新metadata依赖 + metadataProjectCoreService.updateRefs(projPath, metadataProject, packageHeader); + //3、安装特定包 + restoreSpecificPackage(metadataProject.getProjectPath().substring(0, metadataProject.getProjectPath().indexOf(Utils.getMetadataProjPath()) - 1), mavenPackageRefs, mavenPath, packagePath); + }); + } + + public void installMdpkg(String groupId, String artifactId, String version, String absolutePath, String mavenPath, + String packagePath) throws IOException { + try { + installMdpkg(groupId, artifactId, version, absolutePath, false, mavenPath, packagePath); + } catch (IOException e) { + log.error("获取最新元数据包失败,请查看mdproj文件中引用的元数据包是否正确"); + throw new RuntimeException(e); + } + } + + public void doRestore(List refs, String absolutePath, boolean forceUpdateFlag, String mavenPath, + String packagePath) throws IOException { + // 防止工作空间未初始化maven文件夹 + if (!fileServiceImp.isDirectoryExist(mavenPath)) { + fileServiceImp.createDirectory(mavenPath); + } + + String metadataPath = fileServiceImp.getCombinePath(absolutePath, Utils.getMetadataProjPath()); + String pomPath = fileServiceImp.getCombinePath(metadataPath, MavenUtils.pomFile); + ProcessMode processMode = metadataProjectCoreService.getProcessMode(absolutePath); + try { + // 创建pom + final PomManager pomManager = new PomManager(); + pomManager.createPomForDependencyCopy(refs, pomPath); + + // copy dependency + downloadPath = fileServiceImp.getCombinePath(mavenPath, MavenUtils.tempFolder); + copyDependencies(metadataPath, mavenPath, downloadPath, forceUpdateFlag); + + // 解压并复制下载的元数据包到maven目录下 + extractMd(downloadPath, mavenPath); + ExecutorService executorService = Executors.newFixedThreadPool(2); + if (downloadMdpkgPaths != null && downloadMdpkgPaths.size() > 0) { + CopyToPackagesRunnable copyToPackagesRunnable = new CopyToPackagesRunnable(); + copyToPackagesRunnable.setDownloadMdpkgPaths(downloadMdpkgPaths); + copyToPackagesRunnable.setPackagePath(packagePath); + executorService.submit(copyToPackagesRunnable::run); + } + + // 下载jar + if (forceUpdateFlag && ProcessMode.GENERATION.equals(processMode)) { + InstallJarRunnable installJarRunnable = new InstallJarRunnable(); + installJarRunnable.setPomPath(pomPath); + installJarRunnable.setDownloadMdpkgPaths(downloadMdpkgPaths); + installJarRunnable.setPomDirPath(metadataPath); + installJarRunnable.setForceUpdateFlag(true); + installJarRunnable.setMavenPath(mavenPath); + installJarRunnable.setDownloadPath(downloadPath); + executorService.submit(installJarRunnable::run); + } + } finally { + if (!forceUpdateFlag || !ProcessMode.GENERATION.equals(processMode)) { + //删除pom.xml + if (fileServiceImp.isFileExist(pomPath)) { + fileServiceImp.fileDelete(pomPath); + } + //删除\projects\maven/temp + if (fileServiceImp.isDirectoryExist(downloadPath)) { + fileServiceImp.deleteAllFilesUnderDirectory(downloadPath); + } + } + } + } + + public void installMdpkg(String groupId, String artifactId, String version, String absolutePath, + Boolean forceUpdateFlag, String mavenPath, String packagePath) throws IOException { + //创建pom文件,对应的mdproj添加依赖信息 + absolutePath = metadataProjectCoreService.getProjPath(absolutePath); + String metadataPath = absolutePath + File.separator + "metadata"; + String desPath = new File(mavenPath).getAbsolutePath(); + if (!fileServiceImp.isDirectoryExist(desPath)) { + fileServiceImp.createDirectory(desPath); + } + try { + boolean isDone = createPomAndDownloadMdproj(groupId, artifactId, version, metadataPath, forceUpdateFlag, mavenPath); + if (!isDone) { + throw new RuntimeException("获取元数据依赖失败"); + } + if (!addDependencyToMdproj(groupId, artifactId, version, metadataPath)) { + throw new RuntimeException("添加依赖包到mdproj失败"); + } + + //解压并复制下载的元数据包到/projects/maven目录下,结构和nuget对齐。 + extractMd(downloadPath, mavenPath); + ExecutorService executorService = Executors.newSingleThreadExecutor(); + if (downloadMdpkgPaths != null && downloadMdpkgPaths.size() > 0) { + CopyToPackagesRunnable copyToPackagesRunnable = new CopyToPackagesRunnable(); + copyToPackagesRunnable.setDownloadMdpkgPaths(downloadMdpkgPaths); + copyToPackagesRunnable.setPackagePath(packagePath); + executorService.submit(copyToPackagesRunnable::run); + } + + //下载jar包 + ProcessMode processMode = metadataProjectCoreService.getProcessMode(absolutePath); + if (version.contains("SNAPSHOT") && forceUpdateFlag && ProcessMode.GENERATION.equals(processMode)) { + InstallSingleJarRunnable installSingleJarRunnable = new InstallSingleJarRunnable(); + installSingleJarRunnable.setPomDirPath(metadataPath); + installSingleJarRunnable.setDownloadPath(downloadPath); + installSingleJarRunnable.setMavenPath(mavenPath); + executorService.submit(installSingleJarRunnable::run); + } + + //添加api依赖 + String apiPath = fileServiceImp.getApiModulePath(absolutePath); + if (apiPath != null && !apiPath.isEmpty()) { + String pomApi = fileServiceImp.getCombinePath(fileServiceImp.getApiModulePath(absolutePath), MavenUtils.pomFile); + if (fileServiceImp.isFileExist(pomApi)) { + addProjectDependency(pomApi, groupId, artifactId, version); + } + } + + } finally { + String metadataPomPath = fileServiceImp.getCombinePath(metadataPath, MavenUtils.pomFile); + //删除pom.xml + if (fileServiceImp.isFileExist(metadataPomPath)) { + fileServiceImp.fileDelete(metadataPomPath); + } + //删除\projects\maven/temp + if (!version.contains("SNAPSHOT") || !forceUpdateFlag) { + if (fileServiceImp.isDirectoryExist(downloadPath)) { + fileServiceImp.deleteAllFilesUnderDirectory(downloadPath); + } + } + } + } + + public void uninstallMdpkg(String absolutePath, String packName, String mavenPath) { + int divideIndex = packName.indexOf("-"); + String groupId = packName.substring(0, divideIndex); + String artifactId = packName.substring(divideIndex + 1); + MavenPackageRefs mavenPackageRefs = new MavenPackageRefs(); + mavenPackageRefs.setGroupId(groupId); + mavenPackageRefs.setArtifactId(artifactId); + + MetadataProject metadataProject = metadataProjectCoreService.getMetadataProjInfo(absolutePath); + RepositoryFactory.getInstance().getMetadataProjectRepository().removeMavenRefs(absolutePath, metadataProject, mavenPackageRefs); + + PackageNameManager packageNameManager = new PackageNameManager(); + String mdpkgName = packageNameManager.getMdpkgNameByGA(groupId, artifactId, mavenPath, absolutePath); + if (mdpkgName.isEmpty()) { + throw new RuntimeException("无法根据" + packName + "获取准确的元数据包名,请手动删除工程引用文件中MetadataPackageRefs节点和ProjectRefs节点中的相关内容。"); + } + + List mdpkgNames = new ArrayList<>(); + mdpkgNames.add(mdpkgName); + RepositoryFactory.getInstance().getMetadataProjectRepository().removeProjectRefs(absolutePath, metadataProject, mdpkgNames); + + MetadataPackageHeader metadataPackageHeader = new MetadataPackageHeader(); + metadataPackageHeader.setName(mdpkgName); + RepositoryFactory.getInstance().getMetadataProjectRepository().removeRefs(absolutePath, metadataProject, metadataPackageHeader); + } + + public void addProjectDependency(String pomPath, String groupId, String artifactId, String version) { + try (FileInputStream fis = new FileInputStream(pomPath)) { + MavenXpp3Reader reader = new MavenXpp3Reader(); + Model model = reader.read(fis); + List list = model.getDependencies(); + Dependency dependency = new Dependency(); + dependency.setGroupId(groupId); + dependency.setArtifactId(artifactId); + if (version.startsWith("m")) { + dependency.setVersion(version.substring(1)); + } else { + dependency.setVersion(version); + } + //需要判断依赖信息。依赖信息中不允许有重复。 + boolean isDependencyExits = false; + for (Dependency dep : list) { + if (dep.getGroupId().equals(groupId) && dep.getArtifactId().equals(artifactId)) { + //如果groupId,artifactId相同,则更新版本号。 + isDependencyExits = true; + if (version.startsWith("m")) { + dep.setVersion(version.substring(1)); + } else { + dep.setVersion(version); + } + } + } + if (!isDependencyExits) { + list.add(dependency); + } + model.setDependencies(list); + MavenXpp3Writer mavenXpp3Writer = new MavenXpp3Writer(); + try (FileOutputStream fileOutputStream = new FileOutputStream(pomPath)) { + mavenXpp3Writer.write(fileOutputStream, model); + } + } catch (IOException | XmlPullParserException e) { + e.printStackTrace(); + } + } + + public void deployReleaseMdVersion(String projPath, String version, String repoId, boolean revert, + String dependenciesVersion, String mavenPath) throws IOException { + if (projPath == null || projPath.isEmpty()) { + throw new IllegalArgumentException("工程路径不能为空"); + } + if (version == null || version.isEmpty()) { + throw new IllegalArgumentException("version不能为空"); + } + String codepath = projPath + File.separator + "java" + File.separator + Utils.getMavenProName(); + + String apiPomPath = fileServiceImp.getApiModulePath(projPath) + File.separator + MavenUtils.pomFile; + String revertCommand = "versions:revert"; + String commitCommand = "versions:commit"; + String command = String.format("versions:set -DnewVersion=%s", version); + //更新release版本号 + mavenUtilsCore.exeMavenCommand(codepath, mavenPath, command); + //根据前端dependencies进行版本号变更 + if (!StringUtils.isEmpty(dependenciesVersion)) { + List list = null; + Model model = null; + try (FileInputStream fis = new FileInputStream(apiPomPath)) { + MavenXpp3Reader reader = new MavenXpp3Reader(); + model = reader.read(fis); + list = model.getDependencies(); + for (Dependency dependency : list) { + if (dependency.getVersion() != null) { + if (dependency.getVersion().endsWith(MavenUtils.snapShot)) { + dependency.setVersion(dependenciesVersion); + } + } + } + + } catch (IOException | XmlPullParserException e) { + e.printStackTrace(); + } + if (model != null) { + model.setDependencies(list); + } else { + throw new RuntimeException("api模块pom.xml内容为空"); + } + FileOutputStream fos = new FileOutputStream(apiPomPath); + MavenXpp3Writer mavenXpp3Writer = new MavenXpp3Writer(); + mavenXpp3Writer.write(fos, model); + fos.close(); + //然后进行推送操作 + try { + deployMdpkg(projPath, repoId, dependenciesVersion, mavenPath); + } finally { + if (revert) { + mavenUtilsCore.exeMavenCommand(codepath, mavenPath, revertCommand); + } else { + mavenUtilsCore.exeMavenCommand(codepath, mavenPath, commitCommand); + } + } + } + } + + public void deploySnapshotMdVersion(String projPath, String repoId, String version, boolean revert, + String mavenPath) { + if (projPath == null || projPath.isEmpty()) { + throw new IllegalArgumentException("工程路径不能为空"); + } + if (version == null || version.isEmpty()) { + throw new IllegalArgumentException("version不能为空"); + } + + String codePath = projPath + File.separator + "java" + File.separator + Utils.getMavenProName(); + String revertCommand = "versions:revert"; + String commitCommand = "versions:commit"; + String command = String.format("versions:set -DnewVersion=%s", version); + //更新版本号 + mavenUtilsCore.exeMavenCommand(codePath, mavenPath, command); + //然后进行推送操作 + try { + deployMdpkg(projPath, repoId, null, mavenPath); + } finally { + if (revert) { + mavenUtilsCore.exeMavenCommand(codePath, mavenPath, revertCommand); + } else { + mavenUtilsCore.exeMavenCommand(codePath, mavenPath, commitCommand); + } + } + } + + public void deployMdpkgForInterpretation(String projPath, String repoId, String version, String dependencyVersion, + String mavenPath) { + final MavenDeploymentForMdpkgManager mavenDeploymentForMdpkgManager = new MavenDeploymentForMdpkgManager(); + mavenDeploymentForMdpkgManager.deploy(projPath, repoId, version, dependencyVersion, mavenPath); + } + + public void deployMdpkg(String proPath, String repoId, String dependencyVersion, String mavenPath) { + String repoUrl = getRepoUrl(repoId, mavenPath); + if (repoUrl == null || repoUrl.isEmpty()) { + throw new IllegalArgumentException("获取repoUrl失败,请检查" + mavenPath + "/config/settings.xml配置"); + } + boolean isModelExist = isJavaProjExist(proPath); + //接下来拷贝元数据 + String moduleApiPath; + String codePath = proPath + File.separator + "java" + File.separator + Utils.getMavenProName(); + String codePom = fileServiceImp.getCombinePath(codePath, MavenUtils.pomFile); + String apiPomPath; + String metadataBin = File.separator + "metadata" + File.separator + "bin"; + String metadataBinPath = proPath + metadataBin; + String metadataPath = File.separator + "metadata"; + String metadataDir = proPath + metadataPath; + String metadataTempDir = fileServiceImp.getCombinePath(metadataDir, MavenUtils.tempFolder); + if (isModelExist) { + moduleApiPath = fileServiceImp.getApiModulePath(proPath); + apiPomPath = fileServiceImp.getCombinePath(moduleApiPath, MavenUtils.pomFile); + //读mdproj获取依赖信息 + metadataProject = metadataProjectCoreService.getMetadataProjInfo(metadataDir); + List refsList = metadataProject.getMavenPackageRefs(); + try { + //获取api module的groupId,artifactId,version + apiModuleInfo = getApiModuleInfo(apiPomPath); + if (apiModuleInfo != null) { + boolean isSnapshot = apiModuleInfo.getVersion().endsWith(MavenUtils.snapShot); + setRepoUrl(codePom, repoUrl, repoId, isSnapshot); + } + createPomForDeploy(apiModuleInfo, refsList, metadataTempDir, repoUrl, repoId, dependencyVersion); + boolean isCreated = createSrcDir(metadataTempDir); + if (!isCreated) { + log.error("创建资源目录失败"); + } + } catch (IOException e) { + e.printStackTrace(); + } + //获取工程下元数据包名 + String metadaPackageName = ""; + List list = fileServiceImp.getAllFiles(metadataBinPath); + for (File file : list) { + if (file.getName().endsWith(Utils.getMetadataPackageExtension())) { + metadaPackageName = file.getName(); + } + } + if (metadaPackageName.isEmpty()) { + throw new RuntimeException("找不到元数据包,请先编译!"); + } + String metadataFullPath = metadataBinPath + File.separator + metadaPackageName; + String destPath = metadataTempDir + File.separator + MavenUtils.resourcesDir + File.separator + metadaPackageName; + try { + fileServiceImp.fileCopy(metadataFullPath, destPath); + } catch (IOException e) { + e.printStackTrace(); + } + try { + if (!mavenUtilsCore.exeMavenCommand(metadataTempDir, mavenPath, "deploy")) { + throw new RuntimeException("部署元数据包失败"); + } + } catch (Exception e) { + throw new RuntimeException("部署元数据失败", e); + } finally { + try { + fileServiceImp.deleteAllFilesUnderDirectory(metadataTempDir); + } catch (IOException e) { + e.printStackTrace(); + } + } + boolean isApiPushed = mavenUtilsCore.exeMavenCommand(codePath, mavenPath, "deploy -pl api -am"); + if (!isApiPushed) { + throw new RuntimeException("部署api失败"); + } + + try { + String processMode = metadataProject.getMetadataPackageInfo().getProcessMode() == null ? "generation" : metadataProject.getMetadataPackageInfo().getProcessMode().toString(); + updateMetadataIndexWithProcessMode(metadaPackageName, metadataBinPath, repoUrl, apiModuleInfo, processMode); + } catch (Exception e) { + updateMetadataIndex(metadaPackageName, metadataBinPath, repoUrl, apiModuleInfo); + } + } else { + throw new RuntimeException("未找到Java模板工程目录,请先生成Java代码"); + } + } + + public MavenComponents getVersionsOfSinglePackage(String sourceUrl, String packName) { + String[] urlSections = sourceUrl.split("/"); + String repository = urlSections[urlSections.length - 1]; + String groupId = packName.substring(0, packName.indexOf("-")); + String artifactId = packName.substring(packName.indexOf("-") + 1); + String url = "https://repos.iec.io/service/rest/v1/search?repository=" + + repository + + "&group=" + + groupId + + "&name=" + + artifactId + + "&sort=version"; + try { + HttpHeaders headers = new HttpHeaders(); + headers.setBasicAuth("igix-web-ide", "imUIz2J#mEgmkvRS"); + HttpEntity entity = new HttpEntity<>(null, headers); + ResponseEntity response = restTemplate.exchange(url, HttpMethod.GET, entity, MavenComponents.class); + return response.getBody(); + } catch (Exception e) { + return null; + } + } + + public String getMavenPackageLatestVersion(String groupId, String artifactId) { + // 首先从gsp-releases获取,如果可以连接外网,则可以获取。 + String version = getMavenPackageVersionsFromGsp(groupId, artifactId); + if ("0.1.0".equals(version)) { + // 读取settings.xml中的仓库,循环查找版本 + try { + version = getMavenPackageVersionsFromRepository(groupId, artifactId); + } catch (MalformedURLException e) { + } + } + return version; + } + + private String getMavenPackageVersionsFromGsp(String groupId, String artifactId) { + String version = "0.1.0"; + try { + String url = "https://repos.iec.io/service/rest/v1/search?repository=maven-gsp-releases&group=" + groupId + "&name=" + artifactId + "&sort=version"; + HttpHeaders headers = new HttpHeaders(); + headers.setBasicAuth("igix-web-ide", "imUIz2J#mEgmkvRS"); + HttpEntity entity = new HttpEntity<>(null, headers); + ResponseEntity response = restTemplate.exchange(url, HttpMethod.GET, entity, MavenComponents.class); + // 如果查找到版本,排序获取最新版本 + VersionManager versionManager = new VersionManager(); + for (MavenComponent item : response.getBody().getItems()) { + version = versionManager.versionCompare(version, item.getVersion().replace("m", "")); + } + } catch (Exception e) { + } + return version; + } + + private String getMavenPackageVersionsFromRepository(String groupId, + String artifactId) throws MalformedURLException { + String version = "0.1.0"; + final MavenSettings mavenSettings = SpringBeanUtils.getBean(MavenService.class).getMavenSettings(); + if (mavenSettings == null) { + return version; + } + + for (MavenSettingsMirror mirror : mavenSettings.getMirrors()) { + if (mirror.getUrl() == null || mirror.getId() == null) { + break; + } + + HttpHeaders headers = null; + for (MavenSettingsServer server : mavenSettings.getServers()) { + if (server.getId().equals(mirror.getId())) { + headers = new HttpHeaders(); + headers.setBasicAuth(server.getUsername(), server.getPassword()); + break; + } + } + if (headers == null) { + break; + } + + final URL url = new URL(mirror.getUrl()); + final String[] splitUrl = mirror.getUrl().split("/"); + String repository = splitUrl[splitUrl.length - 1]; + String searchUrl = url.getProtocol() + "://" + url.getHost(); + searchUrl += url.getPort() == -1 ? "" : ":" + url.getPort(); + searchUrl += "/service/rest/v1/search?repository=" + repository + "&group=" + groupId + "&name=" + artifactId + "&sort=version"; + + try { + HttpEntity entity = new HttpEntity<>(null, headers); + ResponseEntity response = restTemplate.exchange(searchUrl, HttpMethod.GET, entity, MavenComponents.class); + // 如果查找到版本,排序获取最新版本 + if (response.getBody() != null && response.getBody().getItems() != null && response.getBody().getItems().size() > 0) { + for (MavenComponent item : response.getBody().getItems()) { + version = versionCompareRelease(version, item.getVersion().replace("m", "")); + } + } + } catch (Exception e) { + } + } + return version; + } + + private String versionCompareRelease(String existVersion, String newVersion) { + if (newVersion.contains("-")) { + return existVersion; + } else { + VersionManager versionManager = new VersionManager(); + return versionManager.versionCompare(existVersion, newVersion); + } + } + + public MavenPackageRefs getGAByMdpkgName(String mdpkgName) { + MavenPackageRefs mavenPackageRefs = new MavenPackageRefs(); + String groupId; + String artifactId; + + String[] info = mdpkgName.split("\\."); + switch (info.length) { + case 2: + groupId = "com." + info[0].toLowerCase(); + artifactId = String.format("%s-api", info[0]).toLowerCase(); + break; + case 3: + groupId = "com." + info[0].toLowerCase(); + artifactId = String.format("%s-api", info[1]).toLowerCase(); + break; + default: + groupId = String.format("com.%s.%s", info[0], info[1]).toLowerCase(); + if ("Inspur.Gsp.Common.CommonCmp.mdpkg".equals(mdpkgName)) { + artifactId = "gsp-common-commoncomponent-api"; + } else if ("Inspur.Gsp.Common.CommonUdt.mdpkg".equals(mdpkgName)) { + artifactId = "gsp-pfcommon-commonudt-api"; + } else { + if (info.length > 4) { + artifactId = String.format("%s-%s-%s-api", info[2], info[3], info[4]).toLowerCase(); + } else { + artifactId = String.format("%s-%s-%s-api", info[1], info[2], info[3]).toLowerCase(); + } + } + } + mavenPackageRefs.setGroupId(groupId); + mavenPackageRefs.setArtifactId(artifactId); + return mavenPackageRefs; + } + + public MetadataRepo getRepoList() { + final MavenSettings mavenSettings = SpringBeanUtils.getBean(MavenService.class).getMavenSettings(); + final List mirrors = mavenSettings.getMirrors(); + final MetadataRepo metadataRepo = transferMirrorsToMetadataRepo(mirrors); + return metadataRepo; + } + + public MetadataRepo getHostedRepoList() { + final List mirrors = getHostedMirrors(); + final MetadataRepo metadataRepo = transferMirrorsToMetadataRepo(mirrors); + return metadataRepo; + } + + private List getHostedMirrors() { + final MavenSettings mavenSettings = SpringBeanUtils.getBean(MavenService.class).getMavenSettings(); + final List mirrorsInSettings = mavenSettings.getMirrors(); + // 去掉aliyun + List mirrors = mirrorsInSettings.stream().filter(mirror -> !mirror.getUrl().contains(alimavenFlag)).collect(Collectors.toList()); + // 加上gsp和bf + publicMirrors.forEach(publicMirror -> { + if (mirrors.stream().noneMatch(mirror -> mirror.getUrl().equals(publicMirror.getUrl()))) { + mirrors.add(publicMirror); + } + }); + return mirrors; + } + + private MetadataRepo transferMirrorsToMetadataRepo(List mirrors) { + MetadataRepo metadataRepo = new MetadataRepo(); + List sourceDtos = new ArrayList<>(); + mirrors.forEach(mirror -> { + final PackageSourceDto packageSourceDto = new PackageSourceDto(); + packageSourceDto.setId(mirror.getId()); + packageSourceDto.setName(mirror.getName()); + packageSourceDto.setSourceUrl(mirror.getUrl()); + sourceDtos.add(packageSourceDto); + }); + metadataRepo.setRepoList(sourceDtos); + return metadataRepo; + } + + private String handleCompileGoal(String modules) { + StringBuilder sb; + if ("all".equals(modules)) { + sb = new StringBuilder("clean install").append(" -T 100C -Dmaven.test.skip=true"); + } else { + sb = new StringBuilder("clean install -pl ").append(modules).append(" -T 100C -Dmaven.test.skip=true"); + } + + if (modules.contains("api")) { + sb.append(" -am "); + } + return sb.toString(); + } + + public boolean getInstallFlag(MavenPackageRefs ref, Boolean force, String mavenPath, String packagePath) { + boolean flagValidMavenRef = ref.getGroupId() != null && ref.getArtifactId() != null && ref.getVersion() != null; + if (!flagValidMavenRef) { + String log = "[LCM Warning]" + "存在不合法的maven引用,GAV:" + ref.getGroupId() + "," + ref.getArtifactId() + "," + ref.getVersion(); + LoggerDisruptorQueue.publishEvent(log, CAFContext.current.getUserId()); + return false; + } + + // 是临时包则下载;maven文件夹下需要元数据包和pom文件,缺一则下载;packages文件夹下需要元数据包,缺少则下载 + boolean installFlag = ref.getVersion().contains(MavenUtils.snapShot) && force; + if (!installFlag) { + List fileInMaven = fileServiceImp.getAllFiles(mavenPath + File.separator + ref.getGroupId() + "-" + ref.getArtifactId() + "-" + ref.getVersion()); + installFlag = fileInMaven.size() < 2; + if (!installFlag) { + File mdpkg = fileInMaven.stream().filter(file -> file.getName().endsWith(".mdpkg")).findAny().orElse(null); + installFlag = mdpkg == null || !fileServiceImp.isFileExist(packagePath + File.separator + mdpkg.getName() + File.separator + mdpkg.getName()); + } + } + return installFlag; + } + + private void removeProjectRefs(String absolutePath, List mavenPackageRefsList, + List projectHeaderList) { + if (Utils.isNullOrEmpty(projectHeaderList) || Utils.isNullOrEmpty(mavenPackageRefsList)) { + return; + } + + List mavenPackageInfoInBo = new ArrayList<>(); + for (ProjectHeader projectHeader : projectHeaderList) { + String projPath = fileServiceImp.getCombinePath(absolutePath, projectHeader.getProjectPath()); + if (fileServiceImp.isDirectoryExist(projPath)) { + GspProject gspProjectInfo = new GspProjectCoreService().getGspProjectInfo(projPath); + MavenPackageRefs mavenPackageRefs = new MavenPackageRefs(); + String[] strings = gspProjectInfo.getProjectNameSpace().split("\\."); + if (strings.length == 1) { + mavenPackageRefs.setGroupId("com." + strings[0].toLowerCase()); + } else { + mavenPackageRefs.setGroupId("com." + (strings[0] + "." + strings[1]).toLowerCase()); + } + mavenPackageRefs.setArtifactId((gspProjectInfo.getAppCode() + "-" + gspProjectInfo.getServiceUnitCode() + "-" + gspProjectInfo.getMetadataProjectName().replace("bo-", "") + "-api").toLowerCase()); + mavenPackageInfoInBo.add(mavenPackageRefs); + } + } + + List refForExclude = new ArrayList<>(); + if (mavenPackageInfoInBo.size() > 0) { + for (MavenPackageRefs mavenPackageRefs : mavenPackageRefsList) { + for (MavenPackageRefs mavenPackageRefsInBo : mavenPackageInfoInBo) { + if (mavenPackageRefs.getGroupId().equals(mavenPackageRefsInBo.getGroupId()) + && mavenPackageRefs.getArtifactId().equals(mavenPackageRefsInBo.getArtifactId())) { + refForExclude.add(mavenPackageRefs); + } + } + } + for (MavenPackageRefs mavenPackageRefs : refForExclude) { + mavenPackageRefsList.remove(mavenPackageRefs); + } + } + } + + private void updateMetadataIndex(String mdpkgName, String mdpkgPath, String repoUrl, ApiModuleInfo apiModuleInfo) { + MetadataPackage metadataPackage = new MetadataCoreManager().getMetadataPackageInfo(mdpkgName, mdpkgPath); + if (metadataPackage.getMetadataList() != null && metadataPackage.getMetadataList().size() > 0) { + PackageWithMetadataInfo packageWithMetadataInfo = new PackageWithMetadataInfo(); + packageWithMetadataInfo.setMavenPackageGroupId(apiModuleInfo.getGroupId()); + packageWithMetadataInfo.setMavenPackageArtifactId(apiModuleInfo.getArtifactId()); + packageWithMetadataInfo.setMavenPackageVersion(apiModuleInfo.getVersion()); + packageWithMetadataInfo.setMavenPackageUrl(repoUrl); + + List metadatas = new ArrayList<>(); + for (GspMetadata metadata : metadataPackage.getMetadataList()) { + MetadataInfoInMaven tempMetadata = new MetadataInfoInMaven(); + tempMetadata.setMetadataId(metadata.getHeader().getId()); + tempMetadata.setMetadataCode(metadata.getHeader().getCode()); + tempMetadata.setMetadataName(metadata.getHeader().getName()); + tempMetadata.setMetadataNamespace(metadata.getHeader().getNameSpace()); + tempMetadata.setMetadataType(metadata.getHeader().getType()); + tempMetadata.setMetadataIsTranslating(metadata.getHeader().getTranslating() ? "t" : "f"); + tempMetadata.setMdBizobjectId(metadata.getHeader().getBizObjectId()); + tempMetadata.setMetadataPackageCode(metadataPackage.getHeader().getName()); + tempMetadata.setMetadataPackageVersion(metadataPackage.getHeader().getVersion().getVersionString()); + tempMetadata.setMetadataLanguage(metadata.getHeader().getLanguage()); + tempMetadata.setMavenPackageGroupId(apiModuleInfo.getGroupId()); + tempMetadata.setMavenPackageArtifactId(apiModuleInfo.getArtifactId()); + tempMetadata.setMavenPackageVersion(apiModuleInfo.getVersion()); + tempMetadata.setMavenPackageUrl(repoUrl); + metadatas.add(tempMetadata); + } + + packageWithMetadataInfo.setMetadatas(metadatas); + + String indexServerUrl = IndexServerManager.getInstance().getIndexServerUrl(); +// IndexServerConfiguration indexServer = IndexServerHelper.getInstance().getIndexServerConfigUration(); +// indexServer.setIP("localhost"); +// String url = "http://" + indexServer.getIP() + ":" + indexServer.getPort() + "/api/v1/metadataindex/mvn"; + restTemplate.postForObject(indexServerUrl, new HttpEntity<>(packageWithMetadataInfo, new HttpHeaders()), boolean.class); + } + } + + private ApiModuleInfo getApiModuleInfo(String apiPomPath) { + try (FileInputStream fis = new FileInputStream(apiPomPath)) { + MavenXpp3Reader reader = new MavenXpp3Reader(); + Model model = reader.read(fis); + ApiModuleInfo apiModuleInfo = new ApiModuleInfo(); + //api模块继承父的groupid,artifactid,version,自己没有定义 + if (model.getGroupId() != null) { + apiModuleInfo.setGroupId(model.getGroupId()); + } else { + apiModuleInfo.setGroupId(model.getParent().getGroupId()); + } + if (model.getArtifactId() != null) { + apiModuleInfo.setArtifactId(model.getArtifactId()); + } else { + apiModuleInfo.setArtifactId(model.getParent().getArtifactId()); + } + if (model.getVersion() != null) { + apiModuleInfo.setVersion(model.getVersion()); + } else { + apiModuleInfo.setVersion(model.getParent().getVersion()); + } + return apiModuleInfo; + } catch (IOException | XmlPullParserException e) { + e.printStackTrace(); + } + return null; + } + + private void setRepoUrl(String codePom, String repoUrl, String repoId, boolean isSnapshot) { + try (FileInputStream fis = new FileInputStream(codePom)) { + MavenXpp3Reader reader = new MavenXpp3Reader(); + Model model = reader.read(fis); + DistributionManagement distributionManagement = getDistributionManagement(repoUrl, repoId, isSnapshot); + model.setDistributionManagement(distributionManagement); + MavenXpp3Writer mavenXpp3Writer = new MavenXpp3Writer(); + FileOutputStream fos = new FileOutputStream(codePom); + mavenXpp3Writer.write(fos, model); + fos.close(); + } catch (IOException | XmlPullParserException e) { + e.printStackTrace(); + } + } + + private boolean isJavaProjExist(String proPath) { + //判断模板工程是否已创建。 + if (fileServiceImp.getProjectPath(proPath) != null) { + String subpropath = fileServiceImp.getProjectPath(proPath); + String fullPath = fileServiceImp.getCombinePath(proPath, subpropath); + List list = fileServiceImp.getAllFiles(fullPath); + for (File file : list) { + if (file.toString().endsWith("pom.xml")) { + return true; + } + } + } + return false; + } + + private String getRepoUrl(String repoId, String mavenPath) { + String repoUrl = ""; + MetadataRepo metadataRepo = getRepoList(); + if (metadataRepo == null || metadataRepo.getRepoList() == null || metadataRepo.getRepoList().size() <= 0) { + return null; + } + for (PackageSourceDto item : metadataRepo.getRepoList()) { + if (item.getId().equals(repoId)) { + repoUrl = item.getSourceUrl(); + } + } + + return repoUrl; + } + + private boolean addDependencyToMdproj(String groupid, String artifactid, String version, String mepath) { + //给对应的mdproj添加依赖信息 + metadataProject = metadataProjectCoreService.getMetadataProjInfo(mepath); + MavenPackageRefs singlemavenPackageRefs = new MavenPackageRefs(); + singlemavenPackageRefs.setGroupId(groupid); + singlemavenPackageRefs.setArtifactId(artifactid); + singlemavenPackageRefs.setVersion(version); + if (metadataProject.getMavenPackageRefs() == null) { + List list = new ArrayList<>(); + list.add(singlemavenPackageRefs); + metadataProject.setMavenPackageRefs(list); + } else { + //不允许引用多个版本的相同包。 + List mavenPackageRefs = metadataProject.getMavenPackageRefs(); + boolean isDependencyExits = false; + for (MavenPackageRefs dep : mavenPackageRefs) { + if (dep.getGroupId().equals(groupid) && dep.getArtifactId().equals(artifactid)) { + //如果groupId,artifactId相同,则更新版本号。 + isDependencyExits = true; + dep.setVersion(version); + } + } + if (!isDependencyExits) { + mavenPackageRefs.add(singlemavenPackageRefs); + } + metadataProject.setMavenPackageRefs(mavenPackageRefs); + } + //实体已更新,序列化到磁盘 + List files = fileServiceImp.getAllFiles(mepath); + File mdprojFile = null; + for (File file : files) { + if (".mdproj".equals(fileServiceImp.getExtension(file))) { + mdprojFile = file; + } + } + if (mdprojFile == null) { + throw new RuntimeException(".mdproj文件不存在"); + } + Utils.writeValue(mdprojFile.getPath(), metadataProject); + + return true; + } + + private boolean createPomAndDownloadMdproj(String groupid, String artifactid, String version, String path, + Boolean forceUpdateFlag, String mavenPath) throws IOException { + File pomFile = new File(fileServiceImp.getCombinePath(path, MavenUtils.pomFile)); + if (!pomFile.exists()) { + if (pomFile.createNewFile()) { + log.debug("创建下载pom.xml完成"); + } + } + FileOutputStream fileOutputStream = new FileOutputStream(pomFile); + Model model = new Model(); + model.setArtifactId("com.inspur.edp"); + model.setGroupId("download-tools"); + model.setVersion("0.1.0-SNAPSHOT"); + model.setModelVersion("4.0.0"); + model.setPackaging("pom"); + List list = model.getDependencies(); + Dependency dependency = new Dependency(); + dependency.setArtifactId(artifactid); + dependency.setGroupId(groupid); + dependency.setVersion(version); + dependency.setType("zip"); + list.add(dependency); + model.setDependencies(list); + MavenXpp3Writer mavenXpp3Writer = new MavenXpp3Writer(); + mavenXpp3Writer.write(fileOutputStream, model); + fileOutputStream.close(); + downloadPath = fileServiceImp.getCombinePath(mavenPath, MavenUtils.tempFolder); + + //获取排除的artifact + MetadataProject metadataProject = metadataProjectCoreService.getMetadataProjInfo(metadataProjectCoreService.getProjPath(path)); + StringBuilder excludeArtifactIds = new StringBuilder(); + if (metadataProject.getMavenPackageRefs() != null && metadataProject.getMavenPackageRefs().size() > 0) { + for (MavenPackageRefs mavenPackageRef : metadataProject.getMavenPackageRefs()) { + if (!mavenPackageRef.getArtifactId().equals(artifactid)) { + excludeArtifactIds.append(mavenPackageRef.getArtifactId()).append(","); + } + } + } + if (excludeArtifactIds.length() > 0) { + excludeArtifactIds = new StringBuilder(excludeArtifactIds.substring(0, excludeArtifactIds.length() - 1)); + } + + String mvnCommand = String.format(" dependency:copy-dependencies -DoutputDirectory=%s -DincludeTypes=zip -DexcludeArtifactIds=%s -Dmdep.copyPom", downloadPath, excludeArtifactIds.toString()); + mvnCommand = forceUpdateFlag ? mvnCommand + " -U" : mvnCommand; + //拷贝依赖 + return mavenUtilsCore.exeMavenCommand(path, mavenPath, mvnCommand); + } + + private void checkModules(String projPath, String modules) { + String codePath = projPath + File.separator + "java" + File.separator + "code"; + String[] moduleArray = modules.split(","); + for (String module : moduleArray) { + checkModule(codePath, module); + } +// if (moduleArray.length == 1) { +// checkModuleTarget(codePath, moduleArray[0]); +// } + } + + private void checkModule(String codePath, String module) { + String srcPath = codePath + File.separator + module + File.separator + "pom.xml"; + if (!fileServiceImp.isFileExist(srcPath)) { + throw new RuntimeException("未找到" + module + "模块代码pom文件,请检查" + module + "模块代码是否已经成功生成。"); + } + } + + private MavenPackageRefs handleMavenPackageName(String mdpkgName) { + MavenPackageRefs mavenPackageRefs = getGAByMdpkgName(mdpkgName); + String version = getMavenPackageLatestVersion(mavenPackageRefs.getGroupId(), mavenPackageRefs.getArtifactId()); + version = version.startsWith("m") ? version : "m" + version; + mavenPackageRefs.setVersion(version); + return mavenPackageRefs; + + } + + private MetadataPackageHeader handleMetadataPackageName(String packName) { + MetadataPackageHeader packageHeader = new MetadataPackageHeader(); + packageHeader.setName(packName.replace(".mdpkg", "")); + packageHeader.setVersion(new MetadataPackageVersion("1.0.0")); + + return packageHeader; + } + + private void restoreSpecificPackage(String path, MavenPackageRefs ref, String mavenPath, String packagePath) { + if (path == null || path.isEmpty()) { + throw new IllegalArgumentException("工程路径不能为空"); + } + if (ref.getGroupId() != null && ref.getArtifactId() != null && ref.getVersion() != null) { + if (ref.getVersion().contains(MavenUtils.snapShot)) { + try { + installMdpkg(ref.getGroupId(), ref.getArtifactId(), ref.getVersion(), path, mavenPath, packagePath); + } catch (IOException e) { + log.error("获取最新元数据包失败,请查看mdproj文件中引用的元数据包是否正确"); + throw new RuntimeException(e); + } + } + if (fileServiceImp.getAllFiles(mavenPath + "/" + ref.getGroupId() + "-" + ref.getArtifactId() + "-" + ref.getVersion() + ).size() == 0) { + log.info("路径" + mavenPath + "/" + ref.getGroupId() + "-" + ref.getArtifactId() + + "-" + ref.getVersion() + "元数据不存在,开始下载"); + try { + installMdpkg(ref.getGroupId(), ref.getArtifactId(), ref.getVersion(), path, mavenPath, packagePath); + } catch (IOException e) { + log.error("获取最新元数据包失败,请查看mdproj文件中引用的元数据包是否正确"); + throw new RuntimeException(e); + } + } + } + } + + private void createPomForDeploy(ApiModuleInfo info, List refs, String pomPath, String repoUrl, + String repoId, String dependencyVersion) throws IOException { + File pomDir = new File(pomPath); + if (!pomDir.exists()) { + if (pomDir.mkdir()) { + log.debug("创建打包目录完成"); + } + } + File pom_file = new File(fileServiceImp.getCombinePath(pomDir.toString(), MavenUtils.pomFile)); + if (!pom_file.exists()) { + if (pom_file.createNewFile()) { + log.debug("创建打包pom.xml完成"); + } + } + try (FileOutputStream fileOutputStream = new FileOutputStream(pom_file)) { + Model model = new Model(); + //构造父pom信息 + Parent parent = new Parent(); + parent.setArtifactId("metadata-parent"); + parent.setGroupId("com.inspur.edp"); + boolean isSnotshot = apiModuleInfo.getVersion().endsWith(MavenUtils.snapShot); + parent.setVersion("0.1.0"); + model.setParent(parent); + model.setArtifactId(info.getArtifactId()); + model.setGroupId(info.getGroupId()); + model.setVersion("m" + info.getVersion()); + model.setModelVersion("4.0.0"); + model.setPackaging("metadata-pack"); + DistributionManagement distributionManagement = getDistributionManagement(repoUrl, repoId, isSnotshot); + model.setDistributionManagement(distributionManagement); + List list = model.getDependencies(); + if (refs != null && refs.size() > 0) { + refs.forEach(ref -> { + Dependency dependency = new Dependency(); + dependency.setGroupId(ref.getGroupId()); + dependency.setArtifactId(ref.getArtifactId()); + if (dependencyVersion != null && ref.getVersion().endsWith(MavenUtils.snapShot)) { + + dependency.setVersion("m" + dependencyVersion); + } else { + dependency.setVersion(ref.getVersion()); + } + dependency.setType("zip"); + list.add(dependency); + }); + } + //配置插件,必须配置lcm-metadata-build-maven-plugin + + model.setDependencies(list); + MavenXpp3Writer mavenXpp3Writer = new MavenXpp3Writer(); + mavenXpp3Writer.write(fileOutputStream, model); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private DistributionManagement getDistributionManagement(String repoUrl, String repoId, boolean isSnotshot) { + DistributionManagement distributionManagement = new DistributionManagement(); + DeploymentRepository deploymentRepository = new DeploymentRepository(); + deploymentRepository.setId(repoId); + deploymentRepository.setUrl(repoUrl); + if (isSnotshot) { + distributionManagement.setSnapshotRepository(deploymentRepository); + } else { + distributionManagement.setRepository(deploymentRepository); + } + return distributionManagement; + } + + private boolean createSrcDir(String mdpkgPath) { + String resDir = mdpkgPath + File.separator + MavenUtils.resourcesDir; + File resourceFile = new File(resDir); + return resourceFile.mkdirs(); + } + + private void afterCompile(String absolutePath) { + List types = new ArrayList<>(); + types.add("comp"); + metadataProjectCoreService.setSourceDataModifiedTime(absolutePath, types); + } + + private void extractMd(String libPath, String mavenPath) { + lock.lock(); + try { + // 获取lib下所有的元数据包,解压到/projects/maven下 + List allFiles = fileServiceImp.getAllFiles(libPath); + downloadMdpkgPaths = new ArrayList<>(); + allFiles.stream().parallel().forEach(file -> { + String desMetadataDir; + String exactGroupId = getGroupId(file); + // 解压元数据包 + if (Utils.getZipSuffix().equals(fileServiceImp.getExtension(file))) { + ZipFile zf = null; + InputStream in = null; + ZipInputStream zin = null; + try { + zf = new ZipFile(file); + in = new BufferedInputStream(new FileInputStream(file)); + Charset utf8 = StandardCharsets.UTF_8; + zin = new ZipInputStream(in, utf8); + ZipEntry ze; + InputStream is = null; + OutputStream outputStream = null; + OutputStream packageOutputStream = null; + while ((ze = zin.getNextEntry()) != null) { + try { + if (Utils.getMetadataPackageExtension().equals(fileServiceImp.getExtension(ze.toString()))) { + String fileName = ze.getName(); + is = zf.getInputStream(ze); + + String fileNameWithoutExt = fileServiceImp.getFileNameWithoutExtension(file); + desMetadataDir = mavenPath + File.separator + exactGroupId + "-" + fileNameWithoutExt; + String outputFilePath = desMetadataDir + File.separator + fileName; + downloadMdpkgPaths.add(outputFilePath); + // 如果是已存在的正式版,则不需要再解压到maven文件夹 + if (isReleaseMdpkgExists(desMetadataDir)) { + return; + } + + if (!fileServiceImp.isDirectoryExist(desMetadataDir)) { + fileServiceImp.createDirectory(desMetadataDir); + } + String pomFileName = fileNameWithoutExt + Utils.getPomSuffix(); + fileServiceImp.fileCopy(libPath + File.separator + pomFileName, desMetadataDir + File.separator + pomFileName); + File outputFile = new File(outputFilePath); + outputStream = new FileOutputStream(outputFile); + int len; + while ((len = is.read()) != -1) { + outputStream.write(len); + } + } + } catch (IOException e) { + log.error(e.toString()); + } finally { + if (is != null) { + is.close(); + } + if (packageOutputStream != null) { + packageOutputStream.close(); + } + if (outputStream != null) { + outputStream.close(); + } + } + } + } catch (IOException e) { + e.printStackTrace(); + } finally { + assert zin != null; + try { + zin.closeEntry(); + zin.close(); + in.close(); + zf.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + }); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("提取元数据包错误,路径为:" + libPath, e); + } finally { + lock.unlock(); + } + } + + private boolean isReleaseMdpkgExists(String desMetadataDir) { + return !desMetadataDir.endsWith(Utils.getVersionSuffix()) && fileServiceImp.getAllFiles(desMetadataDir).size() == 2; + } + + private String getGroupId(File file) { + PomManager pomManager = new PomManager(); + String groupId = null; + String pomPath = file.getPath().replace(".zip", ".pom"); + if (fileServiceImp.isFileExist(pomPath)) { + Model model = pomManager.getModel(pomPath); + if (model != null) { + groupId = model.getGroupId(); + } + } + return groupId; + } + + private boolean copyDependencies(String pomDirPath, String mavenPath, String tempPath, boolean forceUpdateFlag) { + final MavenCommandGenerator mavenCommandGenerator = new MavenCommandGenerator(); + mavenCommandGenerator.setOutputDirectory(tempPath); + mavenCommandGenerator.setIncludeTypes(PackageType.zip.toString()); + mavenCommandGenerator.setCopyPom(true); + mavenCommandGenerator.setForceUpdate(forceUpdateFlag); + final String mavenCommand = mavenCommandGenerator.generateCopydependencies(); + return mavenUtilsCore.exeMavenCommand(pomDirPath, mavenPath, mavenCommand); + } + + private void updateMetadataIndexWithProcessMode(String mdpkgName, String mdpkgDir, String repoUrl, + ApiModuleInfo apiModuleInfo, String processMode) { + final MavenDeploymentForMdpkgManager mavenDeploymentForMdpkgManager = new MavenDeploymentForMdpkgManager(); + Model sourceModel = new Model(); + sourceModel.setGroupId(apiModuleInfo.getGroupId()); + sourceModel.setArtifactId(apiModuleInfo.getArtifactId()); + sourceModel.setVersion(apiModuleInfo.getVersion()); + mavenDeploymentForMdpkgManager.updateMetadataIndex(mdpkgName, mdpkgDir, repoUrl, sourceModel, processMode); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RefCommonCoreService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RefCommonCoreService.java new file mode 100644 index 0000000..f86bf1d --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RefCommonCoreService.java @@ -0,0 +1,97 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.ProjectMetadataCache; +import com.inspur.edp.lcm.metadata.cache.MetadataDevCacheManager; +import com.inspur.edp.lcm.metadata.common.configuration.RefStrategyHelper; +import com.inspur.edp.lcm.metadata.core.index.MetadataPackageIndexServiceForMaven; +import com.inspur.edp.lcm.metadata.core.index.MetadataPackageIndexServiceForPackages; +import com.inspur.edp.lcm.metadata.core.index.ProjectMetadataCacheService; +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import lombok.extern.slf4j.Slf4j; + +/** + * @author zhaoleitr + */ +@Slf4j +public class RefCommonCoreService { + private final MetadataCoreManager metadataManager = new MetadataCoreManager(); + private final MetadataProjectCoreService projectService = new MetadataProjectCoreService(); + private ProjectMetadataCacheService projectMetadataCacheService; + + public GspMetadata getRefMetadata(String metadataId, String path, String packagePath, String mavenPath) { + + // 工程信息 + String projectPath = projectService.getProjPath(path); + MetadataProject metadataProject = projectService.getMetadataProjInfo(path); + + // 当前工程及bo下的引用的工程下搜索 + GspMetadata gspMetadata = getMetadataFromProjects(metadataId, metadataProject); + if (gspMetadata != null) { + return gspMetadata; + } + + // 从缓存中获取 + projectMetadataCacheService = ProjectMetadataCacheService.getNewInstance(metadataProject, projectPath, packagePath, mavenPath); + projectMetadataCacheService.setRefStrategy(RefStrategyHelper.getInstance().getRefStrategy()); + String metadataPackageLocation = getMetadataPackageLocationFromCache(metadataId, metadataProject, false, packagePath, mavenPath); + if (metadataPackageLocation == null || metadataPackageLocation.isEmpty()) { + metadataPackageLocation = getMetadataPackageLocationFromCache(metadataId, metadataProject, true, packagePath, mavenPath); + if (metadataPackageLocation == null || metadataPackageLocation.isEmpty()) { + metadataManager.throwMetadataNotFoundException(metadataId); + } + } + File metadataPackage = new File(metadataPackageLocation); + gspMetadata = metadataManager.getMetadataFromPackage(metadataPackage.getName(), metadataPackage.getParent(), metadataId).getMetadata(); + return gspMetadata; + } + + private GspMetadata getMetadataFromProjects(String metadataID, MetadataProject metadataProject) { + List refProjPaths = new ArrayList<>(); + if (metadataProject != null) { + refProjPaths.add(metadataProject.getProjectPath()); + projectService.getRefProjPaths(metadataProject.getProjectPath(), refProjPaths); + + for (String projPath : refProjPaths) { + List metadataList = metadataManager.getMetadataList(projPath); + for (GspMetadata gspMetadata : metadataList) { + if (gspMetadata.getHeader() != null && gspMetadata.getHeader().getId() != null && metadataID.equals(gspMetadata.getHeader().getId())) { + gspMetadata = metadataManager.loadMetadata(gspMetadata.getHeader().getFileName(), gspMetadata.getRelativePath()); + return gspMetadata; + } + } + } + } + return null; + } + + private String getMetadataPackageLocationFromCache(String metadataID, MetadataProject metadataProject, + Boolean refreshIndexFlag, String packagePath, String mavenPath) { + if (refreshIndexFlag) { + MetadataPackageIndexServiceForPackages.getInstance(packagePath).refreshMetadataPackageIndex(); + MetadataPackageIndexServiceForMaven.getInstance(mavenPath).refreshMetadataPackageIndex(); + projectMetadataCacheService.clearCache(); + } + projectMetadataCacheService.syncProjectMetadataCache(); + ProjectMetadataCache projectMetadataCacheMap = (ProjectMetadataCache) MetadataDevCacheManager.getProjectMetadataCacheMap(metadataProject.getProjectPath()); + return projectMetadataCacheMap.getMetadataPackageLocations().get(metadataID); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RefCommonServiceImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RefCommonServiceImp.java new file mode 100644 index 0000000..d25a9eb --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RefCommonServiceImp.java @@ -0,0 +1,47 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.service.RefCommonService; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; + +/** + * @author zhaoleitr + */ +public class RefCommonServiceImp implements RefCommonService { + private final RefCommonCoreService refService = new RefCommonCoreService(); + + @Override + public GspMetadata getRefMetadata(String metadataID) { + String packagePath = ManagerUtils.getMetadataPackageLocation(); + String mavenPath = ManagerUtils.getMavenStoragePath(); + // 工程信息 + String path = Utils.getMetadataPath(); + if (path == null || path.isEmpty()) { + throw new RuntimeException("元数据归属工程路径为空,无法找到元数据:" + metadataID); + } + String absolutePath = ManagerUtils.getAbsolutePath(path); + GspMetadata gspMetadata = refService.getRefMetadata(metadataID, absolutePath, packagePath, mavenPath); + + String devRootPath = Utils.handlePath(ManagerUtils.getDevRootPath()); + if (gspMetadata.getRelativePath() != null && gspMetadata.getRelativePath().startsWith(devRootPath)) { + gspMetadata.setRelativePath(gspMetadata.getRelativePath().substring(devRootPath.length()).substring(1)); + } + return gspMetadata; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RestTemplateService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RestTemplateService.java new file mode 100644 index 0000000..4427e2a --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RestTemplateService.java @@ -0,0 +1,86 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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; + +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataInfoFilter; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataInfoWithVersion; +import com.inspur.edp.lcm.metadata.api.mvnEntity.PageMetadataInfo; +import com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode.MetadataInfoFilterWithProcessMode; +import com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode.PageMetadataInfoWithProcessMode; +import java.net.URI; +import java.util.List; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.RequestEntity; +import org.springframework.http.ResponseEntity; +import org.springframework.web.client.RestTemplate; + +/** + * Classname RestTemplateService Description RestTemplate工具类 Date 2019/11/29 17:43 + * + * @author zhongchq + * @version 1.0 + */ +public class RestTemplateService { + + public static RestTemplateService instance = new RestTemplateService(); + private final RestTemplate restTemplate = new RestTemplate(); + + /** + * post请求 + */ + public PageMetadataInfo getObjectByPost(String remoteIndexUrl, MetadataInfoFilter filter) { + HttpHeaders headers = new HttpHeaders(); + HttpEntity entity = new HttpEntity<>(filter, headers); + return restTemplate.postForObject(remoteIndexUrl, entity, PageMetadataInfo.class); + } + + /** + * post请求 + */ + public PageMetadataInfoWithProcessMode getObjectByPost(String remoteIndexUrl, + MetadataInfoFilterWithProcessMode filter) { + HttpHeaders headers = new HttpHeaders(); + HttpEntity entity = new HttpEntity<>(filter, headers); + return restTemplate.postForObject(remoteIndexUrl, entity, PageMetadataInfoWithProcessMode.class); + } + + /** + * get请求 + */ + public List getObjectByGet(String url) { + ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { + }; + ResponseEntity> responseEntity = restTemplate.exchange(new RequestEntity(HttpMethod.GET, URI.create(url)), typeRef); + if (responseEntity.getStatusCode().equals(HttpStatus.OK)) { + return responseEntity.getBody(); + } + return null; + } + + public String getStatusByGet(String url) { + try { + final ResponseEntity responseEntity = restTemplate.getForEntity(url, Object.class); + return responseEntity.getStatusCode().getReasonPhrase(); + } catch (Exception e) { + return e.getCause().getMessage(); + } + } +} + diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/entity/MdprojInfoDto.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/entity/MdprojInfoDto.java new file mode 100644 index 0000000..feeff32 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/entity/MdprojInfoDto.java @@ -0,0 +1,39 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.entity; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; + +public class MdprojInfoDto { + private String projPath; + private MetadataProject metadataProject; + + public String getProjPath() { + return projPath; + } + + public void setProjPath(String projPath) { + this.projPath = projPath; + } + + public MetadataProject getMetadataProject() { + return metadataProject; + } + + public void setMetadataProject(MetadataProject metadataProject) { + this.metadataProject = metadataProject; + } +} diff --git a/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/EnvironmentUtil.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/entity/PackageType.java similarity index 74% rename from model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/EnvironmentUtil.java rename to model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/entity/PackageType.java index 6820c82..11a05ec 100644 --- a/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/EnvironmentUtil.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/entity/PackageType.java @@ -13,15 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.inspur.edp.jittojava.context.temp; +package com.inspur.edp.lcm.metadata.core.entity; -/** - * The type EnvironmentUtil - * - * @author: Jack Lee - */ -public class EnvironmentUtil { - public static String getServerRTPath() { - return "jstack"; - } +public enum PackageType { + jar, + zip } diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/DirEventBroker.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/DirEventBroker.java new file mode 100644 index 0000000..6533f3e --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/DirEventBroker.java @@ -0,0 +1,43 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.event; + +import io.iec.edp.caf.commons.event.CAFEventArgs; +import io.iec.edp.caf.commons.event.EventBroker; +import io.iec.edp.caf.commons.event.config.EventListenerSettings; + +public class DirEventBroker extends EventBroker { + private DirEventManager dirEventManager; + + public DirEventBroker(EventListenerSettings settings) { + super(settings); + this.dirEventManager = new DirEventManager(); + this.init(); + } + + @Override + protected void onInit() { + this.eventManagerCollection.add(dirEventManager); + } + + public void fireDirDeletingEvent(CAFEventArgs args) { + this.dirEventManager.fireDirDeletingEvent(args); + } + + public void fireDirDeletedEvent(CAFEventArgs args) { + this.dirEventManager.fireDirDeletedEvent(args); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/DirEventListenerImpl.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/DirEventListenerImpl.java new file mode 100644 index 0000000..b9430c9 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/DirEventListenerImpl.java @@ -0,0 +1,72 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.event; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.core.MetadataCoreManager; +import com.inspur.edp.lcm.metadata.core.MetadataProjectCoreService; +import com.inspur.edp.lcm.metadata.spi.event.DirEventArgs; +import com.inspur.edp.lcm.metadata.spi.event.DirEventListener; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import org.springframework.util.CollectionUtils; + +public class DirEventListenerImpl implements DirEventListener { + @Override + public void fireDirDeletingEvent(DirEventArgs args) { + // 获取目录下的元数据,将id和filename存入字典 + List metadataListInDir = MetadataCoreManager.getCurrent().getMetadataList(args.getPath()); + // 目录下无元数据,直接删除。 + if (CollectionUtils.isEmpty(metadataListInDir)) { + return; + } + + Map filesInDir = new HashMap<>(); + metadataListInDir.forEach(metadata -> + { + filesInDir.put(metadata.getHeader().getId(), metadata.getHeader().getFileName()); + }); + // 获取工程下的元数据 + MetadataProject project = MetadataProjectCoreService.getCurrent().getMetadataProjInfo(args.getPath()); + // 非工程文件夹,直接删除 + if (project == null) { + return; + } + List metadataListInProject = MetadataCoreManager.getCurrent().getMetadataList(project.getProjectPath()); + + // 排除目录下的元数据 + List metadataListExclude = metadataListInProject.stream().filter(item -> !filesInDir.containsKey(item.getHeader().getId())).collect(Collectors.toList()); + + metadataListExclude.forEach(metadata -> + { + metadata.getRefs().forEach(item -> + { + if (filesInDir.containsKey(item.getDependentMetadata().getId())) { + String message = "元数据" + filesInDir.get(item.getDependentMetadata().getId()) + "被文件夹外的元数据" + metadata.getHeader().getFileName() + "依赖,请清除其中依赖后重试。"; + throw new RuntimeException(message); + } + }); + }); + } + + @Override + public void fireDirDeletedEvent(DirEventArgs args) { + MetadataCoreManager.getCurrent().removeMetadataListCache(args.getPath()); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/DirEventManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/DirEventManager.java new file mode 100644 index 0000000..1122c61 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/DirEventManager.java @@ -0,0 +1,70 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.event; + +import com.inspur.edp.lcm.metadata.spi.event.DirEventListener; +import io.iec.edp.caf.commons.event.CAFEventArgs; +import io.iec.edp.caf.commons.event.EventManager; +import io.iec.edp.caf.commons.event.IEventListener; + +public class DirEventManager extends EventManager { + + enum DirEventType { + fireDirDeletingEvent, + fireDirDeletedEvent + } + + @Override + public String getEventManagerName() { + return "DirEventManager"; + } + + @Override + public boolean isHandlerListener(IEventListener iEventListener) { + return iEventListener instanceof DirEventListener; + } + + @Override + public void addListener(IEventListener iEventListener) { + checkHandlerListener(iEventListener); + DirEventListener dirEventListener = (DirEventListener) iEventListener; + this.addEventHandler(DirEventType.fireDirDeletingEvent, dirEventListener, "fireDirDeletingEvent"); + this.addEventHandler(DirEventType.fireDirDeletedEvent, dirEventListener, "fireDirDeletedEvent"); + } + + @Override + public void removeListener(IEventListener iEventListener) { + checkHandlerListener(iEventListener); + DirEventListener dirEventListener = (DirEventListener) iEventListener; + this.removeEventHandler(DirEventType.fireDirDeletingEvent, dirEventListener, "fireDirDeletingEvent"); + this.removeEventHandler(DirEventType.fireDirDeletedEvent, dirEventListener, "fireDirDeletedEvent"); + } + + public void fireDirDeletingEvent(CAFEventArgs args) { + this.fire(DirEventType.fireDirDeletingEvent, args); + } + + public void fireDirDeletedEvent(CAFEventArgs args) { + this.fire(DirEventType.fireDirDeletedEvent, args); + } + + private void checkHandlerListener(IEventListener iEventListener) { + if (!isHandlerListener(iEventListener)) { + throw new RuntimeException("指定的监听者" + iEventListener.getClass().getName() + + "没有实现" + DirEventListener.class.getName() + "接口"); + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventBroker.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventBroker.java new file mode 100644 index 0000000..fab3cbe --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventBroker.java @@ -0,0 +1,43 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.event; + +import io.iec.edp.caf.commons.event.CAFEventArgs; +import io.iec.edp.caf.commons.event.EventBroker; +import io.iec.edp.caf.commons.event.config.EventListenerSettings; + +public class MetadataCreateEventBroker extends EventBroker { + private MetadataCreateEventManager metadataCreateEventManager; + + public MetadataCreateEventBroker(EventListenerSettings settings) { + super(settings); + this.metadataCreateEventManager = new MetadataCreateEventManager(); + this.init(); + } + + @Override + protected void onInit() { + this.eventManagerCollection.add(metadataCreateEventManager); + } + + public void fireMetadataCreatingEvent(CAFEventArgs args) { + this.metadataCreateEventManager.fireMetadataCreatingEvent(args); + } + + public void fireMetadataCreatedEvent(CAFEventArgs args) { + this.metadataCreateEventManager.fireMetadataCreatedEvent(args); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventListenerImpl.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventListenerImpl.java new file mode 100644 index 0000000..06bde56 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventListenerImpl.java @@ -0,0 +1,32 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.event; + +import com.inspur.edp.lcm.metadata.spi.event.MetadataCreateEventListener; +import com.inspur.edp.lcm.metadata.spi.event.MetadataEventArgs; + +public class MetadataCreateEventListenerImpl implements MetadataCreateEventListener { + + @Override + public void fireMetadataCreatingEvent(MetadataEventArgs args) { + System.out.println("fireMetadataCreatingEvent"); + } + + @Override + public void fireMetadataCreatedEvent(MetadataEventArgs args) { + System.out.println("fireMetadataCreatedEvent"); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventManager.java new file mode 100644 index 0000000..b331cd9 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventManager.java @@ -0,0 +1,70 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.event; + +import com.inspur.edp.lcm.metadata.spi.event.MetadataCreateEventListener; +import io.iec.edp.caf.commons.event.CAFEventArgs; +import io.iec.edp.caf.commons.event.EventManager; +import io.iec.edp.caf.commons.event.IEventListener; + +public class MetadataCreateEventManager extends EventManager { + + enum MetadataCreateEventType { + metadataCreatingEvent, + metadataCreatedEvent + } + + @Override + public String getEventManagerName() { + return "MetadataCreateEventManager"; + } + + @Override + public boolean isHandlerListener(IEventListener iEventListener) { + return iEventListener instanceof MetadataCreateEventListener; + } + + @Override + public void addListener(IEventListener iEventListener) { + checkHandlerListener(iEventListener); + MetadataCreateEventListener metadataCreateEventListener = (MetadataCreateEventListener) iEventListener; + this.addEventHandler(MetadataCreateEventType.metadataCreatingEvent, metadataCreateEventListener, "fireMetadataCreatingEvent"); + this.addEventHandler(MetadataCreateEventType.metadataCreatedEvent, metadataCreateEventListener, "fireMetadataCreatedEvent"); + } + + @Override + public void removeListener(IEventListener iEventListener) { + checkHandlerListener(iEventListener); + MetadataCreateEventListener metadataCreateEventListener = (MetadataCreateEventListener) iEventListener; + this.removeEventHandler(MetadataCreateEventType.metadataCreatingEvent, metadataCreateEventListener, "fireMetadataCreatingEvent"); + this.removeEventHandler(MetadataCreateEventType.metadataCreatedEvent, metadataCreateEventListener, "fireMetadataCreatedEvent"); + } + + public void fireMetadataCreatingEvent(CAFEventArgs args) { + this.fire(MetadataCreateEventType.metadataCreatingEvent, args); + } + + public void fireMetadataCreatedEvent(CAFEventArgs args) { + this.fire(MetadataCreateEventType.metadataCreatedEvent, args); + } + + private void checkHandlerListener(IEventListener iEventListener) { + if (!isHandlerListener(iEventListener)) { + throw new RuntimeException("指定的监听者" + iEventListener.getClass().getName() + + "没有实现" + MetadataCreateEventListener.class.getName() + "接口"); + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataEventBroker.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataEventBroker.java new file mode 100644 index 0000000..43921ba --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataEventBroker.java @@ -0,0 +1,69 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.event; + +import io.iec.edp.caf.commons.event.CAFEventArgs; +import io.iec.edp.caf.commons.event.EventBroker; +import io.iec.edp.caf.commons.event.IEventListener; +import io.iec.edp.caf.commons.event.config.EventListenerData; +import io.iec.edp.caf.commons.event.config.EventListenerSettings; + +public class MetadataEventBroker extends EventBroker { + private MetadataEventManager metadataEventManager; + + public MetadataEventBroker(EventListenerSettings settings) { + super(settings); + this.metadataEventManager = new MetadataEventManager(); + this.init(); + } + + @Override + protected void onInit() { + this.eventManagerCollection.add(metadataEventManager); + } + + public void fireMetadataSavingEvent(CAFEventArgs args) { + this.metadataEventManager.fireMetadataSavingEvent(args); + } + + public void fireMetadataSavedEvent(CAFEventArgs args) { + this.metadataEventManager.fireMetadataSavedEvent(args); + } + + public void fireMetadataDeletingEvent(CAFEventArgs args) { + this.metadataEventManager.fireMetadataDeletingEvent(args); + } + + public void fireMetadataDeletedEvent(CAFEventArgs args) { + this.metadataEventManager.fireMetadataDeletedEvent(args); + } + + /** + * 测试异常是否被抛出 + */ + public IEventListener createEventListenerTest(EventListenerData eventListenerData) { + return this.createEventListener(eventListenerData); + } + + /** + * 测试注销事件 + * + * @param eventListener + */ + public void removeListenerTest(IEventListener eventListener) { + this.removeListener(eventListener); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataEventListenerImpl.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataEventListenerImpl.java new file mode 100644 index 0000000..a9d439d --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataEventListenerImpl.java @@ -0,0 +1,60 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.event; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.core.MetadataCoreManager; +import com.inspur.edp.lcm.metadata.core.MetadataProjectCoreService; +import com.inspur.edp.lcm.metadata.spi.event.MetadataEventArgs; +import com.inspur.edp.lcm.metadata.spi.event.MetadataEventListener; +import java.util.List; + +public class MetadataEventListenerImpl implements MetadataEventListener { + MetadataCoreManager manager = new MetadataCoreManager(); + + @Override + public void fireMetadataSavingEvent(MetadataEventArgs args) { + + } + + @Override + public void fireMetadataSavedEvent(MetadataEventArgs args) { + MetadataCoreManager.getCurrent().removeMetadataListCache(args.getPath()); + } + + @Override + public void fireMetadataDeletingEvent(MetadataEventArgs args) { + // 找到工程下的所有元数据 + MetadataProject project = MetadataProjectCoreService.getCurrent().getMetadataProjInfo(args.getPath()); + List metadataList = MetadataCoreManager.getCurrent().getMetadataList(project.getProjectPath()); + + metadataList.forEach(metadata -> { + if (metadata.getRefs() != null) { + metadata.getRefs().forEach(item -> { + if (item.getDependentMetadata().getId().equals(args.getMetadata().getHeader().getId())) { + throw new RuntimeException("此元数据被" + metadata.getHeader().getFileName() + "依赖,请清除其中依赖后重试。"); + } + }); + } + }); + } + + @Override + public void fireMetadataDeletedEvent(MetadataEventArgs args) { + manager.removeMetadataListCache(args.getPath()); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataEventManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataEventManager.java new file mode 100644 index 0000000..17a6dcc --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataEventManager.java @@ -0,0 +1,84 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.event; + +import com.inspur.edp.lcm.metadata.spi.event.MetadataEventListener; +import io.iec.edp.caf.commons.event.CAFEventArgs; +import io.iec.edp.caf.commons.event.EventManager; +import io.iec.edp.caf.commons.event.IEventListener; + +public class MetadataEventManager extends EventManager { + + enum MetadataEventType { + metadataSavingEvent, + metadataSavedEvent, + metadataDeletingEvent, + metadataDeletedEvent + } + + @Override + public String getEventManagerName() { + return "MetadataEventManager"; + } + + @Override + public boolean isHandlerListener(IEventListener iEventListener) { + return iEventListener instanceof MetadataEventListener; + } + + @Override + public void addListener(IEventListener iEventListener) { + checkHandlerListener(iEventListener); + MetadataEventListener metadataEventListener = (MetadataEventListener) iEventListener; + this.addEventHandler(MetadataEventType.metadataSavingEvent, metadataEventListener, "fireMetadataSavingEvent"); + this.addEventHandler(MetadataEventType.metadataSavedEvent, metadataEventListener, "fireMetadataSavedEvent"); + this.addEventHandler(MetadataEventType.metadataDeletingEvent, metadataEventListener, "fireMetadataDeletingEvent"); + this.addEventHandler(MetadataEventType.metadataDeletedEvent, metadataEventListener, "fireMetadataDeletedEvent"); + } + + @Override + public void removeListener(IEventListener iEventListener) { + checkHandlerListener(iEventListener); + MetadataEventListener metadataEventListener = (MetadataEventListener) iEventListener; + this.removeEventHandler(MetadataEventType.metadataSavingEvent, metadataEventListener, "fireMetadataSavingEvent"); + this.removeEventHandler(MetadataEventType.metadataSavedEvent, metadataEventListener, "fireMetadataSavedEvent"); + this.removeEventHandler(MetadataEventType.metadataDeletingEvent, metadataEventListener, "fireMetadataDeletingEvent"); + this.removeEventHandler(MetadataEventType.metadataDeletedEvent, metadataEventListener, "fireMetadataDeletedEvent"); + } + + public void fireMetadataSavingEvent(CAFEventArgs args) { + this.fire(MetadataEventType.metadataSavingEvent, args); + } + + public void fireMetadataSavedEvent(CAFEventArgs args) { + this.fire(MetadataEventType.metadataSavedEvent, args); + } + + public void fireMetadataDeletingEvent(CAFEventArgs args) { + this.fire(MetadataEventType.metadataDeletingEvent, args); + } + + public void fireMetadataDeletedEvent(CAFEventArgs args) { + this.fire(MetadataEventType.metadataDeletedEvent, args); + } + + private void checkHandlerListener(IEventListener iEventListener) { + if (!isHandlerListener(iEventListener)) { + throw new RuntimeException("指定的监听者" + iEventListener.getClass().getName() + + "没有实现" + MetadataEventListener.class.getName() + "接口"); + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnException.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnException.java new file mode 100644 index 0000000..1c141a3 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnException.java @@ -0,0 +1,25 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.exception; + +import io.iec.edp.caf.commons.exception.CAFRuntimeException; +import io.iec.edp.caf.commons.exception.ExceptionLevel; + +public class MvnException extends CAFRuntimeException { + public MvnException(String exceptionCode, String message, Exception innerException) { + super("lcm", exceptionCode, message, innerException, ExceptionLevel.Error); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionEnum.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionEnum.java new file mode 100644 index 0000000..6578d50 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionEnum.java @@ -0,0 +1,20 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.exception; + +public enum MvnExceptionEnum { + GSP_LCM_MVN_0001 +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionHandler.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionHandler.java new file mode 100644 index 0000000..5bac860 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionHandler.java @@ -0,0 +1,118 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.exception; + +import io.iec.edp.caf.commons.exception.handle.DefaultExceptionHandler; + +public class MvnExceptionHandler extends DefaultExceptionHandler { + private static final String errorKeyword = "[ERROR]"; + private String messageHandled = ""; + + public String handleMessage(String message) { + handleNotFindSymbolError(message); + if (!messageHandled.isEmpty()) { + return messageHandled; + } + + handleError(message, MvnExceptionKeyword.NOT_EXIST, MvnExceptionSolution.NOT_EXIST_SOLUTION); + if (!messageHandled.isEmpty()) { + return messageHandled; + } + + handleError(message, MvnExceptionKeyword.NOT_ABSTRACT, MvnExceptionSolution.NOT_ABSTRACT_SOLUTION); + if (!messageHandled.isEmpty()) { + return messageHandled; + } + + handleError(message, MvnExceptionKeyword.DEFINED_NAME, MvnExceptionSolution.DEFINED_NAME_SOLUTION); + if (!messageHandled.isEmpty()) { + return messageHandled; + } + + handleError(message, MvnExceptionKeyword.NOT_BE_RESOLVED, MvnExceptionSolution.NOT_BE_RESOLVED_SOLUTION); + if (!messageHandled.isEmpty()) { + return messageHandled; + } + + handleClassNotAvailableError(message); + if (!messageHandled.isEmpty()) { + return messageHandled; + } + + handleNotAccessableError(message); + if (!messageHandled.isEmpty()) { + return messageHandled; + } + + handleError(message, MvnExceptionKeyword.ERROR_IN_OPENING_ZIP_FILE, MvnExceptionSolution.ERROR_IN_OPENING_ZIP_FILE_SOLUTION); + if (!messageHandled.isEmpty()) { + return messageHandled; + } + + return messageHandled; + } + + private void handleNotFindSymbolError(String message) { + if (message.contains(MvnExceptionKeyword.NOT_FIND_SYMBOL)) { + final String notFindSymbolString = findErrorStringByKeyword(message, MvnExceptionKeyword.NOT_FIND_SYMBOL); + final String symbolString = findErrorStringByKeyword(message, MvnExceptionKeyword.SYMBOL); + final String symbolLocationString = findErrorStringByKeyword(message, MvnExceptionKeyword.SYMBOL_LOCATION); + messageHandled += MvnExceptionSolution.NOT_FIND_SYMBOL_SOLUTION + notFindSymbolString + symbolString + symbolLocationString + MvnExceptionSolution.LOG_REMINDER; + } + } + + private void handleClassNotAvailableError(String message) { + if (message.contains(MvnExceptionKeyword.CLASS_NOT_AVAILABLE)) { + final String classNotAvailableString = findErrorStringByKeyword(message, MvnExceptionKeyword.CLASS_NOT_AVAILABLE); + final String needString = findErrorStringByKeyword(message, MvnExceptionKeyword.NEED); + final String findString = findErrorStringByKeyword(message, MvnExceptionKeyword.FIND); + final String reasonString = findErrorStringByKeyword(message, MvnExceptionKeyword.REASON); + messageHandled += MvnExceptionSolution.CLASS_NOT_AVAILABLE_SOLUTION + classNotAvailableString + needString + findString + reasonString + MvnExceptionSolution.LOG_REMINDER; + } + } + + private void handleNotAccessableError(String message) { + if (message.contains(MvnExceptionKeyword.NOT_ACCESSIBLE)) { + final String classNotAccessableString = findErrorStringByKeyword(message, MvnExceptionKeyword.NOT_ACCESSIBLE); + final String classNotFindString = findErrorStringByKeyword(message, MvnExceptionKeyword.NOT_FIND); + messageHandled += MvnExceptionSolution.NOT_ACCESSIBLE_SOLUTION + classNotAccessableString + classNotFindString + MvnExceptionSolution.LOG_REMINDER; + } + } + + private void handleError(String message, String keyword, String solution) { + if (message.contains(keyword)) { + final String errorStringByKeyword = findErrorStringByKeyword(message, keyword); + messageHandled += solution + errorStringByKeyword + MvnExceptionSolution.LOG_REMINDER; + } + } + + private String findErrorStringByKeyword(String message, String keyword) { + String errorString = ""; + final int keywordIndex = message.indexOf(keyword); + if (keywordIndex > -1) { + int lastErrorIndex = message.substring(0, keywordIndex).lastIndexOf(errorKeyword); + lastErrorIndex = lastErrorIndex == -1 ? errorKeyword.length() : lastErrorIndex + errorKeyword.length(); + + int nextErrorIndex = message.substring(keywordIndex).indexOf(errorKeyword) + keywordIndex; + if (nextErrorIndex == -1) { + errorString = message.substring(lastErrorIndex).trim(); + } else { + errorString = message.substring(lastErrorIndex, nextErrorIndex).trim(); + } + } + return errorString + "。"; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionKeyword.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionKeyword.java new file mode 100644 index 0000000..2dfb562 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionKeyword.java @@ -0,0 +1,40 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.exception; + +public class MvnExceptionKeyword { + public static final String NOT_FIND_SYMBOL = "找不到符号"; + public static final String SYMBOL = "符号:"; + public static final String SYMBOL_LOCATION = "位置"; + + public static final String NOT_EXIST = "不存在"; + + public static final String NOT_ABSTRACT = "不是抽象的"; + + public static final String DEFINED_NAME = "已定义"; + + public static final String NOT_BE_RESOLVED = "The following artifacts could not be resolved"; + + public static final String CLASS_NOT_AVAILABLE = "无法将类"; + public static final String NEED = "需要"; + public static final String FIND = "找到"; + public static final String REASON = "无法将类"; + + public static final String NOT_ACCESSIBLE = "无法访问"; + public static final String NOT_FIND = "找不到"; + + public static final String ERROR_IN_OPENING_ZIP_FILE = "error in opening zip file"; +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionSolution.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionSolution.java new file mode 100644 index 0000000..a2b8503 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionSolution.java @@ -0,0 +1,36 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.exception; + +public class MvnExceptionSolution { + public static final String NOT_FIND_SYMBOL_SOLUTION = "请确认是否已点击保存并同步。"; + + public static final String NOT_EXIST_SOLUTION = "请确认是否已点击保存并同步。"; + + public static final String NOT_ABSTRACT_SOLUTION = "请确认edp-parent的版本是否为最新。"; + + public static final String DEFINED_NAME_SOLUTION = "请确认是否存在字段名相同的关联。"; + + public static final String NOT_BE_RESOLVED_SOLUTION = "请确认仓库中是否存在以下包。"; + + public static final String CLASS_NOT_AVAILABLE_SOLUTION = "请将以下符号保持一致。"; + + public static final String NOT_ACCESSIBLE_SOLUTION = "请确认包中是否存在以下文件。"; + + public static final String ERROR_IN_OPENING_ZIP_FILE_SOLUTION = "请删除本地仓库中的以下包。"; + + public static final String LOG_REMINDER = "可在输出框查看详细错误日志。"; +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexService.java new file mode 100644 index 0000000..5281c6c --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexService.java @@ -0,0 +1,258 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.index; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageForIndex; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.core.MetadataCoreManager; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.maven.model.Model; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +public class MetadataPackageIndexService { + + FileServiceImp fileServiceImp = new FileServiceImp(); + + protected String KEY_CONNECTOR = "_"; + + protected String LINE = "-"; + + protected String FEATURE_IN_NAME = "-api-"; + + public String location; + + protected String depFileSuffix; + + protected Map metadataPackageIndexHashMap; + + public MetadataPackageIndexService() { + metadataPackageIndexHashMap = new HashMap<>(); + } + + public void refreshMetadataPackageIndex() { + // 初始化 + if (metadataPackageIndexHashMap.size() == 0) { + initMetadataPackageIndex(); + } else { + // 增删改处理 + refreshIndex(); + } + } + + private void refreshIndex() { + // 获取所有keys + List currentKeys = getAllKeysFromLocation(); + List indexKeys = new ArrayList<>(metadataPackageIndexHashMap.keySet()); + + // 交集 + List retainKeys = new ArrayList<>(currentKeys); + retainKeys.retainAll(indexKeys); + + // 新增 + currentKeys.removeAll(retainKeys); + + // 减少 + indexKeys.removeAll(retainKeys); + + delete(indexKeys); + + insert(currentKeys); + + update(retainKeys); + } + + private void delete(List deleteKeys) { + for (String key : deleteKeys) { + if (metadataPackageIndexHashMap.containsKey(key)) { + metadataPackageIndexHashMap.remove(key); + } + } + } + + private void update(List retainKeys) { + for (String key : retainKeys) { + String[] fileNameArray = key.split(KEY_CONNECTOR); + if (!fileNameArray[1].contains(LINE) || fileNameArray[1].endsWith(Utils.getVersionSuffix())) { + Long lastModified = new File(location + File.separator + fileNameArray[1] + File.separator + fileNameArray[0]).lastModified(); + boolean changeFlag = lastModified - metadataPackageIndexHashMap.get(key).getLastModified() != 0; + if (changeFlag) { + metadataPackageIndexHashMap.get(key).setLastModified(lastModified); + getMetadataIdsAndReferencesInSinglePackage(key); + } + } + } + } + + private void insert(List insertKeys) { + for (String key : insertKeys) { + String[] fileNameArray = key.split(KEY_CONNECTOR); + File dir = new File(location + File.separator + fileNameArray[1]); + getSingleMetadataPackageForIndex(dir); + } + for (String key : insertKeys) { + getMetadataIdsAndReferencesInSinglePackage(key); + } + } + + private List getAllKeysFromLocation() { + List metadataPackageIndexKeys = new ArrayList<>(); + List dirs = fileServiceImp.getDirectorys(location); + for (File dir : dirs) { + File[] files = dir.listFiles(); + String key; + for (File file : files) { + if (file.getName().endsWith(Utils.getMetadataPackageExtension())) { + key = handleKey(file.getName(), dir.getName()); + metadataPackageIndexKeys.add(key); + } + } + } + return metadataPackageIndexKeys; + } + + private void initMetadataPackageIndex() { + // 初始metadatapackage + getAllMetadataPackages(); + + // 获取metadataIds和depMetadataPackages + getMetadataIdsAndReferences(); + } + + private void getAllMetadataPackages() { + // 获取location下所有文件夹 + List dirs = fileServiceImp.getDirectorys(location); + for (File dir : dirs) { + getSingleMetadataPackageForIndex(dir); + } + } + + protected void getSingleMetadataPackageForIndex(File dir) { + File[] files = dir.listFiles(); + MetadataPackageForIndex metadataPackageForIndex = new MetadataPackageForIndex(); + String metadataPackageForIndexKey = ""; + for (File file : files) { + if (file.getName().endsWith(Utils.getMetadataPackageExtension())) { + metadataPackageForIndexKey = handleKey(file.getName(), dir.getName()); + metadataPackageForIndex.setMetadataPackageName(file.getName()); + metadataPackageForIndex.setLocation(file.getAbsolutePath()); + metadataPackageForIndex.setLastModified(file.lastModified()); + metadataPackageForIndex.setSourceName(dir.getName()); + if (dir.getName().contains(FEATURE_IN_NAME)) { + String sourceVersion = dir.getName().substring(dir.getName().lastIndexOf(FEATURE_IN_NAME) + FEATURE_IN_NAME.length()); + metadataPackageForIndex.setSourceVersion(sourceVersion); + } + } + if (depFileSuffix != null && file.getName().endsWith(depFileSuffix)) { + metadataPackageForIndex.setDepFileLocation(file.getAbsolutePath()); + } + } + if (metadataPackageForIndexKey != "") { + metadataPackageIndexHashMap.put(metadataPackageForIndexKey, metadataPackageForIndex); + } + } + + protected String handleKey(String metadataPackageName, String name) { + String key = metadataPackageName + KEY_CONNECTOR + name; + return key; + } + + private void getMetadataIdsAndReferences() { + metadataPackageIndexHashMap.keySet().forEach(key -> { + getMetadataIdsAndReferencesInSinglePackage(key); + }); + } + + private void getMetadataIdsAndReferencesInSinglePackage(String metadataPackageIndexKey) { + // 获取元数据包信息 + MetadataCoreManager metadataManager = new MetadataCoreManager(); + if (!metadataPackageIndexHashMap.containsKey(metadataPackageIndexKey)) { + return; + } + String packageLocation = fileServiceImp.getDirectoryName(metadataPackageIndexHashMap.get(metadataPackageIndexKey).getLocation()); + MetadataPackage metadataPackageInfo = metadataManager.getMetadataPackageInfo(metadataPackageIndexHashMap.get(metadataPackageIndexKey).getMetadataPackageName(), packageLocation); + + // 获取元数据包中的metadataIds + getMetadataIdsInSinglePackage(metadataPackageInfo, metadataPackageIndexKey); + + // 获取元数据包中的依赖 + getReferencesInSinglePackage(metadataPackageInfo, metadataPackageIndexKey); + } + + private void getMetadataIdsInSinglePackage(MetadataPackage metadataPackageInfo, String metadataPackageForIndexKey) { + List metadataIds = new ArrayList<>(); + metadataPackageInfo.getMetadataList().forEach(metadata -> { + metadataIds.add(metadata.getHeader().getId()); + }); + metadataPackageIndexHashMap.get(metadataPackageForIndexKey).setMetadataIds(metadataIds); + } + + private void getReferencesInSinglePackage(MetadataPackage metadataPackageInfo, String metadataPackageForIndexKey) { + Map depMetadataPackages = new HashMap<>(); + // 添加maven依赖 + String depFileLocation = metadataPackageIndexHashMap.get(metadataPackageForIndexKey).getDepFileLocation(); + if (depFileLocation != null) { + Model model = getModel(depFileLocation); + model.getDependencies().forEach(dependency -> { + String gav = dependency.getGroupId() + LINE + dependency.getArtifactId() + LINE + dependency.getVersion(); + metadataPackageIndexHashMap.keySet().forEach(key -> { + if (key.endsWith(gav)) { + depMetadataPackages.put(key, metadataPackageIndexHashMap.get(key)); + return; + } + }); + }); + } + // 添加元数据包依赖 + if (metadataPackageInfo != null && metadataPackageInfo.getReference() != null) { + metadataPackageInfo.getReference().forEach(depMetadataPackage -> { + boolean existFlag = false; + String depMetadataPackageName = depMetadataPackage.getDepententPackage().getName() + Utils.getMetadataPackageExtension(); + for (String key : depMetadataPackages.keySet()) { + if (key.startsWith(depMetadataPackageName)) { + existFlag = true; + break; + } + } + if (!existFlag) { + String key = depMetadataPackageName + KEY_CONNECTOR + depMetadataPackageName; + depMetadataPackages.put(key, MetadataPackageIndexServiceForPackages.getInstance(null).getMetadataPackageIndexForPackagesHashMap().get(key)); + } + }); + } + + metadataPackageIndexHashMap.get(metadataPackageForIndexKey).setDepMetadataPackages(depMetadataPackages); + } + + private Model getModel(String depFileLocation) { + try (FileInputStream fis = new FileInputStream(depFileLocation)) { + MavenXpp3Reader reader = new MavenXpp3Reader(); + final Model model = reader.read(fis); + return model; + } catch (IOException | XmlPullParserException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexServiceForMaven.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexServiceForMaven.java new file mode 100644 index 0000000..275f5d9 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexServiceForMaven.java @@ -0,0 +1,47 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.index; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageForIndex; +import com.inspur.edp.lcm.metadata.common.Utils; +import java.util.HashMap; +import java.util.Map; + +public class MetadataPackageIndexServiceForMaven extends MetadataPackageIndexService { + + private static MetadataPackageIndexServiceForMaven instance; + private final Map metadataPackageIndexForMavenHashMap; + + public MetadataPackageIndexServiceForMaven(String location) { + this.location = location; + depFileSuffix = Utils.getPomSuffix(); + metadataPackageIndexHashMap = metadataPackageIndexForMavenHashMap = new HashMap<>(); + } + + public static MetadataPackageIndexServiceForMaven getInstance(String location) { + if (instance == null || (location != null && !location.equals(instance.location))) { + instance = new MetadataPackageIndexServiceForMaven(location); + } + return instance; + } + + public Map getMetadataPackageIndexForMavenHashMap() { + if (metadataPackageIndexForMavenHashMap == null || metadataPackageIndexForMavenHashMap.size() == 0) { + refreshMetadataPackageIndex(); + } + return metadataPackageIndexForMavenHashMap; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexServiceForPackages.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexServiceForPackages.java new file mode 100644 index 0000000..31080ca --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexServiceForPackages.java @@ -0,0 +1,46 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.index; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageForIndex; +import java.util.HashMap; +import java.util.Map; + +public class MetadataPackageIndexServiceForPackages extends MetadataPackageIndexService { + + private static MetadataPackageIndexServiceForPackages instance; + + public static MetadataPackageIndexServiceForPackages getInstance(String location) { + if (instance == null || (location != null && !location.equals(instance.location))) { + instance = new MetadataPackageIndexServiceForPackages(location); + } + return instance; + } + + private Map metadataPackageIndexForPackagesHashMap; + + public Map getMetadataPackageIndexForPackagesHashMap() { + if (metadataPackageIndexForPackagesHashMap == null || metadataPackageIndexForPackagesHashMap.size() == 0) { + refreshMetadataPackageIndex(); + } + return metadataPackageIndexForPackagesHashMap; + } + + public MetadataPackageIndexServiceForPackages(String location) { + this.location = location; + metadataPackageIndexHashMap = metadataPackageIndexForPackagesHashMap = new HashMap<>(); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/ProjectMetadataCacheService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/ProjectMetadataCacheService.java new file mode 100644 index 0000000..f261d43 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/ProjectMetadataCacheService.java @@ -0,0 +1,354 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.index; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageForIndex; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.ProjectHeader; +import com.inspur.edp.lcm.metadata.api.entity.ProjectMetadataCache; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.api.service.MdpkgService; +import com.inspur.edp.lcm.metadata.cache.MetadataDevCacheManager; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.core.MetadataProjectCoreService; +import com.inspur.edp.lcm.metadata.core.manager.VersionManager; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ProjectMetadataCacheService { + + MdpkgService mdpkgService = SpringBeanUtils.getBean(MdpkgService.class); + private final MetadataProjectCoreService projectService = new MetadataProjectCoreService(); + + public static ProjectMetadataCacheService getNewInstance(MetadataProject metadataProject, String projectPath, + String packagePath, String mavenPath) { + return new ProjectMetadataCacheService(metadataProject, projectPath, packagePath, mavenPath); + } + + private MetadataProject metadataProject; + private String projectPath; + private String packagePath; + private String mavenPath; + private String refStrategy; + + private ProjectMetadataCache projectMetadataCache; + + final Map metadataPackageIndexForPackagesHashMap; + + final Map metadataPackageIndexForMavenHashMap; + + private List scannedKeys; + + public ProjectMetadataCacheService(MetadataProject metadataProject, String projectPath, String packagePath, + String mavenPath) { + this.metadataProject = metadataProject; + this.projectPath = projectPath; + this.packagePath = packagePath; + this.mavenPath = mavenPath; + metadataPackageIndexForPackagesHashMap = MetadataPackageIndexServiceForPackages.getInstance(packagePath).getMetadataPackageIndexForPackagesHashMap(); + metadataPackageIndexForMavenHashMap = MetadataPackageIndexServiceForMaven.getInstance(mavenPath).getMetadataPackageIndexForMavenHashMap(); + projectMetadataCache = (ProjectMetadataCache) MetadataDevCacheManager.getProjectMetadataCacheMap(metadataProject.getProjectPath()); + } + + public void syncProjectMetadataCache() { + if (projectMetadataCache == null) { + initProjectMetadataCache(); + } else { + syncCache(); + } + } + + public void clearCache() { + projectMetadataCache = null; + } + + private void initProjectMetadataCache() { + projectMetadataCache = new ProjectMetadataCache(); + // 获取直接引用的索引元数据包 + getDirectReferences(); + + // 获取所有引用的索引原数据包,取版本最新 + getAllReferences(); + + // 获取所有元数据路径信息 + getMetadataPackageLocations(); + + MetadataDevCacheManager.setProjectMetadataCacheMap(metadataProject.getProjectPath(), projectMetadataCache); + } + + private void syncCache() { + Map oldDirectReferences = new HashMap<>(projectMetadataCache.getDirectReferences()); + List oldKeys = new ArrayList<>(oldDirectReferences.keySet()); + getDirectReferences(); + Map currentDirectReferences = projectMetadataCache.getDirectReferences(); + List currentKeys = new ArrayList<>(currentDirectReferences.keySet()); + // 交集 + List retainKeys = new ArrayList<>(oldKeys); + retainKeys.retainAll(currentKeys); + + // 删除 + oldKeys.removeAll(retainKeys); + if (oldKeys.size() > 0) { + initProjectMetadataCache(); + return; + } + + // 修改 + for (String key : retainKeys) { + if (!currentDirectReferences.get(key).getLastModified().equals(oldDirectReferences.get(key).getLastModified())) { + initProjectMetadataCache(); + return; + } + } + + // 新增 + currentKeys.removeAll(retainKeys); + if (currentKeys.size() > 0) { + scannedKeys = new ArrayList<>(); + currentKeys.forEach(key -> { + getReferencesRecursive(projectMetadataCache.getAllReferences(), key, currentDirectReferences.get(key)); + }); + getMetadataPackageLocations(); + MetadataDevCacheManager.setProjectMetadataCacheMap(metadataProject.getProjectPath(), projectMetadataCache); + } + } + + private void getDirectReferences() { + Map directReferences = getReferencesFromMetadataProject(metadataProject); + projectMetadataCache.setDirectReferences(directReferences); + } + + private Map getReferencesFromMetadataProject(MetadataProject metadataProject) { + Map references = new HashMap<>(); + List existMavenPackageRefs = new ArrayList<>(); + + metadataProject.getMetadataPackageRefs().forEach(metadataPackageHeader -> { + String metadataPackageName = metadataPackageHeader.getName() + Utils.getMetadataPackageExtension(); + final MavenPackageRefs mavenPackageRef = mdpkgService.getGAByMdpkgName(metadataPackageName); + String mavenIndexKey = null; + + // bo间引用 + if (metadataProject.getProjectRefs() != null && metadataProject.getProjectRefs().size() > 0) { + ProjectHeader projectHeader = metadataProject.getProjectRefs().stream().filter( + header -> header.getName().equals(metadataPackageHeader.getName())).findFirst().orElse(null); + if (projectHeader != null) { + String refProjectPath = projectPath + File.separator + projectHeader.getProjectPath(); + if (new File(refProjectPath).exists()) { + existMavenPackageRefs.add(mavenPackageRef); + mavenIndexKey = metadataPackageName + "_" + projectHeader.getProjectPath(); + MetadataPackageForIndex metadataPackageForIndex = new MetadataPackageForIndex(); + metadataPackageForIndex.setLocation(refProjectPath); + metadataPackageForIndex.setSourceName("bo"); + String refMdprojPath = projectService.getMdprojPath(refProjectPath); + metadataPackageForIndex.setDepFileLocation(refMdprojPath); + metadataPackageForIndex.setLastModified(new File(refMdprojPath).lastModified()); + references.put(mavenIndexKey, metadataPackageForIndex); + return; + } + } + } + + // maven引用 + if (metadataProject.getMavenPackageRefs() != null) { + for (MavenPackageRefs mavenRef : metadataProject.getMavenPackageRefs()) { + if (mavenRef.getGroupId().equals(mavenPackageRef.getGroupId()) && mavenRef.getArtifactId().equals(mavenPackageRef.getArtifactId())) { + mavenIndexKey = metadataPackageName + "_" + mavenRef.getGroupId() + "-" + mavenRef.getArtifactId() + "-" + mavenRef.getVersion(); + existMavenPackageRefs.add(mavenPackageRef); + if (!metadataPackageIndexForMavenHashMap.containsKey(mavenIndexKey)) { + MetadataPackageIndexServiceForMaven.getInstance(mavenPath).refreshMetadataPackageIndex(); + } + if (metadataPackageIndexForMavenHashMap.containsKey(mavenIndexKey)) { + references.put(mavenIndexKey, metadataPackageIndexForMavenHashMap.get(mavenIndexKey)); + return; + } + break; + } + } + } + + // packages引用 + String key = metadataPackageName + "_" + metadataPackageName; + if (!metadataPackageIndexForPackagesHashMap.containsKey(key)) { + MetadataPackageIndexServiceForPackages.getInstance(packagePath).refreshMetadataPackageIndex(); + } + if (metadataPackageIndexForPackagesHashMap.containsKey(key)) { + references.put(key, metadataPackageIndexForPackagesHashMap.get(key)); + return; + } + + System.out.println("找不到对元数据包" + metadataPackageName + "的引用。"); + }); + + // 存在多余的maven引用 + if (metadataProject.getMavenPackageRefs() != null) { + metadataProject.getMavenPackageRefs().forEach(mavenPackageRef -> { + Boolean existFlag = existMavenPackageRefs.stream().anyMatch(ref -> ref.getGroupId().equals(mavenPackageRef.getGroupId()) && ref.getArtifactId().equals(mavenPackageRef.getArtifactId())); + if (existFlag) { + return; + } + String gav = mavenPackageRef.getGroupId() + "-" + mavenPackageRef.getArtifactId() + "-" + mavenPackageRef.getVersion(); + final String metadataPackageIndexKey = metadataPackageIndexForMavenHashMap.keySet().stream().filter(key -> key.endsWith(gav)).findFirst().orElse(null); + if (metadataPackageIndexKey != null && metadataPackageIndexForMavenHashMap.containsKey(metadataPackageIndexKey)) { + references.put(metadataPackageIndexKey, metadataPackageIndexForMavenHashMap.get(metadataPackageIndexKey)); + } + }); + } + + return references; + } + + private void getAllReferences() { + Map allReferences = new HashMap<>(); + Map directReferences = projectMetadataCache.getDirectReferences(); + scannedKeys = new ArrayList<>(); + directReferences.forEach((key, metadataPackageForIndex) -> { + getReferencesRecursive(allReferences, key, metadataPackageForIndex); + }); + projectMetadataCache.setAllReferences(allReferences); + } + + private void getReferencesRecursive(Map allReferences, + String metadataPackageForIndexKey, MetadataPackageForIndex ref) { + if (scannedKeys.contains(metadataPackageForIndexKey)) { + return; + } else { + scannedKeys.add(metadataPackageForIndexKey); + } + if (ref == null) { + return; + } + + // bo内引用 + if (ref.getSourceName().equals("bo")) { + String refProjectPath = ref.getLocation(); + final MetadataProject refMetadataProject = projectService.getMetadataProjInfo(refProjectPath); + final Map depMetadataPackages = getReferencesFromMetadataProject(refMetadataProject); + ref.setMetadataPackageName(refMetadataProject.getMetadataPackageInfo().getName() + Utils.getMetadataPackageExtension()); + ref.setDepMetadataPackages(depMetadataPackages); + } else { + if ("nearest".equals(refStrategy)) { + // 直接引用版本优先,直接引用版本,并且直接引用版本带具体版本 + String mdpkgName = metadataPackageForIndexKey.split("_")[0]; + // 直接引用中存在对此元数据包的直接引用 + boolean directExistFlag = projectMetadataCache.getDirectReferences().keySet().stream().anyMatch(key -> key.startsWith(mdpkgName)); + // !直接引用中不包含此包,或者此包不带版本 + boolean directRefFlag = projectMetadataCache.getDirectReferences().containsKey(metadataPackageForIndexKey) && metadataPackageForIndexKey.contains("-"); + if (directExistFlag && !directRefFlag) { + return; + } + if (!directRefFlag) { + // maven和packages下的版本比较 + String existKey = allReferences.keySet().stream().filter(key -> key.startsWith(ref.getMetadataPackageName())).findFirst().orElse(null); + if (existKey != null) { + // 比较版本 + String existVersion = allReferences.get(existKey).getSourceVersion(); + String newVersion = ref.getSourceVersion(); + if (existVersion != null && existVersion.equals(newVersion)) { + return; + } + + VersionManager versionManager = new VersionManager(); + String decidedVersion = versionManager.versionCompare(existVersion, newVersion); + if (decidedVersion == null || decidedVersion.equals(existVersion)) { + return; + } + + allReferences.remove(existKey); + } +// handleMultiVersion(allReferences, ref); + } + } else { + // maven和packages下的版本比较 + String existKey = allReferences.keySet().stream().filter(key -> key.startsWith(ref.getMetadataPackageName())).findFirst().orElse(null); + if (existKey != null) { + // 比较版本 + String existVersion = allReferences.get(existKey).getSourceVersion(); + String newVersion = ref.getSourceVersion(); + // 如果已经存在的版本和要比较的版本一致,则不再继续处理 + if (existVersion != null && existVersion.equals(newVersion)) { + return; + } + + VersionManager versionManager = new VersionManager(); + String decidedVersion = versionManager.versionCompare(existVersion, newVersion); + // 如果比较出来的版本和已经存在的版本一致,则不再继续处理 + if (decidedVersion == null || decidedVersion.equals(existVersion)) { + return; + } + + allReferences.remove(existKey); + } +// handleMultiVersion(allReferences, ref); + } + } + + allReferences.put(metadataPackageForIndexKey, ref); + + if (ref.getDepMetadataPackages() == null) { + return; + } + + ref.getDepMetadataPackages().forEach((key, metadataPackageForIndex) -> { + getReferencesRecursive(allReferences, key, metadataPackageForIndex); + }); + } + + private void handleMultiVersion(Map allReferences, MetadataPackageForIndex ref) { + // maven和packages下的版本比较 + String existKey = allReferences.keySet().stream().filter(key -> key.startsWith(ref.getMetadataPackageName())).findFirst().orElse(null); + if (existKey != null) { + // 比较版本 + String existVersion = allReferences.get(existKey).getSourceVersion(); + String newVersion = ref.getSourceVersion(); + if (existVersion != null && existVersion.equals(newVersion)) { + return; + } + + VersionManager versionManager = new VersionManager(); + String decidedVersion = versionManager.versionCompare(existVersion, newVersion); + if (decidedVersion == null || decidedVersion.equals(existVersion)) { + return; + } + + allReferences.remove(existKey); + } + } + + private void getMetadataPackageLocations() { + Map metadataPackageLocations = new HashMap<>(); + final Map allReferences = projectMetadataCache.getAllReferences(); + allReferences.values().forEach(ref -> { + if (ref != null && ref.getMetadataIds() != null) { + ref.getMetadataIds().forEach(metadataId -> metadataPackageLocations.put(metadataId, ref.getLocation())); + } else { + System.out.println("ref:" + ref.getLocation()); + } + }); + projectMetadataCache.setMetadataPackageLocations(metadataPackageLocations); + } + + public String getRefStrategy() { + return refStrategy; + } + + public void setRefStrategy(String refStrategy) { + this.refStrategy = refStrategy; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/IndexServerManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/IndexServerManager.java new file mode 100644 index 0000000..844582c --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/IndexServerManager.java @@ -0,0 +1,65 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.manager; + +import com.inspur.edp.ide.setting.api.entity.MetadataIndexServer; +import com.inspur.edp.ide.setting.api.service.SettingService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; + +public class IndexServerManager { + private SettingService settingService; + + private SettingService getSettingService() { + if (settingService == null) { + settingService = SpringBeanUtils.getBean(SettingService.class); + } + return settingService; + } + + private static IndexServerManager instance; + + public static IndexServerManager getInstance() { + if (instance == null) { + instance = new IndexServerManager(); + } + return instance; + } + + public String getPageWebapiOfIndexServer() { + return getIndexServerUrl() + "/page"; + } + + public String getPageWebapiOfIndexServerWithProcessMode() { + return getIndexServerWithProcessModeUrl() + "/page"; + } + + public String getMetadataWebapiOfIndexServer() { + return getIndexServerUrl() + "/metadataId"; + } + + public String getIndexServerUrl() { + MetadataIndexServer metadataIndexServer = getSettingService().getMetadataIndexServer(); + return "http://" + metadataIndexServer.getIp() + ":" + metadataIndexServer.getPort() + "/api/v1/metadataindex/mvn"; + } + + public String getIndexServerWithProcessModeUrl() { + return getIndexServerUrl() + "/withprocessmode"; + } + + public String getTestStatusWebapiOfIndexServer(String ip, String port) { + return "http://" + ip + ":" + port + "/api/v1/metadataindex/mvn/metadataId?metadataId=test"; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenCommandGenerator.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenCommandGenerator.java new file mode 100644 index 0000000..88c04cf --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenCommandGenerator.java @@ -0,0 +1,83 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.manager; + +public class MavenCommandGenerator { + private String outputDirectory = ""; + private String includeTypes = ""; + private String excludeArtifactIds = ""; + private boolean copyPom; + private boolean excludeTransitive; + private boolean forceUpdate; + + public String generateCopydependencies() { + StringBuilder stringBuilder = new StringBuilder("dependency:copy-dependencies"); + if (!outputDirectory.isEmpty()) { + stringBuilder.append(" -DoutputDirectory="); + stringBuilder.append(outputDirectory); + } + if (!includeTypes.isEmpty()) { + stringBuilder.append(" -DincludeTypes="); + stringBuilder.append(includeTypes); + } + if (!excludeArtifactIds.isEmpty()) { + stringBuilder.append(" -DexcludeArtifactIds="); + stringBuilder.append(excludeArtifactIds); + } + if (copyPom) { + stringBuilder.append(" -Dmdep.copyPom"); + } + if (excludeTransitive) { + stringBuilder.append(" -DexcludeTransitive"); + } + if (forceUpdate) { + stringBuilder.append(" -U"); + } + return stringBuilder.toString(); + } + + public String generateInstall() { + StringBuilder stringBuilder = new StringBuilder("install"); + if (forceUpdate) { + stringBuilder.append(" -U"); + } + return stringBuilder.toString(); + } + + public void setOutputDirectory(String outputDirectory) { + this.outputDirectory = outputDirectory; + } + + public void setIncludeTypes(String includeTypes) { + this.includeTypes = includeTypes; + } + + public void setExcludeArtifactIds(String excludeArtifactIds) { + this.excludeArtifactIds = excludeArtifactIds; + } + + public void setCopyPom(boolean copyPom) { + this.copyPom = copyPom; + } + + public void setExcludeTransitive(boolean excludeTransitive) { + this.excludeTransitive = excludeTransitive; + } + + public void setForceUpdate(boolean forceUpdate) { + this.forceUpdate = forceUpdate; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForJarManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForJarManager.java new file mode 100644 index 0000000..a9a55e1 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForJarManager.java @@ -0,0 +1,95 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.manager; + +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.MavenUtils; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.core.MavenUtilsCore; +import java.io.File; +import java.util.List; + +public class MavenDeploymentForJarManager extends MavenDeploymentManager { + private MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + + private FileServiceImp fileServiceImp = new FileServiceImp(); + + private PomManager pomManager = new PomManager(); + + private String projPath; + private String repoId; + private String dependencyVersion; + private String mavenPath; + + public MavenDeploymentForJarManager() { + + } + + public void deploy(String projPath, String repoId, String dependencyVersion, String mavenPath) { + this.projPath = projPath; + this.repoId = repoId; + this.dependencyVersion = dependencyVersion; + this.mavenPath = mavenPath; + beforeDeploy(); + + doDeploy(); + + afterDeploy(); + } + + protected void beforeDeploy() { + boolean isModelExist = isJavaProjExist(projPath); + if (!isModelExist) { + throw new RuntimeException("未找到Java模板工程目录,请先生成Java代码"); + } + + setCodeRepoUrl(projPath, repoId); + } + + protected void doDeploy() { + // 推送api + String codePath = projPath + File.separator + "java" + File.separator + Utils.getMavenProName(); + boolean isApiPushed = mavenUtilsCore.exeMavenCommand(codePath, mavenPath, "deploy -pl api -am"); + if (!isApiPushed) { + throw new RuntimeException("部署api失败"); + } + } + + protected void afterDeploy() { + + } + + private boolean isJavaProjExist(String projPath) { + //判断模板工程是否已创建。 + if (fileServiceImp.getProjectPath(projPath) != null) { + String subpropath = fileServiceImp.getProjectPath(projPath); + String fullPath = fileServiceImp.getCombinePath(projPath, subpropath); + List list = fileServiceImp.getAllFiles(fullPath); + for (File file : list) { + if (file.toString().endsWith("pom.xml")) { + return true; + } + } + } + return false; + } + + private void setCodeRepoUrl(String projPath, String repoId) { + String codePomPath = projPath + File.separator + "java" + File.separator + Utils.getMavenProName() + File.separator + MavenUtils.pomFile; + pomManager.setRepoUrl(codePomPath, repoId); + } + +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForMdpkgManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForMdpkgManager.java new file mode 100644 index 0000000..1c46b01 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForMdpkgManager.java @@ -0,0 +1,230 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.manager; + +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.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode.MetadataInfoInMavenWithProcessMode; +import com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode.PackageWithMetadataInfoWithProcessMode; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.MavenUtils; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.core.GspProjectCoreService; +import com.inspur.edp.lcm.metadata.core.MavenUtilsCore; +import com.inspur.edp.lcm.metadata.core.MetadataCoreManager; +import com.inspur.edp.lcm.metadata.core.MetadataProjectCoreService; +import com.inspur.edp.lcm.metadata.core.persistence.RepositoryFactory; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.apache.maven.model.Dependency; +import org.apache.maven.model.Model; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.web.client.RestTemplate; + +public class MavenDeploymentForMdpkgManager extends MavenDeploymentManager { + private MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + + private FileServiceImp fileServiceImp = new FileServiceImp(); + + private MetadataProjectCoreService metadataProjectCoreService = new MetadataProjectCoreService(); + + private GspProjectCoreService gspProjectCoreService = new GspProjectCoreService(); + + private RestTemplate restTemplate = new RestTemplate(); + + private PomManager pomManager = new PomManager(); + + private String projPath; + private String repoId; + private String version; + private String dependencyVersion; + private String mavenPath; + private String metadataBinPath; + private String metadataTempDir; + private String metadataPomPath; + private String mdpkgPath; + private Model sourceModel; + + public MavenDeploymentForMdpkgManager() { + + } + + public void deploy(String projPath, String repoId, String version, String dependencyVersion, String mavenPath) { + this.projPath = projPath; + this.repoId = repoId; + this.version = version; + this.dependencyVersion = dependencyVersion; + this.mavenPath = mavenPath; + metadataBinPath = projPath + File.separator + "metadata" + File.separator + "bin"; + metadataTempDir = fileServiceImp.getCombinePath(projPath + File.separator + "metadata", MavenUtils.tempFolder); + metadataPomPath = fileServiceImp.getCombinePath(metadataTempDir, MavenUtils.pomFile); + + beforeDeploy(); + + doDeploy(); + + afterDeploy(); + } + + @Override + protected void beforeDeploy() { + handlePomForMetadata(); + } + + @Override + protected void doDeploy() { + try { + if (!mavenUtilsCore.exeMavenCommand(metadataTempDir, mavenPath, "deploy")) { + throw new RuntimeException("部署元数据包失败"); + } + } catch (Exception e) { + throw new RuntimeException("部署元数据失败", e); + } finally { + try { + fileServiceImp.deleteAllFilesUnderDirectory(metadataTempDir); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + @Override + protected void afterDeploy() { + String metadaPackageName = new File(mdpkgPath).getName(); + String repoUrl = RepositoryFactory.getInstance().getMavenSettingsRepository().getRepoUrl(repoId); + String processMode = metadataProjectCoreService.getProcessMode(projPath).toString(); + updateMetadataIndex(metadaPackageName, metadataBinPath, repoUrl, sourceModel, processMode); + } + + private void handlePomForMetadata() { + // 准备pom + pomManager.createPomWithSourceModel(createSourceModel(), metadataPomPath, repoId, dependencyVersion); + + // 准备元数据包 + mdpkgPath = metadataProjectCoreService.getMdpkgPath(projPath); + Utils.checkEmpty(mdpkgPath, "未找到元数据包,请先编译:" + projPath); + createSrcDir(metadataTempDir); + String destPath = metadataTempDir + File.separator + MavenUtils.resourcesDir + File.separator + new File(mdpkgPath).getName(); + try { + fileServiceImp.fileCopy(mdpkgPath, destPath); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private Model createSourceModel() { + sourceModel = new Model(); + final GspProject gspProjectInfo = gspProjectCoreService.getGspProjectInfo(projPath); + sourceModel.setGroupId(getGroupId(gspProjectInfo)); + sourceModel.setArtifactId(getArtifactID(gspProjectInfo) + "-api"); + sourceModel.setVersion(version); + List dependencies = new ArrayList<>(); + final MetadataProject metadataProjInfo = metadataProjectCoreService.getMetadataProjInfo(projPath); + if (metadataProjInfo.getMavenPackageRefs() != null && metadataProjInfo.getMavenPackageRefs().size() > 0) { + metadataProjInfo.getMavenPackageRefs().forEach(mavenPackageRef -> { + Dependency dependency = new Dependency(); + dependency.setGroupId(mavenPackageRef.getGroupId()); + dependency.setArtifactId(mavenPackageRef.getArtifactId()); + dependency.setVersion(mavenPackageRef.getVersion()); + dependencies.add(dependency); + }); + } + sourceModel.setDependencies(dependencies); + return sourceModel; + } + + private String getGroupId(GspProject gspProject) { + String groupId; + String prepareGroupId = gspProject.getProjectNameSpace().toLowerCase(); + String firstGroupId = "com."; + if (!prepareGroupId.contains(".")) { + return firstGroupId + prepareGroupId; + } + String[] subGroupId = prepareGroupId.split("\\."); + groupId = firstGroupId + (subGroupId[0] + "." + subGroupId[1]).toLowerCase(); + return groupId; + } + + private String getArtifactID(GspProject gspProject) { + String appCode = gspProject.getAppCode().toLowerCase(); + String suCode = gspProject.getServiceUnitCode().toLowerCase(); + String boCode = gspProject.getMetadataProjectName().toLowerCase(); + if (boCode.startsWith("bo-")) { + boCode = boCode.substring(boCode.indexOf("-") + 1); + } + String artifactId = String.format("%s-%s-%s", appCode, suCode, boCode); + + return artifactId; + } + + private boolean createSrcDir(String mdpkgPath) { + String resDir = mdpkgPath + File.separator + MavenUtils.resourcesDir; + File resourceFile = new File(resDir); + return resourceFile.mkdirs(); + } + + public void updateMetadataIndex(String mdpkgName, String mdpkgDir, String repoUrl, Model sourceModel, + String processMode) { + MetadataPackage metadataPackage = new MetadataCoreManager().getMetadataPackageInfo(mdpkgName, mdpkgDir); + if (metadataPackage.getMetadataList() != null && metadataPackage.getMetadataList().size() > 0) { + PackageWithMetadataInfoWithProcessMode packageWithMetadataInfoWithProcessMode = new PackageWithMetadataInfoWithProcessMode(); + packageWithMetadataInfoWithProcessMode.setMavenPackageGroupId(sourceModel.getGroupId()); + packageWithMetadataInfoWithProcessMode.setMavenPackageArtifactId(sourceModel.getArtifactId()); + packageWithMetadataInfoWithProcessMode.setMavenPackageVersion(sourceModel.getVersion()); + packageWithMetadataInfoWithProcessMode.setMavenPackageUrl(repoUrl); + packageWithMetadataInfoWithProcessMode.setProcessMode(processMode); + + List metadatas = new ArrayList<>(); + for (GspMetadata metadata : metadataPackage.getMetadataList()) { + MetadataInfoInMavenWithProcessMode tempMetadata = new MetadataInfoInMavenWithProcessMode(); + tempMetadata.setMetadataId(metadata.getHeader().getId()); + tempMetadata.setMetadataCode(metadata.getHeader().getCode()); + tempMetadata.setMetadataName(metadata.getHeader().getName()); + tempMetadata.setMetadataNamespace(metadata.getHeader().getNameSpace()); + tempMetadata.setMetadataType(metadata.getHeader().getType()); + tempMetadata.setMetadataIsTranslating(metadata.getHeader().getTranslating() ? "t" : "f"); + tempMetadata.setMdBizobjectId(metadata.getHeader().getBizObjectId()); + tempMetadata.setMetadataPackageCode(metadataPackage.getHeader().getName()); + tempMetadata.setMetadataPackageVersion(metadataPackage.getHeader().getVersion().getVersionString()); + tempMetadata.setMetadataLanguage(metadata.getHeader().getLanguage()); + tempMetadata.setMavenPackageGroupId(sourceModel.getGroupId()); + tempMetadata.setMavenPackageArtifactId(sourceModel.getArtifactId()); + tempMetadata.setMavenPackageVersion(sourceModel.getVersion()); + tempMetadata.setMavenPackageUrl(repoUrl); + tempMetadata.setProcessMode(processMode); + metadatas.add(tempMetadata); + } + + packageWithMetadataInfoWithProcessMode.setMetadatas(metadatas); + + String indexServerUrl = IndexServerManager.getInstance().getIndexServerWithProcessModeUrl(); + try { + restTemplate.postForObject(indexServerUrl, new HttpEntity<>(packageWithMetadataInfoWithProcessMode, new HttpHeaders()), boolean.class); + } catch (Exception e) { + if (e.getMessage().contains("404")) { + throw new RuntimeException("未更新索引服务器版本,无法推送解析型元数据。请联系管理员解决。"); + } else { + throw e; + } + } + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentManager.java new file mode 100644 index 0000000..33c488b --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentManager.java @@ -0,0 +1,50 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.manager; + +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.core.MavenUtilsCore; + +public class MavenDeploymentManager { + + private MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + + private FileServiceImp fileServiceImp = new FileServiceImp(); + + public MavenDeploymentManager() { + + } + + public void deploy() { + beforeDeploy(); + + doDeploy(); + + afterDeploy(); + } + + protected void beforeDeploy() { + + } + + protected void doDeploy() { + + } + + protected void afterDeploy() { + + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/PackageNameManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/PackageNameManager.java new file mode 100644 index 0000000..265c58a --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/PackageNameManager.java @@ -0,0 +1,79 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.manager; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.core.MetadataProjectCoreService; +import java.io.File; +import java.util.List; + +public class PackageNameManager { + private MetadataProjectCoreService metadataProjectCoreService = new MetadataProjectCoreService(); + + public String getMdpkgNameByGA(String groupId, String artifactId, String mavenPath, String absolutePath) { + String mdpkgName = ""; + + mdpkgName = getMdpkgNameByGAFromMaven(groupId, artifactId, mavenPath); + if (!mdpkgName.isEmpty()) { + return mdpkgName; + } + + mdpkgName = getMdpkgNameByGASplice(groupId, artifactId, absolutePath); + return mdpkgName; + } + + private String getMdpkgNameByGASplice(String groupId, String artifactId, String absolutePath) { + String mdpkgName = ""; + if (artifactId.equals("gsp-common-commoncomponent-api")) { + mdpkgName = "Inspur.Gsp.Common.CommonCmp".toLowerCase(); + } else if (artifactId.equals("gsp-pfcommon-commonudt-api")) { + mdpkgName = "Inspur.Gsp.Common.CommonUdt".toLowerCase(); + } else { + String front = groupId.substring(groupId.indexOf(".") + 1); + String back = artifactId.substring(0, artifactId.indexOf("-api")).replace('-', '.'); + back = back.endsWith("front") ? back.substring(0, back.length() - 5) + ".front" : back; + String mdpkgNameLikely = front + '.' + back; + MetadataProject metadataProjInfo = metadataProjectCoreService.getMetadataProjInfo(absolutePath); + List metadataPackageRefs = metadataProjInfo.getMetadataPackageRefs(); + if (metadataPackageRefs != null && metadataPackageRefs.size() > 0) { + MetadataPackageHeader metadataPackageHeader = metadataPackageRefs.stream().filter(ref -> ref.getName().toLowerCase().equals(mdpkgNameLikely)).findFirst().orElse(null); + if (metadataPackageHeader != null) { + mdpkgName = metadataPackageHeader.getName(); + } + } + } + return mdpkgName; + } + + private String getMdpkgNameByGAFromMaven(String groupId, String artifactId, String mavenPath) { + String mdpkgName = ""; + FileServiceImp fileServiceImp = new FileServiceImp(); + + // 首先从maven目录获取,以packName开头的目录将被选出来,其余被过滤掉 + File[] dirs = new File(mavenPath).listFiles((dir, name) -> name.startsWith(groupId + "-" + artifactId)); + if (dirs != null && dirs.length > 0) { + File[] files = dirs[0].listFiles((dir, name) -> name.endsWith(Utils.getMetadataPackageExtension())); + if (files != null && files.length > 0) { + mdpkgName = fileServiceImp.getFileNameWithoutExtension(files[0].getPath()); + } + } + return mdpkgName; + } + +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/PomManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/PomManager.java new file mode 100644 index 0000000..2902b4f --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/PomManager.java @@ -0,0 +1,64 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.manager; + +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.common.MavenUtils; +import com.inspur.edp.lcm.metadata.core.persistence.RepositoryFactory; +import java.util.List; +import org.apache.maven.model.DistributionManagement; +import org.apache.maven.model.Model; + +public class PomManager { + + public void createPomWithSourceModel(Model sourceModel, String pomPath, String repoId, String dependencyVersion) { + final Model model = createModelWithSourceModel(sourceModel, repoId, dependencyVersion); + writeModel(pomPath, model); + } + + public void createPomForDependencyCopy(List refs, String pomPath) { + RepositoryFactory.getInstance().getPomRepository().createPomForDependencyCopy(refs, pomPath); + } + + public void updatePom(String pomPath, List refs, String packaging) { + RepositoryFactory.getInstance().getPomRepository().updatePom(pomPath, refs, packaging); + } + + public void setRepoUrl(String pomPath, String repoId) { + final Model model = getModel(pomPath); + final DistributionManagement distributionManagement = RepositoryFactory.getInstance().getMavenSettingsRepository().getDistributionManagement(repoId, model.getVersion().endsWith(MavenUtils.snapShot)); + model.setDistributionManagement(distributionManagement); + writeModel(pomPath, model); + } + + public void writeModel(String pomPath, Model model) { + RepositoryFactory.getInstance().getPomRepository().writeModel(pomPath, model); + } + + public Model getModel(String pomPath) { + Model model = RepositoryFactory.getInstance().getPomRepository().getModel(pomPath); + model.setGroupId(model.getGroupId() == null ? model.getParent().getGroupId() : model.getGroupId()); + model.setArtifactId(model.getArtifactId() == null ? model.getParent().getArtifactId() : model.getArtifactId()); + model.setVersion(model.getVersion() == null ? model.getParent().getVersion() : model.getVersion()); + return model; + } + + private Model createModelWithSourceModel(Model sourceModel, String repoId, String dependencyVersion) { + final Model modelWithSourceModel = RepositoryFactory.getInstance().getPomRepository().createModelWithSourceModel(sourceModel, repoId, dependencyVersion); + return modelWithSourceModel; + } + +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/VersionManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/VersionManager.java new file mode 100644 index 0000000..dfb0fbb --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/VersionManager.java @@ -0,0 +1,77 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.manager; + +import com.inspur.edp.lcm.metadata.common.Utils; + +public class VersionManager { + public String versionCompare(String existVersion, String newVersion) { + if (newVersion == null) { + return existVersion; + } + + if (existVersion == null) { + return newVersion; + } + + String[] existVersions = existVersion.split("\\."); + String[] newVersions = newVersion.split("\\."); + int first = Integer.parseInt(existVersions[0].replace(Utils.getVersionPrefix(), "")) - Integer.parseInt(newVersions[0].replace(Utils.getVersionPrefix(), "")); + if (first > 0) { + return existVersion; + } + if (first < 0) { + return newVersion; + } + int second = Integer.parseInt(existVersions[1]) - Integer.parseInt(newVersions[1]); + if (second > 0) { + return existVersion; + } + if (second < 0) { + return newVersion; + } + + // 解决其他后缀对比问题 + String third1 = existVersions[2].replace(Utils.getVersionSuffix(), ""); + int thirdInt1; + if (third1.contains("-")) { + thirdInt1 = Integer.parseInt(third1.split("-")[0]); + } else { + thirdInt1 = Integer.parseInt(third1); + } + String third2 = newVersions[2].replace(Utils.getVersionSuffix(), ""); + int thirdInt2; + if (third2.contains("-")) { + thirdInt2 = Integer.parseInt(third2.split("-")[0]); + } else { + thirdInt2 = Integer.parseInt(third2); + } + int third = thirdInt1 - thirdInt2; + + if (third > 0) { + return existVersion; + } + if (third < 0) { + return newVersion; + } + + if (!existVersion.endsWith(Utils.getVersionSuffix())) { + return existVersion; + } else { + return newVersion; + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MavenSettingsRepository.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MavenSettingsRepository.java new file mode 100644 index 0000000..36acc3b --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MavenSettingsRepository.java @@ -0,0 +1,66 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.persistence; + +import com.inspur.edp.ide.setting.api.entity.MavenSettings; +import com.inspur.edp.ide.setting.api.entity.MavenSettingsMirror; +import com.inspur.edp.ide.setting.api.service.MavenService; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataRepo; +import com.inspur.edp.lcm.metadata.common.Utils; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.util.List; +import org.apache.maven.model.DeploymentRepository; +import org.apache.maven.model.DistributionManagement; + +public class MavenSettingsRepository { + public List getRepoUrls() { + MetadataRepo metadataRepo = new MetadataRepo(); + final MavenSettings mavenSettings = SpringBeanUtils.getBean(MavenService.class).getMavenSettings(); + final List mirrors = mavenSettings.getMirrors(); + return mirrors; + } + + public String getRepoUrl(String repoId) { + final MavenSettings mavenSettings = SpringBeanUtils.getBean(MavenService.class).getMavenSettings(); + final List mirrors = mavenSettings.getMirrors(); + if (mirrors == null || mirrors.size() <= 0) { + return null; + } + for (MavenSettingsMirror mirror : mirrors) { + if (mirror.getId().equals(repoId)) { + return mirror.getUrl(); + } + } + return null; + } + + public DistributionManagement getDistributionManagement(String repoId, boolean isSnotshot) { + DeploymentRepository deploymentRepository = new DeploymentRepository(); + String repoUrl = getRepoUrl(repoId); + Utils.checkEmpty(repoUrl, "获取仓库地址为空:" + repoId + ",请检查工作空间下的settings.xml文件。"); + deploymentRepository.setId(repoId); + deploymentRepository.setUrl(repoUrl); + + DistributionManagement distributionManagement = new DistributionManagement(); + if (isSnotshot) { + distributionManagement.setSnapshotRepository(deploymentRepository); + } else { + distributionManagement.setRepository(deploymentRepository); + } + + return distributionManagement; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataProjectRepository.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataProjectRepository.java new file mode 100644 index 0000000..5505857 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataProjectRepository.java @@ -0,0 +1,264 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.persistence; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; +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.ProjectHeader; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import java.io.File; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; + +public class MetadataProjectRepository { + private FileServiceImp fileService = new FileServiceImp(); + + public void add(String fullPath, String projectStr) { + fileService.createFile(fullPath); + fileService.fileUpdate(fullPath, projectStr, false); + } + + public MetadataProject assmbllyMetadataProj(String projName, String projNameSpace, String packageName) { + MetadataProject metadataProject = new MetadataProject(); + metadataProject.setId(UUID.randomUUID().toString()); + metadataProject.setNameSpace(projNameSpace); + metadataProject.setName(projName); + metadataProject.setMetadataPackageInfo(new MetadataPackageHeader()); + metadataProject.getMetadataPackageInfo().setName(packageName); + metadataProject.getMetadataPackageInfo().setVersion(new MetadataPackageVersion("1.0.0")); + metadataProject.setMetadataPackageRefs(new ArrayList<>()); + metadataProject.setMavenPackageRefs(new ArrayList<>()); + return metadataProject; + } + + public void setSourceData(String absolutePath, + Map>> sourceData) throws IOException { + String filePath = absolutePath + "/" + Utils.getMetadataProjPath() + "/" + Utils.getMetadataBinPath() + "/" + Utils.getSourceDataFileName(); + File sourceDataFile = new File(filePath); + if (!sourceDataFile.exists()) { + createBinDir(absolutePath); + sourceDataFile.createNewFile(); + } + fileService.fileUpdate(filePath, JSON.toJSONString(sourceData, true), false); + } + + public Map>> getSourceData(String absolutePath) { + Map>> sourceData = new HashMap<>(); + String filePath = absolutePath + "/" + Utils.getMetadataProjPath() + + "/" + Utils.getMetadataBinPath() + "/" + Utils.getSourceDataFileName(); + if (!fileService.isFileExist(filePath)) { + Map> modifiedTime = new HashMap<>(); + modifiedTime.put("metadata", new HashMap<>()); + modifiedTime.put("api_src", new HashMap<>()); + modifiedTime.put("api", new HashMap<>()); + modifiedTime.put("comp", new HashMap<>()); + modifiedTime.put("runtime", new HashMap<>()); + sourceData.put("modifiedtime", modifiedTime); + return sourceData; + } + try { + // 如果sourcedata.json文件格式错误,则初始化,并返回空。 + sourceData = JSONObject.parseObject(fileService.fileRead(filePath), new TypeReference>>>() { + }); + return sourceData; + } catch (Exception e) { + try { + fileService.fileDelete(filePath); + return getSourceData(absolutePath); + } catch (IOException ioException) { + ioException.printStackTrace(); + } + } + return sourceData; + } + + public void setMavenUpdateFlag(String absolutePath, Boolean flag) { + String filePath = absolutePath + "/" + Utils.getMetadataProjPath() + + "/" + Utils.getMetadataBinPath() + "/" + Utils.getMavenUpdateFlagFileName(); + File mavenUpdateFlagFile = new File(filePath); + if (!mavenUpdateFlagFile.exists()) { + createBinDir(absolutePath); + try { + mavenUpdateFlagFile.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + } + String feature = flag == true ? " -U" : ""; + fileService.fileUpdate(filePath, feature, false); + } + + public String getMavenUpdateFlag(String absolutePath) { + String filePath = absolutePath + "/" + Utils.getMetadataProjPath() + + "/" + Utils.getMetadataBinPath() + "/" + Utils.getMavenUpdateFlagFileName(); + if (!fileService.isFileExist(filePath)) { + setMavenUpdateFlag(absolutePath, false); + } + String updateFlag = fileService.fileRead(filePath); + return updateFlag; + } + + private void createBinDir(String absolutePath) { + String dirPath = absolutePath + "/" + Utils.getMetadataProjPath() + + "/" + Utils.getMetadataBinPath(); + File binDir = new File(dirPath); + if (!binDir.exists()) { + binDir.mkdirs(); + } + } + + public void updateMetadataProject(String projPath, MetadataProject metadataProject) { + String filePath = getMdprojPath(projPath, metadataProject); + Utils.writeValue(filePath, metadataProject); + } + + public void updateRefs(String projPath, MetadataProject metadataProject, MetadataPackageHeader packageHeader) { + String filePath = getMdprojPath(projPath, metadataProject); + + if (packageHeader.getName() == null || packageHeader.getName().isEmpty()) { + return; + } + + if (packageHeader.getName().endsWith(Utils.getMetadataPackageExtension())) { + packageHeader.setName(fileService.getFileNameWithoutExtension(packageHeader.getName())); + } + + if (metadataProject.getMetadataPackageRefs() == null) { + metadataProject.setMetadataPackageRefs(new ArrayList<>()); + } + + boolean existFlag = metadataProject.getMetadataPackageRefs().stream().anyMatch(ref -> ref.getName().equals(packageHeader.getName())); + if (!existFlag) { + metadataProject.getMetadataPackageRefs().add(packageHeader); + Utils.writeValue(filePath, metadataProject); + } + } + + public void removeRefs(String projPath, MetadataProject metadataProject, MetadataPackageHeader packageHeader) { + String filePath = getMdprojPath(projPath, metadataProject); + + if (packageHeader.getName() == null || packageHeader.getName().isEmpty()) { + return; + } + + if (packageHeader.getName().endsWith(Utils.getMetadataPackageExtension())) { + packageHeader.setName(fileService.getFileNameWithoutExtension(packageHeader.getName())); + } + + if (metadataProject.getMetadataPackageRefs() == null) { + metadataProject.setMetadataPackageRefs(new ArrayList<>()); + } + + MetadataPackageHeader metadataPackageHeader = metadataProject.getMetadataPackageRefs() + .stream() + .filter(ref -> ref.getName().equals(packageHeader.getName())) + .findFirst().orElse(null); + if (metadataPackageHeader != null) { + metadataProject.getMetadataPackageRefs().remove(metadataPackageHeader); + Utils.writeValue(filePath, metadataProject); + } + } + + public void updateMavenRefs(String projPath, MetadataProject metadataProject, MavenPackageRefs packageRefs) { + String filePath = getMdprojPath(projPath, metadataProject); + + if (metadataProject.getMavenPackageRefs() == null) { + metadataProject.setMavenPackageRefs(new ArrayList<>()); + } + + int index = -1; + for (int i = 0; i < metadataProject.getMavenPackageRefs().size(); i++) { + if (metadataProject.getMavenPackageRefs().get(i).getGroupId().equals(packageRefs.getGroupId()) && metadataProject.getMavenPackageRefs().get(i).getArtifactId().equals(packageRefs.getArtifactId())) { + index = i; + break; + } + } + if (index != -1) { + metadataProject.getMavenPackageRefs().get(index).setVersion(packageRefs.getVersion()); + } else { + metadataProject.getMavenPackageRefs().add(packageRefs); + } + + Utils.writeValue(filePath, metadataProject); + } + + public void removeMavenRefs(String projPath, MetadataProject metadataProject, MavenPackageRefs packageRefs) { + String filePath = getMdprojPath(projPath, metadataProject); + + if (metadataProject.getMavenPackageRefs() == null) { + metadataProject.setMavenPackageRefs(new ArrayList<>()); + } + + MavenPackageRefs mavenPackageRefs = metadataProject.getMavenPackageRefs() + .stream() + .filter(ref -> ref.getGroupId().equals(packageRefs.getGroupId()) && ref.getArtifactId().equals(packageRefs.getArtifactId())) + .findFirst() + .orElse(null); + if (mavenPackageRefs != null) { + metadataProject.getMavenPackageRefs().remove(mavenPackageRefs); + Utils.writeValue(filePath, metadataProject); + } + } + + public void removeProjectRefs(String projPath, MetadataProject metadataProject, List mdpkgNames) { + String filePath = getMdprojPath(projPath, metadataProject); + if (metadataProject.getProjectRefs() == null) { + metadataProject.setProjectRefs(new ArrayList<>()); + } + + List projectHeaders = metadataProject.getProjectRefs() + .stream() + .filter(ref -> mdpkgNames.contains(ref.getName())) + .collect(Collectors.toList()); + if (projectHeaders != null && projectHeaders.size() > 0) { + for (ProjectHeader header : projectHeaders) { + metadataProject.getProjectRefs().remove(header); + } + Utils.writeValue(filePath, metadataProject); + } + } + + public void updateProjectRefs(String projPath, MetadataProject metadataProject, ProjectHeader projectHeader) { + String filePath = getMdprojPath(projPath, metadataProject); + if (metadataProject.getProjectRefs() == null) { + metadataProject.setProjectRefs(new ArrayList<>()); + } + boolean notExistFlag = metadataProject.getProjectRefs() + .stream() + .noneMatch(ref -> projectHeader.getName().equals(ref.getName())); + if (notExistFlag) { + metadataProject.getProjectRefs().add(projectHeader); + Utils.writeValue(filePath, metadataProject); + } + } + + private String getMdprojPath(String projPath, MetadataProject metadataProject) { + String mdprojPath = Paths.get(projPath).resolve(Utils.getMetadataProjPath() + File.separator + metadataProject.getProjectFileName()).toString(); + return mdprojPath; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataRepository.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataRepository.java new file mode 100644 index 0000000..00db729 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataRepository.java @@ -0,0 +1,111 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.persistence; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.MetadataSerializer; +import com.inspur.edp.lcm.metadata.common.Utils; +import java.io.File; +import java.io.IOException; +import java.util.List; +import lombok.var; + +public class MetadataRepository { + private FileServiceImp fileService = new FileServiceImp(); + MetadataSerializer metadataSerializer = new MetadataSerializer(); + + public GspMetadata load(String absolutePath) { + var fileString = fileService.fileRead(absolutePath); + var metadata = metadataSerializer.deserialize(fileString, GspMetadata.class); + metadata.setRelativePath(absolutePath.substring(0, Utils.handlePath(absolutePath).lastIndexOf('/'))); + return metadata; + } + + public GspMetadata getMetadataWithoutContent(String path) { + String fileStr = fileService.fileRead(path); + if (fileStr == null || fileStr.isEmpty()) { + return null; + } + ObjectMapper mapper = Utils.getMapper(); + JsonNode metadataObj = null; + try { + metadataObj = mapper.readTree(fileStr); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } catch (IOException e) { + e.printStackTrace(); + } + GspMetadata metadata = metadataSerializer.buildMetadataBaseInfo(metadataObj); + metadata.setRelativePath(path.substring(0, Utils.handlePath(path).lastIndexOf('/'))); + return metadata; + } + + public void getMetadatasUnderDir(List mdPathList, String dirPath) { + var dirs = fileService.getDirectorys(dirPath); + if (dirs.size() > 0) { + for (int i = 0; i < dirs.size(); i++) { + String dirName = fileService.getFileName(Utils.handlePath(dirs.get(i).getPath())); + String temPath = dirPath + "/" + dirName; + if (!dirName.equalsIgnoreCase(".git") && !dirName.equalsIgnoreCase(".vs") && !dirName.equalsIgnoreCase("bin") && !dirName.toLowerCase().equals("publish") && !dirName.toLowerCase().equals("obj") && !dirName.toLowerCase().equals("src") && !dirName.toLowerCase().equals("java")) { + getMetadatasUnderDir(mdPathList, temPath); + } + } + } + var paths = fileService.getAllFiles(dirPath); + if (paths.size() > 0) { + for (File path : paths) { + mdPathList.add(Utils.handlePath(path.getPath())); + } + } + } + + public void create(GspMetadata metadata, String path) { + // 序列化元数据 + String metadataStr = metadataSerializer.serialize(metadata); + String folderPath = new File(path).getParent(); + if (!fileService.isDirectoryExist(folderPath)) { + fileService.createDirectory(folderPath); + } + fileService.createFile(path); + fileService.fileUpdate(path, metadataStr, false); + } + + public void save(GspMetadata metadata, String path) { + // 序列化元数据 + String metadataStr = metadataSerializer.serialize(metadata); + fileService.fileUpdate(path, metadataStr, false); + } + + public void delete(String path) { + try { + fileService.fileDelete(path); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void rename(String oldName, String newName) { + try { + fileService.fileRename(oldName, newName); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/PomRepository.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/PomRepository.java new file mode 100644 index 0000000..dd0af2d --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/PomRepository.java @@ -0,0 +1,156 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.persistence; + +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.MavenUtils; +import com.inspur.edp.lcm.metadata.core.entity.PackageType; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.apache.maven.model.Dependency; +import org.apache.maven.model.DistributionManagement; +import org.apache.maven.model.Model; +import org.apache.maven.model.Parent; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.apache.maven.model.io.xpp3.MavenXpp3Writer; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +public class PomRepository { + private final String GROUP_ID = "com.inspur.edp"; + private final String ARTIFACT_ID = "download-tools"; + private final String VERSION = "0.1.0-SNAPSHOT"; + private final String MODEL_VERSION = "4.0.0"; + private final String PACKAGING = "pom"; + + FileServiceImp fileServiceImp = new FileServiceImp(); + + public Model getModel(String pomPath) { + try (FileInputStream fis = new FileInputStream(pomPath)) { + MavenXpp3Reader reader = new MavenXpp3Reader(); + final Model model = reader.read(fis); + return model; + } catch (IOException | XmlPullParserException e) { + e.printStackTrace(); + } + return null; + } + + public void writeModel(String pomPath, Model model) { + File pom = new File(pomPath); + if (!pom.exists()) { + pom.getParentFile().mkdirs(); + try { + pom.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + } + try (FileOutputStream fileOutputStream = new FileOutputStream(pomPath)) { + MavenXpp3Writer mavenXpp3Writer = new MavenXpp3Writer(); + mavenXpp3Writer.write(fileOutputStream, model); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void createPomForDependencyCopy(List refs, String pomPath) { + // 创建pom文件 + fileServiceImp.createFile(pomPath); + // 创建model并写入 + final List dependencies = createDependencies(refs, PackageType.zip.toString()); + final Model model = createModel(GROUP_ID, ARTIFACT_ID, VERSION, MODEL_VERSION, PACKAGING, dependencies); + writeModel(pomPath, model); + } + + public void updatePom(String pomPath, List refs, String packaging) { + Model model = getModel(pomPath); + model.setPackaging(packaging); + final List dependencies = createDependencies(refs, PackageType.jar.toString()); + model.setDependencies(dependencies); + writeModel(pomPath, model); + } + + public Model createModelWithSourceModel(Model sourceModel, String repoId, String dependencyVersion) { + Model model = new Model(); + + Parent parent = createParent(); + model.setParent(parent); + + model.setGroupId(sourceModel.getGroupId()); + model.setArtifactId(sourceModel.getArtifactId()); + model.setVersion(sourceModel.getVersion().startsWith("m") ? sourceModel.getVersion() : "m" + sourceModel.getVersion()); + + model.setModelVersion("4.0.0"); + model.setPackaging("metadata-pack"); + + final boolean isSnotshot = sourceModel.getVersion().endsWith(MavenUtils.snapShot); + DistributionManagement distributionManagement = RepositoryFactory.getInstance().getMavenSettingsRepository().getDistributionManagement(repoId, isSnotshot); + model.setDistributionManagement(distributionManagement); + + List list = model.getDependencies(); + if (sourceModel.getDependencies() != null && sourceModel.getDependencies().size() > 0) { + sourceModel.getDependencies().forEach(sourceDependency -> { + Dependency dependency = new Dependency(); + dependency.setGroupId(sourceDependency.getGroupId()); + dependency.setArtifactId(sourceDependency.getArtifactId()); + boolean dependencyVersionFlag = dependencyVersion != null && sourceDependency.getVersion().endsWith(MavenUtils.snapShot); + String actingVersion = "m" + (dependencyVersionFlag ? dependencyVersion : sourceDependency.getVersion()); + dependency.setVersion(actingVersion); + dependency.setType("zip"); + }); + } + model.setDependencies(list); + return model; + } + + private Model createModel(String groupId, String artifactId, String version, String modelVersion, String packaging, + List dependencies) { + Model model = new Model(); + model.setArtifactId(groupId); + model.setGroupId(artifactId); + model.setVersion(version); + model.setModelVersion(modelVersion); + model.setPackaging(packaging); + model.setDependencies(dependencies); + return model; + } + + private List createDependencies(List refs, String dependencyType) { + List dependencies = new ArrayList<>(); + refs.forEach(ref -> { + Dependency dependency = new Dependency(); + dependency.setArtifactId(ref.getArtifactId()); + dependency.setGroupId(ref.getGroupId()); + dependency.setVersion(ref.getVersion()); + dependency.setType(dependencyType); + dependencies.add(dependency); + }); + return dependencies; + } + + private Parent createParent() { + final Parent parent = new Parent(); + parent.setArtifactId("metadata-parent"); + parent.setGroupId("com.inspur.edp"); + parent.setVersion("0.1.0"); + return parent; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/RepositoryFactory.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/RepositoryFactory.java new file mode 100644 index 0000000..ce16cf7 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/RepositoryFactory.java @@ -0,0 +1,68 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.persistence; + +public class RepositoryFactory { + private RepositoryFactory() { + } + + ; + private static RepositoryFactory instance; + + public static RepositoryFactory getInstance() { + if (instance == null) { + instance = new RepositoryFactory(); + } + return instance; + } + + private MetadataRepository metadataRepository; + + public MetadataRepository getMetadataRepository() { + if (metadataRepository == null) { + metadataRepository = new MetadataRepository(); + } + return metadataRepository; + } + + private MetadataProjectRepository metadataProjectRepository; + + public MetadataProjectRepository getMetadataProjectRepository() { + if (metadataProjectRepository == null) { + metadataProjectRepository = new MetadataProjectRepository(); + } + return metadataProjectRepository; + } + + private PomRepository pomRepository; + + public PomRepository getPomRepository() { + if (pomRepository == null) { + pomRepository = new PomRepository(); + } + return pomRepository; + } + + private MavenSettingsRepository mavenSettingsRepository; + + public MavenSettingsRepository getMavenSettingsRepository() { + if (mavenSettingsRepository == null) { + mavenSettingsRepository = new MavenSettingsRepository(); + } + return mavenSettingsRepository; + } + +} diff --git a/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/RefCommonServiceImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/IRefI18nFilter.java similarity index 66% rename from model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/RefCommonServiceImp.java rename to model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/IRefI18nFilter.java index bef24d0..874da02 100644 --- a/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/RefCommonServiceImp.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/IRefI18nFilter.java @@ -13,19 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.inspur.edp.jittojava.context.temp; +package com.inspur.edp.lcm.metadata.core.refi18n; import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; -import com.inspur.edp.lcm.metadata.api.service.RefCommonService; +import java.util.List; -/** - * The type RefCommonServiceImp - * - * @author: Jack Lee - */ -public class RefCommonServiceImp implements RefCommonService { - @Override - public GspMetadata getRefMetadata(String metadataID) { - return null; - } +public interface IRefI18nFilter { + List getRefI18nMetadata(String resouceMdID, String resourceFileName, String path, String mavenPath, + String packagePath); } diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/RefI18nMetadataFactory.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/RefI18nMetadataFactory.java new file mode 100644 index 0000000..b3f9570 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/RefI18nMetadataFactory.java @@ -0,0 +1,26 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.refi18n; + +import com.inspur.edp.lcm.metadata.core.MetadataCoreManager; + +public class RefI18nMetadataFactory { + public IRefI18nFilter createFilter(String resourceMetadataID, String path) { + MetadataCoreManager metadataCoreManager = new MetadataCoreManager(); + boolean existInProject = metadataCoreManager.isMetadataExistInProject(path, resourceMetadataID); + return existInProject ? new SelfProjectFilter() : new RefLocationFilter(); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/RefLocationFilter.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/RefLocationFilter.java new file mode 100644 index 0000000..eefc4aa --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/RefLocationFilter.java @@ -0,0 +1,134 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.refi18n; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4Ref; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.ProjectMetadataCache; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.cache.MetadataDevCacheManager; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.core.MetadataCoreManager; +import com.inspur.edp.lcm.metadata.core.MetadataProjectCoreService; +import com.inspur.edp.lcm.metadata.core.index.MetadataPackageIndexServiceForMaven; +import com.inspur.edp.lcm.metadata.core.index.MetadataPackageIndexServiceForPackages; +import com.inspur.edp.lcm.metadata.core.index.ProjectMetadataCacheService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +public class RefLocationFilter implements IRefI18nFilter { + private final MetadataCoreManager metadataManager = new MetadataCoreManager(); + private final MetadataProjectCoreService projectService = new MetadataProjectCoreService(); + private ProjectMetadataCacheService projectMetadataCacheService; + + @Override + public List getRefI18nMetadata(String resourceMdID, String resourceFileName, String path, + String mavenPath, String packagePath) { + //从工程引用范围内,查找包依赖的元数据内容 + MetadataProject metadataProject = MetadataProjectCoreService.getCurrent().getMetadataProjInfo(path); + Utils.checkNPE(metadataProject, "获取的元数据工程信息为null,参数为projPath:" + path); + + // 从当前工程及bo下的引用的工程下搜索 + List metadataFromProjects = getMetadataFromProjects(resourceMdID, metadataProject); + if (metadataFromProjects.size() > 0) { + return metadataFromProjects; + } + + // 从缓存中获取 + projectMetadataCacheService = ProjectMetadataCacheService.getNewInstance(metadataProject, path, packagePath, mavenPath); + String metadataPackageLocation = getMetadataPackageLocationFromCache(resourceMdID, metadataProject, false, packagePath, mavenPath); + if (metadataPackageLocation == null || metadataPackageLocation.isEmpty()) { + metadataPackageLocation = getMetadataPackageLocationFromCache(resourceMdID, metadataProject, true, packagePath, mavenPath); + if (metadataPackageLocation == null || metadataPackageLocation.isEmpty()) { + metadataManager.throwMetadataNotFoundException(resourceMdID); + } + } + + //按照maven的查找规范查找,查找maven目录与packages目录 + //获取资源元数据所在包的信息,包括包所在的位置,元数据所处包中的位置,需要过滤具体的包中,资源元数据对应的语言包元数据,元数据文件名称.languagecode.lres(SalesOrder0426.be.en.lres) + return GetlresMetadataFromPackage(resourceMdID, resourceFileName, metadataPackageLocation); + } + + private String getMetadataPackageLocationFromCache(String metadataID, MetadataProject metadataProject, + Boolean refreshIndexFlag, String packagePath, String mavenPath) { + if (refreshIndexFlag) { + MetadataPackageIndexServiceForPackages.getInstance(packagePath).refreshMetadataPackageIndex(); + MetadataPackageIndexServiceForMaven.getInstance(mavenPath).refreshMetadataPackageIndex(); + projectMetadataCacheService.clearCache(); + } + projectMetadataCacheService.syncProjectMetadataCache(); + ProjectMetadataCache projectMetadataCacheMap = (ProjectMetadataCache) MetadataDevCacheManager.getProjectMetadataCacheMap(metadataProject.getProjectPath()); + return projectMetadataCacheMap.getMetadataPackageLocations().get(metadataID); + } + + private List getMetadataFromProjects(String resourceMdID, MetadataProject metadataProject) { + List lresMetadataList = new ArrayList<>(); + List refProjPaths = new ArrayList<>(); + if (metadataProject != null) { + refProjPaths.add(metadataProject.getProjectPath()); + projectService.getRefProjPaths(metadataProject.getProjectPath(), refProjPaths); + FileService fileService = SpringBeanUtils.getBean(FileService.class); + for (String projPath : refProjPaths) { + List metadataList = metadataManager.getMetadataList(projPath); + for (GspMetadata gspMetadata : metadataList) { + if (gspMetadata.getHeader().getId().equals(resourceMdID)) { + String resourceMdFileNameWithoutExt = fileService.getFileNameWithoutExtension(gspMetadata.getHeader().getFileName()); + for (GspMetadata metadata : metadataList) { + if (metadata.getHeader().getFileName().endsWith(Utils.getLanguageMetadataFileExtention()) && metadata.getHeader().getFileName().startsWith(resourceMdFileNameWithoutExt)) { + GspMetadata lresMetadata = metadataManager.loadMetadata(gspMetadata.getHeader().getFileName(), gspMetadata.getRelativePath()); + lresMetadataList.add(lresMetadata); + } + } + break; + } + } + } + } + return lresMetadataList; + } + + private List GetlresMetadataFromPackage(String resourceMdID, String resourceMdFileName, + String metadataPackageLocation) { + File packageFile = new File(metadataPackageLocation); + //必须用GetMetadataPackageInfoFromSpecPath获取包的信息 + MetadataPackage metadataPackageInfo = MetadataCoreManager.getCurrent().getMetadataPackageInfo(packageFile.getName(), packageFile.getParent()); + //根据包具体的信息,对比metadataid,找到metadataid对应元数据的相对路径,其中找语言包元数据列表 + if (metadataPackageInfo == null || metadataPackageInfo.getMetadataList() == null) { + throw new RuntimeException("could not find reourseMetadata's metadataPackage, reoursefilename is " + resourceMdFileName); + } + + FileService fileService = SpringBeanUtils.getBean(FileService.class); + List lresMetadataList = new ArrayList<>(); + for (GspMetadata gspMetadata : metadataPackageInfo.getMetadataList()) { + if (resourceMdID.equals(gspMetadata.getHeader().getId())) { + String resourceMdFileNameWithoutExt = fileService.getFileNameWithoutExtension(gspMetadata.getHeader().getFileName()); + for (GspMetadata metadata : metadataPackageInfo.getMetadataList()) { + if (metadata.getHeader().getFileName().endsWith(Utils.getLanguageMetadataFileExtention()) && metadata.getHeader().getFileName().startsWith(resourceMdFileNameWithoutExt)) { + Metadata4Ref metadataFromPackage = MetadataCoreManager.getCurrent().getMetadataFromPackage(packageFile.getName(), packageFile.getParent(), metadata.getHeader().getId()); + lresMetadataList.add(metadataFromPackage.getMetadata()); + } + } + break; + } + } + + return lresMetadataList; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/SelfProjectFilter.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/SelfProjectFilter.java new file mode 100644 index 0000000..febb9e3 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/SelfProjectFilter.java @@ -0,0 +1,56 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.refi18n; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.core.MetadataCoreManager; +import com.inspur.edp.lcm.metadata.core.MetadataProjectCoreService; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +public class SelfProjectFilter implements IRefI18nFilter { + @Override + public List getRefI18nMetadata(String resouceMdID, String resourceFileName, String path, + String mavenPath, String packagePath) { + List languageMetadataList = new ArrayList<>(); + + MetadataProjectCoreService metadataProjectCoreService = new MetadataProjectCoreService(); + MetadataProject metadataProjInfo = metadataProjectCoreService.getMetadataProjInfo(path); + MetadataCoreManager metadataCoreManager = new MetadataCoreManager(); + GspMetadata resourceMetadata = metadataCoreManager.loadMetadataByMetadataId(resouceMdID, metadataProjInfo.getProjectPath()); + + //查找对应的语言包元数据,语言包元数据需要文件操作,获取所有的语言包元数据文件 + //资源元数据以及资源元数据对应的语言包元数据,是平铺到一起的 + //资源元数据文件名称.languagecode.lres(SalesOrder0426.be.en.lres) + //先过滤包含资源元数据文件名称的文件,然后过滤后缀为lres的文件 + String absolutePath = ManagerUtils.getAbsolutePath(resourceMetadata.getRelativePath()); + FileService fileService = new FileServiceImp(); + String searchFileName = resourceFileName == null || resourceFileName.isEmpty() ? fileService.getFileNameWithoutExtension(resourceMetadata.getHeader().getFileName()) : fileService.getFileNameWithoutExtension(resourceFileName); + File[] files = new File(absolutePath).listFiles((dir, name) -> name.startsWith(searchFileName) && name.endsWith(Utils.getLanguageMetadataFileExtention())); + + for (File file : files) { + GspMetadata metadata = metadataCoreManager.loadMetadata(file.getName(), file.getParent()); + languageMetadataList.add(metadata); + } + return languageMetadataList; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/CopyToPackagesRunnable.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/CopyToPackagesRunnable.java new file mode 100644 index 0000000..75d9173 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/CopyToPackagesRunnable.java @@ -0,0 +1,52 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.sync; + +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import java.io.File; +import java.io.IOException; +import java.util.List; + +public class CopyToPackagesRunnable implements Runnable { + private List downloadMdpkgPaths; + private String packagePath; + protected final FileServiceImp fileServiceImp = new FileServiceImp(); + + @Override + public void run() { + downloadMdpkgPaths.stream().parallel().forEach(path -> { + String mdpkgName = new File(path).getName(); + String desPackageDir = fileServiceImp.getCombinePath(packagePath, mdpkgName); + if (!fileServiceImp.isDirectoryExist(desPackageDir)) { + fileServiceImp.createDirectory(desPackageDir); + } + String desPackagePath = fileServiceImp.getCombinePath(desPackageDir, mdpkgName); + try { + fileServiceImp.fileCopy(path, desPackagePath); + } catch (IOException e) { + e.printStackTrace(); + } + }); + } + + public void setPackagePath(String packagePath) { + this.packagePath = packagePath; + } + + public void setDownloadMdpkgPaths(List downloadMdpkgPaths) { + this.downloadMdpkgPaths = downloadMdpkgPaths; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/InstallJarRunnable.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/InstallJarRunnable.java new file mode 100644 index 0000000..211faa0 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/InstallJarRunnable.java @@ -0,0 +1,111 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.sync; + +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.core.MavenUtilsCore; +import com.inspur.edp.lcm.metadata.core.entity.PackageType; +import com.inspur.edp.lcm.metadata.core.manager.MavenCommandGenerator; +import com.inspur.edp.lcm.metadata.core.manager.PomManager; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class InstallJarRunnable implements Runnable { + protected String pomPath; + protected String pomDirPath; + protected String mavenPath; + protected String downloadPath; + protected boolean forceUpdateFlag; + protected final FileServiceImp fileServiceImp = new FileServiceImp(); + protected final MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + private List downloadMdpkgPaths; + private String FEATURE_IN_NAME = "-api-"; + + @Override + public void run() { + try { + List refs = getMavenPackageRefs(); + final PomManager pomManager = new PomManager(); + pomManager.updatePom(pomPath, refs, PackageType.jar.toString()); + final MavenCommandGenerator mavenCommandGenerator = new MavenCommandGenerator(); + mavenCommandGenerator.setOutputDirectory(downloadPath); + mavenCommandGenerator.setIncludeTypes(PackageType.jar.toString()); + mavenCommandGenerator.setForceUpdate(forceUpdateFlag); + mavenCommandGenerator.setExcludeTransitive(true); + final String mavenCommand = mavenCommandGenerator.generateCopydependencies(); + mavenUtilsCore.exeMavenCommand(pomDirPath, mavenPath, mavenCommand); + } finally { + try { + //删除pom.xml + if (fileServiceImp.isFileExist(pomPath)) { + fileServiceImp.fileDelete(pomPath); + } + //删除\projects\maven/temp + if (fileServiceImp.isDirectoryExist(downloadPath)) { + fileServiceImp.deleteAllFilesUnderDirectory(downloadPath); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + private List getMavenPackageRefs() { + List refs = new ArrayList<>(); + downloadMdpkgPaths.forEach(path -> { + if (!path.contains("SNAPSHOT")) { + return; + } + String dirName = new File(new File(path).getParent()).getName(); + MavenPackageRefs mavenPackageRefs = new MavenPackageRefs(); + String groupId = dirName.substring(0, dirName.indexOf("-")); + String version = dirName.substring(dirName.lastIndexOf(FEATURE_IN_NAME) + FEATURE_IN_NAME.length() + 1); + String artifactId = dirName.substring(dirName.indexOf("-") + 1, dirName.lastIndexOf(FEATURE_IN_NAME) + FEATURE_IN_NAME.length() - 1); + mavenPackageRefs.setGroupId(groupId); + mavenPackageRefs.setArtifactId(artifactId); + mavenPackageRefs.setVersion(version); + refs.add(mavenPackageRefs); + }); + return refs; + } + + public void setPomPath(String pomPath) { + this.pomPath = pomPath; + } + + public void setForceUpdateFlag(boolean forceUpdateFlag) { + this.forceUpdateFlag = forceUpdateFlag; + } + + public void setPomDirPath(String pomDirPath) { + this.pomDirPath = pomDirPath; + } + + public void setMavenPath(String mavenPath) { + this.mavenPath = mavenPath; + } + + public void setDownloadPath(String downloadPath) { + this.downloadPath = downloadPath; + } + + public void setDownloadMdpkgPaths(List downloadMdpkgPaths) { + this.downloadMdpkgPaths = downloadMdpkgPaths; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/InstallSingleJarRunnable.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/InstallSingleJarRunnable.java new file mode 100644 index 0000000..016a465 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/InstallSingleJarRunnable.java @@ -0,0 +1,45 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.sync; + +import com.inspur.edp.lcm.metadata.core.manager.PomManager; +import java.io.File; +import java.io.IOException; +import org.apache.maven.model.Model; + +public class InstallSingleJarRunnable extends InstallJarRunnable { + + @Override + public void run() { + for (File file : fileServiceImp.getAllFiles(downloadPath)) { + if (file.getName().contains("SNAPSHOT") && fileServiceImp.getExtension(file).equals(".pom")) { + PomManager pomManager = new PomManager(); + Model model = pomManager.getModel(file.getPath()); + if (model != null) { + String mvnCommand = String.format(" dependency:get -DgroupId=%s -DartifactId=%s -Dversion=%s -Dskip=true -Dtransitive=false -U", model.getGroupId(), model.getArtifactId(), model.getVersion().substring(1)); + mavenUtilsCore.exeMavenCommand(pomDirPath, mavenPath, mvnCommand); + } + } + } + if (fileServiceImp.isDirectoryExist(downloadPath)) { + try { + fileServiceImp.deleteAllFilesUnderDirectory(downloadPath); + } catch (IOException e) { + e.printStackTrace(); + } + } + } +} diff --git a/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/common/JitCompilerConfigLoader.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/common/JitCompilerConfigLoader.java index ddc1370..98b73aa 100644 --- a/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/common/JitCompilerConfigLoader.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/common/JitCompilerConfigLoader.java @@ -20,11 +20,11 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.PropertyNamingStrategy; -import com.inspur.edp.jittojava.context.temp.EnvironmentUtil; +import com.inspur.edp.jittojava.context.entity.JitCompilerConfigration; +import io.iec.edp.caf.common.environment.EnvironmentUtil; import java.io.IOException; import java.nio.file.Paths; import java.util.List; -import com.inspur.edp.jittojava.context.entity.JitCompilerConfigration; /** * @Classname JitCompilerConfigLoader diff --git a/model/framework/runtime-spi/pom.xml b/model/framework/runtime-spi/pom.xml index 489c7c4..2d92872 100644 --- a/model/framework/runtime-spi/pom.xml +++ b/model/framework/runtime-spi/pom.xml @@ -14,4 +14,18 @@ ubml-model-framework-runtime-spi ${project.version} + + + io.iec.edp + caf-boot-commons-event + 0.3.2 + + + org.openatom.ubml + ubml-model-framework-common + 0.9.0-SNAPSHOT + compile + + + \ No newline at end of file diff --git a/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/DirEventArgs.java b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/DirEventArgs.java new file mode 100644 index 0000000..caf2e5b --- /dev/null +++ b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/DirEventArgs.java @@ -0,0 +1,30 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.spi.event; + +import io.iec.edp.caf.commons.event.CAFEventArgs; + +public class DirEventArgs extends CAFEventArgs { + private String path; + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } +} diff --git a/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/DirEventListener.java b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/DirEventListener.java new file mode 100644 index 0000000..5184496 --- /dev/null +++ b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/DirEventListener.java @@ -0,0 +1,34 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.spi.event; + +import io.iec.edp.caf.commons.event.IEventListener; + +public interface DirEventListener extends IEventListener { + /** + * 文件夹删除前事件 + * + * @param args 文件夹事件参数 + */ + void fireDirDeletingEvent(DirEventArgs args); + + /** + * 文件夹删除后事件 + * + * @param args 文件夹事件参数 + */ + void fireDirDeletedEvent(DirEventArgs args); +} diff --git a/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MdPkgChangedArgs.java b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MdPkgChangedArgs.java new file mode 100644 index 0000000..035e44e --- /dev/null +++ b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MdPkgChangedArgs.java @@ -0,0 +1,27 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.spi.event; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import io.iec.edp.caf.commons.event.CAFEventArgs; + +/** + * @author zhaoleitr + */ +public class MdPkgChangedArgs extends CAFEventArgs { + + private MetadataPackage metadataPackage; +} diff --git a/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MdPkgChangedEventListener.java b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MdPkgChangedEventListener.java new file mode 100644 index 0000000..3d43e0c --- /dev/null +++ b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MdPkgChangedEventListener.java @@ -0,0 +1,38 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.spi.event; + +import io.iec.edp.caf.commons.event.IEventListener; + +/** + * @author zhaoleitr + */ +public interface MdPkgChangedEventListener extends IEventListener { + + /** + * 元数据包新增后事件 + * + * @param args 元数据变更参数 + */ + void fireMdPkgAddedEvent(MdPkgChangedArgs args); + + /** + * 元数据更新后事件 + * + * @param args 元数据变更参数 + */ + void fireMdPkgChangedEvent(MdPkgChangedArgs args); +} diff --git a/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MetadataCreateEventListener.java b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MetadataCreateEventListener.java new file mode 100644 index 0000000..e55db18 --- /dev/null +++ b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MetadataCreateEventListener.java @@ -0,0 +1,34 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.spi.event; + +import io.iec.edp.caf.commons.event.IEventListener; + +public interface MetadataCreateEventListener extends IEventListener { + /** + * 元数据创建前事件 + * + * @param args 元数据事件参数 + */ + void fireMetadataCreatingEvent(MetadataEventArgs args); + + /** + * 元数据创建后事件 + * + * @param args 元数据事件参数 + */ + void fireMetadataCreatedEvent(MetadataEventArgs args); +} diff --git a/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MetadataEventArgs.java b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MetadataEventArgs.java new file mode 100644 index 0000000..0f5f0d1 --- /dev/null +++ b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MetadataEventArgs.java @@ -0,0 +1,40 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.spi.event; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import io.iec.edp.caf.commons.event.CAFEventArgs; + +public class MetadataEventArgs extends CAFEventArgs { + private String path; + private GspMetadata metadata; + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public GspMetadata getMetadata() { + return metadata; + } + + public void setMetadata(GspMetadata metadata) { + this.metadata = metadata; + } +} diff --git a/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MetadataEventListener.java b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MetadataEventListener.java new file mode 100644 index 0000000..24f9cec --- /dev/null +++ b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MetadataEventListener.java @@ -0,0 +1,48 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.spi.event; + +import io.iec.edp.caf.commons.event.IEventListener; + +public interface MetadataEventListener extends IEventListener { + /** + * 元数据保存前事件 + * + * @param args 元数据事件参数 + */ + void fireMetadataSavingEvent(MetadataEventArgs args); + + /** + * 元数据保存后事件 + * + * @param args 元数据事件参数 + */ + void fireMetadataSavedEvent(MetadataEventArgs args); + + /** + * 元数据删除前事件 + * + * @param args 元数据事件参数 + */ + void fireMetadataDeletingEvent(MetadataEventArgs args); + + /** + * 元数据删除后事件 + * + * @param args 元数据事件参数 + */ + void fireMetadataDeletedEvent(MetadataEventArgs args); +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/entity/GspVoExtendInfo.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/entity/GspVoExtendInfo.java index 885caf7..fae9fa8 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/entity/GspVoExtendInfo.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/entity/GspVoExtendInfo.java @@ -20,7 +20,6 @@ import java.util.Date; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; -import lombok.Data; import lombok.NoArgsConstructor; /** @@ -35,7 +34,6 @@ import lombok.NoArgsConstructor; @Table(name = "GspViewModel") @NoArgsConstructor @JsonIgnoreProperties(ignoreUnknown = true) -@Data public class GspVoExtendInfo { public GspVoExtendInfo(String id, String extendInfo, String configId, String createdBy, -- Gitee From 9047a1e171befeac90432bdd89654f698f387f6d Mon Sep 17 00:00:00 2001 From: Q-Lee Date: Thu, 29 Apr 2021 11:04:05 +0800 Subject: [PATCH 47/61] =?UTF-8?q?=E9=87=8D=E6=9E=84=EF=BC=9A=E5=B0=86?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E6=97=B6devtime-api=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=85=B7=E4=BD=93=E5=AE=9E=E7=8E=B0=E4=BB=A3=E7=A0=81=E8=BF=81?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lcm/metadata/api/ConfigData/CommonConfigData.java | 10 +++++----- .../edp/lcm/metadata/core/MetadataCoreManager.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/CommonConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/CommonConfigData.java index 460470a..8358e33 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/CommonConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/CommonConfigData.java @@ -28,7 +28,7 @@ public class CommonConfigData { private String assembly; private String typeCode; private String typeName; - private boolean isCreatingResourceMetadata; + private boolean creatingResourceMetadata; public String getType() { return type; @@ -62,12 +62,12 @@ public class CommonConfigData { this.typeName = typeName; } - public boolean getIsCreatingResourceMetadata() { - return isCreatingResourceMetadata; + public boolean isCreatingResourceMetadata() { + return creatingResourceMetadata; } - public void setIsCreatingResourceMetadata(boolean isCreatingResourceMetadata) { - this.isCreatingResourceMetadata = isCreatingResourceMetadata; + public void setCreatingResourceMetadata(boolean creatingResourceMetadata) { + this.creatingResourceMetadata = creatingResourceMetadata; } } diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java index 046de4e..4cdb631 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java @@ -186,7 +186,7 @@ public class MetadataCoreManager { } // 普通元数据需要抽取资源元数据 - if (commonData.getIsCreatingResourceMetadata() && !i18nCoreService.isI18nMetadata(metadata)) { + if (commonData.isCreatingResourceMetadata() && !i18nCoreService.isI18nMetadata(metadata)) { i18nCoreService.extractResourceMetadata(metadata, path); } -- Gitee From 7a703e69d7566e0b9214e3e23da48cefe7423bc0 Mon Sep 17 00:00:00 2001 From: Q-Lee Date: Sat, 8 May 2021 17:45:59 +0800 Subject: [PATCH 48/61] =?UTF-8?q?=E9=87=8D=E6=9E=84=EF=BC=9Alcm-metadata-f?= =?UTF-8?q?ramework=E5=B7=A5=E7=A8=8B=E4=BB=A3=E7=A0=81=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../initializer/ExternalApiInitializer.java | 4 +- .../provider/ExternalApiMetadataBuilder.java | 18 +- model/externalapi/runtime-core/pom.xml | 6 + model/framework/common/pom.xml | 66 +- .../lcm/file/system/FileSystemServiceImp.java | 73 ++ .../system/monitor/FileAltMonitorFactory.java | 24 + .../system/monitor/FileAltMonitorImpl.java | 147 ++++ .../entity/AdvancedFunctionConfiguration.java | 24 + .../metadata/api/entity/DbConnectionInfo.java | 112 +++ .../metadata/api/entity/DebugEnvironment.java | 73 ++ .../api/entity/DeploymentContext.java | 38 + .../metadata/api/entity/ExtractContext.java | 9 + .../metadata/api/entity/MetadataRTFilter.java | 42 ++ .../api/entity/WorkspaceDataLocation.java | 32 + .../compiler/MetadataCompilerConfigData.java | 38 + .../MetadataCompilerConfiguration.java | 47 ++ .../api/entity/deployer/DeployConfigData.java | 38 + .../api/entity/deployer/DeploymentType.java | 46 ++ .../IndexServerConfiguration.java | 38 + .../metadata/api/service/FileAltMonitor.java | 24 + .../api/service/FileSystemService.java | 35 + .../api/service/MavenUtilsService.java | 42 ++ .../api/service/MetadataRTService.java | 99 +++ .../api/service/PackageGenerateService.java | 37 + .../api/service/ProjectExtendService.java | 62 ++ .../metadata/cache/MetadataCacheManager.java | 0 .../cache/MetadataDevCacheManager.java | 0 .../cache/MetadataDistCacheManager.java | 0 .../metadata/cache/MetadataRtDistCache.java | 0 .../lcm/metadata/cache/RtCacheHandler.java | 0 .../metadata/common/MetadataDtoConverter.java | 6 +- .../MetadataCompilerConfigLoader.java | 59 ++ .../compiler/MetadataCompilerHelper.java | 53 ++ .../common/config/LcmComConfiguration.java | 38 + .../common/context/RuntimeContext.java | 51 ++ .../common/deployer/DeploymentHelper.java | 57 ++ .../deployer/DeploymentTypeConfigLoader.java | 87 +++ .../common/extractor/ExtractConfigLoader.java | 67 ++ .../common/extractor/ExtractHelper.java | 53 ++ .../common/logging/MvnStreamConsumer.java | 57 ++ .../lcm/metadata/common/util/CommandUtil.java | 642 ++++++++++++++++ .../edp/lcm/metadata/common/util/DbUtil.java | 49 ++ .../lcm/metadata/common/util/EncryptUtil.java | 69 ++ .../lcm/metadata/common/util/Kernel32.java | 25 + .../edp/lcm/metadata/spi/ExtractAction.java | 27 + .../metadata/spi/IProjectCreateManager.java | 22 + .../lcm/metadata/spi/JitRuntimeAction.java | 20 + .../metadata/spi/MdExtendRuleSerializer.java | 29 + .../metadata/spi/MetadataCompileAction.java | 27 + .../metadata/spi/MetadataExtRuleService.java | 24 + .../lcm/metadata/spi/MetadataI18nService.java | 33 + model/framework/devtime-api/pom.xml | 15 +- .../api/exception/MetadataExceptionCode.java | 20 + model/framework/devtime-core/pom.xml | 71 +- .../core/PackageGenerateCoreService.java | 304 ++++++++ .../core/PackageGenerateServiceImp.java | 40 + .../core/ProjectExtendCoreService.java | 273 +++++++ .../core/ProjectExtendServiceImp.java | 55 ++ .../core/config/CoreServiceConfiguration.java | 55 ++ .../core/config/JitRuntimeConfigLoader.java | 66 ++ .../core/config/JitRuntimeHelper.java | 58 ++ .../core/config/ServiceConfiguration.java | 73 ++ .../metadata/core/thread/ProcessRunnable.java | 36 + .../extend/action/DeployActionImpl.java | 44 ++ .../extend/action/ExtractActionImpl.java | 110 +++ .../action/MetadataCompileActionImpl.java | 29 + .../edp/lcm/metadata/ref/MavenUtilsImp.java | 45 ++ .../edp/lcm/metadata/ref/MdpkgServiceImp.java | 181 +++++ .../metadata/ref/config/RefConfiguration.java | 44 ++ model/framework/devtime-webapi/pom.xml | 37 + .../main/java/webapi/FileSystemWebApi.java | 42 ++ .../java/webapi/GspProjectServiceWebApi.java | 78 ++ .../src/main/java/webapi/MdServiceWebApi.java | 378 ++++++++++ .../webapi/MetadataConfigServiceWebApi.java | 62 ++ .../webapi/MetadataPackageServiceWebApi.java | 77 ++ .../webapi/MetadataProjectServiceWebApi.java | 192 +++++ .../java/webapi/MetadataServiceWebApi.java | 508 +++++++++++++ .../webapi/ProjectDeployServiceWebApi.java | 54 ++ .../main/java/webapi/ProjectExtendWebApi.java | 67 ++ .../src/main/java/webapi/RepoRefWebApi.java | 246 +++++++ .../webapi/config/WebApiConfiguration.java | 115 +++ model/framework/entity/pom.xml | 27 + .../metadata/api/ConfigData/BaseConfig.java | 0 .../gspproject/ProjectCommonConfigData.java | 0 .../gspproject/ProjectConfiguration.java | 0 .../gspproject/ProjectCreateConfigData.java | 0 .../lcm/metadata/api/entity/GspProject.java | 0 .../lcm/metadata/api/entity/Metadata4Ref.java | 0 .../metadata/api/entity/Metadata4RefDto.java | 0 .../lcm/metadata/api/entity/MetadataDto.java | 0 .../metadata/api/entity/MetadataFilter.java | 0 .../api/entity/MetadataIndexItemDto.java | 0 .../metadata/api/entity/MetadataPackage.java | 0 .../api/entity/MetadataPackageHeader.java | 0 .../api/entity/MetadataPackageReference.java | 0 .../api/entity/MetadataPackageVersion.java | 0 .../metadata/api/entity/MetadataProject.java | 2 +- .../lcm/metadata/api/entity/MetadataType.java | 0 .../lcm/metadata/api/entity/ProcessMode.java | 0 .../metadata/api/entity/ProjectHeader.java | 0 .../metadata/api/entity/ServiceUnitInfo.java | 0 .../MetadataIndexRepoItemDto.java | 0 .../api/mvnEntity/MavenComponent.java | 0 .../api/mvnEntity/MavenComponents.java | 0 .../api/mvnEntity/MavenPackageRefs.java | 0 .../metadata/api/mvnEntity/MetadataRepo.java | 0 .../api/mvnEntity/PackageSourceDto.java | 0 model/framework/generator-api/pom.xml | 10 + .../edp/jittojava/context/JitContext.java | 14 +- model/framework/pom.xml | 122 ++- model/framework/runtime-api/pom.xml | 11 + .../serverapi/MetadataRTServerService.java | 161 ++++ model/framework/runtime-core/pom.xml | 29 + .../rtservice/MetadataRTServiceImp.java | 164 +++++ .../metadata/rtservice/MetadataRtUtils.java | 83 +++ .../MetadataRTServerServiceImpl.java | 693 ++++++++++++++++++ .../configuration/RestConfiguarion.java | 47 ++ .../event/MdPkgChangedEventBroker.java | 66 ++ .../event/MdPkgChangedEventManager.java | 76 ++ .../monitor/MdpkgAlterationMonitor.java | 105 +++ .../monitor/MdpkgListenerAdapter.java | 197 +++++ .../monitor/MonitorInitializer.java | 42 ++ .../persistent/MetadataPackageRepository.java | 107 +++ .../MetadataPackageRepositoryImp.java | 196 +++++ .../persistent/RepositoryFactory.java | 46 ++ .../util/MetadataServerManagerUitls.java | 77 ++ .../servermanager/util/MetadataUtils.java | 35 + model/framework/runtime-spi/pom.xml | 2 - .../metadata/spi/event/MdPkgChangedArgs.java | 8 + 129 files changed, 8281 insertions(+), 83 deletions(-) create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/file/system/FileSystemServiceImp.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/file/system/monitor/FileAltMonitorFactory.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/file/system/monitor/FileAltMonitorImpl.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/AdvancedFunctionConfiguration.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/DbConnectionInfo.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/DebugEnvironment.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/DeploymentContext.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataRTFilter.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/WorkspaceDataLocation.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/compiler/MetadataCompilerConfigData.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/compiler/MetadataCompilerConfiguration.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/deployer/DeployConfigData.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/deployer/DeploymentType.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/IndexServerConfiguration.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/FileAltMonitor.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/FileSystemService.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/MavenUtilsService.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataRTService.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/PackageGenerateService.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/ProjectExtendService.java rename model/framework/{devtime-core => common}/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataCacheManager.java (100%) rename model/framework/{devtime-core => common}/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDevCacheManager.java (100%) rename model/framework/{devtime-core => common}/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDistCacheManager.java (100%) rename model/framework/{devtime-core => common}/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataRtDistCache.java (100%) rename model/framework/{devtime-core => common}/src/main/java/com/inspur/edp/lcm/metadata/cache/RtCacheHandler.java (100%) create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/compiler/MetadataCompilerConfigLoader.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/compiler/MetadataCompilerHelper.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/config/LcmComConfiguration.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/context/RuntimeContext.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/deployer/DeploymentHelper.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/deployer/DeploymentTypeConfigLoader.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/extractor/ExtractConfigLoader.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/extractor/ExtractHelper.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/logging/MvnStreamConsumer.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/CommandUtil.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/DbUtil.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/EncryptUtil.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/Kernel32.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/ExtractAction.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/IProjectCreateManager.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/JitRuntimeAction.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MdExtendRuleSerializer.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataCompileAction.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataExtRuleService.java create mode 100644 model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataI18nService.java create mode 100644 model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/exception/MetadataExceptionCode.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageGenerateCoreService.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageGenerateServiceImp.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/ProjectExtendCoreService.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/ProjectExtendServiceImp.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/CoreServiceConfiguration.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeConfigLoader.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeHelper.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/ServiceConfiguration.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/thread/ProcessRunnable.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/DeployActionImpl.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/ExtractActionImpl.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/MetadataCompileActionImpl.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MavenUtilsImp.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MdpkgServiceImp.java create mode 100644 model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/config/RefConfiguration.java create mode 100644 model/framework/devtime-webapi/pom.xml create mode 100644 model/framework/devtime-webapi/src/main/java/webapi/FileSystemWebApi.java create mode 100644 model/framework/devtime-webapi/src/main/java/webapi/GspProjectServiceWebApi.java create mode 100644 model/framework/devtime-webapi/src/main/java/webapi/MdServiceWebApi.java create mode 100644 model/framework/devtime-webapi/src/main/java/webapi/MetadataConfigServiceWebApi.java create mode 100644 model/framework/devtime-webapi/src/main/java/webapi/MetadataPackageServiceWebApi.java create mode 100644 model/framework/devtime-webapi/src/main/java/webapi/MetadataProjectServiceWebApi.java create mode 100644 model/framework/devtime-webapi/src/main/java/webapi/MetadataServiceWebApi.java create mode 100644 model/framework/devtime-webapi/src/main/java/webapi/ProjectDeployServiceWebApi.java create mode 100644 model/framework/devtime-webapi/src/main/java/webapi/ProjectExtendWebApi.java create mode 100644 model/framework/devtime-webapi/src/main/java/webapi/RepoRefWebApi.java create mode 100644 model/framework/devtime-webapi/src/main/java/webapi/config/WebApiConfiguration.java create mode 100644 model/framework/entity/pom.xml rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/BaseConfig.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCommonConfigData.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectConfiguration.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCreateConfigData.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/entity/GspProject.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4Ref.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4RefDto.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataDto.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataFilter.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataIndexItemDto.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackage.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageHeader.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageReference.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageVersion.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProject.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataType.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProcessMode.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProjectHeader.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ServiceUnitInfo.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/MetadataIndexRepoItemDto.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponent.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponents.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenPackageRefs.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataRepo.java (100%) rename model/framework/{common => entity}/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PackageSourceDto.java (100%) create mode 100644 model/framework/runtime-api/src/main/java/com/inspur/edp/lcm/metadata/serverapi/MetadataRTServerService.java create mode 100644 model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRTServiceImp.java create mode 100644 model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRtUtils.java create mode 100644 model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/MetadataRTServerServiceImpl.java create mode 100644 model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/configuration/RestConfiguarion.java create mode 100644 model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/event/MdPkgChangedEventBroker.java create mode 100644 model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/event/MdPkgChangedEventManager.java create mode 100644 model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MdpkgAlterationMonitor.java create mode 100644 model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MdpkgListenerAdapter.java create mode 100644 model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MonitorInitializer.java create mode 100644 model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepository.java create mode 100644 model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepositoryImp.java create mode 100644 model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/RepositoryFactory.java create mode 100644 model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/util/MetadataServerManagerUitls.java create mode 100644 model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/util/MetadataUtils.java diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/initializer/ExternalApiInitializer.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/initializer/ExternalApiInitializer.java index bd2c3d4..e2fac1e 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/initializer/ExternalApiInitializer.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/initializer/ExternalApiInitializer.java @@ -15,8 +15,8 @@ */ package org.openatom.ubml.model.externalapi.devtime.core.initializer; -import java.util.UUID; import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import java.util.UUID; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import org.openatom.ubml.model.externalapi.definition.temp.lcm.MetadataContentManager; @@ -38,7 +38,7 @@ public class ExternalApiInitializer implements MetadataContentManager { eapi.setName(metadata.getHeader().getName()); eapi.setVersion("1.0"); eapi.getService().setId(UUID.randomUUID().toString()); - eapi.setBusinessObject(metadata.getHeader().getBizObjectId()); + eapi.setBusinessObject(metadata.getHeader().getBizobjectID()); //TODO:后续添加SU/APP/RouteURL信息 metadata.setContent(eapi); } diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ExternalApiMetadataBuilder.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ExternalApiMetadataBuilder.java index 8e62abc..25a18a6 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ExternalApiMetadataBuilder.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ExternalApiMetadataBuilder.java @@ -69,7 +69,7 @@ public class ExternalApiMetadataBuilder { if (metadataList != null && metadataList.size() > 0) { String metadataCode = eApi.getHeader().getCode(); boolean exist = metadataList.stream() - .anyMatch(x -> metadataCode.equalsIgnoreCase(x.getHeader().getCode())); + .anyMatch(x -> metadataCode.equalsIgnoreCase(x.getHeader().getCode())); if (exist) { metadataService.deleteMetadata(relativePath, eApi.getHeader().getCode() + EAPI_SUFFIX_NAME); } @@ -99,7 +99,7 @@ public class ExternalApiMetadataBuilder { eApi.setId(eapiMetadata.getHeader().getId()); eApi.setCode(eapiMetadata.getHeader().getCode()); eApi.setName(eapiMetadata.getHeader().getName()); - eApi.setBusinessObject(eapiMetadata.getHeader().getBizObjectId()); + eApi.setBusinessObject(eapiMetadata.getHeader().getBizobjectID()); //TODO:set app&su eApi.setApplication(null); eApi.setMicroServiceUnit(null); @@ -133,9 +133,9 @@ public class ExternalApiMetadataBuilder { models.add(model); } else { long count = - eapiContent.getModels().stream() - .filter(x -> x.getId().equalsIgnoreCase(model.getId())) - .count(); + eapiContent.getModels().stream() + .filter(x -> x.getId().equalsIgnoreCase(model.getId())) + .count(); if (count <= 0) { models.add(model); } @@ -156,7 +156,7 @@ public class ExternalApiMetadataBuilder { service.setId(UUID.randomUUID().toString()); service.setResourceId(vo.getHeader().getId()); service.setResourceType(getResourceType(resourceType)); - service.setResourceCode(((GspViewModel)vo.getContent()).getGeneratedConfigID()); + service.setResourceCode(((GspViewModel) vo.getContent()).getGeneratedConfigID()); service.setResourceName(vo.getHeader().getName()); service.setOperations(new ArrayList<>()); switch (resourceType) { @@ -179,11 +179,11 @@ public class ExternalApiMetadataBuilder { metadata.getHeader().setCode(vo.getHeader().getCode()); metadata.getHeader().setName(vo.getHeader().getName()); metadata.getHeader().setExtendable(vo.getHeader().isExtendable()); - if (StringUtils.isBlank(vo.getHeader().getBizObjectId())) { + if (StringUtils.isBlank(vo.getHeader().getBizobjectID())) { throw new RuntimeException( - String.format("VO元数据【%s(ID:%s)】的业务对象不能为空", vo.getHeader().getCode(), vo.getHeader().getId())); + String.format("VO元数据【%s(ID:%s)】的业务对象不能为空", vo.getHeader().getCode(), vo.getHeader().getId())); } - metadata.getHeader().setBizObjectId(vo.getHeader().getBizObjectId()); + metadata.getHeader().setBizobjectID(vo.getHeader().getBizobjectID()); metadata.getHeader().setType(Constants.EXTERNAL_API_METADATA_TYPE); metadata.getHeader().setFileName(vo.getHeader().getCode() + EAPI_SUFFIX_NAME); metadata.setRelativePath(getEapiRelativePath(path)); diff --git a/model/externalapi/runtime-core/pom.xml b/model/externalapi/runtime-core/pom.xml index b6844d1..a2df916 100644 --- a/model/externalapi/runtime-core/pom.xml +++ b/model/externalapi/runtime-core/pom.xml @@ -50,6 +50,12 @@ ubml-model-framework-common 0.9.0-SNAPSHOT compile + + + lcm-metadata-api + com.inspur.edp + + diff --git a/model/framework/common/pom.xml b/model/framework/common/pom.xml index 9b9df9a..bad6930 100644 --- a/model/framework/common/pom.xml +++ b/model/framework/common/pom.xml @@ -8,9 +8,7 @@ 0.9.0-SNAPSHOT 4.0.0 - ubml-model-framework-common ${project.version} - ubml-model-framework-common @@ -20,42 +18,68 @@ - org.openatom.ubml - ubml-model-common-definition - 0.9.0-SNAPSHOT - compile + com.alibaba + fastjson + - org.apache.maven - maven-model - 3.6.1 - compile + io.iec.edp + caf-boot-commons-environment io.iec.edp - caf-boot-commons-environment - 0.3.7-SNAPSHOT + caf-boot-commons-layeringcache + + + io.iec.edp + caf-boot-starter-context + com.inspur.edp - lcm-metadata-spi - 0.1.25 - compile + lcm-logging-service + + + com.inspur.edp + lcm-project-deployer-spi org.apache.maven maven-settings + + + com.inspur.edp + workspace-api + + + + org.openatom.ubml + ubml-model-common-definition + ${project.version} + + + org.openatom.ubml + ubml-model-framework-devtime-api + ${project.version} + + + + org.apache.maven + maven-model 3.6.1 + compile - io.iec.edp - caf-boot-commons-layeringcache - 0.3.2 + org.apache.maven.shared + maven-invoker + 3.0.1 + compile - com.inspur.edp - workspace-api - 0.1.1 + net.java.dev.jna + jna + 4.1.0 + compile diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/file/system/FileSystemServiceImp.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/file/system/FileSystemServiceImp.java new file mode 100644 index 0000000..d9efae9 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/file/system/FileSystemServiceImp.java @@ -0,0 +1,73 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.file.system; + +import com.inspur.edp.lcm.file.system.monitor.FileAltMonitorImpl; +import com.inspur.edp.lcm.metadata.api.entity.FileType; +import com.inspur.edp.lcm.metadata.api.service.FileAltMonitor; +import com.inspur.edp.lcm.metadata.api.service.FileSystemService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import io.iec.edp.caf.boot.context.CAFContext; +import io.iec.edp.caf.core.session.WebSession; +import java.awt.Desktop; +import java.io.File; +import java.io.IOException; +import org.apache.commons.io.monitor.FileAlterationListenerAdaptor; + +public class FileSystemServiceImp implements FileSystemService { + FileServiceImp fileServiceImp = new FileServiceImp(); + + @Override + public void showInExplorer(String path) throws IOException { + WebSession webSession = (WebSession) CAFContext.current.getCurrentSession(); + if (!webSession.getRemoteAddress().equals("127.0.0.1") && !webSession.getRemoteAddress().equals("0:0:0:0:0:0:0:1")) { + throw new RuntimeException("不支持访问远程路径。"); + } + String absolutePath = ManagerUtils.getAbsolutePath(path); + absolutePath = fileServiceImp.isFileExist(absolutePath) ? fileServiceImp.getDirectoryName(absolutePath) : absolutePath; + if (!fileServiceImp.isDirectoryExist(absolutePath)) { + throw new RuntimeException("路径不存在:" + path + "。"); + } + + File file = new File(absolutePath); + try { + System.setProperty("java.awt.headless", "false"); + Desktop.getDesktop().open(file); + } catch (Exception e) { + openDirectoryByShell(absolutePath); + } + } + + @Override + public FileAltMonitor createFileMonitor(String path, FileType type, FileAlterationListenerAdaptor adaptor) { + return new FileAltMonitorImpl(path, type, adaptor); + } + + private void openDirectoryByShell(String path) throws IOException { + if (System.getProperty("os.name").toLowerCase().contains("win")) { + String[] cmd = new String[5]; + cmd[0] = "cmd"; + cmd[1] = "/c"; + cmd[2] = "start"; + cmd[3] = " "; + cmd[4] = new File(path).getAbsolutePath(); + Runtime.getRuntime().exec(cmd); + } else { + throw new RuntimeException("仅支持windows系统"); + } + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/file/system/monitor/FileAltMonitorFactory.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/file/system/monitor/FileAltMonitorFactory.java new file mode 100644 index 0000000..e5f53fb --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/file/system/monitor/FileAltMonitorFactory.java @@ -0,0 +1,24 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.file.system.monitor; + +import org.apache.commons.io.monitor.FileAlterationMonitor; + +class FileAltMonitorFactory { + static FileAlterationMonitor create(Long interval) { + return new FileAlterationMonitor(interval); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/file/system/monitor/FileAltMonitorImpl.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/file/system/monitor/FileAltMonitorImpl.java new file mode 100644 index 0000000..d271a63 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/file/system/monitor/FileAltMonitorImpl.java @@ -0,0 +1,147 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.file.system.monitor; + +import com.inspur.edp.lcm.metadata.api.entity.FileType; +import com.inspur.edp.lcm.metadata.api.service.FileAltMonitor; +import org.apache.commons.io.filefilter.FileFilterUtils; +import org.apache.commons.io.monitor.FileAlterationListenerAdaptor; +import org.apache.commons.io.monitor.FileAlterationMonitor; +import org.apache.commons.io.monitor.FileAlterationObserver; + +public class FileAltMonitorImpl implements FileAltMonitor { + private String path; // 文件夹目录 + + private String fileSuffix; // 需要监听的文件名后缀 + + private long interval; // 监听间隔 + + private FileAlterationMonitor monitor; // 监视器 + + private static final long DEFAULT_INTERVAL = 5 * 1000; // 默认监听间隔10s + + private boolean running = false; + + private FileAlterationListenerAdaptor listener; // 事件处理类对象 + + public FileAltMonitorImpl(String path, String fileSuffix, FileAlterationListenerAdaptor listenerAdaptor) { + this(path, fileSuffix, DEFAULT_INTERVAL, listenerAdaptor); + } + + public FileAltMonitorImpl(String path, FileAlterationListenerAdaptor listenerAdaptor) { + this(path, DEFAULT_INTERVAL, listenerAdaptor); + } + + public FileAltMonitorImpl(String path, long interval, FileAlterationListenerAdaptor listenerAdaptor) { + this(path, "", interval, listenerAdaptor); + } + + public FileAltMonitorImpl(String path, String fileSuffix, long interval, + FileAlterationListenerAdaptor listenerAdaptor) { + this.path = path; + this.fileSuffix = fileSuffix; + this.interval = interval; + this.listener = listenerAdaptor; + init(); + } + + public FileAltMonitorImpl(String path, FileType fileType, FileAlterationListenerAdaptor listenerAdaptor) { + this(path, fileType, DEFAULT_INTERVAL, listenerAdaptor); + } + + public FileAltMonitorImpl(String path, FileType fileType, long interval, + FileAlterationListenerAdaptor listenerAdaptor) { + this(path, parseToString(fileType), interval, listenerAdaptor); + } + + private static String parseToString(FileType fileType) { + switch (fileType) { + case MDPKG: + return ".mdpkg"; + case JAR: + return ".jar"; + default: + return null; + } + } + + private void init() { + if (path == null || "".equals(path)) { + throw new IllegalStateException("Listen path must not be null"); + } + if (listener == null) { + throw new IllegalStateException("Listener must not be null"); + } + + // 设定观察者,监听文件 + FileAlterationObserver observer; + if (fileSuffix == null || "".equals(fileSuffix)) { + observer = new FileAlterationObserver(path); + } else { + observer = new FileAlterationObserver(path, + FileFilterUtils.suffixFileFilter(fileSuffix)); + } + + // 给观察者添加监听事件 + observer.addListener(listener); + + // FileAlterationMonitor本身实现了 Runnable,是单独的一个线程,按照设定的时间间隔运行,默认间隔是 10s + monitor = FileAltMonitorFactory.create(interval); + + monitor.addObserver(observer); + } + + /*** + * 开启监听 + */ + public void start() { + try { + monitor.start(); + running = true; + } catch (Exception e) { + throw new RuntimeException("monitor start error", e); + } + } + + public void stop() { + try { + monitor.stop(); + running = false; + } catch (Exception e) { + throw new RuntimeException("monitor stop error", e); + } + } + + public void checkAndNotify() { + if (running) { + for (FileAlterationObserver observer : this.monitor.getObservers()) { + observer.checkAndNotify(); + } + } + } + + public void setPath(String path) { + this.path = path; + } + + public void setFileSuffix(String fileSuffix) { + this.fileSuffix = fileSuffix; + } + + public void setAdaptor(FileAlterationListenerAdaptor listenerAdaptor) { + this.listener = listenerAdaptor; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/AdvancedFunctionConfiguration.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/AdvancedFunctionConfiguration.java new file mode 100644 index 0000000..bcc578a --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/AdvancedFunctionConfiguration.java @@ -0,0 +1,24 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.api.entity; + +import lombok.Data; + +@Data +public class AdvancedFunctionConfiguration { + private boolean maven; + private boolean menu; +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/DbConnectionInfo.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/DbConnectionInfo.java new file mode 100644 index 0000000..01e52f0 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/DbConnectionInfo.java @@ -0,0 +1,112 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.api.entity; + +import io.iec.edp.caf.commons.dataaccess.DbType; + +public class DbConnectionInfo { + private String dbServerIP; + private String dbPort; + private String dbName; + private String dbUserName; + private String dbPassword; + private DbType dbType; + + public String getDbServerIP() { + return dbServerIP; + } + + public void setDbServerIP(String dbServerIP) { + this.dbServerIP = dbServerIP; + } + + public String getDbPort() { + return dbPort; + } + + public void setDbPort(String dbPort) { + this.dbPort = dbPort; + } + + public String getDbName() { + return dbName; + } + + public void setDbName(String dbName) { + this.dbName = dbName; + } + + public String getDbUserName() { + return dbUserName; + } + + public void setDbUserName(String dbUserName) { + this.dbUserName = dbUserName; + } + + public String getDbPassword() { + return dbPassword; + } + + public void setDbPassword(String dbPassword) { + this.dbPassword = dbPassword; + } + + public DbType getDbType() { + return dbType; + } + + public void setDbType(DbType dbType) { + this.dbType = dbType; + } + + private String url; + + public String getUrl() { + if (url == null || url.length() <= 0) { + switch (dbType) { + case DM: + url = "jdbc:dm://" + getDbServerIP() + ":" + dbPort + "/DMSERVER?schema=" + dbName; + break; + case PgSQL: + url = "jdbc:postgresql://" + getDbServerIP() + ":" + dbPort + "/" + dbName; + break; + case Oracle: + url = "jdbc:oracle:thin:@//" + getDbServerIP() + ":" + dbPort + "/" + dbName; + break; + case SQLServer: + url = "jdbc:sqlserver://" + getDbServerIP() + "\\" + dbName + ":" + dbPort + ";database=" + dbName; + break; + case HighGo: + url = "jdbc:highgo://" + getDbServerIP() + ":" + dbPort + "/" + dbName; + break; + case MySQL: + url = "jdbc:mysql://" + getDbServerIP() + ":" + dbPort + "/" + dbName + "?characterEncoding=utf8&serverTimezone=UTC&useSSL=false"; + break; + case Oscar: + url = "jdbc:oscar://" + getDbServerIP() + ":" + dbPort + "/" + dbName; + break; + default: + throw new RuntimeException("数据库类型不正确"); + } + } + return url; + } + + public void setUrl(String url) { + this.url = url; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/DebugEnvironment.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/DebugEnvironment.java new file mode 100644 index 0000000..c44e54b --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/DebugEnvironment.java @@ -0,0 +1,73 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.api.entity; + +public class DebugEnvironment { + private String serverPath; + private String language; + private String deployPath; + private String deployConfigPath; + private DbConnectionInfo dbConnectionInfo; + private DbConnectionInfo centralDbConnectionInfo; + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public String getServerPath() { + return serverPath; + } + + public void setServerPath(String serverPath) { + this.serverPath = serverPath; + } + + public String getDeployPath() { + return deployPath; + } + + public void setDeployPath(String deployPath) { + this.deployPath = deployPath; + } + + public String getDeployConfigPath() { + return deployConfigPath; + } + + public void setDeployConfigPath(String deployConfigPath) { + this.deployConfigPath = deployConfigPath; + } + + public DbConnectionInfo getDbConnectionInfo() { + return dbConnectionInfo; + } + + public void setDbConnectionInfo(DbConnectionInfo dbConnectionInfo) { + this.dbConnectionInfo = dbConnectionInfo; + } + + public DbConnectionInfo getCentralDbConnectionInfo() { + return centralDbConnectionInfo; + } + + public void setCentralDbConnectionInfo(DbConnectionInfo centralDbConnectionInfo) { + this.centralDbConnectionInfo = centralDbConnectionInfo; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/DeploymentContext.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/DeploymentContext.java new file mode 100644 index 0000000..8f9ac17 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/DeploymentContext.java @@ -0,0 +1,38 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.api.entity; + +public class DeploymentContext { + private DebugEnvironment debugEnvironment; + + public DebugEnvironment getDebugEnvironment() { + return debugEnvironment; + } + + public void setDebugEnvironment(DebugEnvironment debugEnvironment) { + this.debugEnvironment = debugEnvironment; + } + + public String getPublishPath() { + return publishPath; + } + + public void setPublishPath(String publishPath) { + this.publishPath = publishPath; + } + + private String publishPath; +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ExtractContext.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ExtractContext.java index e3826d1..b96eff3 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ExtractContext.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ExtractContext.java @@ -21,6 +21,15 @@ public class ExtractContext { private String deployPath; private String deployConfigPath; private String webModulePath; + private String deployType; + + public String getDeployType() { + return deployType; + } + + public void setDeployType(String deployType) { + this.deployType = deployType; + } public String getProjectPath() { return projectPath; diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataRTFilter.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataRTFilter.java new file mode 100644 index 0000000..109fb2b --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataRTFilter.java @@ -0,0 +1,42 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.api.entity; + +import java.util.List; +import lombok.Data; + +/** + * Classname MetadataRTFilter Description 过滤条件实体类 Date 2019/11/18 15:21 + * + * @author zhongchq + * @version 1.0 + */ +@Data +public class MetadataRTFilter { + + //关键应用编号 + public String appCode; + //服务单元编号 + public String serviceUnitCode; + //业务对象ID + public List bizobjectId; + + public String type; + + public String code; + + public String nameSpace; +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/WorkspaceDataLocation.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/WorkspaceDataLocation.java new file mode 100644 index 0000000..aca8a1f --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/WorkspaceDataLocation.java @@ -0,0 +1,32 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.api.entity; + +import lombok.Data; + +/** + * @Classname WorkspaceDataLocation + * @Description TODO + * @Date 2019/7/20 15:08 + * @Created by zhongchq + * @Version 1.0 + */ + +@Data +public class WorkspaceDataLocation { + + public String workspaceDataLocation; +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/compiler/MetadataCompilerConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/compiler/MetadataCompilerConfigData.java new file mode 100644 index 0000000..9be1eb4 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/compiler/MetadataCompilerConfigData.java @@ -0,0 +1,38 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.api.entity.compiler; + +public class MetadataCompilerConfigData { + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + private String name; + + public String getAssembly() { + return assembly; + } + + public void setAssembly(String assembly) { + this.assembly = assembly; + } + + private String assembly; +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/compiler/MetadataCompilerConfiguration.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/compiler/MetadataCompilerConfiguration.java new file mode 100644 index 0000000..1116f87 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/compiler/MetadataCompilerConfiguration.java @@ -0,0 +1,47 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.api.entity.compiler; + +public class MetadataCompilerConfiguration { + private String typeCode; + private boolean enable; + + public String getTypeCode() { + return typeCode; + } + + public void setTypeCode(String typeCode) { + this.typeCode = typeCode; + } + + public boolean getEnable() { + return enable; + } + + public void setEnable(boolean enable) { + this.enable = enable; + } + + public MetadataCompilerConfigData getMetadataCompiler() { + return metadataCompiler; + } + + public void setMetadataCompiler(MetadataCompilerConfigData metadataCompiler) { + this.metadataCompiler = metadataCompiler; + } + + private MetadataCompilerConfigData metadataCompiler; +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/deployer/DeployConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/deployer/DeployConfigData.java new file mode 100644 index 0000000..11692b2 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/deployer/DeployConfigData.java @@ -0,0 +1,38 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.api.entity.deployer; + +public class DeployConfigData { + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAssembly() { + return assembly; + } + + public void setAssembly(String assembly) { + this.assembly = assembly; + } + + private String assembly; +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/deployer/DeploymentType.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/deployer/DeploymentType.java new file mode 100644 index 0000000..843b521 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/deployer/DeploymentType.java @@ -0,0 +1,46 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.api.entity.deployer; + +public class DeploymentType { + public DeployConfigData getDeployer() { + return deployer; + } + + public void setDeployer(DeployConfigData deployer) { + this.deployer = deployer; + } + + public boolean getEnable() { + return enable; + } + + public void setEnable(boolean enable) { + this.enable = enable; + } + + private String typeCode; + private DeployConfigData deployer; + private boolean enable; + + public String getTypeCode() { + return typeCode; + } + + public void setTypeCode(String typeCode) { + this.typeCode = typeCode; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/IndexServerConfiguration.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/IndexServerConfiguration.java new file mode 100644 index 0000000..1ab08dd --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/IndexServerConfiguration.java @@ -0,0 +1,38 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.api.entity.metadataindex; + +public class IndexServerConfiguration { + private String IP; + + private String port; + + public String getIP() { + return IP; + } + + public void setIP(String IP) { + this.IP = IP; + } + + public String getPort() { + return port; + } + + public void setPort(String port) { + this.port = port; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/FileAltMonitor.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/FileAltMonitor.java new file mode 100644 index 0000000..aa0a55a --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/FileAltMonitor.java @@ -0,0 +1,24 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.api.service; + +public interface FileAltMonitor { + void stop(); + + void start(); + + void checkAndNotify(); +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/FileSystemService.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/FileSystemService.java new file mode 100644 index 0000000..9a5012f --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/FileSystemService.java @@ -0,0 +1,35 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.api.service; + +import com.inspur.edp.lcm.metadata.api.entity.FileType; +import java.io.IOException; +import org.apache.commons.io.monitor.FileAlterationListenerAdaptor; + +/** + * @author zhaoleitr + */ +public interface FileSystemService { + /** + * 展示到浏览器 + * + * @param path 路径 + * @throws IOException + */ + void showInExplorer(String path) throws IOException; + + FileAltMonitor createFileMonitor(String path, FileType type, FileAlterationListenerAdaptor adaptor); +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/MavenUtilsService.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/MavenUtilsService.java new file mode 100644 index 0000000..e069a34 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/MavenUtilsService.java @@ -0,0 +1,42 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.api.service; + +/** + * Classname MavenUtilsService Description Maven操作工具类 Date 2020/1/9 14:55 + * + * @author zhongchq + * @version 1.0 + */ +public interface MavenUtilsService { + + /** + * 获取本地仓库地址 + * + * @return 本地仓库地址 + */ + String getLocalRepository(); + + /** + * 执行maven命令 + * + * @param mePath java代码路径 + * @param comd 命令 + * @return 命令是否执行成功 + */ + boolean exeMavenCommand(String mePath, String comd); + +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataRTService.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataRTService.java new file mode 100644 index 0000000..a41c4cb --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataRTService.java @@ -0,0 +1,99 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.api.service; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4Ref; +import com.inspur.edp.lcm.metadata.api.entity.MetadataCustomizationFilter; +import com.inspur.edp.lcm.metadata.api.entity.MetadataRTFilter; +import com.inspur.edp.lcm.metadata.api.entity.ServiceUnitInfo; +import java.util.List; + +/** + * 元数据运行时服务接口 + * + * @author zhaoleitr + */ +public interface MetadataRTService { + /** + * 运行时获取元数据(不带国际化信息) + * + * @param id 元数据id + * @return 元数据内容实体 + */ + GspMetadata getMetadataRTByID(String id); + + /** + * 运行时获取元数据(带国际化信息) + * + * @param id 元数据id + * @return 元数据内容实体 + */ + GspMetadata getMetadata(String id); + + /** + * 根据过滤条件获取元数据 + * + * @param metadataCustomizationFilter 元数据过滤器 + * @return 元数据实体 + */ + GspMetadata getMetadata(MetadataCustomizationFilter metadataCustomizationFilter); + + /** + * 加载服务端所有的元数据 + */ + void loadAllMetadata(); + + /** + * 根据元数据类型获取元数据信息列表 + * + * @param metadataTypes 元数据类型列表,通过","分隔 + * @return 元数据信息列表 + */ + List getMetadataRefList(String metadataTypes); + + /** + * 获取所有的元数据列表 + * + * @return 元数据信息列表 + */ + List getMetadataRefList(); + + /** + * @param filter 过滤条件 + * @return 元数据信息列表 + * @author zhongchq + */ + List getMetadataListByFilter(MetadataRTFilter filter); + + /** + * 根据业务主键获取元数据 + * + * @param metadataNamespace 元数据命名空间 + * @param metadataCode 元数据编号 + * @param metadataTypeCode 元数据类型编号 + * @return 元数据内容实体 + */ + GspMetadata getMetadataBySemanticID(String metadataNamespace, String metadataCode, String metadataTypeCode); + + /** + * 根据元数据ID获取SU信息 + * + * @param metadataId 元数据id + * @return 服务单元信息 + */ + ServiceUnitInfo getServiceUnitInfo(String metadataId); +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/PackageGenerateService.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/PackageGenerateService.java new file mode 100644 index 0000000..cec4e5a --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/PackageGenerateService.java @@ -0,0 +1,37 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.api.service; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import java.util.List; + +/** + * 打包服务 + * + * @author zhaoleitr + */ +public interface PackageGenerateService { + + /** + * 打包 + * + * @param projectPath 工程路径 + */ + void generatePackage(String projectPath); + + List getLocalPackages(String path); +} + diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/ProjectExtendService.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/ProjectExtendService.java new file mode 100644 index 0000000..f32f304 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/ProjectExtendService.java @@ -0,0 +1,62 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.api.service; + +import com.inspur.edp.lcm.metadata.api.entity.DbConnectionInfo; +import java.io.IOException; +import java.util.List; + +/** + * @author zhaoleitr + */ +public interface ProjectExtendService { + /** + * 提取 + * + * @param path + */ + void extract(String path); + + /** + * 部署 + * + * @param dBConnectionInfo 数据库信息 + * @param serverPath + * @param projPath 工程路径 + * @param restart 是否重启 + * @return + */ + void deploy(DbConnectionInfo dBConnectionInfo, String serverPath, String projPath, String restart); + + /** + * 文件迁移 + * + * @param path 工程路径 + */ + void migration(String path); + + /** + * 获取部署状态 + * + * @param sign 加密的文件路径 + * @return 部署状态 + * @throws IOException + */ + String getDeployStatus(String sign) throws IOException; + + List batchCompile(String path, String exts, String disabledExts); +} + diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataCacheManager.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataCacheManager.java similarity index 100% rename from model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataCacheManager.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataCacheManager.java diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDevCacheManager.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDevCacheManager.java similarity index 100% rename from model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDevCacheManager.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDevCacheManager.java diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDistCacheManager.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDistCacheManager.java similarity index 100% rename from model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDistCacheManager.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDistCacheManager.java diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataRtDistCache.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataRtDistCache.java similarity index 100% rename from model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataRtDistCache.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataRtDistCache.java diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/RtCacheHandler.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/RtCacheHandler.java similarity index 100% rename from model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/cache/RtCacheHandler.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/RtCacheHandler.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataDtoConverter.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataDtoConverter.java index 3afbc00..c089ef6 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataDtoConverter.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataDtoConverter.java @@ -49,7 +49,7 @@ public class MetadataDtoConverter { return null; } MetadataDto metadataDto = new MetadataDto(); - metadataDto.setBizobjectID(metadata.getHeader().getBizObjectId()); + metadataDto.setBizobjectID(metadata.getHeader().getBizobjectID()); metadataDto.setType(metadata.getHeader().getType()); metadataDto.setId(metadata.getHeader().getId()); metadataDto.setCode(metadata.getHeader().getCode()); @@ -59,7 +59,7 @@ public class MetadataDtoConverter { metadataDto.setLanguage(metadata.getHeader().getLanguage()); metadataDto.setRelativePath(metadata.getRelativePath()); //GspMetadata没有此属性 - metadataDto.setTranslating(metadata.getHeader().getTranslating()); + metadataDto.setIsTranslating(metadata.getHeader().isTranslating()); metadataDto.setExtendProperty(metadata.getExtendProperty()); metadataDto.setExtendable(metadata.getHeader().isExtendable()); metadataDto.setExtented(metadata.isExtended()); @@ -125,7 +125,7 @@ public class MetadataDtoConverter { GspMetadata metadata = new GspMetadata(); metadata.setHeader(new MetadataHeader()); metadata.getHeader().setId(metadataDto.getId()); - metadata.getHeader().setBizObjectId(metadataDto.getBizobjectID()); + metadata.getHeader().setBizobjectID(metadataDto.getBizobjectID()); metadata.getHeader().setNameSpace(metadataDto.getNameSpace()); metadata.getHeader().setType(metadataDto.getType()); metadata.getHeader().setFileName(metadataDto.getFileName()); diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/compiler/MetadataCompilerConfigLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/compiler/MetadataCompilerConfigLoader.java new file mode 100644 index 0000000..2527cae --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/compiler/MetadataCompilerConfigLoader.java @@ -0,0 +1,59 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.compiler; + +import com.inspur.edp.lcm.metadata.api.entity.compiler.MetadataCompilerConfiguration; +import com.inspur.edp.lcm.metadata.common.configuration.MetadataServiceHelper; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.List; + +public class MetadataCompilerConfigLoader { + private String fileName = "config/platform/common/lcm_gspprojectextend.json"; + private String sectionName = "MetadataCompilerConfigration"; + private List compileConfigrations; + + protected List loadCompileConfigration() { + MetadataServiceHelper metadataServiceHelper = new MetadataServiceHelper(); + try { + if (compileConfigrations == null || compileConfigrations.size() <= 0) { + fileName = Paths.get(EnvironmentUtil.getServerRTPath()).resolve(fileName).toString(); + compileConfigrations = metadataServiceHelper.getCompileConfigrationList(fileName, sectionName); + return compileConfigrations; + } else { + return compileConfigrations; + } + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + protected MetadataCompilerConfiguration getCompileConfigurationData(String typeName) { + loadCompileConfigration(); + if (compileConfigrations != null && compileConfigrations.size() > 0) { + for (MetadataCompilerConfiguration data : compileConfigrations) { + if (data.getTypeCode().equalsIgnoreCase(typeName)) { + return data; + } + } + } else { + return null; + } + return null; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/compiler/MetadataCompilerHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/compiler/MetadataCompilerHelper.java new file mode 100644 index 0000000..a1e7c72 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/compiler/MetadataCompilerHelper.java @@ -0,0 +1,53 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.compiler; + +import com.inspur.edp.lcm.metadata.api.entity.compiler.MetadataCompilerConfiguration; +import com.inspur.edp.lcm.metadata.spi.MetadataCompileAction; +import java.util.List; + +public class MetadataCompilerHelper extends MetadataCompilerConfigLoader { + private static MetadataCompilerHelper singleton = null; + + public static MetadataCompilerHelper getInstance() { + if (singleton == null) { + singleton = new MetadataCompilerHelper(); + } + return singleton; + } + + public List getCompileConfigrationList() { + return loadCompileConfigration(); + } + + public MetadataCompileAction getManager(String typeCode) { + MetadataCompileAction manager = null; + MetadataCompilerConfiguration compileConfigurationData = getCompileConfigurationData(typeCode); + if (compileConfigurationData != null) { + Class cls; + try { + if (compileConfigurationData.getMetadataCompiler() != null) { + cls = Class.forName(compileConfigurationData.getMetadataCompiler().getName()); + manager = (MetadataCompileAction) cls.newInstance(); + } + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + return manager; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/config/LcmComConfiguration.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/config/LcmComConfiguration.java new file mode 100644 index 0000000..83e0c2e --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/config/LcmComConfiguration.java @@ -0,0 +1,38 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.config; + +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Classname LcmComConfiguration Description LcmComConfiguration Date 2020/1/9 14:58 + * + * @author zhongchq + * @version 1.0 + */ +//todo +//@Configuration(proxyBeanMethods = false) +@Configuration() +public class LcmComConfiguration { + + @Bean + public FileService createFileService() { + return new FileServiceImp(); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/context/RuntimeContext.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/context/RuntimeContext.java new file mode 100644 index 0000000..9635086 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/context/RuntimeContext.java @@ -0,0 +1,51 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.context; + +import io.iec.edp.caf.boot.context.CAFContext; +import lombok.Setter; + +/** + * Classname RuntimeContext Description TODO Date 2019/8/20 14:11 + * + * @author zhongchq + * @version 1.0 + */ +public class RuntimeContext { + + @Setter + public static String tenantID; + + public static String getTenantID() { + + if (tenantID == null) { + tenantID = "9999"; + } + return tenantID; + } + + @Setter + private static String language; + + public static String getLanguage() { + try { + language = CAFContext.current.getLanguage(); + } catch (Exception e) { + language = "zh-CHS"; + } + return language; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/deployer/DeploymentHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/deployer/DeploymentHelper.java new file mode 100644 index 0000000..80089e5 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/deployer/DeploymentHelper.java @@ -0,0 +1,57 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.deployer; + +import com.inspur.edp.lcm.metadata.api.entity.deployer.DeploymentType; +import com.inspur.edp.lcm.project.deployer.spi.DeployAction; +import java.util.List; + +public class DeploymentHelper extends DeploymentTypeConfigLoader { + + private static DeploymentHelper singleton = null; + + public DeploymentHelper() { + } + + public static DeploymentHelper getInstance() { + if (singleton == null) { + singleton = new DeploymentHelper(); + } + return singleton; + } + + public List getDeploymentType() { + return loadDeploymentTypeConfiguration(); + } + + public DeployAction getManager(String typeCode) { + DeployAction manager = null; + DeploymentType deploymentType = getDeploymentType(typeCode); + if (deploymentType != null) { + Class cls; + try { + if (deploymentType.getDeployer() != null) { + cls = Class.forName(deploymentType.getDeployer().getName()); + manager = (DeployAction) cls.newInstance(); + } + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + return manager; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/deployer/DeploymentTypeConfigLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/deployer/DeploymentTypeConfigLoader.java new file mode 100644 index 0000000..df9f4a3 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/deployer/DeploymentTypeConfigLoader.java @@ -0,0 +1,87 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.deployer; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.inspur.edp.lcm.metadata.api.entity.deployer.DeploymentType; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.List; + +public class DeploymentTypeConfigLoader { + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + private String serverPath; + protected String fileName = "tools/deploy/project_java/config/platform/common/lcm_deploymenttype.json"; + private String sectionName = "DeploymentType"; + + private List deploymentTypeConfiguration; + + public DeploymentTypeConfigLoader() { + serverPath = Paths.get(Utils.getStartupPath()).resolve("../..").toString().replace("\\", "/"); + } + + protected List loadDeploymentTypeConfiguration() { + if (deploymentTypeConfiguration != null) { + return deploymentTypeConfiguration; + } + try { + fileName = Paths.get(serverPath).resolve(fileName).toString(); + deploymentTypeConfiguration = getDeploymentTypeConfiguration(fileName, sectionName); + return deploymentTypeConfiguration; + } catch (IOException ioException) { + ioException.printStackTrace(); + } finally { + fileName = "tools/deploy/project_java/config/platform/common/lcm_deploymenttype.json"; + } + return null; + } + + protected DeploymentType getDeploymentType(String typeCode) { + List deploymentTypes = loadDeploymentTypeConfiguration(); + DeploymentType deploymentType = deploymentTypes.stream().filter(type -> type.getTypeCode().equals(typeCode)).findFirst().orElse(null); + return deploymentType; + } + + private List getDeploymentTypeConfiguration(String path, String sectionName) throws IOException { + FileServiceImp fileService = new FileServiceImp(); + String fileContents = fileService.fileRead(path); + ObjectMapper objectMapper = Utils.getMapper(); + JsonNode jsonNode = objectMapper.readTree(fileContents); + String deploymentType = jsonNode.findValue(sectionName).toString(); + return objectMapper.readValue(deploymentType, new TypeReference>() { + }); + } + + public String getServerPath() { + return serverPath; + } + + public void setServerPath(String serverPath) { + this.serverPath = serverPath; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/extractor/ExtractConfigLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/extractor/ExtractConfigLoader.java new file mode 100644 index 0000000..ba2f64c --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/extractor/ExtractConfigLoader.java @@ -0,0 +1,67 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.extractor; + +import com.inspur.edp.lcm.metadata.api.entity.extract.ExtractConfigration; +import com.inspur.edp.lcm.metadata.common.configuration.MetadataServiceHelper; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.List; + +public class ExtractConfigLoader { + private String fileName = "config/platform/common/lcm_gspprojectextend.json"; + private String sectionName = "ExtractConfigration"; + private List extractConfigrations; + + /** + * @param + * @return java.util.List + * @throws + * @author zhongchq + * @description 获取配置文件数据 + * @date 15:40 2019/7/23 + **/ + protected List loadExtractConfigration() { + MetadataServiceHelper metadataServiceHelper = new MetadataServiceHelper(); + try { + if (extractConfigrations == null || extractConfigrations.size() <= 0) { + fileName = Paths.get(EnvironmentUtil.getServerRTPath()).resolve(fileName).toString(); + extractConfigrations = metadataServiceHelper.getExtractConfigrationList(fileName, sectionName); + return extractConfigrations; + } else { + return extractConfigrations; + } + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + protected ExtractConfigration getExtractConfigurationData(String typeName) { + loadExtractConfigration(); + if (extractConfigrations != null && extractConfigrations.size() > 0) { + for (ExtractConfigration data : extractConfigrations) { + if (data.getTypeCode().equalsIgnoreCase(typeName)) { + return data; + } + } + } else { + return null; + } + return null; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/extractor/ExtractHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/extractor/ExtractHelper.java new file mode 100644 index 0000000..bb3d999 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/extractor/ExtractHelper.java @@ -0,0 +1,53 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.extractor; + +import com.inspur.edp.lcm.metadata.api.entity.extract.ExtractConfigration; +import com.inspur.edp.lcm.metadata.spi.ExtractAction; +import java.util.List; + +public class ExtractHelper extends ExtractConfigLoader { + private static ExtractHelper singleton = null; + + public static ExtractHelper getInstance() { + if (singleton == null) { + singleton = new ExtractHelper(); + } + return singleton; + } + + public List getExtractConfigrationList() { + return loadExtractConfigration(); + } + + public ExtractAction getManager(String typeCode) { + ExtractAction manager = null; + ExtractConfigration extractConfigurationData = getExtractConfigurationData(typeCode); + if (extractConfigurationData != null) { + Class cls; + try { + if (extractConfigurationData.getExtract() != null) { + cls = Class.forName(extractConfigurationData.getExtract().getName()); + manager = (ExtractAction) cls.newInstance(); + } + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + return manager; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/logging/MvnStreamConsumer.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/logging/MvnStreamConsumer.java new file mode 100644 index 0000000..476f7fb --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/logging/MvnStreamConsumer.java @@ -0,0 +1,57 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.logging; + +import com.inspur.lcm.metadata.logging.LoggerDisruptorQueue; +import io.iec.edp.caf.boot.context.CAFContext; +import lombok.extern.slf4j.Slf4j; +import org.apache.maven.shared.invoker.InvocationOutputHandler; + +/** + * Classname MvnStreamConsumer Description 获取日志 Date 2020/3/4 11:32 + * + * @author zhongchq + * @version 1.0 + */ +@Slf4j +public class MvnStreamConsumer implements InvocationOutputHandler { + + private String exceptionString; + + @Override + public void consumeLine(String line) { + if (line.contains("[INFO]")) { +// System.out.println("mvn userId :"+CAFContext.current.getUserId()); + LoggerDisruptorQueue.publishEvent(line, CAFContext.current.getUserId()); + log.info(line); + } else if (line.contains("[WARNING]")) { + LoggerDisruptorQueue.publishEvent(line, CAFContext.current.getUserId()); + log.warn(line); + } else if (line.contains("[ERROR]")) { + this.exceptionString += line + "\r\n"; + LoggerDisruptorQueue.publishEvent(line, CAFContext.current.getUserId()); + log.error(line); + } + } + + public String getExceptionString() { + return exceptionString; + } + + public void setExceptionString(String exceptionString) { + this.exceptionString = exceptionString; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/CommandUtil.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/CommandUtil.java new file mode 100644 index 0000000..086b1fb --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/CommandUtil.java @@ -0,0 +1,642 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.util; + +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; +import java.net.Socket; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +public class CommandUtil { + public static void newProcess(String directory, String command) { + ProcessBuilder builder = new ProcessBuilder("cmd.exe", "/c", command); + builder.directory(new File(directory)); + builder.redirectOutput(ProcessBuilder.Redirect.INHERIT); + builder.redirectError(ProcessBuilder.Redirect.INHERIT); + builder.redirectInput(ProcessBuilder.Redirect.INHERIT); + builder.redirectErrorStream(true); + + InputStream is = null; + InputStreamReader ir = null; + BufferedReader br = null; + + Process p; + try { + p = builder.start(); + is = p.getInputStream(); + ir = new InputStreamReader(is); + br = new BufferedReader(ir); + String line; + while (true) { + line = br.readLine(); + if (line == null) { + break; + } + System.out.println(line); + } + + p.waitFor(); + int exit = p.exitValue(); + if (exit != 0) { + throw new RuntimeException("程序调用异常"); + } + } catch (IOException | InterruptedException e) { + throw new RuntimeException("程序调用异常", e); + } finally { + try { + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + public static void start(String serverPath) { + Runtime runtime = Runtime.getRuntime(); + try { + runtime.exec("cmd /k start " + serverPath); + } catch (IOException e) { + e.printStackTrace(); + } + } + +// public static int getPid(Process process) { +// int pid = 0; +// try { +// Field field = process.getClass().getDeclaredField("handle"); +// field.setAccessible(true); +// Long pidL = Kernel32.INSTANCE.GetProcessId((Long) field.get(process)); +// pid = pidL.intValue(); +// } catch (Exception ex) { +// ex.printStackTrace(); +// } +// return pid; +// } + + // 通过获取当前运行主机的pidName,截取获得他的pid + public static int getCurrentPid() { + RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); + String pidName = runtime.getName();// 5296@dell-PC + int pid = Integer.parseInt(pidName.substring(0, pidName.indexOf("@"))); + return pid; + } + + // 通过Pid获取PidName + public static String getPidNameByPid(int pid) throws Exception { + String pidName = null; + InputStream is = null; + InputStreamReader ir = null; + BufferedReader br = null; + String line; + String[] array; + try { + Process p = Runtime.getRuntime().exec("cmd /c TASKLIST /NH /FO CSV /FI \"PID EQ " + pid + "\""); + is = p.getInputStream(); // "javaw.exe","3856","Console","1","72,292 + // K"从这个进程中获取对应的PidName + ir = new InputStreamReader(is); + br = new BufferedReader(ir); + while ((line = br.readLine()) != null) { + if (line.indexOf(String.valueOf(pid)) != -1) { + array = line.split(","); + line = array[0].replaceAll("\"", ""); + line = line.replaceAll(".exe", "");// 考虑pidName后缀为exe或者EXE + line = line.replaceAll(".exe".toUpperCase(), ""); + pidName = line; + } + } + } catch (IOException localIOException) { + throw new Exception("获取进程名称出错!"); + } finally { + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + } + return pidName; + } + + // 根据Pid获取当前进程的CPU + public static String getCPUByPID(int pid) throws Exception { + if (pid == 0) { + return null; + } + InputStream is = null; + InputStreamReader ir = null; + BufferedReader br = null; + String line; + String[] array; + try { + Process p = Runtime.getRuntime().exec("cmd /c TASKLIST /NH /FO CSV /FI \"PID EQ " + pid + "\""); + is = p.getInputStream(); + ir = new InputStreamReader(is); + br = new BufferedReader(ir); + while ((line = br.readLine()) != null) { + if (!"".equals(line)) { + array = line.split("\",\""); + line = array[3].replaceAll("\"", ""); + return line; + } + } + } catch (Exception localException) { + throw new Exception("获取进程CPU信息出错!"); + } finally { + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + } + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + return null; + } + + // 根据Pid获取当前进程的memory + public static String getMemByPID(int pid) throws Exception { + if (pid == 0) { + return null; + } + InputStream is = null; + InputStreamReader ir = null; + BufferedReader br = null; + String line; + String[] array; + try { + Process p = Runtime.getRuntime().exec("cmd /c TASKLIST /NH /FO CSV /FI \"PID EQ " + pid + "\""); + is = p.getInputStream(); + ir = new InputStreamReader(is); + br = new BufferedReader(ir); + while ((line = br.readLine()) != null) { + if (!"".equals(line)) { + array = line.split("\",\""); + if (array.length < 5) { + continue; + } + line = array[4].replaceAll("\"", ""); + return line; + } + } + } catch (IOException localIOException) { + throw new Exception("获取进程内存信息出错!"); + } finally { + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + } + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + return null; + } + + // 根据Pid将进程干掉 + public static void killProcessByPid(int pid) throws Exception { + Runtime.getRuntime().exec("taskkill /F /PID " + pid); + } + + // 根据PidName将进程干掉 + public static void killProcessByPidName(String pidName) throws Exception { + Runtime.getRuntime().exec("taskkill /F /IM " + pidName); + } + + // 根据PidName获取当前的Pid的list集合 + public static List getPidsByPidName(String pidName) throws Exception { + List pidList = new ArrayList<>(); + InputStream is = null; + InputStreamReader ir = null; + BufferedReader br = null; + String line; + String[] array; + try { + String imageName = pidName; + Process p = Runtime.getRuntime().exec("cmd /c TASKLIST /NH /FO CSV /FI \"IMAGENAME EQ " + imageName + "\""); + is = p.getInputStream(); + ir = new InputStreamReader(is); + br = new BufferedReader(ir); + while ((line = br.readLine()) != null) { + if (line.indexOf(imageName) != -1) { + array = line.split(","); + line = array[1].replaceAll("\"", ""); + pidList.add(Integer.parseInt(line)); + } + } + } catch (IOException localIOException) { + throw new Exception("获取进程ID出错!"); + } finally { + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + } + return pidList; + } + + // 获取所有的pid + public static List getPidsByFilter(String filter) throws Exception { + List pids = new ArrayList<>(); + InputStream is = null; + InputStreamReader ir = null; + BufferedReader br = null; + String line; + String[] array; + try { + Process p = Runtime.getRuntime().exec("cmd /c TASKLIST /NH /FO CSV | findstr " + filter); + is = p.getInputStream(); + ir = new InputStreamReader(is); + br = new BufferedReader(ir); + while ((line = br.readLine()) != null) { + array = line.split(","); + int pid = Integer.parseInt(array[1].replace("\"", "")); + if (pid != 0) { + pids.add(pid); + } + } + } catch (IOException localIOException) { + throw new Exception("获取系统所有进程名出错!"); + } finally { + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + } + return pids; + } + + // 获取当前系统的所有的PidName + public static Set getCurrOsAllPidNameSet() throws Exception { + Set pidNameSet = new HashSet<>(); + InputStream is = null; + InputStreamReader ir = null; + BufferedReader br = null; + String line; + String[] array; + try { + Process p = Runtime.getRuntime().exec("cmd /c TASKLIST /NH /FO CSV"); + is = p.getInputStream(); + ir = new InputStreamReader(is); + br = new BufferedReader(ir); + while ((line = br.readLine()) != null) { + array = line.split(","); + line = array[0].replaceAll("\"", ""); + line = line.replaceAll(".exe", ""); + line = line.replaceAll(".exe".toUpperCase(), ""); + if (line != "") { + pidNameSet.add(line); + } + } + } catch (IOException localIOException) { + throw new Exception("获取系统所有进程名出错!"); + } finally { + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + } + return pidNameSet; + } + + // 判断当前pid是否退出,判断根据pid查询的内存是否为空来决定 + public static boolean isPidExist(int pid) throws Exception { + return getMemByPID(pid) != null; + } + + // 对启动路径和运行参数的拼接 + public static String getCommandFormatStr(String proPath) {// 这样的思路就可以控制俩种参数的输入 + return getCommandFormatStr(proPath, null); + } + + public static String getCommandFormatStr(String proPath, String runArgs) { + StringBuffer command = new StringBuffer(); + command.append("\""); + command.append(proPath); + command.append("\""); + if (runArgs != "") { + command.append(" ").append(runArgs); + } + return command.toString(); + } + + // 执行完相应的命令行就退出cmd + private static String getCommandByCmd(String cmdStr) { + StringBuffer command = new StringBuffer(); + command.append("cmd /C "); + command.append(cmdStr); + return command.toString(); + } + + // 通过cmd打开对应的文件 + public static void openDir(String fileDir) throws Exception {// 打开cmd,执行explorer + Runtime.getRuntime().exec("cmd /c start explorer " + fileDir);// explorer.exe是Windows的程序管理器或者文件资源管理器 + } + + // 根据当前的Pid获取当前进程的端口 + public static int getPortByPID(int pid) { + if (pid == 0) { + return 0; + } + InputStream is = null; + InputStreamReader ir = null; + BufferedReader br = null; + String line = ""; + String LISTENING_STATE_TYPE = "LISTENING";// 状态值 + String[] array; + try { + Process p = Runtime.getRuntime().exec("cmd /c netstat /ano | findstr [ | findstr " + pid + " | findstr " + LISTENING_STATE_TYPE); + is = p.getInputStream(); + ir = new InputStreamReader(is); + br = new BufferedReader(ir); + do { + if (line.indexOf(String.valueOf(pid)) != -1) { + line = line.replaceFirst("\\s+", ""); + array = line.split("\\s+"); + int port = Integer.parseInt(array[1].split(":")[3].trim()); + return port; + } + if ((line = br.readLine()) == null) { + break; + } + } + while (pid != 0); + } catch (IOException localIOException) { + throw new RuntimeException("获取进程端口信息出错!"); + } finally { + try { + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + return 0; + } + + // 根据当前的Pid获取当前进程的端口 + public static Map> getPortsByPID(int pid) throws Exception { + if (pid == 0) { + return null; + } + InputStream is = null; + InputStreamReader ir = null; + BufferedReader br = null; + String line = null; + String TCP_TYPE = "TCP"; + String UDP_TYPE = "UDP"; + String LISTENING_STATE_TYPE = "LISTENING";// 状态值 + Map> portMap = new HashMap<>(); + List tcpPortList = new ArrayList<>(); + List udpPortList = new ArrayList<>(); + portMap.put(TCP_TYPE, tcpPortList); + portMap.put(UDP_TYPE, udpPortList); + String[] array; + try { + Process p = Runtime.getRuntime().exec("netstat /ano"); + is = p.getInputStream(); + ir = new InputStreamReader(is); + br = new BufferedReader(ir); + do { + if (line.indexOf(pid) != -1) { + line = line.replaceFirst("\\s+", ""); + if (line.indexOf(TCP_TYPE) != -1) { + if (line.indexOf(LISTENING_STATE_TYPE) != -1) { + array = line.split("\\s+"); + String port = array[1].split(":")[1]; + tcpPortList.add(port); + } + } else { + array = line.split("\\s+"); + String port = array[1].split(":")[1]; + udpPortList.add(port); + } + } + if ((line = br.readLine()) == null) { + break; + } + } + while (pid != 0); + } catch (IOException localIOException) { + throw new Exception("获取进程端口信息出错!"); + } finally { + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + } + return portMap; + } + + public static List getPidsByServerPath(String serverPath) { + List pids = new ArrayList<>(); + ArrayList inputs; + String cmd = "wmic process where caption=\"java.exe\" get caption,executablepath,processid"; + try { + inputs = getInputs(cmd); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("获取进程信息失败:" + cmd, e); + } + List processInfos = inputs.stream().filter(input -> input.contains(serverPath)).collect(Collectors.toList()); + if (processInfos != null) { + processInfos.forEach(processInfo -> { + String[] splits = processInfo.split("\\s+"); + int pid = Integer.parseInt(splits[2].trim()); + pids.add(pid); + }); + } + return pids; + } + + // 根据当前的Pid获取当前进程的端口 + public static ArrayList getInputs(String cmd) throws Exception { + ArrayList inputs = new ArrayList<>(); + InputStream is = null; + InputStreamReader ir = null; + BufferedReader br = null; + String line; + try { + Process p = Runtime.getRuntime().exec(cmd); + is = p.getInputStream(); + ir = new InputStreamReader(is); + br = new BufferedReader(ir); + while ((line = br.readLine()) != null) { + inputs.add(line); + } + + p.waitFor(); + int exit = p.exitValue(); + if (exit != 0) { + throw new RuntimeException("程序调用异常"); + } + } catch (IOException localIOException) { + throw new Exception("执行命令:" + cmd + "出错。"); + } finally { + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + } + return inputs; + } + + public static List getPidsByPort(int port) { + ArrayList pids = new ArrayList<>(); + try { + Runtime rt = Runtime.getRuntime(); + Process proc = rt.exec("cmd /c netstat -ano | findstr " + port); + + BufferedReader stdInput = new BufferedReader(new + InputStreamReader(proc.getInputStream())); + String s = null; + if ((s = stdInput.readLine()) != null) { + int index = s.lastIndexOf(" "); + String sc = s.substring(index); + pids.add(Integer.parseInt(sc.trim())); + //rt.exec("cmd /c Taskkill /PID" +sc+" /T /F"); + } + return pids; + } catch (Exception e) { + throw new RuntimeException("获取pid失败"); + } + } + + public static boolean isPortAvailable(int port) { + try (Socket ignored = new Socket("localhost", port)) { + return false; + } catch (IOException ignored) { + return true; + } + } + + public static boolean isWindows() { + String OS = System.getProperty("os.name").toLowerCase(); + boolean isWindows = OS.startsWith("windows"); + return isWindows; + } + + // 获取当前环境的Java_Home + public static String getJavaHome(boolean isDeployTool) { + String javaHomeInServer = getJavaHomeInServer(isDeployTool); + if (new File(javaHomeInServer).exists()) { + return javaHomeInServer; + } + + String javaHome = System.getenv("JAVA_HOME"); + javaHome = javaHome == null ? System.getProperty("java.home") : javaHome; + + if (Utils.isNullOrEmpty(javaHome)) { + throw new RuntimeException("请配置系统变量JAVA_HOME"); + } + + return ""; + } + + public static String getJavaHomeInServer(boolean isDeployTool) { + String javaDir = isWindows() ? "amd64-win" : "x86_64-linux"; + String javaHome = FileServiceImp.combinePath(Utils.getBasePath(isDeployTool), EnvironmentUtil.getServerRuntimePathName(), "runtime/java", javaDir, "bin"); + return javaHome; + } + + // 对于这个方法在产品阶段用于判断是否具有JAVA_HOME + public static boolean existJavaHome() throws Exception { + ArrayList inputs = getInputs("cmd /c echo %JAVA_HOME%"); + if (Utils.isNullOrEmpty(inputs)) { + return false; + } + boolean existFlag = inputs.stream().anyMatch(input -> input.contains("%JAVA_HOME%")); + return existFlag; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/DbUtil.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/DbUtil.java new file mode 100644 index 0000000..d2b125b --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/DbUtil.java @@ -0,0 +1,49 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.util; + +import com.inspur.edp.lcm.metadata.api.entity.DbConnectionInfo; +import io.iec.edp.caf.commons.dataaccess.DbConfigDataConvertor; +import io.iec.edp.caf.commons.dataaccess.DbType; +import io.iec.edp.caf.commons.dataaccess.GSPDbConfigData; +import io.iec.edp.caf.commons.dataaccess.JDBCConnectionInfo; +import java.sql.DriverManager; +import java.sql.SQLException; + +public class DbUtil { + public static void testDBConnection(DbConnectionInfo dbConnectionInfo) { + JDBCConnectionInfo dbConfigData = getDbConfigData(dbConnectionInfo); + try { + DriverManager.getConnection(dbConfigData.getDatabaseURL(), dbConfigData.getUserName(), dbConfigData.getPassword()); + } catch (SQLException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + private static JDBCConnectionInfo getDbConfigData(DbConnectionInfo dbConnectionInfo) { + String source = dbConnectionInfo.getDbServerIP() + ":" + dbConnectionInfo.getDbPort(); + source = dbConnectionInfo.getDbType().equals(DbType.Oracle) ? source + "/" + dbConnectionInfo.getDbName() : source; + GSPDbConfigData gspDbConfigData = new GSPDbConfigData(); + gspDbConfigData.setDbType(dbConnectionInfo.getDbType()); + gspDbConfigData.setSource(source); + gspDbConfigData.setCatalog(dbConnectionInfo.getDbName()); + gspDbConfigData.setUserId(dbConnectionInfo.getDbUserName()); + gspDbConfigData.setPassword(dbConnectionInfo.getDbPassword()); + JDBCConnectionInfo dbConfigData = DbConfigDataConvertor.Convert(gspDbConfigData); + return dbConfigData; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/EncryptUtil.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/EncryptUtil.java new file mode 100644 index 0000000..73adf48 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/EncryptUtil.java @@ -0,0 +1,69 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.util; + +import com.inspur.edp.lcm.metadata.common.Utils; +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; +import sun.misc.BASE64Decoder; +import sun.misc.BASE64Encoder; + +public class EncryptUtil { + final static BASE64Decoder decoder = new BASE64Decoder(); + final static BASE64Encoder encoder = new BASE64Encoder(); + + public static String decryptInBASE64(String decryptString) { + try { + return new String(decoder.decodeBuffer(decryptString), StandardCharsets.UTF_8); + } catch (Exception e) { + throw new RuntimeException("配置解密失败, 请重新配置或者联系系统管理员。", e); + } + } + + public static String encryptInBASE64(String encodeString) { + if (Utils.isNullOrEmpty(encodeString)) { + return ""; + } + try { + return encoder.encode(encodeString.getBytes(StandardCharsets.UTF_8.name())); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return ""; + } + + public static String encryptInAscii(String text, int offset) { + if (Utils.isNullOrEmpty(text)) { + return ""; + } + char[] chars = text.toCharArray(); + for (int i = 0; i < chars.length; i++) { + chars[i] = (char) (chars[i] + offset); + } + return new String(chars); + } + + public static String decryptInAscii(String text, int offset) { + if (Utils.isNullOrEmpty(text)) { + return ""; + } + char[] chars = text.toCharArray(); + for (int i = 0; i < chars.length; i++) { + chars[i] = (char) (chars[i] - offset); + } + return new String(chars); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/Kernel32.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/Kernel32.java new file mode 100644 index 0000000..3e83358 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/Kernel32.java @@ -0,0 +1,25 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.common.util; + +import com.sun.jna.Library; +import com.sun.jna.Native; + +public interface Kernel32 extends Library { + public static Kernel32 INSTANCE = (Kernel32) Native.loadLibrary("kernel32", Kernel32.class); + + public long GetProcessId(Long hProcess); +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/ExtractAction.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/ExtractAction.java new file mode 100644 index 0000000..2a6acd3 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/ExtractAction.java @@ -0,0 +1,27 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.spi; + +import com.inspur.edp.lcm.metadata.api.entity.ExtractContext; + +public interface ExtractAction { + /** + * 提取扩展动作 + * + * @param context 提取上下文 + */ + void extract(ExtractContext context); +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/IProjectCreateManager.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/IProjectCreateManager.java new file mode 100644 index 0000000..2b82448 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/IProjectCreateManager.java @@ -0,0 +1,22 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.spi; + +import java.util.Map; + +public interface IProjectCreateManager { + void onCreatedProject(String projectPathWithFileName, Map items); +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/JitRuntimeAction.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/JitRuntimeAction.java new file mode 100644 index 0000000..c34939b --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/JitRuntimeAction.java @@ -0,0 +1,20 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.spi; + +public interface JitRuntimeAction { + void generateRuntime(String projPath); +} \ No newline at end of file diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MdExtendRuleSerializer.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MdExtendRuleSerializer.java new file mode 100644 index 0000000..e0c35fa --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MdExtendRuleSerializer.java @@ -0,0 +1,29 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.spi; + +import com.fasterxml.jackson.databind.JsonNode; +import com.inspur.edp.lcm.metadata.api.IMdExtRuleContent; + +/** + * @author zhaoleitr 元数据扩展规则序列化 + */ +public interface MdExtendRuleSerializer { + + JsonNode serialize(IMdExtRuleContent extendRule); + + IMdExtRuleContent deSerialize(JsonNode contentJObject); +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataCompileAction.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataCompileAction.java new file mode 100644 index 0000000..8186c24 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataCompileAction.java @@ -0,0 +1,27 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.spi; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataCompilerContext; + +public interface MetadataCompileAction { + /** + * 编译扩展动作 + * + * @param context 扩展上下文 + */ + void metadataCompile(MetadataCompilerContext context); +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataExtRuleService.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataExtRuleService.java new file mode 100644 index 0000000..7e2ab44 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataExtRuleService.java @@ -0,0 +1,24 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.spi; + +import com.inspur.edp.lcm.metadata.api.IMetadataContent; + +public interface MetadataExtRuleService { + + public IMetadataContent getDefaultExtRule(String type); + +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataI18nService.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataI18nService.java new file mode 100644 index 0000000..24b9942 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataI18nService.java @@ -0,0 +1,33 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.spi; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.I18nResource; +import java.util.List; + +public interface MetadataI18nService { + /// 合并(用于加载翻译后的元数据) + /// 基础元数据 + /// 多语资源 + GspMetadata merge(GspMetadata metadata, List resource); + + /// 此方法在运行时 获取元数据时,用不到。 + /// 此方法用于在设计时抽取资源元数据内容。 + /// 从基础元数据抽取资源元数据内容 + /// 基础元数据 + I18nResource getResourceItem(GspMetadata metadata); +} diff --git a/model/framework/devtime-api/pom.xml b/model/framework/devtime-api/pom.xml index 453e1a3..44be71b 100644 --- a/model/framework/devtime-api/pom.xml +++ b/model/framework/devtime-api/pom.xml @@ -8,24 +8,15 @@ 0.9.0-SNAPSHOT 4.0.0 - ubml-model-framework-devtime-api ${project.version} - ubml-model-framework-devtime-api + org.openatom.ubml - ubml-model-common-definition - 0.9.0-SNAPSHOT - compile - - - org.openatom.ubml - ubml-model-framework-common - 0.9.0-SNAPSHOT - compile + ubml-model-framework-entity + ${project.version} - \ No newline at end of file diff --git a/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/exception/MetadataExceptionCode.java b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/exception/MetadataExceptionCode.java new file mode 100644 index 0000000..f0766d0 --- /dev/null +++ b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/exception/MetadataExceptionCode.java @@ -0,0 +1,20 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.api.exception; + +public class MetadataExceptionCode { + public final String Unknown = "GSP_LCM_Meta_0000"; +} diff --git a/model/framework/devtime-core/pom.xml b/model/framework/devtime-core/pom.xml index 9483ce1..6082276 100644 --- a/model/framework/devtime-core/pom.xml +++ b/model/framework/devtime-core/pom.xml @@ -12,42 +12,77 @@ ubml-model-framework-devtime-core - - org.openatom.ubml - ubml-model-framework-devtime-api - 0.9.0-SNAPSHOT - compile - io.iec.edp caf-business-object-api - 0.1.4 - com.inspur.edp - lcm-logging-service - 0.1.4 + io.iec.edp + caf-boot-starter-context com.inspur.edp - ide-setting-core - 0.1.4 + i18n-resource-api + + + lcm-metadata-api + com.inspur.edp + + io.iec.edp - caf-boot-starter-context - 0.3.2 + caf-sumgr-core + com.inspur.edp - i18n-resource-api - 0.1.2 + lcm-logging-service + + + com.inspur.edp + ide-setting-core + + + lcm-metadata-devcommon + com.inspur.edp + + com.inspur.edp metadata-to-java-context - 0.1.3 + + + lcm-metadata-api + com.inspur.edp + + + lcm-metadata-manager + com.inspur.edp + + + lcm-metadata-core + com.inspur.edp + + - + + org.openatom.ubml + ubml-model-framework-common + ${project.version} + + + lcm-metadata-api + com.inspur.edp + + + + + org.openatom.ubml + ubml-model-framework-runtime-spi + ${project.version} + + \ No newline at end of file diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageGenerateCoreService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageGenerateCoreService.java new file mode 100644 index 0000000..12eacb6 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageGenerateCoreService.java @@ -0,0 +1,304 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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; + +import com.fasterxml.jackson.databind.ObjectMapper; +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.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageReference; +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.ServiceUnitInfo; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import static com.inspur.edp.lcm.metadata.common.Utils.handlePath; + +/** + * @author zhaoleitr + */ +public class PackageGenerateCoreService { + private final MetadataProjectCoreService projectService = new MetadataProjectCoreService(); + + private String packageName = ""; + private String projectPath = ""; + private String packagePath = ""; + private String projectFileName = ""; + private MetadataPackageHeader metadataPackageHeader; + private List metadataList; + private Map metadataAndDirPathList; + private MetadataPackageVersion packageVersion = new MetadataPackageVersion(); + private final FileServiceImp fileService = new FileServiceImp(); + + public void generatePackage(String path) { + projectPath = handlePath(path); + //1、初始化参数 + initialize(projectPath); + //2、组织manifest文件 + getManifest(); + //3、打包 + publishPackage(); + } + + private void initialize(String path) { + MetadataProject project = projectService.getMetadataProjInfo(path); + projectFileName = project.getName() + Utils.getMetadataProjSuffix(); + packageName = project.getMetadataPackageInfo().getName(); + packageVersion = project.getMetadataPackageInfo().getVersion(); + metadataPackageHeader = project.getMetadataPackageInfo(); + + String tempPath = fileService.getCombinePath(projectPath, "bin"); + packagePath = fileService.getCombinePath(tempPath, UUID.randomUUID().toString()); + metadataAndDirPathList = new LinkedHashMap<>(); + metadataList = new ArrayList<>(); + } + + private void getManifest() { + //1、获取头结点 + MetadataPackageHeader mpHeader = metadataPackageHeader; + //2、获取SU信息 + ServiceUnitInfo suInfo = getServiceUnitInfo(); + //3、获取依赖关系 + List mpRefs = getMpReference(); + //4、查找元数据前处理 + handleMetadataBeforePackage(metadataAndDirPathList, projectPath, packagePath); + //5、查找元数据后处理 + handleMetadataAfterFinding(mpHeader, suInfo, mpRefs); + } + + private void publishPackage() { + Utils.compress(packagePath, fileService.getDirectoryName(packagePath), this.packageName); + //将新建的文件夹删除,只保留生成的元数据包文件 + handleMetadataAfterPackage(packagePath); + } + + private MetadataPackageHeader getMpHeader() { + MetadataPackageHeader mpHeader = new MetadataPackageHeader(); + mpHeader.setName(packageName); + mpHeader.setVersion(packageVersion); + + return mpHeader; + } + + private ServiceUnitInfo getServiceUnitInfo() { + // 获取工程信息 + GspProject gspProject = new GspProjectCoreService().getGspProjectInfo(projectPath); + // 从工程信息中获取服务单元信息 + ServiceUnitInfo suInfo = new ServiceUnitInfo(); + suInfo.setAppCode(gspProject.getAppCode()); + suInfo.setServiceUnitCode(gspProject.getServiceUnitCode()); + + return suInfo; + } + + private List getMpReference() { + String projectFilePath = fileService.getCombinePath(projectPath, projectFileName); + if (!fileService.isFileExist(projectFilePath)) { + return null; + } + List mpReferences = new ArrayList<>(); + FileService service = new FileServiceImp(); + String projStr = null; + try { + projStr = service.fileRead(projectFilePath); + } catch (IOException e) { + e.printStackTrace(); + } + ObjectMapper objectMapper = Utils.getMapper(); + MetadataProject project; + try { + project = objectMapper.readValue(projStr, MetadataProject.class); + } catch (Exception e) { + throw new RuntimeException(e); + } + if (project.getMetadataPackageRefs() == null) { + return null; + } + for (MetadataPackageHeader item : project.getMetadataPackageRefs()) { + MetadataPackageReference mpRefs = new MetadataPackageReference(); + mpRefs.setDepententPackage(new MetadataPackageHeader()); + mpRefs.getDepententPackage().setName(item.getName()); + if (item.getVersion().getVersionString().contains("-")) { + mpRefs.getDepententPackage().setVersion(new MetadataPackageVersion(item.getVersion().getVersionString().substring(0, item.getVersion().getVersionString().indexOf("-")))); + } else { + mpRefs.getDepententPackage().setVersion(new MetadataPackageVersion(item.getVersion())); + } + mpReferences.add(mpRefs); + } + + return mpReferences; + } + + private void handleMetadataBeforePackage(Map hashMap, String projectPath, String packagePath) { + //找到工程下所有的元数据及文件夹列表 + findMdAndDirPathWithinProject(hashMap, projectPath); + //创建临时文件夹 + if (!fileService.isDirectoryExist(packagePath)) { + fileService.createDirectory(packagePath); + } + //拷贝元数据文件到临时路径下 + copyMdFiles(hashMap, projectPath, packagePath); + if (hashMap != null && hashMap.size() > 0) { + for (String item : hashMap.keySet()) { + String relativePath; + if ("File".equals(hashMap.get(item))) { + GspMetadata metadata = new MetadataCoreManager().getMetadataWithoutContent(item); + relativePath = item.replace(projectPath, ""); + metadata.setRelativePath(Utils.handlePath(relativePath)); + if (!metadataList.contains(metadata)) { + metadataList.add(metadata); + } + } + } + } + } + + private void handleMetadataAfterFinding(MetadataPackageHeader mpHeader, ServiceUnitInfo suInfo, + List mpReference) { + MetadataPackage metadataPackage = new MetadataPackage(); + metadataPackage.setHeader(mpHeader); + metadataPackage.setServiceUnitInfo(suInfo); + metadataPackage.setReference(mpReference); + metadataPackage.setMetadataList(new ArrayList<>()); + if (metadataList != null && metadataList.size() > 0) { + metadataList.forEach(item -> metadataPackage.getMetadataList().add(item)); + } + ObjectMapper objectMapper = new ObjectMapper(); + String metadataPackageStr; + try { + metadataPackageStr = objectMapper.writeValueAsString(metadataPackage); + } catch (Exception e) { + throw new RuntimeException(e); + } + String manifestPath = fileService.getCombinePath(packagePath, Utils.getManifestFileName()); + if (!fileService.isFileExist(manifestPath)) { + try { + fileService.createFile(packagePath, Utils.getManifestFileName()); + fileService.fileUpdate(manifestPath, metadataPackageStr); + } catch (Exception e) { + throw new RuntimeException(e); + } + } else { + fileService.fileUpdate(manifestPath, metadataPackageStr); + } + } + + private void findMdAndDirPathWithinProject(Map hashMap, String projectPath) { + + List dirs = fileService.getDirectorys(projectPath); + if (dirs.size() > 0) { + for (File dir : dirs) { + String dirName = fileService.getFileName(handlePath(dir.getPath())); + String temPath = projectPath + File.separator + dirName; + if (!hashMap.containsKey(temPath) && !".git".equals(dirName) && !".vs".equals(dirName) && !"bin".equals(dirName) && !"publish".equals(dirName) && !"obj".equals(dirName) && !"src".equals(dirName)) { + hashMap.put(handlePath(temPath), "Directory"); + findMdAndDirPathWithinProject(hashMap, temPath); + } + } + } + + List paths = fileService.getAllFiles(projectPath); + if (paths.size() > 0) { + boolean isMetadataExisting = false; + for (File path : paths) { + String extension = fileService.getExtension(handlePath(path.getPath())).toLowerCase(); + //TODO 这里需要从配置文件读取元数据后缀类型 + List metadataAllTypes = Utils.getMetadataPostfixTypes(); + boolean flag = false; + for (String item : metadataAllTypes) { + if (item.toLowerCase().equals(extension)) { + flag = true; + break; + } + } + if (flag) { + hashMap.put(handlePath(path.getPath()), "File"); + isMetadataExisting = true; + } + } + if (!isMetadataExisting) { + hashMap.remove(handlePath(projectPath)); + } + } else { + hashMap.remove(handlePath(projectPath)); + } + } + + private void copyMdFiles(Map hashMap, String projectPath, String packagePath) { + //将工程下的元数据文件都拷贝到新建的以程序集名称的文件夹下 + String absolutePath; + String relativePath; + if (hashMap == null || metadataAndDirPathList.size() == 0) { + return; + } + for (String path : metadataAndDirPathList.keySet()) { + relativePath = path.replace(projectPath, "").substring(1); + absolutePath = fileService.getCombinePath(packagePath, relativePath); + if ("Directory".equals(hashMap.get(path))) { + if (!fileService.isDirectoryExist(absolutePath)) { + fileService.createDirectory(absolutePath); + } + } else { + if (fileService.isFileExist(absolutePath)) { + try { + fileService.fileDelete(absolutePath); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + copyMdFiles(path, absolutePath); + } + } + } + + private void copyMdFiles(String sourcePath, String destinationPath) { + try { + fileService.fileCopy(sourcePath, destinationPath); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private void handleMetadataAfterPackage(String path) { + try { + fileService.deleteAllFilesUnderDirectory(path); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public List getLocalPackages(String absolutePath) { + List metadataPackages = new ArrayList<>(); + File[] files = new File(absolutePath).listFiles(pathname -> pathname.getName().endsWith(Utils.getMetadataProjSuffix())); + if (files != null && files.length > 0) { + MetadataCoreManager metadataCoreManager = new MetadataCoreManager(); + for (File file : files) { + metadataPackages.add(metadataCoreManager.getMetadataPackageInfo(file.getName(), file.getParent())); + } + } + return metadataPackages; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageGenerateServiceImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageGenerateServiceImp.java new file mode 100644 index 0000000..ad633d0 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageGenerateServiceImp.java @@ -0,0 +1,40 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.service.PackageGenerateService; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import java.util.List; + +/** + * @author zhaoleitr + */ +public class PackageGenerateServiceImp implements PackageGenerateService { + private PackageGenerateCoreService packageGenerateCoreService = new PackageGenerateCoreService(); + + @Override + public void generatePackage(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + packageGenerateCoreService.generatePackage(absolutePath); + } + + @Override + public List getLocalPackages(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return packageGenerateCoreService.getLocalPackages(absolutePath); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/ProjectExtendCoreService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/ProjectExtendCoreService.java new file mode 100644 index 0000000..8b405c4 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/ProjectExtendCoreService.java @@ -0,0 +1,273 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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; + +import com.inspur.edp.lcm.metadata.api.entity.DbConnectionInfo; +import com.inspur.edp.lcm.metadata.api.entity.DebugEnvironment; +import com.inspur.edp.lcm.metadata.api.entity.DeploymentContext; +import com.inspur.edp.lcm.metadata.api.entity.ExtractContext; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataCompilerContext; +import com.inspur.edp.lcm.metadata.api.entity.compiler.MetadataCompilerConfiguration; +import com.inspur.edp.lcm.metadata.api.entity.extract.ExtractConfigration; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.common.compiler.MetadataCompilerHelper; +import com.inspur.edp.lcm.metadata.common.deployer.DeploymentHelper; +import com.inspur.edp.lcm.metadata.common.extractor.ExtractHelper; +import com.inspur.edp.lcm.metadata.common.util.CommandUtil; +import com.inspur.edp.lcm.metadata.core.thread.ProcessRunnable; +import com.inspur.edp.lcm.metadata.spi.ExtractAction; +import com.inspur.edp.lcm.metadata.spi.MetadataCompileAction; +import com.inspur.edp.lcm.project.deployer.spi.DeployAction; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import io.iec.edp.caf.sumgr.core.ServiceUnitFactory; +import java.io.File; +import java.io.IOException; +import java.net.URLDecoder; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.stream.Collectors; +import sun.misc.BASE64Decoder; + +/** + * @author zhaoleitr + */ +public class ProjectExtendCoreService { + private final FileServiceImp fileService = new FileServiceImp(); + private final MetadataProjectCoreService metadataProjectCoreService = new MetadataProjectCoreService(); + private final GspProjectCoreService gspProjectCoreService = new GspProjectCoreService(); + + public String getDeployStatus(String sign) throws IOException { + BASE64Decoder decoder = new BASE64Decoder(); + byte[] bytes = decoder.decodeBuffer(sign); + String urlEncodeSign = new String(bytes); + String fileName = URLDecoder.decode(urlEncodeSign, "utf8"); + String status = ""; + if (fileService.isFileExist(fileName)) { + status = fileService.fileRead(fileName); + switch (status) { + case "success": + case "fail": + fileService.fileDelete(fileName); + break; + default: + break; + } + } + return status; + } + + public void extract(String absolutePath) { + List projPaths = new ArrayList<>(); + if (absolutePath.endsWith(Utils.getMetadataProjPath())) { + absolutePath = new File(absolutePath).getParent(); + } + metadataProjectCoreService.getProjPathsInPath(absolutePath, projPaths); + for (String projPath : projPaths) { + GspProject gspProjectInfo = gspProjectCoreService.getGspProjectInfo(projPath); + ExtractContext extractContext = new ExtractContext(); + extractContext.setProjectPath(projPath); + extractContext.setDeployPath(gspProjectInfo.getSuDeploymentPath()); + doExtract(extractContext); + } + } + + private void doExtract(ExtractContext extractContext) { + // 文件清理 + clearPublishDir(extractContext); + // 组织上下文 + buildExtractContext(extractContext); + // 各类型提取扩展 + List extractConfigrationList = ExtractHelper.getInstance().getExtractConfigrationList(); + extractConfigrationList.forEach(item -> { + if (item.isEnable()) { + if (extractContext.getDeployType() != null && ("WEB").equals(item.getTypeCode()) && !"all".equals(extractContext.getDeployType()) && !extractContext.getDeployType().contains("web")) { + return; + } + ExtractAction extractAction = ExtractHelper.getInstance().getManager(item.getTypeCode()); + if (extractAction == null) { + throw new RuntimeException("未能获取到" + item.getTypeCode() + "的提取器,请确认配置是否正确"); + } + extractAction.extract(extractContext); + } + }); + } + + private void buildExtractContext(ExtractContext context) { + String publishPath = Paths.get(context.getProjectPath()).resolve(Utils.getPublishPath()).toString(); + String deployPath = Paths.get(publishPath).resolve(Utils.getJstackPath()).resolve(context.getDeployPath().toLowerCase()).toString(); + context.setDeployPath(deployPath); + } + + private void clearPublishDir(ExtractContext extractContext) { + String publishPath = Paths.get(extractContext.getProjectPath()).resolve(Utils.getPublishPath()).toString(); + File file = new File(publishPath); + if (!file.exists()) { + file.mkdir(); + } + try { + fileService.cleanDirectory(file); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void deploy(DbConnectionInfo dBConnectionInfo, String serverPath, String projPath, String restart) { + serverPath = serverPath == null || serverPath.isEmpty() ? Utils.getBasePath() : serverPath; + + beforeDeploy(serverPath, projPath); + + String args = handleArgs(dBConnectionInfo, serverPath, projPath, restart); + String currentServerPath = Paths.get(Utils.getBasePath()).resolve("tools/deploy/project_java/runtime").toString(); + String javaHome = CommandUtil.getJavaHome(false); + String javaCmd = javaHome == "" ? "java" : javaHome + "/java"; + String serverRuntimePathName = EnvironmentUtil.getServerRuntimePathName(); + String command = javaCmd + " -server \"-Dloader.path=libs,3rd\" \"-Dserver.runtime.path.name=" + serverRuntimePathName + "\" \"-Dspring.config.location=../config/application.yaml\" -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n -jar lcm-project-deploy-tool.jar" + args; + if ("0".equals(restart)) { + newProcessRunnable(currentServerPath, command); + } else { + CommandUtil.newProcess(currentServerPath, command); + } + } + + private void beforeDeploy(String serverPath, String projPath) { + if (!suFileExists(serverPath, projPath)) { + generateSuFile(serverPath, projPath); + } + } + + private boolean suFileExists(String serverPath, String projPath) { + GspProject gspProjectInfo = gspProjectCoreService.getGspProjectInfo(projPath); + String serverLink = new File(FileServiceImp.combinePath(serverPath, "jstack")).exists() ? "jstack" : "server"; + String destDir = FileServiceImp.combinePath(serverPath, serverLink, "apps", gspProjectInfo.getAppCode().toLowerCase(), gspProjectInfo.getServiceUnitCode().toLowerCase()); + File file = new File(destDir); + file.mkdirs(); + Boolean existsFlag = ServiceUnitFactory.createGenerator().exists(file); + return existsFlag; + } + + private void generateSuFile(String serverPath, String projPath) { + GspProject gspProjectInfo = gspProjectCoreService.getGspProjectInfo(projPath); + io.iec.edp.caf.sumgr.api.entity.ServiceUnitInfo serviceUnitInfo = new io.iec.edp.caf.sumgr.api.entity.ServiceUnitInfo(); + serviceUnitInfo.setApplicationName(gspProjectInfo.getAppCode()); + serviceUnitInfo.setName(gspProjectInfo.getServiceUnitCode()); + String serverLink = new File(FileServiceImp.combinePath(serverPath, "jstack")).exists() ? "jstack" : "server"; + String destDir = FileServiceImp.combinePath(serverPath, serverLink, "apps", gspProjectInfo.getAppCode().toLowerCase(), gspProjectInfo.getServiceUnitCode().toLowerCase()); + File file = new File(destDir); + ServiceUnitFactory.createGenerator().generate(serviceUnitInfo, file); + } + + private void newProcessRunnable(String serverPath, String command) { + ProcessRunnable processRunnable = new ProcessRunnable(); + processRunnable.setServerPath(serverPath); + processRunnable.setCommand(command); + ExecutorService executor = Executors.newCachedThreadPool(); + executor.submit(processRunnable::run); + } + + private String handleArgs(DbConnectionInfo dbConnectionInfo, String serverPath, String projPath, String restart) { + StringBuilder stringBuilder = new StringBuilder(); + String publishPath = Paths.get(metadataProjectCoreService.getProjPath(projPath)).resolve(Utils.getPublishPath()).toString(); + appendArg(stringBuilder, publishPath); + appendArg(stringBuilder, serverPath); + appendArg(stringBuilder, dbConnectionInfo.getDbServerIP()); + appendArg(stringBuilder, dbConnectionInfo.getDbPort()); + appendArg(stringBuilder, dbConnectionInfo.getDbName()); + appendArg(stringBuilder, dbConnectionInfo.getDbUserName()); + appendArg(stringBuilder, dbConnectionInfo.getDbPassword()); + appendArg(stringBuilder, String.valueOf(dbConnectionInfo.getDbType().ordinal())); + appendArg(stringBuilder, restart); + + if (restart.equals("0")) { + int currentPid = CommandUtil.getCurrentPid(); + appendArg(stringBuilder, String.valueOf(currentPid)); + } + + return stringBuilder.toString(); + } + + private void appendArg(StringBuilder stringBuilder, String arg) { + stringBuilder.append(" \""); + stringBuilder.append(arg); + stringBuilder.append("\""); + } + + public void migration(String absolutePath) { + DeploymentContext context = new DeploymentContext(); + String publishPath = Paths.get(metadataProjectCoreService.getProjPath(absolutePath)).resolve(Utils.getPublishPath()).toString(); + context.setPublishPath(publishPath); + DebugEnvironment debugEnvironment = new DebugEnvironment(); + debugEnvironment.setServerPath(Utils.getBasePath()); + context.setDebugEnvironment(debugEnvironment); + DeployAction baseMigration = DeploymentHelper.getInstance().getManager("BaseMigration"); + if (baseMigration == null) { + throw new RuntimeException("未能获取到BaseMigration的部署器,请确认配置是否正确"); + } + baseMigration.deploy(context); + } + + public List batchCompile(String absolutePath, String exts, String disabledExts, String packagePath) { + List projPaths = new ArrayList<>(); + if (absolutePath.contains(",")) { + projPaths = Arrays.asList(absolutePath.split(",")); + } else { + if (absolutePath.endsWith(Utils.getMetadataProjPath())) { + absolutePath = new File(absolutePath).getParent(); + } + metadataProjectCoreService.getProjPathsInPath(absolutePath, projPaths); + } + + List extsList = exts.isEmpty() ? new ArrayList<>() : Arrays.asList(exts.split(",")); + List disabledExtsList = disabledExts.isEmpty() ? new ArrayList<>() : Arrays.asList(disabledExts.split(",")); + + for (String projPath : projPaths) { + System.out.println("正在编译:" + projPath); + String projectMetadataPath = Paths.get(projPath).resolve(Utils.getMetadataProjPath()).toString(); + MetadataCompilerContext metadataCompilerContext = new MetadataCompilerContext(); + metadataCompilerContext.setProjectPath(projectMetadataPath); + compile(metadataCompilerContext, extsList, disabledExtsList); + System.out.println("编译完成:" + projPath); + } + + return null; + } + + private void compile(MetadataCompilerContext metadataCompilerContext, List extsList, + List disabledExtsList) { + List compileConfigrationList = MetadataCompilerHelper.getInstance().getCompileConfigrationList(); + if (extsList != null && extsList.size() > 0) { + compileConfigrationList = compileConfigrationList.stream().filter(config -> extsList.contains(config.getTypeCode())).collect(Collectors.toList()); + } + if (disabledExtsList != null && disabledExtsList.size() > 0) { + compileConfigrationList = compileConfigrationList.stream().filter(config -> !disabledExtsList.contains(config.getTypeCode())).collect(Collectors.toList()); + } + for (MetadataCompilerConfiguration item : compileConfigrationList) { + if (item.getEnable()) { + MetadataCompileAction manager = MetadataCompilerHelper.getInstance().getManager(item.getTypeCode()); + if (manager != null) { + manager.metadataCompile(metadataCompilerContext); + } else { + System.out.println(item.getTypeCode() + "无法获取类"); + } + } + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/ProjectExtendServiceImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/ProjectExtendServiceImp.java new file mode 100644 index 0000000..acae329 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/ProjectExtendServiceImp.java @@ -0,0 +1,55 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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; + +import com.inspur.edp.lcm.metadata.api.entity.DbConnectionInfo; +import com.inspur.edp.lcm.metadata.api.service.ProjectExtendService; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import java.util.List; + +public class ProjectExtendServiceImp implements ProjectExtendService { + private final ProjectExtendCoreService projectExtendCoreService = new ProjectExtendCoreService(); + + @Override + public void deploy(DbConnectionInfo dBConnectionInfo, String serverPath, String projPath, String restart) { + String absolutePath = ManagerUtils.getAbsolutePath(projPath); + projectExtendCoreService.deploy(dBConnectionInfo, serverPath, absolutePath, restart); + } + + @Override + public void extract(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + projectExtendCoreService.extract(absolutePath); + } + + @Override + public void migration(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + projectExtendCoreService.migration(absolutePath); + } + + @Override + public String getDeployStatus(String sign) { + return null; + } + + @Override + public List batchCompile(String path, String exts, String disabledExts) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String packagePath = ManagerUtils.getMetadataPackageLocation(); + return projectExtendCoreService.batchCompile(absolutePath, exts, disabledExts, packagePath); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/CoreServiceConfiguration.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/CoreServiceConfiguration.java new file mode 100644 index 0000000..ec7e9dd --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/CoreServiceConfiguration.java @@ -0,0 +1,55 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.config; + +import com.inspur.edp.lcm.metadata.core.event.DirEventBroker; +import com.inspur.edp.lcm.metadata.core.event.MetadataCreateEventBroker; +import com.inspur.edp.lcm.metadata.core.event.MetadataEventBroker; +import io.iec.edp.caf.commons.event.config.EventListenerSettings; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Classname ServiceConfiguration Description TODO Date 2019/11/9 15:40 + * + * @author zhongchq + * @version 1.0 + */ +//todo +//@Configuration(proxyBeanMethods = false) +@Configuration() +public class CoreServiceConfiguration { + private EventListenerSettings settings; + + public CoreServiceConfiguration(EventListenerSettings settings) { + this.settings = settings; + } + + @Bean + public MetadataEventBroker metadataEventBroker() { + return new MetadataEventBroker(settings); + } + + @Bean + public MetadataCreateEventBroker metadataCreateEventBroker() { + return new MetadataCreateEventBroker(settings); + } + + @Bean + public DirEventBroker dirEventBroker() { + return new DirEventBroker(settings); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeConfigLoader.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeConfigLoader.java new file mode 100644 index 0000000..fde9144 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeConfigLoader.java @@ -0,0 +1,66 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.config; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.inspur.edp.lcm.metadata.api.mvnEntity.JitRuntimeConfigration; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.io.IOException; +import java.nio.file.Paths; +import lombok.Getter; +import lombok.Setter; + +public class JitRuntimeConfigLoader { + + private static final String sectionName = "JitRuntimeConfigration"; + @Getter + @Setter + static JitRuntimeConfigration jitRuntimeConfigration; + private static String fileName = "config/platform/common/lcm_gspprojectextend.json"; + + public JitRuntimeConfigLoader() { + } + + protected JitRuntimeConfigration getJitRuntimeConfigration() { + + fileName = Paths.get(EnvironmentUtil.getServerRTPath()).resolve(fileName).toString(); + + try { + if (jitRuntimeConfigration == null) { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + FileServiceImp fileService = new FileServiceImp(); + String fileContents = fileService.fileRead(fileName); + JsonNode jsonNode = objectMapper.readTree(fileContents); + String jitRuntimeConfigrationJson = jsonNode.findValue(sectionName).toString(); + jitRuntimeConfigration = objectMapper.readValue(jitRuntimeConfigrationJson, new TypeReference() { + }); + return jitRuntimeConfigration; + } else { + return jitRuntimeConfigration; + } + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeHelper.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeHelper.java new file mode 100644 index 0000000..16aec0f --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeHelper.java @@ -0,0 +1,58 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.config; + +import com.inspur.edp.lcm.metadata.api.mvnEntity.JitRuntimeConfigration; +import com.inspur.edp.lcm.metadata.spi.JitRuntimeAction; + +/** + * @Classname JitCompilerHelper + * @Description TODO + * @Date 2019/7/29 16:06 + * @Created by zhongchq + * @Version 1.0 + */ +public class JitRuntimeHelper extends JitRuntimeConfigLoader { + + private static JitRuntimeHelper singleton = null; + + public JitRuntimeHelper() { + } + + public static JitRuntimeHelper getInstance() { + if (singleton == null) { + singleton = new JitRuntimeHelper(); + } + return singleton; + } + + public JitRuntimeAction getManager() { + JitRuntimeAction manager = null; + JitRuntimeConfigration data = getJitRuntimeConfigration(); + if (data != null && data.getEnable() == true) { + Class cls = null; + if (data.getAction() != null) { + try { + cls = Class.forName(data.getAction().getName()); + manager = (JitRuntimeAction) cls.newInstance(); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + } + } + } + return manager; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/ServiceConfiguration.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/ServiceConfiguration.java new file mode 100644 index 0000000..29524ce --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/ServiceConfiguration.java @@ -0,0 +1,73 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.config; + +import com.inspur.edp.lcm.metadata.api.service.GspProjectService; +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.PackageGenerateService; +import com.inspur.edp.lcm.metadata.api.service.ProjectExtendService; +import com.inspur.edp.lcm.metadata.api.service.RefCommonService; +import com.inspur.edp.lcm.metadata.core.GspProjectServiceImp; +import com.inspur.edp.lcm.metadata.core.MetadataProjectServiceImp; +import com.inspur.edp.lcm.metadata.core.MetadataServiceImp; +import com.inspur.edp.lcm.metadata.core.PackageGenerateServiceImp; +import com.inspur.edp.lcm.metadata.core.ProjectExtendServiceImp; +import com.inspur.edp.lcm.metadata.core.RefCommonServiceImp; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @Classname ServiceConfiguration + * @Description 配置类 + * @Date 2019/7/26 14:55 + * @Created by liu_bintr + * @Version 1.0 + */ +//todo +//@Configuration(proxyBeanMethods = false) +@Configuration() +public class ServiceConfiguration { + @Bean + public MetadataService createMetadataService() { + return new MetadataServiceImp(); + } + + @Bean + public GspProjectService createGspProjectService() { + return new GspProjectServiceImp(); + } + + @Bean + public MetadataProjectService createMetadataProjectService() { + return new MetadataProjectServiceImp(); + } + + @Bean + public RefCommonService createRefService() { + return new RefCommonServiceImp(); + } + + @Bean + public PackageGenerateService createPackageGenerateService() { + return new PackageGenerateServiceImp(); + } + + @Bean + public ProjectExtendService createProjectExtendService() { + return new ProjectExtendServiceImp(); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/thread/ProcessRunnable.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/thread/ProcessRunnable.java new file mode 100644 index 0000000..c509827 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/thread/ProcessRunnable.java @@ -0,0 +1,36 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.thread; + +import com.inspur.edp.lcm.metadata.common.util.CommandUtil; + +public class ProcessRunnable implements Runnable { + private String serverPath; + private String command; + + public void setServerPath(String serverPath) { + this.serverPath = serverPath; + } + + public void setCommand(String command) { + this.command = command; + } + + @Override + public void run() { + CommandUtil.newProcess(serverPath, command); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/DeployActionImpl.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/DeployActionImpl.java new file mode 100644 index 0000000..e5e706a --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/DeployActionImpl.java @@ -0,0 +1,44 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.extend.action; + +import com.inspur.edp.lcm.metadata.api.entity.DeploymentContext; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.project.deployer.spi.DeployAction; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.File; +import java.nio.file.Paths; + +public class DeployActionImpl implements DeployAction { + @Override + public void deploy(DeploymentContext context) { + File publishFile = new File(context.getPublishPath()); + FileService fileService = SpringBeanUtils.getBean(FileService.class); + File[] files = publishFile.listFiles(); + for (File file : files) { + if (file.getName().equals("jstack")) { + String serverRtPath = Paths.get(context.getDebugEnvironment().getServerPath(), "server").toString(); + if (fileService.isDirectoryExist(serverRtPath)) { + fileService.folderCopy(file.getPath(), serverRtPath); + } else { + fileService.folderCopy(file.getPath(), Paths.get(context.getDebugEnvironment().getServerPath(), file.getName()).toString()); + } + } else { + fileService.folderCopy(file.getPath(), Paths.get(context.getDebugEnvironment().getServerPath(), file.getName()).toString()); + } + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/ExtractActionImpl.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/ExtractActionImpl.java new file mode 100644 index 0000000..d5af8be --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/ExtractActionImpl.java @@ -0,0 +1,110 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.extend.action; + +import com.inspur.edp.lcm.metadata.api.entity.ExtractContext; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.spi.ExtractAction; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.File; +import java.io.IOException; +import java.nio.file.Paths; + +public class ExtractActionImpl implements ExtractAction { + @Override + public void extract(ExtractContext context) { + // 提取元数据包 + extractMdpkg(context); + + if (context.getDeployType() != null && !"all".equals(context.getDeployType()) && !context.getDeployType().contains("jar")) { + return; + } + + // 提取java交付物 + extractJavaProduct(context); + } + + private void extractJavaProduct(ExtractContext context) { + + String javaCodePath = Paths.get(context.getProjectPath()).resolve(Utils.getJavaProjectPath()).resolve(Utils.getCodePath()).toString(); + String deployPath = Paths.get(context.getDeployPath()).resolve(Utils.getLibsPath()).toString(); + + MetadataProjectService metadataProjectService = SpringBeanUtils.getBean(MetadataProjectService.class); + ProcessMode processMode = metadataProjectService.getProcessMode(context.getProjectPath()); + if (ProcessMode.GENERATION.equals(processMode)) { + copyJar(javaCodePath, "api", deployPath); + copyJar(javaCodePath, "core", deployPath); + } + + copyJar(javaCodePath, "comp", deployPath); + } + + private void copyJar(String javaCodePath, String module, String deployPath) { + FileService fileService = SpringBeanUtils.getBean(FileService.class); + String moduleJarPath = getJarPath(javaCodePath, module); + if (moduleJarPath.isEmpty()) { + return; + } + String destPath = Paths.get(deployPath).resolve(new File(moduleJarPath).getName()).toString(); + fileService.createDirectory(deployPath); + try { + fileService.fileCopy(moduleJarPath, destPath); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private String getJarPath(String javaCodePath, String module) { + String targetPath = Paths.get(javaCodePath).resolve(module).resolve(Utils.getTargetPath()).toString(); + File file = new File(targetPath); + if (file.exists()) { + File[] files = file.listFiles((dir, name) -> name.endsWith(Utils.getJarSuffix())); + if (files.length > 0) { + return files[0].getPath(); + } + } + System.out.println("无" + module + "jar包。"); + return ""; + } + + private void extractMdpkg(ExtractContext context) { + String binPath = Paths.get(context.getProjectPath()).resolve(Utils.getMetadataProjPath()).resolve(Utils.getMetadataBinPath()).toString(); + File binFile = new File(binPath); + String sourcePath = ""; + if (binFile.exists()) { + File[] files = binFile.listFiles((dir, name) -> name.endsWith(Utils.getMetadataPackageExtension())); + if (files.length > 0) { + sourcePath = files[0].getPath(); + } + } + if (sourcePath.isEmpty()) { + throw new RuntimeException("元数据包不存在,请先生成元数据包:" + context.getProjectPath()); + } + String targetDir = FileServiceImp.combinePath(context.getDeployPath().replace("publish\\jstack\\apps", "publish\\metadata\\apps").replace("publish/jstack/apps", "publish/metadata/apps"), "metadata"); + String targetPath = FileServiceImp.combinePath(targetDir, new File(sourcePath).getName()); + FileService fileService = SpringBeanUtils.getBean(FileService.class); + fileService.createDirectory(targetDir); + try { + fileService.fileCopy(sourcePath, targetPath); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/MetadataCompileActionImpl.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/MetadataCompileActionImpl.java new file mode 100644 index 0000000..c0d5f13 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/MetadataCompileActionImpl.java @@ -0,0 +1,29 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.extend.action; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataCompilerContext; +import com.inspur.edp.lcm.metadata.api.service.PackageGenerateService; +import com.inspur.edp.lcm.metadata.spi.MetadataCompileAction; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; + +public class MetadataCompileActionImpl implements MetadataCompileAction { + @Override + public void metadataCompile(MetadataCompilerContext context) { + PackageGenerateService packageGenerateService = SpringBeanUtils.getBean(PackageGenerateService.class); + packageGenerateService.generatePackage(context.getProjectPath()); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MavenUtilsImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MavenUtilsImp.java new file mode 100644 index 0000000..78fb424 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MavenUtilsImp.java @@ -0,0 +1,45 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.ref; + +import com.inspur.edp.lcm.metadata.api.service.MavenUtilsService; +import com.inspur.edp.lcm.metadata.core.MavenUtilsCore; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import lombok.extern.slf4j.Slf4j; + +/** + * Classname MavenUtils Description mvn操作工具类 Date 2019/12/9 9:49 + * + * @author zhongchq + * @version 1.0 + */ +@Slf4j +public class MavenUtilsImp implements MavenUtilsService { + + @Override + public boolean exeMavenCommand(String javaCodePath, String goal) { + + String mavenPath = ManagerUtils.getMavenStoragePath(); + MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + return mavenUtilsCore.exeMavenCommand(javaCodePath, mavenPath, goal); + } + + @Override + public String getLocalRepository() { + MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + return mavenUtilsCore.getLocalRepository(); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MdpkgServiceImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MdpkgServiceImp.java new file mode 100644 index 0000000..f31dc01 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MdpkgServiceImp.java @@ -0,0 +1,181 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.ref; + +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenComponents; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataRepo; +import com.inspur.edp.lcm.metadata.api.service.MdpkgService; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.core.PackageCoreService; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.IOException; +import java.util.List; +import lombok.extern.slf4j.Slf4j; + +/** + * 元数据服务 + */ +@Slf4j +public class MdpkgServiceImp implements MdpkgService { + + private MetadataProjectService metadataProjectService; + + private MetadataProjectService getMetadataProjectService() { + if (metadataProjectService == null) { + metadataProjectService = SpringBeanUtils.getBean(MetadataProjectService.class); + } + return metadataProjectService; + } + + private PackageCoreService packageCoreService = new PackageCoreService(); + + /** + * @param path 路径 + * @param modules 模块 + */ + @Override + public void compile(String path, String modules) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String mavenPath = ManagerUtils.getMavenStoragePath(); + packageCoreService.compile(absolutePath, modules, mavenPath); + } + + @Override + public void compileAll(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String mavenPath = ManagerUtils.getMavenStoragePath(); + packageCoreService.compile(absolutePath, "all", mavenPath); + } + + @Override + public void restore(String path, Boolean force) { + if (Utils.isNullOrEmpty(path)) { + throw new IllegalArgumentException("工程路径不能为空"); + } + String absolutePath = ManagerUtils.getAbsolutePath(path); + String mavenPath = ManagerUtils.getMavenStoragePath(); + String packagePath = ManagerUtils.getMetadataPackageLocation(); + packageCoreService.restore(absolutePath, force, mavenPath, packagePath); + } + + @Override + public void addDepedencyAndRestore(String path, List metadataPackages) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String mavenPath = ManagerUtils.getMavenStoragePath(); + String packagePath = ManagerUtils.getMetadataPackageLocation(); + packageCoreService.addDependencyAndRestore(absolutePath, metadataPackages, mavenPath, packagePath); + } + + @Override + public void deployReleaseMdVersion(String path, String version, String repoId, boolean revert, + String dependenciesVersion) throws IOException { + Utils.checkEmpty(path, "工程路径不能为空"); + Utils.checkEmpty(path, "version不能为空"); + String absolutePath = ManagerUtils.getAbsolutePath(path); + String projPath = getMetadataProjectService().getProjPath(absolutePath); + String mavenPath = ManagerUtils.getMavenStoragePath(); + final ProcessMode processMode = getMetadataProjectService().getProcessMode(projPath); + switch (processMode.toString()) { + case "interpretation": + packageCoreService.deployMdpkgForInterpretation(projPath, repoId, version, dependenciesVersion, mavenPath); + break; + default: + packageCoreService.deployReleaseMdVersion(projPath, version, repoId, revert, dependenciesVersion, mavenPath); + } + } + + @Override + public void deploySnapshotMdVersion(String path, String repoId, String version, boolean revert) { + Utils.checkEmpty(path, "工程路径不能为空"); + Utils.checkEmpty(path, "version不能为空"); + String absolutePath = ManagerUtils.getAbsolutePath(path); + String projPath = getMetadataProjectService().getProjPath(absolutePath); + String mavenPath = ManagerUtils.getMavenStoragePath(); + + final ProcessMode processMode = getMetadataProjectService().getProcessMode(projPath); + switch (processMode.toString()) { + case "interpretation": + packageCoreService.deployMdpkgForInterpretation(projPath, repoId, version, null, mavenPath); + break; + default: + packageCoreService.deploySnapshotMdVersion(projPath, repoId, version, revert, mavenPath); + } + } + + @Override + public void installMdpkg(String groupId, String artifactId, String version, String proPath, + Boolean forceUpdateFlag) throws IOException { + // 创建pom文件,对应的mdproj添加依赖信息 + String absolutePath = ManagerUtils.getAbsolutePath(proPath); + String mavenPath = ManagerUtils.getMavenStoragePath(); + String packagePath = ManagerUtils.getMetadataPackageLocation(); + packageCoreService.installMdpkg(groupId, artifactId, version, absolutePath, forceUpdateFlag, mavenPath, packagePath); + } + + @Override + public void uninstallMdpkg(String projPath, String packName) { + String absolutePath = ManagerUtils.getAbsolutePath(projPath); + String mavenPath = ManagerUtils.getMavenStoragePath(); + packageCoreService.uninstallMdpkg(absolutePath, packName, mavenPath); + } + + @Override + public void addProjectDependency(String pomp_ath, String groupId, String artifactId, String version) { + packageCoreService.addProjectDependency(pomp_ath, groupId, artifactId, version); + } + + @Override + public void deployMdpkg(String proPath, String repoId, String dependencyVersion) { + proPath = getMetadataProjectService().getProjPath(proPath); + String mavenPath = ManagerUtils.getMavenStoragePath(); + packageCoreService.deployMdpkg(proPath, repoId, dependencyVersion, mavenPath); + } + + @Override + public MetadataRepo getRepoList() { + return packageCoreService.getHostedRepoList(); + } + + @Override + public String getMavenPackageLatestVersion(String groupId, String artifactId) { + return packageCoreService.getMavenPackageLatestVersion(groupId, artifactId); + } + + @Override + public MavenPackageRefs getGAByMdpkgName(String mdpkgName) { + return packageCoreService.getGAByMdpkgName(mdpkgName); + } + + @Override + public MavenComponents getVersionsOfSinglePackage(String sourceId, String packName) { + MetadataRepo metadataRepo = getRepoList(); + return metadataRepo.getRepoList().stream().filter(repo -> repo.getId().equals(sourceId)) + .findFirst() + .map(repo -> packageCoreService.getVersionsOfSinglePackage(repo.getSourceUrl(), packName)) + .orElse(null); + } + + @Override + public void batchOperate(String path, List operations) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String mavenPath = ManagerUtils.getMavenStoragePath(); + packageCoreService.batchOperation(absolutePath, mavenPath, operations); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/config/RefConfiguration.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/config/RefConfiguration.java new file mode 100644 index 0000000..50ffd26 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/config/RefConfiguration.java @@ -0,0 +1,44 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.ref.config; + +import com.inspur.edp.lcm.metadata.api.service.MavenUtilsService; +import com.inspur.edp.lcm.metadata.api.service.MdpkgService; +import com.inspur.edp.lcm.metadata.ref.MavenUtilsImp; +import com.inspur.edp.lcm.metadata.ref.MdpkgServiceImp; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Classname RefConfiguration Description ref配置类 Date 2019/11/28 10:34 + * + * @author zhongchq + * @version 1.0 + */ +//todo +//@Configuration(proxyBeanMethods = false) +@Configuration() +public class RefConfiguration { + @Bean + public MdpkgService createMdpkgService() { + return new MdpkgServiceImp(); + } + + @Bean + public MavenUtilsService createMavenUtilsService() { + return new MavenUtilsImp(); + } +} diff --git a/model/framework/devtime-webapi/pom.xml b/model/framework/devtime-webapi/pom.xml new file mode 100644 index 0000000..0aaf73f --- /dev/null +++ b/model/framework/devtime-webapi/pom.xml @@ -0,0 +1,37 @@ + + + + ubml-model-framework + org.openatom.ubml + 0.9.0-SNAPSHOT + + 4.0.0 + ubml-model-framework-devtime-webapi ${project.version} + ubml-model-framework-devtime-webappi + + + + io.iec.edp + caf-boot-starter-rest-server + + + + org.openatom.ubml + ubml-model-framework-common + ${project.version} + + + lcm-metadata-api + com.inspur.edp + + + + + + + 8 + 8 + + \ No newline at end of file diff --git a/model/framework/devtime-webapi/src/main/java/webapi/FileSystemWebApi.java b/model/framework/devtime-webapi/src/main/java/webapi/FileSystemWebApi.java new file mode 100644 index 0000000..da2a8a1 --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/FileSystemWebApi.java @@ -0,0 +1,42 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 webapi; + +import com.inspur.edp.lcm.file.system.FileSystemServiceImp; +import com.inspur.edp.lcm.metadata.api.service.FileSystemService; +import java.io.IOException; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +/** + * @author zhaoleitr + */ +@Path("/") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class FileSystemWebApi { + + FileSystemService fileSystemService = new FileSystemServiceImp(); + + @GET + public void showInExplorer(@QueryParam(value = "path") String path) throws IOException { + fileSystemService.showInExplorer(path); + } +} diff --git a/model/framework/devtime-webapi/src/main/java/webapi/GspProjectServiceWebApi.java b/model/framework/devtime-webapi/src/main/java/webapi/GspProjectServiceWebApi.java new file mode 100644 index 0000000..e8af26d --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/GspProjectServiceWebApi.java @@ -0,0 +1,78 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 webapi; + +import com.inspur.edp.lcm.metadata.api.ConfigData.gspproject.ProjectConfiguration; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.service.GspProjectService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.IOException; +import java.util.List; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +@Path("/") +@Produces(MediaType.APPLICATION_JSON) +public class GspProjectServiceWebApi { + private GspProjectService gspProjectService; + + private GspProjectService getGspProjectService() { + if (gspProjectService == null) { + gspProjectService = SpringBeanUtils.getBean(GspProjectService.class); + } + return gspProjectService; + } + + /** + * 获取工程信息(GSPProject.json的信息) + * + * @param path 工程路径 + * @return 工程路径 + * @throws IOException + */ + @GET + public GspProject getGspProjectInfo(@QueryParam(value = "path") String path) throws IOException { + return getGspProjectService().getGspProjectInfo(path); + } + + /** + * 获取工程类型 + * + * @return + */ + @GET + @Path("/type") + public List getGspProjectTypeInfo() { + return getGspProjectService().getGspProjectTypeInfo(); + } + + /** + * 更新工程基础技术栈 + * + * @param path 工程路径 + * @param codeLanguage 技术栈 + * @Description 暂时不用 + */ + @PUT + public void updateGspProject(@QueryParam(value = "path") String path, + @QueryParam(value = "codeLanguage") String codeLanguage) { + return; + } +} diff --git a/model/framework/devtime-webapi/src/main/java/webapi/MdServiceWebApi.java b/model/framework/devtime-webapi/src/main/java/webapi/MdServiceWebApi.java new file mode 100644 index 0000000..5de73be --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/MdServiceWebApi.java @@ -0,0 +1,378 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 webapi; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.inspur.edp.lcm.metadata.api.IMdExtRuleContent; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataIndexItemDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; +import com.inspur.edp.lcm.metadata.api.entity.Page; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.entity.metadataindex.MetadataIndexDto; +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.PackageGenerateService; +import com.inspur.edp.lcm.metadata.api.service.RefCommonService; +import com.inspur.edp.lcm.metadata.common.MetadataDtoConverter; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.common.configuration.MdExtRuleSerializerHelper; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import com.inspur.edp.lcm.metadata.spi.MdExtendRuleSerializer; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.QueryParam; + +public class MdServiceWebApi { + private MetadataService metadataService; + + private MetadataService getMetadataService() { + if (metadataService == null) { + metadataService = SpringBeanUtils.getBean(MetadataService.class); + } + return metadataService; + } + + private MetadataProjectService metadataProjectService; + + private MetadataProjectService getMetadataProjectService() { + if (metadataProjectService == null) { + metadataProjectService = SpringBeanUtils.getBean(MetadataProjectService.class); + } + return metadataProjectService; + } + + private RefCommonService refCommonService; + + private RefCommonService getRefCommonService() { + if (refCommonService == null) { + refCommonService = SpringBeanUtils.getBean(RefCommonService.class); + } + return refCommonService; + } + + PackageGenerateService packService; + + private PackageGenerateService getPackService() { + if (packService == null) { + packService = SpringBeanUtils.getBean(PackageGenerateService.class); + } + return packService; + } + + /** + * @param spacePath 元数据路径 + * @param metadataTypeList 元数据类型 + * @return java.util.List + * @author zhongchq + **/ + @GET + public List getMetadataList(@QueryParam(value = "path") String spacePath, + @QueryParam(value = "metadataTypeList") String metadataTypeList) { + List result = getMetadataService().getMetadataList(spacePath, handleMetadataTypeList(metadataTypeList)); + + String projPath = getMetadataProjectService().getProjPath(spacePath); + ProcessMode processMode = ProcessMode.GENERATION; + if (projPath != null && !projPath.isEmpty()) { + processMode = getMetadataProjectService().getProcessMode(projPath); + } + List metadataDtos = asMdDtos(result, processMode); + metadataDtos.forEach(dto -> dto.setRelativePath(ManagerUtils.getRalativePath(dto.getRelativePath()))); + return metadataDtos; + } + + /** + * 根据当前工程路径获取bo下的元数据列表(会根据processMode过滤) + * + * @param path + * @param metadataTypeList + * @return List + */ + @GET + @Path(value = "/metadataListInBo") + public List getMetadataListInBo(@QueryParam(value = "path") String path, + @QueryParam(value = "metadataTypeList") String metadataTypeList) { + List result = getMetadataService().getMetadataListInBo(path, handleMetadataTypeList(metadataTypeList)); + result.forEach(dto -> dto.setRelativePath(ManagerUtils.getRalativePath(dto.getRelativePath()))); + return result; + } + + /*** + * @author zhongchq + * @param metadataPath + * 元数据所在路径信息,当前工程下的某个路径,相对路径 + * @param metadataID + *元数据唯一标识 + * @return com.inspur.edp.lcm.metadata.api.entity.MetadataDto + **/ + @GET + @Path(value = "/relied") + public MetadataDto getRefMetadata(@QueryParam(value = "metadataPath") String metadataPath, + @QueryParam(value = "metadataID") String metadataID) { + Utils.setMetadataPath(metadataPath); + return MetadataDtoConverter.asDto(getRefCommonService().getRefMetadata(metadataID)); + } + + /** + * 获取各元数据配置的元数据类型信息及后缀信息 + * + * @return java.util.List + * @author zhongchq + **/ + @GET + @Path(value = "/typeList") + public List getMetadataTypeList() { + return getMetadataService().getMetadataTypeList(); + } + + /** + * @param projectPath 获取工程信息 + * @return com.inspur.edp.lcm.metadata.api.entity.MetadataProject + * @author zhongchq + **/ + @GET + @Path(value = "/projectInfo") + public MetadataProject getMetadataProjInfo(@QueryParam(value = "projectPath") String projectPath) { + if (projectPath == null || projectPath.isEmpty()) { + throw new IllegalArgumentException("projectPath参数不能为空"); + } + return getMetadataService().getMetadataProjInfo(projectPath); + } + + /** + * @param scopeType 查找范围0.默认 1.本地 2.已安装 3.已引用 4.仓库中 + * @param text 查询内容 + * @param path 相对于开发根路径的路径信息 + * @param metadataTypeList 可以传递想要获取的元数据类型,类型用逗号隔开,如metadataTypeList=.be,.cmp,.api 该参数可以不赋值,默认获取所有类型 + * @param conflictAvoid 冲突避免 + * @param selectedPackageSource 包源 + * @param page 是否分页 + * @param pageSize 每页大小 + * @param pageIndex 第几页 + * @return com.inspur.edp.lcm.metadata.api.entity.metadataindex.MetadataIndexDto + * @author zhongchq + **/ + @GET + @Path(value = "/mdlist") + public MetadataIndexDto getMetadataIndexList(@QueryParam(value = "scopeType") int scopeType, + @DefaultValue("") @QueryParam(value = "text") String text, + @QueryParam(value = "path") String path, + @QueryParam(value = "metadataTypeList") String metadataTypeList, + @DefaultValue("") @QueryParam(value = "selectedPackageSource") String selectedPackageSource, + @DefaultValue("true") @QueryParam(value = "page") boolean page, + @DefaultValue("10") @QueryParam(value = "pageSize") int pageSize, + @DefaultValue("0") @QueryParam(value = "pageIndex") int pageIndex, + @DefaultValue("false") @QueryParam(value = "conflictAvoid") boolean conflictAvoid) { + if (metadataTypeList != null) { + metadataTypeList = metadataTypeList.toLowerCase(); + } + MetadataIndexDto dto = new MetadataIndexDto(); + List list; + switch (scopeType) { + // 离线 + case 1: + list = getLocalMetadataList(text, path, metadataTypeList, page, pageSize, pageIndex); + break; + // 远程 + case 2: + list = getRemoteMetadataIndexList(text, path, selectedPackageSource, metadataTypeList, page, pageSize, pageIndex, false, conflictAvoid); + break; + // 引用 + case 3: + list = getRemoteMetadataIndexList(text, path, selectedPackageSource, metadataTypeList, page, pageSize, pageIndex, true, conflictAvoid); + break; + default: + throw new IllegalArgumentException("Param scope is invalid."); + } + if (list.size() > 0) { + dto.setMetadataIndexItems(list); + Page page1 = new Page(); + page1.setPageIndex(pageIndex); + page1.setPageSize(list.size()); + dto.setPage(page1); + } else { + Page page2 = new Page(); + page2.setPageIndex(pageIndex); + page2.setPageSize(0); + dto.setPage(page2); + } + return dto; + } + + /** + * @param scopeType 查找范围0.默认 1.本地 2.已安装 3.已引用 4.仓库中 + * @param currentPath 当前路径 + * @param metadataIndexDto MetadataIndexItemDto实体 + * @param isNeedMdDto 是否需要??? + * @return com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto + * @author zhongchq + **/ + @POST + @Path(value = "pickmd") + public Metadata4RefDto pickMetadataIndex(@QueryParam(value = "scopeType") int scopeType, + @QueryParam(value = "currentPath") String currentPath, + MetadataIndexItemDto metadataIndexDto, + @DefaultValue("true") @QueryParam(value = "isNeedMdDto") boolean isNeedMdDto) { + return getMetadataService().pickMetadataIndex(scopeType, currentPath, metadataIndexDto, isNeedMdDto); + } + + @GET + @Path(value = "/metadata") + public MetadataDto loadMetadataByMetadataId(String metadataId, String path) { + final GspMetadata metadata = getMetadataService().loadMetadataByMetadataId(metadataId, path); + Utils.checkNPE(metadata, "工程" + path + "中找不到元数据:" + metadataId); + return MetadataDtoConverter.asDto(metadata); + } + + @GET + @Path(value = "/indexServerStatus") + public String getIndexServerStatus(@QueryParam(value = "ip") String ip, @QueryParam(value = "port") String port) { + return getMetadataService().getIndexServerStatus(ip, port); + } + + @GET + @Path(value = "/extendrule") + public String getMdExtRule(@QueryParam(value = "metadataId") String metadataId, + @QueryParam(value = "path") String path) { + IMdExtRuleContent extendRule = getMetadataService().getMdExtRule(metadataId, path); + String result = null; + if (extendRule == null) { + return null; + } + List metadataList = getMetadataService().getMetadataList(path); + Optional optMetadata = metadataList.stream().filter(item -> item.getHeader().getId() == metadataId).findAny(); + if (!optMetadata.isPresent()) { + throw new RuntimeException("不存在ID为" + metadataId + ",路径为" + path + "的元数据"); + } + MdExtendRuleSerializer mdExtRulemanager = MdExtRuleSerializerHelper.getInstance().getManager(optMetadata.get().getHeader().getType()); + if (mdExtRulemanager != null) { + JsonNode extRuleNode = mdExtRulemanager.serialize(extendRule); + ObjectMapper objectMapper = Utils.getMapper(); + try { + result = objectMapper.writeValueAsString(extRuleNode); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + } + return result; + } + + @PUT + @Path(value = "/extendrule") + public void saveMdExtRule(@QueryParam(value = "metadataId") String metadataId, + @QueryParam(value = "path") String path, String extendRuleStr) { + List metadataList = getMetadataService().getMetadataList(path); + Optional optMetadata = metadataList.stream().filter(item -> item.getHeader().getId() == metadataId).findAny(); + if (!optMetadata.isPresent()) { + throw new RuntimeException("不存在ID为" + metadataId + ",路径为" + path + "的元数据"); + } + MdExtendRuleSerializer mdExtRulemanager = MdExtRuleSerializerHelper.getInstance().getManager(optMetadata.get().getHeader().getType()); + IMdExtRuleContent extendRule = null; + if (mdExtRulemanager != null) { + ObjectMapper objectMapper = Utils.getMapper(); + try { + JsonNode extRuleNode = objectMapper.readTree(extendRuleStr); + extendRule = mdExtRulemanager.deSerialize(extRuleNode); + } catch (IOException e) { + e.printStackTrace(); + } + } + getMetadataService().saveMdExtRule(metadataId, path, extendRule); + } + + @GET + @Path(value = "/processMode") + public String getProcessMode(@QueryParam(value = "path") String path) { + return getMetadataProjectService().getProcessMode(path).toString(); + } + + @GET + @Path(value = "/projinpath") + public List getProjPathsInPath(@QueryParam(value = "path") String path) { + return getMetadataProjectService().getProjPathsInPath(path); + } + + @GET + @Path(value = "/isMetadataRefed") + public boolean isMetadataRefed(@QueryParam(value = "path") String path) { + return getMetadataService().isMetadataRefed(path); + } + + @GET + @Path(value = "/mdpkgNameExist") + public String getMdpkgNameExistInBo(@QueryParam(value = "path") String path, + @QueryParam(value = "mdpkgName") String mdpkgName) { + return getMetadataProjectService().getMdpkgNameExistInBo(path, mdpkgName); + } + + @POST + @Path(value = "/changeProcessMode") + public void changeProcessMode(@QueryParam(value = "path") String path, + @QueryParam(value = "processMode") String processMode) { + getMetadataProjectService().changeProcessMode(path, ProcessMode.valueOf(processMode)); + } + + private List getRemoteMetadataIndexList(String text, String path, + String selectedPackageSource, + String metadataTypeList, boolean page, int pageSize, + int pageIndex, boolean isFilterByRefs, boolean conflictAvoidFlag) { + List typeList = handleMetadataTypeList(metadataTypeList); + return getMetadataService().getRemoteMetadataIndexList(text, path, selectedPackageSource, typeList, page, + pageSize, pageIndex, isFilterByRefs, conflictAvoidFlag); + } + + private List getLocalMetadataList(String text, String path, String metadataTypeList, + boolean page, int pageSize, int pageIndex) { + List typeList = handleMetadataTypeList(metadataTypeList); + return getMetadataService().getLocalMetadataList(text, path, typeList, page, pageSize, pageIndex); + } + + private List asMdDtos(List mds, ProcessMode processMode) { + if (mds == null) { + return null; + } + List list = new ArrayList<>(); + mds.forEach(md -> { + MetadataDto metadataDto = MetadataDtoConverter.asDto(md); + metadataDto.setProcessMode(processMode.toString()); + list.add(metadataDto); + }); + return list; + } + + private List handleMetadataTypeList(String metadataTypes) { + List typeList = null; + if (!(metadataTypes == null || metadataTypes.isEmpty())) { + String[] types = metadataTypes.split(","); + typeList = new ArrayList<>(Arrays.asList(types)); + } + return typeList; + } +} diff --git a/model/framework/devtime-webapi/src/main/java/webapi/MetadataConfigServiceWebApi.java b/model/framework/devtime-webapi/src/main/java/webapi/MetadataConfigServiceWebApi.java new file mode 100644 index 0000000..a8d1607 --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/MetadataConfigServiceWebApi.java @@ -0,0 +1,62 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 webapi; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; +import com.inspur.edp.lcm.metadata.api.service.MetadataService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.util.List; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +@Path("/") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class MetadataConfigServiceWebApi { + private MetadataService metadataService; + + private MetadataService getMetadataService() { + if (metadataService == null) { + metadataService = SpringBeanUtils.getBean(MetadataService.class); + } + return metadataService; + } + + /** + * 获取各元数据配置的元数据类型信息及后缀信息 + * + * @return + */ + @GET + public List getMetadataTypeList() { + return getMetadataService().getMetadataTypeList(); + } + + /** + * 更新元数据缓存路径 + * + * @param path 工程路径 + */ + @PUT + public void setMetadataUri(@QueryParam(value = "path") String path) { + getMetadataService().setMetadataUri(path); + } +} diff --git a/model/framework/devtime-webapi/src/main/java/webapi/MetadataPackageServiceWebApi.java b/model/framework/devtime-webapi/src/main/java/webapi/MetadataPackageServiceWebApi.java new file mode 100644 index 0000000..aa0c65e --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/MetadataPackageServiceWebApi.java @@ -0,0 +1,77 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 webapi; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageDto; +import com.inspur.edp.lcm.metadata.api.service.MetadataService; +import com.inspur.edp.lcm.metadata.api.service.PackageGenerateService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.File; +import java.util.List; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.QueryParam; + +public class MetadataPackageServiceWebApi { + PackageGenerateService metadataPackageService; + + private PackageGenerateService getMetadataPackageService() { + if (metadataPackageService == null) { + metadataPackageService = SpringBeanUtils.getBean(PackageGenerateService.class); + } + return metadataPackageService; + } + + private MetadataService metadataService; + + private MetadataService getMetadataService() { + if (metadataService == null) { + metadataService = SpringBeanUtils.getBean(MetadataService.class); + } + return metadataService; + } + + /** + * 生成元数据包 + * + * @param metadataPackageDto 实体中的ProjectPath必填,其他值不需要 + */ + @POST + public void generatePackage(MetadataPackageDto metadataPackageDto) { + getMetadataPackageService().generatePackage(metadataPackageDto.getProjectPath()); + } + + /** + * 获取元数据包的基本信息 + * + * @param packagePath 元数据包路径+元数据包名称,要带后缀.mdpkg,需要Encode,这里暂时定的是全路径,因为元数据包也是固定存放在开发服务器一个目录下,但是不是开发根路径 + * @return + */ + @GET + @Path("/packagePath") + public MetadataPackage getMetadataPackageInfo(@QueryParam(value = "packagePath") String packagePath) { + File file = new File(packagePath); + return getMetadataService().getMetadataPackageInfo(file.getName(), file.getParent()); + } + + @GET + @Path("local") + public List getLocalPackages(@QueryParam(value = "path") String path) { + return getMetadataPackageService().getLocalPackages(path); + } +} diff --git a/model/framework/devtime-webapi/src/main/java/webapi/MetadataProjectServiceWebApi.java b/model/framework/devtime-webapi/src/main/java/webapi/MetadataProjectServiceWebApi.java new file mode 100644 index 0000000..090e0ee --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/MetadataProjectServiceWebApi.java @@ -0,0 +1,192 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 webapi; + +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.MetadataProjectDto; +import com.inspur.edp.lcm.metadata.api.entity.bo.BOInfo; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; +import com.inspur.edp.lcm.metadata.api.service.MetadataService; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.util.List; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +@Path("/") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class MetadataProjectServiceWebApi { + private MetadataProjectService metadataProjectService; + + private MetadataProjectService getMetadataProjectService() { + if (metadataProjectService == null) { + metadataProjectService = SpringBeanUtils.getBean(MetadataProjectService.class); + } + return metadataProjectService; + } + + private MetadataService metadataService; + + private MetadataService getMetadataService() { + if (metadataService == null) { + metadataService = SpringBeanUtils.getBean(MetadataService.class); + } + return metadataService; + } + + /** + * 获取元数据工程信息 + * + * @param path 元数据工程所在的路径或者下级路径 + * @return + */ + @GET + public MetadataProject getMetadataProjInfo(@QueryParam(value = "path") String path) { + MetadataProject metadataProjInfo = getMetadataProjectService().getMetadataProjInfo(path); + metadataProjInfo.setProjectPath(ManagerUtils.getRalativePath(metadataProjInfo.getProjectPath())); + return metadataProjInfo; + } + + @GET + @Path("bo") + public List getBOInfo(@QueryParam("boids") String boids) { + String[] boidArray = boids.split(","); + return getMetadataProjectService().getBOInfo(boidArray); + } + + /** + * 根据工程或者下级路径,获取工程路径 + * + * @param path 工程或者下级路径 + * @return + */ + @GET + @Path("/path") + public String getProjPath(@QueryParam(value = "path") String path) { + String projPath = getMetadataProjectService().getProjPath(path); + String ralativePath = ManagerUtils.getRalativePath(projPath); + return ralativePath; + } + + /** + * 元数据工程更新引用信息 + * + * @param metadataProjectDto 需要传递ProjectPath、DepPackageName、DepPackageVersion、DepPackageLocation等信息 + */ + @PUT + public void updateReference(MetadataProjectDto metadataProjectDto) { + MetadataPackageHeader metadataPackageHeader = new MetadataPackageHeader(); + metadataPackageHeader.setName(metadataProjectDto.getDepPackageName()); + metadataPackageHeader.setVersion(new MetadataPackageVersion(metadataProjectDto.getDepPackageVersion())); + metadataPackageHeader.setLocation(metadataProjectDto.getDepPackageLocation()); + getMetadataProjectService().updateRefs(metadataProjectDto.getProjectPath(), metadataPackageHeader); + } + + /** + * 元数据工程文件是否存在,用在前端判断是否可以执行打包操作 + * + * @param path 路径信息,相对路径 + * @return + */ + @GET + @Path("/validationrecursively") + public boolean isExistProjFileRecursively(@QueryParam(value = "path") String path) { + return getMetadataProjectService().isExistProjFileRecursively(path); + } + + /** + * 获取bo路径 + * + * @param path 工程路径 + * @return + */ + @GET + @Path("/bopath") + public String getBoPath(@QueryParam(value = "path") String path) { + return getMetadataProjectService().getBoPath(path); + } + + /** + * 获取是否解析型 + * + * @param path 工程路径 + * @return + */ + @GET + @Path("/isInterpretation") + public boolean isInterpretation(@QueryParam(value = "path") String path) { + return getMetadataProjectService().isInterpretation(path); + } + + /** + * 当前目录是否存在,已废弃,使用getProjPath代替 + * + * @param path + * @return + */ + @Deprecated + @GET + @Path("/validation") + public boolean isExistProjectFile(@QueryParam(value = "path") String path) { + return getMetadataProjectService().isExistProjFile(path); + } + + /** + * 获取技术栈,已废弃,仅保留java技术栈 + * + * @param path 工程路径 + * @return + */ + @Deprecated + @GET + @Path("/codelanguage") + public String getCodeLanguage(@QueryParam(value = "path") String path) { + return "java"; + } + + /** + * 是否使用maven,都使用maven,所以废弃 + * + * @param path 工程路径 + * @return + */ + @Deprecated + @GET + @Path("/isMaven") + public boolean getMavenStatus(@QueryParam(value = "path") String path) { + return true; + } + + /** + * 更新元数据缓存路径 + * + * @param path 工程路径 + */ + @Deprecated + @PUT + @Path("/metadataPath") + public void setMetadataPath(@QueryParam(value = "path") String path) { + getMetadataService().setMetadataUri(path); + } +} diff --git a/model/framework/devtime-webapi/src/main/java/webapi/MetadataServiceWebApi.java b/model/framework/devtime-webapi/src/main/java/webapi/MetadataServiceWebApi.java new file mode 100644 index 0000000..2953724 --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/MetadataServiceWebApi.java @@ -0,0 +1,508 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 webapi; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.inspur.edp.lcm.metadata.api.IMdExtRuleContent; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataFilter; +import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataIndexItemDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; +import com.inspur.edp.lcm.metadata.api.entity.Page; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.entity.metadataindex.MetadataIndexDto; +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.PackageGenerateService; +import com.inspur.edp.lcm.metadata.common.MetadataDtoConverter; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.common.configuration.MdExtRuleSerializerHelper; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import com.inspur.edp.lcm.metadata.spi.MdExtendRuleSerializer; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +@Path("/") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class MetadataServiceWebApi { + private MetadataService metadataService; + + private MetadataService getMetadataService() { + if (metadataService == null) { + metadataService = SpringBeanUtils.getBean(MetadataService.class); + } + return metadataService; + } + + private MetadataProjectService metadataProjectService; + + private MetadataProjectService getMetadataProjectService() { + if (metadataProjectService == null) { + metadataProjectService = SpringBeanUtils.getBean(MetadataProjectService.class); + } + return metadataProjectService; + } + + PackageGenerateService packService; + + private PackageGenerateService getPackService() { + if (packService == null) { + packService = SpringBeanUtils.getBean(PackageGenerateService.class); + } + return packService; + } + +/******************************************************************************************/ + + /** + * 用于新建元数据之前初始化元数据实体 + * + * @param nameSpace 元数据命名空间 + * @param code 元数据编号 + * @param name 元数据名称 + * @param type 元数据类型 + * @param bizObjectID 业务对象主键 + * @param metadataPath 元数据创建路径,相对于开发根路径的路径信息 + * @param extendProperty 扩展属性,默认为空,可以不赋值 + * @return + */ + @GET + @Path("initialized") + public MetadataDto initializeMetadataEntity(@QueryParam(value = "nameSpace") String nameSpace, + @QueryParam(value = "code") String code, + @QueryParam(value = "name") String name, + @QueryParam(value = "type") String type, + @QueryParam(value = "bizObjectID") String bizObjectID, + @QueryParam(value = "metadataPath") String metadataPath, + @DefaultValue("") @QueryParam(value = "extendProperty") String extendProperty) { + GspMetadata metadata = new GspMetadata(); + metadata.setHeader(new MetadataHeader()); + metadata.getHeader().setName(name); + metadata.getHeader().setCode(code); + metadata.getHeader().setNameSpace(nameSpace); + metadata.getHeader().setType(type); + metadata.getHeader().setBizObjectId(bizObjectID); + metadata.setRelativePath(metadataPath); + metadata.setExtendProperty(extendProperty); + getMetadataService().initializeMetadataEntity(metadata); + return MetadataDtoConverter.asDto(metadata); + } + + /** + * 新建元数据,元数据设计器打开之前文件被创建 + * + * @param metadataDto 新建元数据需要的参数,新建元数据之前需要调用初始化元数据实体,因此该参数即为InitializeMetadataEntity返回的实体 + */ + @POST + public void createMetadata(MetadataDto metadataDto) { + String path = metadataDto.relativePath; + getMetadataService().createMetadata(path, MetadataDtoConverter.asMetadata(metadataDto)); + } + + @DELETE + @Path("/delete") + public void deleteUri(@QueryParam(value = "fullPath") String fullPath) { + fullPath = ManagerUtils.getAbsolutePath(fullPath); + File file = new File(fullPath); + if (file.isDirectory()) { + getMetadataService().deleteFolder(fullPath); + } else { + getMetadataService().deleteMetadata(file.getParent(), file.getName()); + } + } + + @PUT + public void saveMetadata(MetadataDto metadataDto) { + final GspMetadata metadata = MetadataDtoConverter.asMetadata(metadataDto); + String fullPath = metadataDto.getRelativePath() + File.separator + metadataDto.getFileName(); + getMetadataService().saveMetadata(metadata, fullPath); + } + + @GET + @Path("/load") + public MetadataDto loadMetadata(@QueryParam(value = "metadataFullPath") String metadataFullPath) { + File file = new File(metadataFullPath); + GspMetadata metadata = getMetadataService().loadMetadata(file.getName(), file.getParent()); + return MetadataDtoConverter.asDto(metadata); + } + + @GET + @Path("/metadataInBo") + public MetadataDto loadMetadata(@QueryParam(value = "metadataFullPath") String metadataFullPath, + @QueryParam(value = "currentProjPath") String currentProjPath) { + GspMetadata metadata = getMetadataService().loadMetadataInBo(metadataFullPath, currentProjPath); + return MetadataDtoConverter.asDto(metadata); + } + + /** + * @param spacePath 元数据路径 + * @param metadataTypeList 元数据类型 + * @return java.util.List + * @author zhongchq + **/ + @GET + public List getMetadataList(@QueryParam(value = "path") String spacePath, + @QueryParam(value = "metadataTypeList") String metadataTypeList) { + List result = getMetadataService().getMetadataList(spacePath, handleMetadataTypeList(metadataTypeList)); + + String projPath = getMetadataProjectService().getProjPath(spacePath); + ProcessMode processMode = ProcessMode.GENERATION; + if (projPath != null && !projPath.isEmpty()) { + processMode = getMetadataProjectService().getProcessMode(projPath); + } + List metadataDtos = asMdDtos(result, processMode); + metadataDtos.forEach(dto -> dto.setRelativePath(ManagerUtils.getRalativePath(dto.getRelativePath()))); + return metadataDtos; + } + + /** + * 根据当前工程路径获取bo下的元数据列表(会根据processMode过滤) + * + * @param path + * @param metadataTypeList + * @return List + */ + @GET + @Path(value = "/metadataListInBo") + public List getMetadataListInBo(@QueryParam(value = "path") String path, + @QueryParam(value = "metadataTypeList") String metadataTypeList) { + List result = getMetadataService().getMetadataListInBo(path, handleMetadataTypeList(metadataTypeList)); + result.forEach(dto -> dto.setRelativePath(ManagerUtils.getRalativePath(dto.getRelativePath()))); + return result; + } + + /** + * 根据过滤条件获取元数据列表,如构件可细分为多种子构件,可根据filter精确过滤具体类型的元数据 + * + * @param path 工程路径 + * @param typeCode 需要精确获取元数据类型的元数据编号 + * @param filter 过滤条件 + * @param postfix 要获取的元数据后缀,不传则默认获取工程下所有的元数据 + * @return + */ + @GET + @Path(value = "/filter") + public List getMetadataByFilter(@QueryParam(value = "path") String path, + @QueryParam(value = "typeCode") String typeCode, @QueryParam(value = "filter") String filter, + @QueryParam(value = "postfix") String postfix) { + MetadataFilter metadataFilter = new MetadataFilter(); + metadataFilter.setFilter(filter); + metadataFilter.setTypeCode(typeCode); + metadataFilter.setMetadataPostfix(postfix); + List metadataByFilter = getMetadataService().getMetadataByFilter(path, metadataFilter); + List dtoList = new ArrayList<>(); + if (metadataByFilter != null) { + metadataByFilter.forEach(metadata -> { + dtoList.add(MetadataDtoConverter.asDto(metadata)); + }); + } + return dtoList; + } + + /*** + * @author zhongchq + * @param metadataPath + * 元数据所在路径信息,当前工程下的某个路径,相对路径 + * @param metadataID + *元数据唯一标识 + * @return com.inspur.edp.lcm.metadata.api.entity.MetadataDto + **/ + @GET + @Path(value = "/relied") + public MetadataDto getRefMetadata(@QueryParam(value = "metadataPath") String metadataPath, + @QueryParam(value = "metadataID") String metadataID) { + return MetadataDtoConverter.asDto(getMetadataService().getRefMetadata(metadataPath, metadataID)); + } + + /** + * 判断元数据新建的路径下是否有相同名称的文件存在 + * + * @param path 元数据新建的路径 + * @param fileName 元数据文件名 + * @return + */ + @GET + @Path("/validation") + public boolean validateRepeatName(@QueryParam(value = "path") String path, + @QueryParam(value = "fileName") String fileName) { + boolean canCreateFlag = getMetadataService().validateRepeatName(path, fileName); + return canCreateFlag; + } + + /*** + * 获取各元数据配置的元数据类型信息及后缀信息 + * @author zhongchq + * @return java.util.List + **/ + @GET + @Path(value = "/typeList") + public List getMetadataTypeList() { + return getMetadataService().getMetadataTypeList(); + } + + @POST + @Path(value = "/packages") + public void GeneratePackage(@QueryParam(value = "projPath") String projPath) { + getPackService().generatePackage(projPath); + } + + /*** + * @author zhongchq + * @param projectPath + * 获取工程信息 + * @return com.inspur.edp.lcm.metadata.api.entity.MetadataProject + **/ + @GET + @Path(value = "/projectInfo") + public MetadataProject getMetadataProjInfo(@QueryParam(value = "projectPath") String projectPath) { + if (projectPath == null || projectPath.isEmpty()) { + throw new IllegalArgumentException("projectPath参数不能为空"); + } + return getMetadataService().getMetadataProjInfo(projectPath); + } + + /*** + * @author zhongchq + * @param scopeType 查找范围0.默认 1.本地 2.已安装 3.已引用 4.仓库中 + * @param text 查询内容 + * @param path 相对于开发根路径的路径信息 + * @param metadataTypeList 可以传递想要获取的元数据类型,类型用逗号隔开,如metadataTypeList=.be,.cmp,.api 该参数可以不赋值,默认获取所有类型 + * @param conflictAvoid 冲突避免 + * @param selectedPackageSource 包源 + * @param page 是否分页 + * @param pageSize 每页大小 + * @param pageIndex 第几页 + * @return com.inspur.edp.lcm.metadata.api.entity.metadataindex.MetadataIndexDto + **/ + @GET + @Path(value = "/mdlist") + public MetadataIndexDto getMetadataIndexList(@QueryParam(value = "scopeType") int scopeType, + @DefaultValue("") @QueryParam(value = "text") String text, + @QueryParam(value = "path") String path, + @QueryParam(value = "metadataTypeList") String metadataTypeList, + @DefaultValue("") @QueryParam(value = "selectedPackageSource") String selectedPackageSource, + @DefaultValue("true") @QueryParam(value = "page") boolean page, + @DefaultValue("10") @QueryParam(value = "pageSize") int pageSize, + @DefaultValue("0") @QueryParam(value = "pageIndex") int pageIndex, + @DefaultValue("false") @QueryParam(value = "conflictAvoid") boolean conflictAvoid) { + if (metadataTypeList != null) { + metadataTypeList = metadataTypeList.toLowerCase(); + } + MetadataIndexDto dto = new MetadataIndexDto(); + List list; + switch (scopeType) { + // 离线 + case 1: + list = getLocalMetadataList(text, path, metadataTypeList, page, pageSize, pageIndex); + break; + // 远程 + case 2: + list = getRemoteMetadataIndexList(text, path, selectedPackageSource, metadataTypeList, page, pageSize, pageIndex, false, conflictAvoid); + break; + // 引用 + case 3: + list = getRemoteMetadataIndexList(text, path, selectedPackageSource, metadataTypeList, page, pageSize, pageIndex, true, conflictAvoid); + break; + default: + throw new IllegalArgumentException("Param scope is invalid."); + } + if (list.size() > 0) { + dto.setMetadataIndexItems(list); + Page page1 = new Page(); + page1.setPageIndex(pageIndex); + page1.setPageSize(list.size()); + dto.setPage(page1); + } else { + Page page2 = new Page(); + page2.setPageIndex(pageIndex); + page2.setPageSize(0); + dto.setPage(page2); + } + return dto; + } + + /** + * @param scopeType 查找范围0.默认 1.本地 2.已安装 3.已引用 4.仓库中 + * @param currentPath 当前路径 + * @param metadataIndexDto MetadataIndexItemDto实体 + * @param isNeedMdDto 是否需要??? + * @return com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto + * @author zhongchq + **/ + @POST + @Path(value = "pickmd") + public Metadata4RefDto pickMetadataIndex(@QueryParam(value = "scopeType") int scopeType, + @QueryParam(value = "currentPath") String currentPath, + MetadataIndexItemDto metadataIndexDto, + @DefaultValue("true") @QueryParam(value = "isNeedMdDto") boolean isNeedMdDto) { + return getMetadataService().pickMetadataIndex(scopeType, currentPath, metadataIndexDto, isNeedMdDto); + } + + @GET + @Path(value = "/metadata") + public MetadataDto loadMetadataByMetadataId(@QueryParam(value = "metadataId") String metadataId, + @QueryParam(value = "path") String path) { + final GspMetadata metadata = getMetadataService().loadMetadataByMetadataId(metadataId, path); + Utils.checkNPE(metadata, "工程" + path + "中找不到元数据:" + metadataId); + return MetadataDtoConverter.asDto(metadata); + } + + @GET + @Path(value = "/indexServerStatus") + public String getIndexServerStatus(@QueryParam(value = "ip") String ip, @QueryParam(value = "port") String port) { + return getMetadataService().getIndexServerStatus(ip, port); + } + + @GET + @Path(value = "/extendrule") + public String getMdExtRule(@QueryParam(value = "metadataId") String metadataId, + @QueryParam(value = "path") String path) { + IMdExtRuleContent extendRule = getMetadataService().getMdExtRule(metadataId, path); + String result = null; + if (extendRule == null) { + return null; + } + List metadataList = getMetadataService().getMetadataList(path); + Optional optMetadata = metadataList.stream().filter(item -> item.getHeader().getId() == metadataId).findAny(); + if (!optMetadata.isPresent()) { + throw new RuntimeException("不存在ID为" + metadataId + ",路径为" + path + "的元数据"); + } + MdExtendRuleSerializer mdExtRulemanager = MdExtRuleSerializerHelper.getInstance().getManager(optMetadata.get().getHeader().getType()); + if (mdExtRulemanager != null) { + JsonNode extRuleNode = mdExtRulemanager.serialize(extendRule); + ObjectMapper objectMapper = Utils.getMapper(); + try { + result = objectMapper.writeValueAsString(extRuleNode); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + } + return result; + } + + @PUT + @Path(value = "/extendrule") + public void saveMdExtRule(@QueryParam(value = "metadataId") String metadataId, + @QueryParam(value = "path") String path, String extendRuleStr) { + List metadataList = getMetadataService().getMetadataList(path); + Optional optMetadata = metadataList.stream().filter(item -> item.getHeader().getId() == metadataId).findAny(); + if (!optMetadata.isPresent()) { + throw new RuntimeException("不存在ID为" + metadataId + ",路径为" + path + "的元数据"); + } + MdExtendRuleSerializer mdExtRulemanager = MdExtRuleSerializerHelper.getInstance().getManager(optMetadata.get().getHeader().getType()); + IMdExtRuleContent extendRule = null; + if (mdExtRulemanager != null) { + ObjectMapper objectMapper = Utils.getMapper(); + try { + JsonNode extRuleNode = objectMapper.readTree(extendRuleStr); + extendRule = mdExtRulemanager.deSerialize(extRuleNode); + } catch (IOException e) { + e.printStackTrace(); + } + } + getMetadataService().saveMdExtRule(metadataId, path, extendRule); + } + + @GET + @Path(value = "/processMode") + public String getProcessMode(@QueryParam(value = "path") String path) { + return getMetadataProjectService().getProcessMode(path).toString(); + } + + @GET + @Path(value = "/mavensetting") + public boolean getMavenSetting() { + return true; + } + + @GET + @Path(value = "/projinpath") + public List getProjPathsInPath(@QueryParam(value = "path") String path) { + return getMetadataProjectService().getProjPathsInPath(path); + } + + @GET + @Path(value = "/isMetadataRefed") + public boolean isMetadataRefed(@QueryParam(value = "path") String path) { + return getMetadataService().isMetadataRefed(path); + } + + @GET + @Path(value = "/mdpkgNameExist") + public String getMdpkgNameExistInBo(@QueryParam(value = "path") String path, + @QueryParam(value = "mdpkgName") String mdpkgName) { + return getMetadataProjectService().getMdpkgNameExistInBo(path, mdpkgName); + } + + private List getRemoteMetadataIndexList(String text, String path, + String selectedPackageSource, + String metadataTypeList, boolean page, int pageSize, + int pageIndex, boolean isFilterByRefs, boolean conflictAvoidFlag) { + List typeList = handleMetadataTypeList(metadataTypeList); + return getMetadataService().getRemoteMetadataIndexList(text, path, selectedPackageSource, typeList, page, + pageSize, pageIndex, isFilterByRefs, conflictAvoidFlag); + } + + private List getLocalMetadataList(String text, String path, String metadataTypeList, + boolean page, int pageSize, int pageIndex) { + List typeList = handleMetadataTypeList(metadataTypeList); + return getMetadataService().getLocalMetadataList(text, path, typeList, page, pageSize, pageIndex); + } + + private List asMdDtos(List mds, ProcessMode processMode) { + if (mds == null) { + return null; + } + List list = new ArrayList<>(); + mds.forEach(md -> { + MetadataDto metadataDto = MetadataDtoConverter.asDto(md); + metadataDto.setProcessMode(processMode.toString()); + list.add(metadataDto); + }); + return list; + } + + private List handleMetadataTypeList(String metadataTypes) { + List typeList = null; + if (!(metadataTypes == null || metadataTypes.isEmpty())) { + String[] types = metadataTypes.split(","); + typeList = new ArrayList<>(Arrays.asList(types)); + } + return typeList; + } +} diff --git a/model/framework/devtime-webapi/src/main/java/webapi/ProjectDeployServiceWebApi.java b/model/framework/devtime-webapi/src/main/java/webapi/ProjectDeployServiceWebApi.java new file mode 100644 index 0000000..38f3e27 --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/ProjectDeployServiceWebApi.java @@ -0,0 +1,54 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 webapi; + +import com.inspur.edp.lcm.metadata.api.entity.DbConnectionInfo; +import com.inspur.edp.lcm.metadata.api.service.ProjectExtendService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.IOException; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +@Path("/") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class ProjectDeployServiceWebApi { + private ProjectExtendService projectExtendService; + + private ProjectExtendService getProjectExtendService() { + if (projectExtendService == null) { + projectExtendService = SpringBeanUtils.getBean(ProjectExtendService.class); + } + return projectExtendService; + } + + @POST + public void deploy(DbConnectionInfo dbConnectionInfo, @QueryParam("path") String path, + @QueryParam("restart") String restart) { + getProjectExtendService().deploy(dbConnectionInfo, "", path, restart); + } + + @GET + public String getDeployStatus(@QueryParam("sign") String sign) throws IOException { + return getProjectExtendService().getDeployStatus(sign); + } + +} diff --git a/model/framework/devtime-webapi/src/main/java/webapi/ProjectExtendWebApi.java b/model/framework/devtime-webapi/src/main/java/webapi/ProjectExtendWebApi.java new file mode 100644 index 0000000..12a9959 --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/ProjectExtendWebApi.java @@ -0,0 +1,67 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 webapi; + +import com.inspur.edp.lcm.metadata.api.entity.ExtractContext; +import com.inspur.edp.lcm.metadata.api.service.ProjectExtendService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.util.List; +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +@Path("/") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class ProjectExtendWebApi { + private ProjectExtendService projectExtendService; + + private ProjectExtendService getProjectExtendService() { + if (projectExtendService == null) { + projectExtendService = SpringBeanUtils.getBean(ProjectExtendService.class); + } + return projectExtendService; + } + + /** + * 批量编译当前目录下的所有工程 + * + * @param path 路径 + * @param exts 扩展 + * @param disabledExts 禁用的扩展 + * @return + */ + @POST + public List BatchCompile(@QueryParam("path") String path, @QueryParam("exts") String exts, + @QueryParam("disabledExts") String disabledExts) { + return getProjectExtendService().batchCompile(path, exts, disabledExts); + } + + @PUT + public void batchExtract(@QueryParam("path") String path) { + getProjectExtendService().extract(path); + } + + @PUT + @Path("single") + public void extract(ExtractContext context) { + getProjectExtendService().extract(context.getProjectPath()); + } +} diff --git a/model/framework/devtime-webapi/src/main/java/webapi/RepoRefWebApi.java b/model/framework/devtime-webapi/src/main/java/webapi/RepoRefWebApi.java new file mode 100644 index 0000000..34bc0f8 --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/RepoRefWebApi.java @@ -0,0 +1,246 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 webapi; + +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenComponents; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataRepo; +import com.inspur.edp.lcm.metadata.api.mvnEntity.ModuleDependencies; +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.MetadataProjectService; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import javax.ws.rs.Consumes; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import org.apache.maven.model.Dependency; +import org.apache.maven.model.Model; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +/** + * Description Maven引用设计时接口实现 + * + * @version 1.0 + */ +@Path("/") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class RepoRefWebApi { + + private MdpkgService mdpkgService; + + private MdpkgService getMdpkgService() { + if (mdpkgService == null) { + mdpkgService = SpringBeanUtils.getBean(MdpkgService.class); + } + return mdpkgService; + } + + private FileService fileService; + + private FileService getFileService() { + if (fileService == null) { + fileService = SpringBeanUtils.getBean(FileService.class); + } + return fileService; + } + + private MetadataProjectService metadataProjectService; + + private MetadataProjectService getMetadataProjectService() { + if (metadataProjectService == null) { + metadataProjectService = SpringBeanUtils.getBean(MetadataProjectService.class); + } + return metadataProjectService; + } + + /** + * 部署jar到nexus私服中。 step1:将元数据包打包中jar中。 step2:推送 + * + * @param proPath 元数据工程路径 + * @param proPath 推送的仓库地址 + * @param version 工程的版本号 + * @param revert 版本号是否回退 + * @return void + **/ + @POST + public void deployMdpkg(@QueryParam(value = "proPath") String proPath, + @QueryParam(value = "repoId") String repoId, + @QueryParam(value = "version") String version, + @DefaultValue("false") @QueryParam(value = "revert") boolean revert) throws IOException { + getMdpkgService().deploySnapshotMdVersion(proPath, repoId, version, revert); + } + + /** + * @param path gsp工程路径 + * @param version 工程版本号 + * @param repoId 仓库唯一id + * @param revert 默认为true,即推送完release版,版本号revert回原版本 + */ + @POST + @Path(value = "/release") + public void deployReleaseMdVersion(@QueryParam(value = "path") String path, + @QueryParam(value = "version") String version, + @QueryParam(value = "repoId") String repoId, + @DefaultValue("false") @QueryParam(value = "revert") boolean revert, + @QueryParam(value = "depversion") String dependenciesVersion) throws IOException { + getMdpkgService().deployReleaseMdVersion(path, version, repoId, revert, dependenciesVersion); + } + + /*** + * 获取仓库列表 + * + * @return com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataRepo + **/ + @GET + @Path(value = "/repolist") + public MetadataRepo getRepoList() { + return getMdpkgService().getRepoList(); + } + + /** + * 实现maven install + * + * @param path gsp工程路径 + **/ + @POST + @Path(value = "/compile") + public void compile(@QueryParam(value = "path") String path, @QueryParam(value = "modules") String modules) { + String projPath = getMetadataProjectService().getProjPath(path); + getMdpkgService().compile(projPath, modules); + } + + /** + * @param path + * @param operations + */ + @POST + @Path(value = "/batchOperate") + public void batchOperate(@QueryParam(value = "path") String path, + @QueryParam(value = "operations") String operations) { + List operationList = Arrays.asList(operations.split(",")); + getMdpkgService().batchOperate(path, operationList); + } + + /** + * 实现maven install + * + * @param path gsp工程路径 + */ + @POST + @Path(value = "/compileAll") + public void compileAll(@QueryParam(value = "path") String path) { + String projPath = getMetadataProjectService().getProjPath(path); + getMdpkgService().compileAll(projPath); + } + + /** + * @param path 工程路径 + */ + @POST + @Path(value = "/restore") + public void restore(@QueryParam(value = "path") String path, @QueryParam(value = "force") Boolean force) { + getMdpkgService().restore(path, force); + } + + /** + * 给工程添加依赖并拉取 + * + * @param path 工程路径 + * @param metadataPackages 新添加的依赖的额元数据包 + */ + @PUT + @Path(value = "/adddepedency") + public void addDepedencyAndRestore(@QueryParam(value = "path") String path, + @QueryParam(value = "metadataPackages") String metadataPackages) { + String[] packages = metadataPackages.split(","); + List packageList = new ArrayList<>(Arrays.asList(packages)); + getMdpkgService().addDepedencyAndRestore(path, packageList); + } + + @GET + @Path(value = "/projversion") + public ModuleDependencies getDependenciesVersion(@QueryParam(value = "path") String path) throws IOException { + String absolutePath = ManagerUtils.getAbsolutePath(path); + + if (getFileService().getApiModulePath(absolutePath) == null) { + throw new RuntimeException("代码未生成,请生成java代码"); + } + String apiPath = getFileService().getApiModulePath(absolutePath) + "/pom.xml"; + List list; + try (FileInputStream fis = new FileInputStream(apiPath)) { + MavenXpp3Reader reader = new MavenXpp3Reader(); + Model model = reader.read(fis); + list = model.getDependencies(); + ModuleDependencies dependencies = new ModuleDependencies(); + if (model.getVersion() != null) { + dependencies.setProjVersion(model.getVersion()); + } else { + dependencies.setProjVersion(model.getParent().getVersion()); + } + for (Dependency dependency : list) { + if (dependency.getVersion().endsWith("SNAPSHOT")) { + dependencies.setNeedChange(true); + } + } + return dependencies; + } catch (IOException | XmlPullParserException e) { + e.printStackTrace(); + } + return new ModuleDependencies(); + } + + @GET + @Path(value = "/buildorder") + public List getBuildOrder(@QueryParam(value = "projPath") String projPath) { + return getMetadataProjectService().getBuildOrder(projPath); + } + + @GET + @Path(value = "/single") + public MavenComponents getVersionsOfSinglePackage(@QueryParam(value = "sourceId") String sourceId, + @QueryParam(value = "packName") String packName) { + return getMdpkgService().getVersionsOfSinglePackage(sourceId, packName); + } + + @PUT + @Path(value = "/install") + public void installMdpkg(@QueryParam(value = "groupId") String groupId, + @QueryParam(value = "artifactId") String artifactId, @QueryParam(value = "version") String version, + @QueryParam(value = "path") String path) throws IOException { + Boolean forceUpdateFlag = version.contains("-") ? true : false; + getMdpkgService().installMdpkg(groupId, artifactId, version, path, forceUpdateFlag); + } + + @POST + @Path(value = "/uninstall") + public void uninstallMdpkg(@QueryParam(value = "projPath") String projPath, + @QueryParam(value = "packName") String packName) { + getMdpkgService().uninstallMdpkg(projPath, packName); + } +} diff --git a/model/framework/devtime-webapi/src/main/java/webapi/config/WebApiConfiguration.java b/model/framework/devtime-webapi/src/main/java/webapi/config/WebApiConfiguration.java new file mode 100644 index 0000000..6faf4ca --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/config/WebApiConfiguration.java @@ -0,0 +1,115 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 webapi.config; + +import io.iec.edp.caf.rest.RESTEndpoint; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import webapi.FileSystemWebApi; +import webapi.GspProjectServiceWebApi; +import webapi.MdServiceWebApi; +import webapi.MetadataConfigServiceWebApi; +import webapi.MetadataPackageServiceWebApi; +import webapi.MetadataProjectServiceWebApi; +import webapi.MetadataServiceWebApi; +import webapi.ProjectDeployServiceWebApi; +import webapi.ProjectExtendWebApi; +import webapi.RepoRefWebApi; + +//todo +//@Configuration(proxyBeanMethods = false) +@Configuration() +public class WebApiConfiguration { + @Bean + public RESTEndpoint gspFSEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/file-system", + new FileSystemWebApi() + ); + } + + @Bean + public RESTEndpoint gspProjectEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/gsp-projects", + new GspProjectServiceWebApi() + ); + } + + @Bean + public RESTEndpoint gspMdEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/mdservice", + new MdServiceWebApi() + ); + } + + @Bean + public RESTEndpoint gspConfigEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/metadata-configs", + new MetadataConfigServiceWebApi() + ); + } + + @Bean + public RESTEndpoint gspMdPkgEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/metadata-packages", + new MetadataPackageServiceWebApi() + ); + } + + @Bean + public RESTEndpoint gspMdProjectEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/metadata-projects", + new MetadataProjectServiceWebApi() + ); + } + + @Bean + public RESTEndpoint gspMetadataEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/metadatas", + new MetadataServiceWebApi() + ); + } + + @Bean + public RESTEndpoint gspDeployEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/deploy-projects", + new ProjectDeployServiceWebApi() + ); + } + + @Bean + public RESTEndpoint gspExtendEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/extend-projects", + new ProjectExtendWebApi() + ); + } + + @Bean + public RESTEndpoint gspRepoEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/repo-packages", + new RepoRefWebApi() + ); + } +} diff --git a/model/framework/entity/pom.xml b/model/framework/entity/pom.xml new file mode 100644 index 0000000..333aea2 --- /dev/null +++ b/model/framework/entity/pom.xml @@ -0,0 +1,27 @@ + + + + ubml-model-framework + org.openatom.ubml + 0.9.0-SNAPSHOT + + 4.0.0 + ubml-model-framework-entity ${project.version} + ubml-model-framework-entity + + + 8 + 8 + + + + + org.openatom.ubml + ubml-model-common-definition + ${project.version} + + + + \ No newline at end of file diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/BaseConfig.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/BaseConfig.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/BaseConfig.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/BaseConfig.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCommonConfigData.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCommonConfigData.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCommonConfigData.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCommonConfigData.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectConfiguration.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectConfiguration.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectConfiguration.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectConfiguration.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCreateConfigData.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCreateConfigData.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCreateConfigData.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCreateConfigData.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/GspProject.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/GspProject.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/GspProject.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/GspProject.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4Ref.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4Ref.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4Ref.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4Ref.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4RefDto.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4RefDto.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4RefDto.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4RefDto.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataDto.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataDto.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataDto.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataDto.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataFilter.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataFilter.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataFilter.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataFilter.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataIndexItemDto.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataIndexItemDto.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataIndexItemDto.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataIndexItemDto.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackage.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackage.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackage.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackage.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageHeader.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageHeader.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageHeader.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageHeader.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageReference.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageReference.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageReference.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageReference.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageVersion.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageVersion.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageVersion.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageVersion.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProject.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProject.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProject.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProject.java index 5a2c846..d198d08 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProject.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProject.java @@ -16,8 +16,8 @@ package com.inspur.edp.lcm.metadata.api.entity; import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import java.util.List; /** * 元数据工程实体,对应.mdproj文件 diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataType.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataType.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataType.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataType.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProcessMode.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProcessMode.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProcessMode.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProcessMode.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProjectHeader.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProjectHeader.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProjectHeader.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProjectHeader.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ServiceUnitInfo.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ServiceUnitInfo.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ServiceUnitInfo.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ServiceUnitInfo.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/MetadataIndexRepoItemDto.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/MetadataIndexRepoItemDto.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/MetadataIndexRepoItemDto.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/MetadataIndexRepoItemDto.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponent.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponent.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponent.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponent.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponents.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponents.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponents.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponents.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenPackageRefs.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenPackageRefs.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenPackageRefs.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenPackageRefs.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataRepo.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataRepo.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataRepo.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataRepo.java diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PackageSourceDto.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PackageSourceDto.java similarity index 100% rename from model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PackageSourceDto.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PackageSourceDto.java diff --git a/model/framework/generator-api/pom.xml b/model/framework/generator-api/pom.xml index a5480a9..6526661 100644 --- a/model/framework/generator-api/pom.xml +++ b/model/framework/generator-api/pom.xml @@ -19,6 +19,16 @@ 0.9.0-SNAPSHOT compile + + org.openatom.ubml + ubml-model-framework-devtime-core + 0.9.0-SNAPSHOT + compile + + + org.springframework.boot + spring-boot-starter-test + diff --git a/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/JitContext.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/JitContext.java index 3687bd3..345f062 100644 --- a/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/JitContext.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/JitContext.java @@ -15,16 +15,16 @@ */ package com.inspur.edp.jittojava.context; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import com.inspur.edp.jittojava.context.temp.ModuleGenerateInfo; +import com.inspur.edp.jittojava.context.temp.ModuleGenerator; import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; -import com.inspur.edp.lcm.metadata.api.service.RefCommonService; import com.inspur.edp.lcm.metadata.api.entity.GspProject; import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; -import com.inspur.edp.jittojava.context.temp.ModuleGenerateInfo; -import com.inspur.edp.jittojava.context.temp.ModuleGenerator; -import com.inspur.edp.jittojava.context.temp.RefCommonServiceImp; +import com.inspur.edp.lcm.metadata.api.service.RefCommonService; +import com.inspur.edp.lcm.metadata.core.RefCommonServiceImp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; public class JitContext { RefCommonService refCommonService; diff --git a/model/framework/pom.xml b/model/framework/pom.xml index 584b636..cce6c08 100644 --- a/model/framework/pom.xml +++ b/model/framework/pom.xml @@ -14,8 +14,10 @@ ubml-model-framework pom + entity devtime-api devtime-core + devtime-webapi runtime-spi runtime-api runtime-core @@ -27,15 +29,119 @@ 2.2.0.RELEASE + 1.2.62 + + 0.3.7-SNAPSHOT + 0.3.2 + 0.3.3 + 0.1.4 + 0.1.2 + 0.3.2 + 0.3.8 + 0.3.2 + + 0.1.4 + 0.1.25 + 0.1.0 + 3.6.1 + 0.1.4 + 0.1.3 + 0.1.0 - - - org.springframework.boot - spring-boot-starter-test - ${spring-boot.version} - test - - + + + + org.springframework.boot + spring-boot-starter-test + ${spring-boot.version} + + + com.alibaba + fastjson + ${fastjson.version} + + + + io.iec.edp + caf-boot-commons-environment + ${caf-boot-commons-environment.version} + + + io.iec.edp + caf-boot-commons-layeringcache + ${caf-boot-commons-layeringcache.version} + + + io.iec.edp + caf-boot-starter-context + ${caf-boot-starter-context.version} + compile + + + io.iec.edp + caf-business-object-api + ${caf-business-object-api.version} + + + com.inspur.edp + i18n-resource-api + ${i18n-resource-api.version} + + + io.iec.edp + caf-boot-starter-rest-server + ${caf-boot-starter-rest-server.version} + + + io.iec.edp + caf-sumgr-core + ${caf-sumgr-core.version} + + + io.iec.edp + caf-rpc-api + ${caf-rpc-api.version} + + + + com.inspur.edp + lcm-logging-service + ${lcm-logging-service.version} + + + com.inspur.edp + lcm-metadata-spi + ${lcm-metadata-spi.version} + compile + + + com.inspur.edp + lcm-project-deployer-spi + ${lcm-project-deployer-spi.version} + compile + + + org.apache.maven + maven-settings + ${maven-settings.version} + + + com.inspur.edp + ide-setting-core + ${ide-setting-core.version} + + + com.inspur.edp + metadata-to-java-context + ${metadata-to-java-context.version} + + + com.inspur.edp + workspace-api + ${workspace-api.version} + + + \ No newline at end of file diff --git a/model/framework/runtime-api/pom.xml b/model/framework/runtime-api/pom.xml index b66e305..bda1332 100644 --- a/model/framework/runtime-api/pom.xml +++ b/model/framework/runtime-api/pom.xml @@ -11,6 +11,17 @@ ubml-model-framework-runtime-api ${project.version} + + + io.iec.edp + caf-rpc-api + + + org.openatom.ubml + ubml-model-framework-common + ${project.version} + + ubml-model-framework-runtime-api diff --git a/model/framework/runtime-api/src/main/java/com/inspur/edp/lcm/metadata/serverapi/MetadataRTServerService.java b/model/framework/runtime-api/src/main/java/com/inspur/edp/lcm/metadata/serverapi/MetadataRTServerService.java new file mode 100644 index 0000000..e3d6358 --- /dev/null +++ b/model/framework/runtime-api/src/main/java/com/inspur/edp/lcm/metadata/serverapi/MetadataRTServerService.java @@ -0,0 +1,161 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.serverapi; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4Ref; +import com.inspur.edp.lcm.metadata.api.entity.MetadataCustomizationFilter; +import com.inspur.edp.lcm.metadata.api.entity.MetadataDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataRTFilter; +import com.inspur.edp.lcm.metadata.api.entity.ServiceUnitInfo; +import io.iec.edp.caf.rpc.api.annotation.GspServiceBundle; +import io.iec.edp.caf.rpc.api.annotation.RpcParam; +import java.util.List; +import java.util.Map; + +@GspServiceBundle(applicationName = "runtime", serviceUnitName = "Lcm", serviceName = "metadata-rt") +public interface MetadataRTServerService { + + /** + * 根据元数据id获取运行时元数据 + * + * @param id 元数据id + * @return 元数据内容实体 + */ + MetadataDto getMetadataDtoRTByID(@RpcParam(paramName = "id") String id); + + /** + * 根据元数据ID获取元数据 + * + * @param id 元数据id + * @return 元数据内容实体 + */ + MetadataDto getMetadataDto(@RpcParam(paramName = "id") String id); + + /** + * 根据元数据id获取元数据 + * + * @param id 元数据ID + * @return 元数据内容实体 + */ + GspMetadata getMetadata(String id); + + /** + * @Author Robin + * @Description 加载服务端所有的元数据 + * @Date 10:02 2019/8/20 + * @Param [] + **/ + void loadAllMetadata(); + + /** + * 根据元数据类型获取元数据 + * + * @param metadataTypes 元数据类型类别,以逗号拼接 + * @return 序列化的元数据信息列表 + */ + String getMetadataRefDtoListWithTypes(String metadataTypes); + + /** + * @return 元数据信息列表 + */ + String getMetadataRefDtoList(); + + /** + * 获取所有元数据信息列表 + * + * @return 元数据信息列表 + */ + List getMetadataRefList(); + + /** + * 根据类型获取元数据信息列表 + * + * @param metadataTypes + * @return + */ + List getMetadataRefListWithTypes(@RpcParam(paramName = "metadataTypes") String metadataTypes); + + /** + * 根据过滤条件获取元数据信息列表 + * + * @param filter 过滤条件 + * @return 元数据信息列表 + */ + String getMetadataDtoListByFilter(@RpcParam(paramName = "filter") String filter); + + /** + * 根据逻辑ID获取元数据 + * + * @param metadataNamespace 命名空间 + * @param metadataCode 元数据编号 + * @param metadataTypeCode 元数据类型 + * @return 元数据实体 + */ + MetadataDto getMetadataDtoBySemanticID(@RpcParam(paramName = "metadataNamespace") String metadataNamespace, + @RpcParam(paramName = "metadataCode") String metadataCode, + @RpcParam(paramName = "metadataTypeCode") String metadataTypeCode); + + /** + * 根据过滤条件虎丘元数据信息列表 + * + * @param filter 过滤条件 + * @return 元数据信息列表 + */ + List getMetadataListByFilter(MetadataRTFilter filter); + + /** + * 根据元数据ID获取SU信息 + * + * @param metadataId 元数据ID + * @return 元数据所属SU信息 + */ + ServiceUnitInfo getServiceUnitInfo(@RpcParam(paramName = "metadataId") String metadataId); + + /** + * 获取元数据 + * + * @param metadataCustomizationFilter 运行时定制元数据过滤器 + * @return 元数据内容实体 + */ + String getMetadataString( + @RpcParam(paramName = "metadataCustomizationFilter") MetadataCustomizationFilter metadataCustomizationFilter); + + /** + * 根据路径递归获取路径下元数据包中元数据列表 + * + * @param path 路径 + * @return 元数据列表 + */ + List getMetadataListRecursivly(String path); + + /** + * 获取路径下元数据包列表 + * + * @param path 路径 + * @return 元数据包列表 + */ + Map getMetadataPackagesRecursivly(String path); + + /** + * 根据元数据包路径及元数据包信息获取元数据列表 + * + * @param packagePath 元数据包路径 + * @return 元数据列表 + */ + List getMetadataListFromPackage(String packagePath); +} diff --git a/model/framework/runtime-core/pom.xml b/model/framework/runtime-core/pom.xml index ce61f0d..961705a 100644 --- a/model/framework/runtime-core/pom.xml +++ b/model/framework/runtime-core/pom.xml @@ -12,7 +12,36 @@ ubml-model-framework-runtime-core ubml-model-framework-runtime-core ${project.version} + + + com.inspur.edp + i18n-resource-api + + + lcm-metadata-api + com.inspur.edp + + + + + org.openatom.ubml + ubml-model-framework-common + ${project.version} + + + org.openatom.ubml + ubml-model-framework-runtime-spi + 0.9.0-SNAPSHOT + compile + + + org.openatom.ubml + ubml-model-framework-runtime-api + 0.9.0-SNAPSHOT + compile + + \ No newline at end of file diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRTServiceImp.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRTServiceImp.java new file mode 100644 index 0000000..f74189d --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRTServiceImp.java @@ -0,0 +1,164 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.rtservice; + +import com.inspur.edp.i18n.resource.api.II18nResourceRTManager; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.I18nResource; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4Ref; +import com.inspur.edp.lcm.metadata.api.entity.MetadataCustomizationFilter; +import com.inspur.edp.lcm.metadata.api.entity.MetadataDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataRTFilter; +import com.inspur.edp.lcm.metadata.api.entity.ServiceUnitInfo; +import com.inspur.edp.lcm.metadata.api.service.MetadataRTService; +import com.inspur.edp.lcm.metadata.cache.MetadataDistCacheManager; +import com.inspur.edp.lcm.metadata.cache.RtCacheHandler; +import com.inspur.edp.lcm.metadata.common.MetadataDtoConverter; +import com.inspur.edp.lcm.metadata.common.MetadataSerializer; +import com.inspur.edp.lcm.metadata.common.configuration.I18nManagerHelper; +import com.inspur.edp.lcm.metadata.common.context.RuntimeContext; +import com.inspur.edp.lcm.metadata.spi.MetadataI18nService; +import io.iec.edp.caf.commons.layeringcache.cache.Cache; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import io.iec.edp.caf.rpc.api.service.RpcClient; +import java.util.LinkedHashMap; +import java.util.List; +import lombok.extern.slf4j.Slf4j; +import lombok.var; + +@Slf4j +public class MetadataRTServiceImp implements MetadataRTService { + MetadataRtUtils utils = new MetadataRtUtils(); + + private Cache cacheManager; + + @Override + public GspMetadata getMetadataRTByID(String id) { + RpcClient client = SpringBeanUtils.getBean(RpcClient.class); + LinkedHashMap params = new LinkedHashMap<>(); + params.put("id", id); + MetadataDto response = client.invoke(MetadataDto.class, "com.inspur.edp.lcm.metadata.serverapi.MetadataRTServerService.getMetadataDtoRTByID", "Lcm", params, null); + return MetadataDtoConverter.asMetadata(response); + } + + @Override + public GspMetadata getMetadata(String id) { + String language = RuntimeContext.getLanguage(); + String metadataKey = RtCacheHandler.getMetadataCacheKey(id, language); + Cache cacheManager = MetadataDistCacheManager.getMetadataCache(); + GspMetadata metadata = cacheManager.get(metadataKey, GspMetadata.class); + if (metadata != null) { + return metadata; + } + RpcClient client = SpringBeanUtils.getBean(RpcClient.class); + LinkedHashMap params = new LinkedHashMap<>(); + params.put("id", id); + MetadataDto response = client.invoke(MetadataDto.class, "com.inspur.edp.lcm.metadata.serverapi.MetadataRTServerService.getMetadataDto", "Lcm", params, null); + metadata = MetadataDtoConverter.asMetadata(response); + if (metadata != null) { + cacheManager.put(metadataKey, metadata); + } + return metadata; + } + + @Override + public GspMetadata getMetadata(MetadataCustomizationFilter metadataCustomizationFilter) { + String language = metadataCustomizationFilter.isI18n() ? RuntimeContext.getLanguage() : ""; + String metadataKey = RtCacheHandler.getMetadataCacheKey(metadataCustomizationFilter.getMetadataId(), language); + cacheManager = MetadataDistCacheManager.getMetadataCache(); + GspMetadata metadata = cacheManager.get(metadataKey, GspMetadata.class); + if (metadata != null) { + return metadata; + } + + RpcClient client = SpringBeanUtils.getBean(RpcClient.class); + LinkedHashMap params = new LinkedHashMap<>(); + params.put("metadataCustomizationFilter", metadataCustomizationFilter); + String response = client.invoke(String.class, "com.inspur.edp.lcm.metadata.serverapi.MetadataRTServerService.getMetadataString", "Lcm", params, null); + metadata = new MetadataSerializer().deserialize(response, GspMetadata.class); + + if (metadataCustomizationFilter.isI18n()) { + try { + List resources = SpringBeanUtils.getBean(II18nResourceRTManager.class).getI18nResource(metadata, language); + MetadataI18nService service = I18nManagerHelper.getInstance().getI18nManager(metadata.getHeader().getType()); + if (service != null && resources != null && resources.size() > 0) { + var result = service.merge(metadata, resources); + RtCacheHandler.updateMetadataCache(metadataKey, result); + return result; + } + } catch (Exception e) { + //TODO 表单强制获取资源项,获取不到时会报错,异常太多,暂时catch住 + } + } + + if (metadata != null) { + cacheManager.put(metadataKey, metadata); + } + return metadata; + } + + @Override + public void loadAllMetadata() { + RpcClient client = SpringBeanUtils.getBean(RpcClient.class); + LinkedHashMap params = new LinkedHashMap<>(); + client.invoke(String.class, "com.inspur.edp.lcm.metadata.serverapi.MetadataRTServerService.loadAllMetadata", "Lcm", params, null); + } + + @Override + public List getMetadataRefList(String metadataTypes) { + RpcClient client = SpringBeanUtils.getBean(RpcClient.class); + LinkedHashMap params = new LinkedHashMap<>(); + params.put("metadataTypes", metadataTypes); + String response = client.invoke(String.class, "com.inspur.edp.lcm.metadata.serverapi.MetadataRTServerService.getMetadataRefDtoListWithTypes", "Lcm", params, null); + return utils.buildMetadata4RefList(response); + } + + @Override + public List getMetadataRefList() { + RpcClient client = SpringBeanUtils.getBean(RpcClient.class); + LinkedHashMap params = new LinkedHashMap<>(); + String response = client.invoke(String.class, "com.inspur.edp.lcm.metadata.serverapi.MetadataRTServerService.getMetadataRefDtoList", "Lcm", params, null); + return utils.buildMetadata4RefList(response); + } + + @Override + public List getMetadataListByFilter(MetadataRTFilter filter) { + RpcClient client = SpringBeanUtils.getBean(RpcClient.class); + LinkedHashMap params = new LinkedHashMap<>(); + params.put("filter", utils.serializerMetadataRtFilter(filter)); + String response = client.invoke(String.class, "com.inspur.edp.lcm.metadata.serverapi.MetadataRTServerService.getMetadataDtoListByFilter", "Lcm", params, null); + return utils.buildMetadata4RefList(response); + } + + @Override + public GspMetadata getMetadataBySemanticID(String metadataNamespace, String metadataCode, String metadataTypeCode) { + RpcClient client = SpringBeanUtils.getBean(RpcClient.class); + LinkedHashMap params = new LinkedHashMap<>(); + params.put("metadataNamespace", metadataNamespace); + params.put("metadataCode", metadataCode); + params.put("metadataTypeCode", metadataTypeCode); + MetadataDto response = client.invoke(MetadataDto.class, "com.inspur.edp.lcm.metadata.serverapi.MetadataRTServerService.getMetadataDtoBySemanticID", "Lcm", params, null); + return MetadataDtoConverter.asMetadata(response); + } + + @Override + public ServiceUnitInfo getServiceUnitInfo(String metadataId) { + RpcClient client = SpringBeanUtils.getBean(RpcClient.class); + LinkedHashMap params = new LinkedHashMap<>(); + params.put("metadataId", metadataId); + return client.invoke(ServiceUnitInfo.class, "com.inspur.edp.lcm.metadata.serverapi.MetadataRTServerService.getServiceUnitInfo", "Lcm", params, null); + } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRtUtils.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRtUtils.java new file mode 100644 index 0000000..21f6af7 --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRtUtils.java @@ -0,0 +1,83 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.rtservice; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4Ref; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataRTFilter; +import com.inspur.edp.lcm.metadata.common.MetadataDtoConverter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.springframework.util.StringUtils; + +/** + * @author zhaoleitr + */ +public class MetadataRtUtils { + public List buildMetadata4RefList(String dtosStr) { + if (StringUtils.isEmpty(dtosStr)) { + return null; + } + List dtoList = deserializerMetadata4RefDto(dtosStr); + if (dtoList == null || dtoList.size() <= 0) { + return null; + } + List metadataList = new ArrayList<>(); + for (Metadata4RefDto dto : dtoList) { + Metadata4Ref metadata4Ref = new Metadata4Ref(); + metadata4Ref.setPackageHeader(dto.getPackageHeader()); + metadata4Ref.setMetadata(MetadataDtoConverter.asMetadata(dto.getMetadata())); + metadata4Ref.setServiceUnitInfo(dto.getServiceUnitInfo()); + metadataList.add(metadata4Ref); + } + return metadataList; + } + + private List deserializerMetadata4RefDto(String content) { + List result = new ArrayList<>(); + ObjectMapper mapper = new ObjectMapper(); + mapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE); + mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + try { + result = mapper.readValue(content, new TypeReference>() { + }); + } catch (IOException e) { + e.printStackTrace(); + } + return result; + } + + public String serializerMetadataRtFilter(MetadataRTFilter filter) { + String result = ""; + ObjectMapper mapper = new ObjectMapper(); + mapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE); + try { + result = mapper.writeValueAsString(filter); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + return result; + } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/MetadataRTServerServiceImpl.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/MetadataRTServerServiceImpl.java new file mode 100644 index 0000000..a0b1d15 --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/MetadataRTServerServiceImpl.java @@ -0,0 +1,693 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.servermanager; + +import com.inspur.edp.i18n.resource.api.II18nResourceRTManager; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.I18nResource; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4Ref; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataCustomizationFilter; +import com.inspur.edp.lcm.metadata.api.entity.MetadataDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataRTFilter; +import com.inspur.edp.lcm.metadata.api.entity.ServiceUnitInfo; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.cache.MetadataCacheManager; +import com.inspur.edp.lcm.metadata.cache.MetadataDistCacheManager; +import com.inspur.edp.lcm.metadata.cache.MetadataRtDistCache; +import com.inspur.edp.lcm.metadata.cache.RtCacheHandler; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.MetadataDtoConverter; +import com.inspur.edp.lcm.metadata.common.MetadataSerializer; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.common.configuration.I18nManagerHelper; +import com.inspur.edp.lcm.metadata.common.configuration.MetadataSerializerHelper; +import com.inspur.edp.lcm.metadata.common.context.RuntimeContext; +import com.inspur.edp.lcm.metadata.serverapi.MetadataRTServerService; +import com.inspur.edp.lcm.metadata.servermanager.persistent.RepositoryFactory; +import com.inspur.edp.lcm.metadata.servermanager.util.MetadataServerManagerUitls; +import com.inspur.edp.lcm.metadata.servermanager.util.MetadataUtils; +import com.inspur.edp.lcm.metadata.spi.MetadataI18nService; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import io.iec.edp.caf.commons.layeringcache.cache.Cache; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipInputStream; +import javax.annotation.PostConstruct; +import lombok.extern.slf4j.Slf4j; +import lombok.var; +import org.codehaus.plexus.util.StringUtils; + +/** + * @author zhaoleitr + */ +@Slf4j +public class MetadataRTServerServiceImpl implements MetadataRTServerService { + FileService fileService = new FileServiceImp(); + + private II18nResourceRTManager i18nResourceRtManager; + + private II18nResourceRTManager getI18nResourceRtManager() { + if (i18nResourceRtManager == null) { + i18nResourceRtManager = SpringBeanUtils.getBean(II18nResourceRTManager.class); + } + return i18nResourceRtManager; + } + + private final Lock lock = new ReentrantLock(); + private static String serverBasePath = ""; + private static String metadataAppPath = ""; + private static String metadataPlatformPath = ""; + private final MetadataServerManagerUitls utils = new MetadataServerManagerUitls(); + + /** + * 启动时加载所有元数据 + */ + @PostConstruct + private void init() { + log.info("Loading Metadata..."); + try { + ExecutorService executor = Executors.newCachedThreadPool(); + executor.submit( + this::loadAllMetadata); + } catch (Exception e) { + log.error("Loading Metadata Failed", e); + } + } + + @Override + public MetadataDto getMetadataDtoRTByID(String id) { + GspMetadata metadata = getMetadataRTByID(id); + return MetadataDtoConverter.asDto(metadata); + } + + private GspMetadata getMetadataRTByID(String metadataID) { + String metadataKey = RtCacheHandler.getMetadataCacheKey(metadataID, ""); + GspMetadata metadataCache = (GspMetadata) MetadataCacheManager.getMetadataInfo(metadataKey); + if (metadataCache != null) { + return metadataCache; + } + String metadataPackagePath = (String) MetadataCacheManager.getMetadataPathMapping(metadataKey); + if (metadataPackagePath == null || metadataPackagePath.isEmpty()) { +// throw new IllegalArgumentException("Could not find metadata, metadataid is " + metadataID); + return null; + } + GspMetadata metadata = getMetadataByIdAndMetadataPath(metadataID, metadataPackagePath); + RtCacheHandler.updateMetadataCache(metadataKey, metadata); + return metadata; + } + + public GspMetadata getMetadataByIdAndMetadataPath(String metadataId, String metadataPath) { + String entryName = metadataPath.substring(metadataPath.indexOf(MetadataUtils.getMetadataPackageExtension()) + MetadataUtils.getMetadataPackageExtension().length() + 1); + metadataPath = metadataPath.substring(0, metadataPath.indexOf(entryName) - 1); + GspMetadata metadata = null; + lock.lock(); + try { + String manifestStr = ""; + StringBuilder sb = new StringBuilder(); + File file = new File(metadataPath); + ZipFile zf = new ZipFile(file); + InputStream in = new BufferedInputStream(new FileInputStream(metadataPath)); + Charset utf8 = StandardCharsets.UTF_8; + ZipInputStream zipInputStream = new ZipInputStream(in, utf8); + ZipEntry zipEntry; + while ((zipEntry = zipInputStream.getNextEntry()) != null) { + if (zipEntry.toString().equals(entryName)) { + BufferedReader br; + br = new BufferedReader(new InputStreamReader(zf.getInputStream(zipEntry), utf8)); + try { + String line; + while ((line = br.readLine()) != null) { + sb.append(line); + } + manifestStr = sb.toString(); + } catch (IOException e) { + log.error("Error in reading metadata"); + throw new IOException("Error in reading metadata in " + metadataPath, e); + } finally { + br.close(); + } + } + } + zipInputStream.close(); + in.close(); + zf.close(); + if (!manifestStr.isEmpty()) { + metadata = new MetadataSerializer().deserialize(manifestStr, GspMetadata.class); + } + + } catch (IOException ioe) { + log.error("构建元数据失败,元数据位置:" + metadataPath + "元数据id:" + metadataId, ioe); + } finally { + lock.unlock(); + } + if (metadata == null) { + throw new RuntimeException("Could not find metadata content!"); + } + return metadata; + } + + private GspMetadata getI18nMetadata(String metadataId, String language) { + if (language == null) { + language = RuntimeContext.getLanguage(); + } + //从缓存中获取元数据,缓存中的元数据认为是国际化的元数据内容 + //缓存中不存在元数据,获取基础元数据内容, + //根据基础元数据内容,获取国际化资源, + //根据合并接口合并元数据,并返回内容,添加缓存。 + String metadataKey = RtCacheHandler.getMetadataCacheKey(metadataId, language); + GspMetadata metadataCache = (GspMetadata) MetadataCacheManager.getMetadataInfo(metadataKey); + if (metadataCache != null) { + return metadataCache; + } + GspMetadata originalData = getMetadataRTByID(metadataId); + //获取多语资源,此处try为兼容各个未国际化的元数据 + try { + List resources = getI18nResourceRtManager().getI18nResource(originalData, language); + MetadataI18nService service = I18nManagerHelper.getInstance().getI18nManager(originalData.getHeader().getType()); + if (service != null && resources != null && resources.size() > 0) { + var result = service.merge(originalData, resources); + RtCacheHandler.updateMetadataCache(metadataKey, result); + return result; + } + } catch (Exception e) { + //TODO 表单强制获取资源项,获取不到时会报错,异常太多,暂时catch住 + } + return originalData; + } + + @Override + public MetadataDto getMetadataDto(String id) { + String language = RuntimeContext.getLanguage(); + return MetadataDtoConverter.asDto(getI18nMetadata(id, language)); + } + + @Override + public GspMetadata getMetadata(String id) { + String language = RuntimeContext.getLanguage(); + return getI18nMetadata(id, language); + } + + @Override + public List getMetadataListRecursivly(String path) { + List result = new ArrayList<>(); + try { + Map packages = RepositoryFactory.getInstance().getMetadataPackageRepository().retrieveAllMdPkg(Utils.handlePath(path)); + if (packages != null && packages.size() > 0) { + for (Map.Entry valuePair : packages.entrySet()) { + MetadataPackage metadataPackage = valuePair.getValue(); + String metadataPackagePath = valuePair.getKey(); + for (GspMetadata item : metadataPackage.getMetadataList()) { + GspMetadata metadata = getMetadataByIdAndMetadataPath(item.getHeader().getId(), metadataPackagePath + item.getRelativePath()); + result.add(metadata); + } + } + } + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException("递归获取路径下元数据包中元数据列表报错,路径为" + path, e); + } + return result; + } + + public List getExtendableMetadataListRecursivly(String path) { + List result = new ArrayList<>(); + try { + Map packages = RepositoryFactory.getInstance().getMetadataPackageRepository().retrieveAllMdPkg(Utils.handlePath(path)); + if (packages != null && packages.size() > 0) { + for (Map.Entry valuePair : packages.entrySet()) { + MetadataPackage metadataPackage = valuePair.getValue(); + String metadataPackagePath = valuePair.getKey(); + for (GspMetadata item : metadataPackage.getMetadataList()) { + if (item.getHeader().isExtendable()) { + GspMetadata metadata = getMetadataByIdAndMetadataPath(item.getHeader().getId(), metadataPackagePath + item.getRelativePath()); + result.add(metadata); + } + } + } + } + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException("递归获取路径下元数据包中元数据列表报错,路径为" + path, e); + } + return result; + } + + @Override + public List getMetadataListFromPackage(String packagePath) { + List result = new ArrayList<>(); + + if (!fileService.isFileExist(packagePath)) { + throw new RuntimeException("元数据包不存在,元数据包路径为" + packagePath); + } + try { + MetadataPackage metadataPackage = RepositoryFactory.getInstance().getMetadataPackageRepository().getMetadataPackage(new File(packagePath)); + for (GspMetadata item : metadataPackage.getMetadataList()) { + GspMetadata metadata = getMetadataByIdAndMetadataPath(item.getHeader().getId(), packagePath + item.getRelativePath()); + result.add(metadata); + } + } catch (IOException e) { + e.printStackTrace(); + } + return result; + } + + public List getMetadataListInfoFromPackage(String packagePath) { + List result = new ArrayList<>(); + + if (!fileService.isFileExist(packagePath)) { + throw new RuntimeException("元数据包不存在,元数据包路径为" + packagePath); + } + try { + MetadataPackage metadataPackage = RepositoryFactory.getInstance().getMetadataPackageRepository().getMetadataPackage(new File(packagePath)); + if (Objects.isNull(metadataPackage)) { + return null; + } + return metadataPackage.getMetadataList(); + } catch (IOException e) { + e.printStackTrace(); + } + return result; + } + + @Override + public Map getMetadataPackagesRecursivly(String path) { + Map result; + try { + result = RepositoryFactory.getInstance().getMetadataPackageRepository().retrieveAllMdPkg(Utils.handlePath(path)); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException("递归获取路径下元数据包中元数据列表报错,路径为" + path, e); + } + return result; + } + + @Override + public void loadAllMetadata() { + String basePath = EnvironmentUtil.getBasePath(); + FileServiceImp fileService = new FileServiceImp(); + metadataAppPath = fileService.getCombinePath(basePath, "metadata/apps"); + metadataPlatformPath = fileService.getCombinePath(basePath, "metadata/platform"); + + //元数据包信息,<元数据包绝对路径,元数据包信息> + Map packageDicInApps; + Map packageDic; + List metadataInfoList = new ArrayList<>(); + try { + packageDicInApps = RepositoryFactory.getInstance().getMetadataPackageRepository().retrieveAllMdPkg(Utils.handlePath(metadataAppPath)); + Map packageDicInPlatform = RepositoryFactory.getInstance().getMetadataPackageRepository().retrieveAllMdPkg(Utils.handlePath(metadataPlatformPath)); + packageDic = Stream.concat(packageDicInApps.entrySet().stream(), packageDicInPlatform.entrySet().stream()) + .collect(Collectors.toMap( + Map.Entry::getKey, + Map.Entry::getValue, + (value1, value2) -> value1)); + } catch (Exception e) { + log.error("Error in reading metadata in metadata/apps or platform", e); + throw new RuntimeException("Error in reading metadata in metadata/apps or platform", e); + } + if (packageDic.size() > 0) { + for (Map.Entry valuePair : packageDic.entrySet()) { + String metadataPackagePath = valuePair.getKey(); + MetadataPackage metadataPackage = valuePair.getValue(); + if (metadataPackage != null) { + RtCacheHandler.updateMetadataPackageCache(metadataPackage.getHeader().getName(), metadataPackage); + } + for (GspMetadata item : metadataPackage.getMetadataList()) { + // + languageID; + String metadataKey = RtCacheHandler.getMetadataCacheKey(item.getHeader().getId(), ""); + MetadataCacheManager.addMetadataPathMapping(metadataKey, metadataPackagePath + item.getRelativePath()); + metadataInfoList.add(item); + } + MetadataCacheManager.addAllMetadataInfo(RtCacheHandler.allMetadataInfoCacheKey, metadataInfoList); + } + } + Cache metadataCache = MetadataDistCacheManager.getMetadataCache(); + metadataCache.clear(); + Cache metadataRtCache = MetadataRtDistCache.getMetadataCache(); + metadataRtCache.clear(); + + // 预加载序反列化器 + MetadataSerializerHelper.getInstance(); + } + + public void loadAllMetadataByPath(String path, String packagePath) { + FileServiceImp fileService = new FileServiceImp(); + String metadataAppPath = fileService.getCombinePath(path, "metadata/apps"); + String metadataPlatformPath = fileService.getCombinePath(path, "metadata/platform"); + + //元数据包信息,<元数据包绝对路径,元数据包信息> + Map packageDicInApps; + Map packageDic; + List metadataInfoList = new ArrayList<>(); + try { + packageDicInApps = RepositoryFactory.getInstance().getMetadataPackageRepository().retrieveAllMdPkg(Utils.handlePath(metadataAppPath)); + Map packageDicInPlatform = RepositoryFactory.getInstance().getMetadataPackageRepository().retrieveAllMdPkg(Utils.handlePath(metadataPlatformPath)); + Map packegeDicInDeployPath = RepositoryFactory.getInstance().getMetadataPackageRepository().retrieveAllMdPkg(Utils.handlePath(packagePath)); + Map serverPackageDic = Stream.concat(packageDicInApps.entrySet().stream(), packageDicInPlatform.entrySet().stream()) + .collect(Collectors.toMap( + Map.Entry::getKey, + Map.Entry::getValue, + (value1, value2) -> value1)); + packageDic = Stream.concat(serverPackageDic.entrySet().stream(), packegeDicInDeployPath.entrySet().stream()) + .collect(Collectors.toMap( + Map.Entry::getKey, + Map.Entry::getValue, + (value1, value2) -> value1)); + } catch (Exception e) { + throw new RuntimeException("Error in reading metadata in metadata/apps or platform", e); + } + if (packageDic.size() > 0) { + for (Map.Entry valuePair : packageDic.entrySet()) { + String metadataPackagePath = valuePair.getKey(); + MetadataPackage metadataPackage = valuePair.getValue(); + if (metadataPackage != null) { + RtCacheHandler.updateMetadataPackageCache(metadataPackage.getHeader().getName(), metadataPackage); + } + for (GspMetadata item : metadataPackage.getMetadataList()) { + // + languageID; + String metadataKey = RtCacheHandler.getMetadataCacheKey(item.getHeader().getId(), ""); + MetadataCacheManager.addMetadataPathMapping(metadataKey, metadataPackagePath + item.getRelativePath()); + metadataInfoList.add(item); + } + } + MetadataCacheManager.addAllMetadataInfo(RtCacheHandler.allMetadataInfoCacheKey, metadataInfoList); + } + // 预加载序反列化器 + MetadataSerializerHelper.getInstance(); + } + + public List getMetadataList(String metadataTypes) { + var result = getMetadataRefListWithTypes(metadataTypes); + return utils.buildMetadata4RefDto(result); + } + + @Override + public String getMetadataRefDtoList() { + List metadataList = getMetadataRefList(); + return utils.serializeMetadata4RefDtos(utils.buildMetadata4RefDto(metadataList)); + } + + @Override + public List getMetadataRefList() { + List metadataList = new ArrayList<>(); + //首先从缓存获取 + List packagesCache = (List) MetadataCacheManager.getAllMetadataPackageInfo(RtCacheHandler.allPackagesCacheKey); + if (packagesCache != null && packagesCache.size() > 0) { + for (MetadataPackage pack : packagesCache) { + List metadata4Ref = getMetadata4Ref(pack, null); + metadataList.addAll(metadata4Ref); + } + return metadataList; + } + List metadataPackages = getMetadataPackages(); + for (MetadataPackage metadataPackage : metadataPackages) { + List metadata4Ref = getMetadata4Ref(metadataPackage, null); + metadataList.addAll(metadata4Ref); + } + MetadataCacheManager.addAllMetadataPackageInfo(RtCacheHandler.allPackagesCacheKey, metadataPackages); + return metadataList; + } + + private List getMetadataPackages() { + + serverBasePath = EnvironmentUtil.getBasePath(); + FileServiceImp fileService = new FileServiceImp(); + metadataAppPath = fileService.getCombinePath(serverBasePath, "metadata/apps"); + metadataPlatformPath = fileService.getCombinePath(serverBasePath, "metadata/platform"); + + //元数据部署目录下遍历 + //List paths = new ArrayList<>(); + //找到目录下的所有元数据包mdpkg + //RepositoryFactory.getInstance().getMetadataPackageRepository().getMdpkgFilesPath(Utils.handlePath("metadata/apps"), paths); + //RepositoryFactory.getInstance().getMetadataPackageRepository().getMdpkgFilesPath(Utils.handlePath("metadata/platform"), paths); + + //缓存的包列表 + List metadataPackages = new ArrayList<>(); + //元数据包信息,<元数据包绝对路径,元数据包信息> + Map packageDicInApps; + Map packageDicInPlatform; + + try { + packageDicInApps = RepositoryFactory.getInstance().getMetadataPackageRepository().retrieveAllMdPkg(Utils.handlePath(metadataAppPath)); + packageDicInPlatform = RepositoryFactory.getInstance().getMetadataPackageRepository().retrieveAllMdPkg(Utils.handlePath(metadataPlatformPath)); + } catch (Exception e) { + log.error("Error in reading metadata in metadata/apps or platform", e); + throw new RuntimeException("Error in reading metadata in metadata/apps or platform", e); + } + + if (packageDicInApps.values().size() > 0) { + metadataPackages.addAll(packageDicInApps.values()); + } + if (packageDicInPlatform.values().size() > 0) { + metadataPackages.addAll(packageDicInPlatform.values()); + } + return metadataPackages; + } + + @Override + public String getMetadataDtoListByFilter(String filter) { + MetadataRTFilter filterInfo = utils.deserializerMetadataRTFilter(filter); + List metadataList = getMetadataListByFilter(filterInfo); + return utils.serializeMetadata4RefDtos(utils.buildMetadata4RefDto(metadataList)); + } + + @Override + public List getMetadataListByFilter(MetadataRTFilter filter) { + + List metadataList; + // 获取所有元数据包 + metadataList = getMetadataRefList(); + // 根据AppCode进行过滤 + if (filter.getAppCode() != null) { + metadataList = metadataList.stream().filter(item -> item.getServiceUnitInfo() == null || item.getServiceUnitInfo().getAppCode().equals(filter.getAppCode())).collect(Collectors.toList()); + } + // 根据ServiceUnitCode进行过滤 + if (filter.getServiceUnitCode() != null) { + metadataList = metadataList.stream().filter(item -> item.getServiceUnitInfo() == null || item.getServiceUnitInfo().getServiceUnitCode().equals(filter.getServiceUnitCode())).collect(Collectors.toList()); + } + // 根据BizobjectID进行过滤 + if (filter.getBizobjectId() != null && filter.getBizobjectId().size() > 0) { + for (String eachBizobjectId : filter.getBizobjectId()) { + metadataList = metadataList.stream().filter(item -> item.getMetadata().getHeader().getBizobjectID().equals(eachBizobjectId)).collect(Collectors.toList()); + } + } + if (filter.getCode() != null) { + metadataList = metadataList.stream().filter(item -> item.getMetadata().getHeader().getCode() != null && item.getMetadata().getHeader().getCode().equals(filter.getCode())).collect(Collectors.toList()); + } + if (filter.getNameSpace() != null) { + metadataList = metadataList.stream().filter(item -> item.getMetadata().getHeader().getNameSpace() != null && item.getMetadata().getHeader().getNameSpace().equals(filter.getNameSpace())).collect(Collectors.toList()); + } + if (filter.getType() != null) { + metadataList = metadataList.stream().filter(item -> item.getMetadata().getHeader().getType() != null && item.getMetadata().getHeader().getType().equals(filter.getType())).collect(Collectors.toList()); + } + return metadataList; + } + + /*** + * @author zhongchq + * @param metadataTypes 想要获取的元数据类型 + * @return java.util.List + **/ + @Override + public String getMetadataRefDtoListWithTypes(String metadataTypes) { + List metadata4Refs = getMetadataRefListWithTypes(metadataTypes); + return utils.serializeMetadata4RefDtos(utils.buildMetadata4RefDto(metadata4Refs)); + + } + + @Override + public List getMetadataRefListWithTypes(String metadataTypes) { + List typeList; + if (metadataTypes == null || metadataTypes.isEmpty()) { + throw new RuntimeException("传入参数不能为空"); + } else { + String[] types = metadataTypes.split(","); + typeList = new ArrayList<>(Arrays.asList(types)); + } + List metadataList = new ArrayList<>(); + //首先从缓存获取 + List packagesCache = (List) MetadataCacheManager.getAllMetadataPackageInfo(RtCacheHandler.allPackagesCacheKey); + if (packagesCache != null && packagesCache.size() > 0) { + for (MetadataPackage pack : packagesCache) { + List metadata4Ref = getMetadata4Ref(pack, typeList); + metadataList.addAll(metadata4Ref); + } + return metadataList; + } + + List metadataPackages = getMetadataPackages(); + for (MetadataPackage metadataPackage : metadataPackages) { + List metadata4Ref = getMetadata4Ref(metadataPackage, typeList); + metadataList.addAll(metadata4Ref); + } + + MetadataCacheManager.addAllMetadataPackageInfo(RtCacheHandler.allPackagesCacheKey, metadataPackages); + return metadataList; + } + + private List getMetadata4Ref(MetadataPackage packageInfo, List metadataTypes) { + List metadata4RefList = new ArrayList<>(); + if (metadataTypes != null && metadataTypes.size() > 0) { + metadataTypes.forEach(type -> + { + var result = packageInfo.getMetadataList().stream().filter(item -> item.getHeader().getType().toLowerCase().equals(type.toLowerCase())).collect(Collectors.toList()); + if (result.size() > 0) { + result.forEach(metadata -> { + Metadata4Ref metadata4Ref = new Metadata4Ref(); + metadata4Ref.setMetadata(metadata); + metadata4Ref.setServiceUnitInfo(packageInfo.getServiceUnitInfo()); + metadata4Ref.setPackageHeader(packageInfo.getHeader()); + metadata4RefList.add(metadata4Ref); + }); + } + } + ); + } else { + packageInfo.getMetadataList().forEach(metadata -> { + Metadata4Ref metadata4Ref = new Metadata4Ref(); + metadata4Ref.setMetadata(metadata); + metadata4Ref.setServiceUnitInfo(packageInfo.getServiceUnitInfo()); + metadata4Ref.setPackageHeader(packageInfo.getHeader()); + metadata4RefList.add(metadata4Ref); + }); + } + return metadata4RefList; + } + + @Override + public MetadataDto getMetadataDtoBySemanticID(String metadataNamespace, String metadataCode, + String metadataTypeCode) { + GspMetadata metadata = getMetadataBySemanticId(metadataNamespace, metadataCode, metadataTypeCode); + return MetadataDtoConverter.asDto(metadata); + } + + private GspMetadata getMetadataBySemanticId(String metadataNamespace, String metadataCode, + String metadataTypeCode) { + List allMetadataInfo = (List) MetadataCacheManager.getAllMetadataInfo(RtCacheHandler.allMetadataInfoCacheKey); + if (allMetadataInfo != null) { + for (GspMetadata item : allMetadataInfo) { + if (item.getHeader().getNameSpace().toLowerCase().equals(metadataNamespace.toLowerCase()) + && item.getHeader().getCode().toLowerCase().equals(metadataCode.toLowerCase()) + && item.getHeader().getType().toLowerCase().equals(metadataTypeCode.toLowerCase())) { + return getMetadataRTByID(item.getHeader().getId()); + } + } + } + List allMetadataList = getMetadataList(metadataTypeCode); + if (allMetadataList != null) { + for (Metadata4RefDto item : allMetadataList) { + if (item.getMetadata().getNameSpace().toLowerCase().equals(metadataNamespace.toLowerCase()) + && item.getMetadata().getCode().toLowerCase().equals(metadataCode.toLowerCase())) { + return getMetadataRTByID(item.getMetadata().getId()); + } + } + } + return null; + } + + @Override + public ServiceUnitInfo getServiceUnitInfo(String metadataId) { + String metadataKey = RtCacheHandler.getMetadataCacheKey(metadataId, ""); + String metadataPackagePath = (String) MetadataCacheManager.getMetadataPathMapping(metadataKey); + if (metadataPackagePath == null || metadataPackagePath.isEmpty()) { + throw new IllegalArgumentException("Could not find metadata, metadataid is " + metadataId); + } + String entryName = metadataPackagePath.substring(metadataPackagePath.indexOf(MetadataUtils.getMetadataPackageExtension()) + MetadataUtils.getMetadataPackageExtension().length() + 1); + metadataPackagePath = metadataPackagePath.substring(0, metadataPackagePath.indexOf(entryName) - 1); + String metadataPackageName = new File(metadataPackagePath).getName(); + String metadataPackageNameWithoutSuffix = metadataPackageName.substring(0, metadataPackageName.indexOf(MetadataUtils.getMetadataPackageExtension())); + MetadataPackage metadataPackage = (MetadataPackage) MetadataCacheManager.getMetadataPackageInfo(metadataPackageNameWithoutSuffix); + return metadataPackage.getServiceUnitInfo(); + } + + @Override + public String getMetadataString(MetadataCustomizationFilter metadataCustomizationFilter) { + return getMetadataStrFromPackage(metadataCustomizationFilter.getMetadataId()); + } + + private String getMetadataStrFromPackage(String metadataID) { + String metadataKey = RtCacheHandler.getMetadataCacheKey(metadataID, ""); + String metadataPackagePath = (String) MetadataCacheManager.getMetadataPathMapping(metadataKey); + if (metadataPackagePath == null || metadataPackagePath.isEmpty()) { + return null; + } + String entryName = metadataPackagePath.substring(metadataPackagePath.indexOf(MetadataUtils.getMetadataPackageExtension()) + MetadataUtils.getMetadataPackageExtension().length() + 1); + metadataPackagePath = metadataPackagePath.substring(0, metadataPackagePath.indexOf(entryName) - 1); + String metadataStr = ""; + + lock.lock(); + try { + StringBuilder sb = new StringBuilder(); + File file = new File(metadataPackagePath); + ZipFile zf = new ZipFile(file); + InputStream in = new BufferedInputStream(new FileInputStream(metadataPackagePath)); + Charset utf8 = StandardCharsets.UTF_8; + ZipInputStream zipInputStream = new ZipInputStream(in, utf8); + ZipEntry zipEntry; + while ((zipEntry = zipInputStream.getNextEntry()) != null) { + if (zipEntry.toString().equals(entryName)) { + BufferedReader br; + br = new BufferedReader(new InputStreamReader(zf.getInputStream(zipEntry), utf8)); + try { + String line; + while ((line = br.readLine()) != null) { + sb.append(line); + } + metadataStr = sb.toString(); + } catch (IOException e) { + log.error("Error in reading metadata"); + throw new IOException("Error in reading metadata in " + metadataPackagePath, e); + } finally { + br.close(); + } + } + } + zipInputStream.close(); + in.close(); + zf.close(); + } catch (IOException ioe) { + log.error("构建元数据失败,元数据位置:" + metadataPackagePath + "元数据id:" + metadataID, ioe); + } finally { + lock.unlock(); + } + if (StringUtils.isEmpty(metadataStr)) { + throw new RuntimeException("Could not find metadata " + metadataID + " from " + metadataPackagePath); + } + return metadataStr; + } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/configuration/RestConfiguarion.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/configuration/RestConfiguarion.java new file mode 100644 index 0000000..a410c6a --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/configuration/RestConfiguarion.java @@ -0,0 +1,47 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.servermanager.configuration; + +import com.inspur.edp.lcm.metadata.api.service.MetadataRTService; +import com.inspur.edp.lcm.metadata.rtservice.MetadataRTServiceImp; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Classname RestConfiguarion Description TODO Date 2019/8/28 14:14 + * + * @author zhongchq + * @version 1.0 + */ +//todo +//@Configuration(proxyBeanMethods = false) +@Configuration() +public class RestConfiguarion { + + @Bean + public MetadataRTService createMetadataRTService() { + return new MetadataRTServiceImp(); + } + +// @Bean +// public MetadataRT4WebApiService createMetadata4WebApiService(){ +// return new MetadataRT4WebApiServiceImp(); +// } +// @Bean +// public RESTEndpoint restEndpoint(MetadataRT4WebApiService metadataRT4WebApiService){ +// return new RESTEndpoint("/runtime/sys/v1.0/rt-metadatas",metadataRT4WebApiService); +// } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/event/MdPkgChangedEventBroker.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/event/MdPkgChangedEventBroker.java new file mode 100644 index 0000000..7daee29 --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/event/MdPkgChangedEventBroker.java @@ -0,0 +1,66 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.servermanager.event; + +import io.iec.edp.caf.commons.event.CAFEventArgs; +import io.iec.edp.caf.commons.event.EventBroker; +import io.iec.edp.caf.commons.event.IEventListener; +import io.iec.edp.caf.commons.event.config.EventListenerData; +import io.iec.edp.caf.commons.event.config.EventListenerSettings; + +/** + * @author zhaoleitr + */ +public class MdPkgChangedEventBroker extends EventBroker { + + public MdPkgChangedEventManager mdPkgChangedEventManager; + + public MdPkgChangedEventBroker(EventListenerSettings settings) { + super(settings); + this.mdPkgChangedEventManager = new MdPkgChangedEventManager(); + this.init(); + } + + @Override + protected void onInit() { + this.eventManagerCollection.add(mdPkgChangedEventManager); + } + + public void fireMdPkgAddedEvent(CAFEventArgs e) { + this.mdPkgChangedEventManager.fireMdPkgAddedEvent(e); + + } + + public void fireMdPkgChangedEvent(CAFEventArgs e) { + this.mdPkgChangedEventManager.fireMdPkgChangedEvent(e); + } + + /** + * 测试异常是否被抛出 + */ + public IEventListener createEventListenerTest(EventListenerData eventListenerData) { + return this.createEventListener(eventListenerData); + } + + /** + * 测试注销事件 + * + * @param eventListener + */ + public void removeListenerTest(IEventListener eventListener) { + this.removeListener(eventListener); + } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/event/MdPkgChangedEventManager.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/event/MdPkgChangedEventManager.java new file mode 100644 index 0000000..b0414ba --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/event/MdPkgChangedEventManager.java @@ -0,0 +1,76 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.servermanager.event; + +import com.inspur.edp.lcm.metadata.spi.event.MdPkgChangedEventListener; +import io.iec.edp.caf.commons.event.CAFEventArgs; +import io.iec.edp.caf.commons.event.EventManager; +import io.iec.edp.caf.commons.event.IEventListener; + +/** + * 元数据包变更监听mangaer + * + * @author zhaoleitr + */ +public class MdPkgChangedEventManager extends EventManager { + + /** + * 内部枚举类 + */ + enum MetadataRtEventType { + fireMdPkgAddedEvent, + fireMdPkgChangedEvent + } + + @Override + public String getEventManagerName() { + return "MdpkgChangedEventManager"; + } + + @Override + public boolean isHandlerListener(IEventListener iEventListener) { + return iEventListener instanceof MdPkgChangedEventListener; + } + + @Override + public void addListener(IEventListener iEventListener) { + if (iEventListener instanceof MdPkgChangedEventListener == false) { + throw new RuntimeException("指定的监听者没有实现IDemoEventListener接口"); + } + MdPkgChangedEventListener mdPkgChangedEventListener = (MdPkgChangedEventListener) iEventListener; + this.addEventHandler(MetadataRtEventType.fireMdPkgAddedEvent, mdPkgChangedEventListener, "fireMdPkgAddedEvent"); + this.addEventHandler(MetadataRtEventType.fireMdPkgChangedEvent, mdPkgChangedEventListener, "fireMdPkgChangedEvent"); + } + + @Override + public void removeListener(IEventListener iEventListener) { + if (iEventListener instanceof MdPkgChangedEventListener == false) { + throw new RuntimeException("指定的监听者没有实现IDemoEventListener接口"); + } + MdPkgChangedEventListener mdPkgChangedEventListener = (MdPkgChangedEventListener) iEventListener; + this.removeEventHandler(MetadataRtEventType.fireMdPkgAddedEvent, mdPkgChangedEventListener, "fireMdPkgAddedEvent"); + this.removeEventHandler(MetadataRtEventType.fireMdPkgChangedEvent, mdPkgChangedEventListener, "fireMdPkgChangedEvent"); + + } + + public void fireMdPkgAddedEvent(CAFEventArgs e) { + this.fire(MetadataRtEventType.fireMdPkgAddedEvent, e); + } + + public void fireMdPkgChangedEvent(CAFEventArgs e) { + this.fire(MetadataRtEventType.fireMdPkgChangedEvent, e); + } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MdpkgAlterationMonitor.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MdpkgAlterationMonitor.java new file mode 100644 index 0000000..c827ddd --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MdpkgAlterationMonitor.java @@ -0,0 +1,105 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.servermanager.monitor; + +import org.apache.commons.io.filefilter.FileFilterUtils; +import org.apache.commons.io.filefilter.HiddenFileFilter; +import org.apache.commons.io.filefilter.IOFileFilter; +import org.apache.commons.io.monitor.FileAlterationListenerAdaptor; +import org.apache.commons.io.monitor.FileAlterationMonitor; +import org.apache.commons.io.monitor.FileAlterationObserver; + +public class MdpkgAlterationMonitor { + private String path; // 文件夹目录 + + private String fileSuffix; // 需要监听的文件名后缀 + + private long interval; // 监听间隔 + + private static final long DEFAULT_INTERVAL = 10 * 1000; // 默认监听间隔10s + + private boolean running = false; + + private FileAlterationListenerAdaptor listener; // 事件处理类对象 + + private FileAlterationMonitor monitor; + + public MdpkgAlterationMonitor() { + this.interval = DEFAULT_INTERVAL; + } + + public MdpkgAlterationMonitor(String path, String fileSuffix, FileAlterationListenerAdaptor listenerAdaptor) { + this.path = path; + this.fileSuffix = fileSuffix; + this.interval = DEFAULT_INTERVAL; + this.listener = listenerAdaptor; + } + + public MdpkgAlterationMonitor(String path, String fileSuffix, long interval, + FileAlterationListenerAdaptor listenerAdaptor) { + this.path = path; + this.fileSuffix = fileSuffix; + this.interval = interval; + this.listener = listenerAdaptor; + } + + /*** + * 开启监听 + */ + public void start() { + if (path == null) { + throw new IllegalStateException("Listen path must not be null"); + } + if (listener == null) { + throw new IllegalStateException("Listener must not be null"); + } + + IOFileFilter directories = FileFilterUtils.and( + FileFilterUtils.directoryFileFilter(), + HiddenFileFilter.VISIBLE); + IOFileFilter files = FileFilterUtils.and( + FileFilterUtils.fileFileFilter(), + FileFilterUtils.suffixFileFilter(fileSuffix)); + IOFileFilter filter = FileFilterUtils.or(directories, files); + // 设定观察者,监听文件 + FileAlterationObserver observer = new FileAlterationObserver(path, filter); + // 给观察者添加监听事件 + observer.addListener(listener); + + // 开启一个监视器,监听频率是5s一次 + // FileAlterationMonitor本身实现了 Runnable,是单独的一个线程,按照设定的时间间隔运行,默认间隔是 10s + monitor = new FileAlterationMonitor(interval); + + monitor.addObserver(observer); + + try { + monitor.start(); + running = true; + } catch (Exception e) { + e.printStackTrace(); + } + } + +// public void checkAndNotify() { +// if (running) { +// Iterator i$ = this.monitor.getObservers().iterator(); +// while(i$.hasNext()) { +// FileAlterationObserver observer = (FileAlterationObserver)i$.next(); +// observer.checkAndNotify(); +// } +// } +// } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MdpkgListenerAdapter.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MdpkgListenerAdapter.java new file mode 100644 index 0000000..86d0006 --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MdpkgListenerAdapter.java @@ -0,0 +1,197 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.servermanager.monitor; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.cache.MetadataCacheManager; +import com.inspur.edp.lcm.metadata.cache.MetadataDistCacheManager; +import com.inspur.edp.lcm.metadata.cache.MetadataRtDistCache; +import com.inspur.edp.lcm.metadata.cache.RtCacheHandler; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.servermanager.event.MdPkgChangedEventBroker; +import com.inspur.edp.lcm.metadata.servermanager.persistent.RepositoryFactory; +import com.inspur.edp.lcm.metadata.spi.event.MdPkgChangedArgs; +import io.iec.edp.caf.commons.layeringcache.cache.Cache; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import io.iec.edp.caf.i18n.framework.api.language.EcpLanguage; +import io.iec.edp.caf.i18n.framework.api.language.ILanguageService; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.apache.commons.io.monitor.FileAlterationListenerAdaptor; + +public class MdpkgListenerAdapter extends FileAlterationListenerAdaptor { + + public MdpkgListenerAdapter() { + + } +// @Override +// public void onStart(FileAlterationObserver observer) { +// System.out.println("start"); +// super.onStart(observer); +// } +// +// @Override +// public void onStop(FileAlterationObserver observer) { +// System.out.println("stop"); +// super.onStop(observer); +// } + + @Override + public void onFileCreate(File file) { + try { + super.onFileCreate(file); + updateMdpkgAndMetadataCache(file, true); + + } catch (Exception e) { + System.out.println(e); + } + } + + @Override + public void onFileDelete(File file) { + try { + //更新缓存信息,文件删除时,具体缓存应该移除 + super.onFileDelete(file); + deleteMdpkgAndMetadataCache(file); + } catch (Exception e) { + System.out.println(e); + } + } + + @Override + public void onFileChange(File file) { + try { + //更新缓存信息 + super.onFileChange(file); + updateMdpkgAndMetadataCache(file, false); + } catch (Exception e) { + System.out.println(e); + } + + } + + private void updateMdpkgAndMetadataCache(File file, boolean isAdd) { + //更新缓存信息:包的信息会更新,因为所有后续获取内容,都依赖于已知的包的信息;所有的元数据内容不需要更新,仅需要移除。 + //当获取元数据时,如果缓存中没有元数据信息,会重新根据已知的包信息,重新加载元数据。 + //在更新元数据包缓存前,需要根据原有包的缓存信息,清理已有的元数据信息。 + //更新所有元数据信息列表 + //清理元数据信息、清理元数据引用信息 + //更新元数据包的信息:元数据包位置信息、元数据包中元数据列表信息、元数据包引用信息 + //更新元数据所在元数据包信息 + try { + Cache metadataCache = MetadataDistCacheManager.getMetadataCache(); + Cache metadataRtCache = MetadataRtDistCache.getMetadataCache(); + MetadataPackage metadataPackage = RepositoryFactory.getInstance().getMetadataPackageRepository().getMetadataPackage(file); + MetadataCacheManager.removeAllMetadataPackageInfo(RtCacheHandler.allPackagesCacheKey); + //清理元数据内容缓存,将原有缓存的包中元数据列表从元数据内容缓存移除 + String metadataKey = ""; + List oldPackageMetadataList = (List) MetadataCacheManager.getMDManifestInfo(metadataPackage.getHeader().getName()); + List allMetadataList = (List) MetadataCacheManager.getAllMetadataInfo(RtCacheHandler.allMetadataInfoCacheKey); + if (oldPackageMetadataList != null && oldPackageMetadataList.size() > 0) { + for (GspMetadata item : oldPackageMetadataList) { + metadataKey = RtCacheHandler.getMetadataCacheKey(item.getHeader().getId(), ""); + MetadataCacheManager.removeMetadataInfo(metadataKey); + MetadataCacheManager.removeMDDependence(metadataKey); + MetadataCacheManager.removeMetadataPathMapping(metadataKey); + + List languages = getLanguages(); + for (String language : languages) { + String key = RtCacheHandler.getMetadataCacheKey(item.getHeader().getId(), language); + MetadataCacheManager.removeMetadataInfo(key); + metadataCache.evict(key); + metadataRtCache.evict(key);//把指定的缓存对象清除 + } + } + //清理并更新所有元数据缓存 + allMetadataList.removeAll(oldPackageMetadataList); + } + allMetadataList.addAll(metadataPackage.getMetadataList()); + MetadataCacheManager.addAllMetadataInfo(RtCacheHandler.allMetadataInfoCacheKey, allMetadataList); + //清理并更新包中<元数据标识,元数据所在位置信息缓存>,清理过程在旧包处理过程中 + String metadataPackagePath = Utils.handlePath(file.toString()); + for (GspMetadata item : metadataPackage.getMetadataList()) { + metadataKey = RtCacheHandler.getMetadataCacheKey(item.getHeader().getId(), ""); + MetadataCacheManager.addMetadataPathMapping(metadataKey, metadataPackagePath + item.getRelativePath()); + } + //更新包缓存 + RtCacheHandler.updateMetadataPackageCache(metadataPackage.getHeader().getName(), metadataPackage); + + MdPkgChangedEventBroker broker = SpringBeanUtils.getBean(MdPkgChangedEventBroker.class); + MdPkgChangedArgs args = new MdPkgChangedArgs(); + args.setMetadataPackage(metadataPackage); + + if (isAdd) { + broker.fireMdPkgAddedEvent(args); + } else { + broker.fireMdPkgChangedEvent(args); + } + } catch (IOException e) { + throw new RuntimeException("update metadatapackage cache filed, package is " + file, e); + } + } + + private void deleteMdpkgAndMetadataCache(File file) { + //这时不需要获取元数据包中的内容,仅需要根据元数据包文件名称,移除内容即可。 + String packageFileName = file.getName(); + String packageName = packageFileName.substring(0, packageFileName.lastIndexOf(".")); + //清理元数据内容缓存,将原有缓存的包中元数据列表从元数据内容缓存移除 + String metadataKey = ""; + Cache metadataCache = MetadataDistCacheManager.getMetadataCache(); + Cache metadataRtCache = MetadataRtDistCache.getMetadataCache(); + + List oldPackageMetadataList = (List) MetadataCacheManager.getMDManifestInfo(packageName); + List allMetadataList = (List) MetadataCacheManager.getAllMetadataInfo(RtCacheHandler.allMetadataInfoCacheKey); + if (oldPackageMetadataList != null && oldPackageMetadataList.size() > 0) { + for (GspMetadata item : oldPackageMetadataList) { + metadataKey = RtCacheHandler.getMetadataCacheKey(item.getHeader().getId(), ""); + MetadataCacheManager.removeMetadataInfo(metadataKey); + MetadataCacheManager.removeMDDependence(metadataKey); + MetadataCacheManager.removeMetadataPathMapping(metadataKey); + List languages = getLanguages(); + for (String language : languages) { + String key = RtCacheHandler.getMetadataCacheKey(item.getHeader().getId(), language); + MetadataCacheManager.removeMetadataInfo(key); + metadataCache.evict(key); + metadataRtCache.evict(key); + } + } + //清理并更新所有元数据缓存 + allMetadataList.removeAll(oldPackageMetadataList); + } + //更新包缓存 + MetadataCacheManager.removeMetadataPackageInfo(packageName); + MetadataCacheManager.removeMDManifestInfo(packageName); + MetadataCacheManager.removeMPDependence(packageName); + MetadataCacheManager.removeAllMetadataPackageInfo(RtCacheHandler.allPackagesCacheKey); + } + + private static List languages; + + private static List getLanguages() { + if (languages == null || languages.size() <= 0) { + languages = new ArrayList<>(); + ILanguageService laguageService = SpringBeanUtils.getBean(ILanguageService.class); + List ecpLanguages = laguageService.getEnabledLanguages(); + for (EcpLanguage language : ecpLanguages) { + languages.add(language.getCode()); + } + } + return languages; + } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MonitorInitializer.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MonitorInitializer.java new file mode 100644 index 0000000..398d2eb --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MonitorInitializer.java @@ -0,0 +1,42 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.servermanager.monitor; + +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import javax.annotation.PostConstruct; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class MonitorInitializer { + private final String mdpkgSuffix = ".mdpkg"; + private final String metatdataPath = "metadata"; + + @PostConstruct + public void initMonitor() { + log.info("Start MdpkgMonitor..."); + + FileServiceImp fileService = new FileServiceImp(); + String monitorFilePath = fileService.getCombinePath(EnvironmentUtil.getBasePath(), metatdataPath); + // 创建过滤器 + + MdpkgAlterationMonitor monitor = new MdpkgAlterationMonitor( + monitorFilePath, + mdpkgSuffix, + new MdpkgListenerAdapter()); + monitor.start(); + } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepository.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepository.java new file mode 100644 index 0000000..3b7224d --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepository.java @@ -0,0 +1,107 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.servermanager.persistent; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Classname IMetadataPackageRepository Description TODO Date 2019/8/21 16:55 + * + * @author zhongchq + * @version 1.0 + */ +public interface MetadataPackageRepository { + + /** + * 生成元数据包实体 从manifest中读取包信息 + * + * @param packagePath 包的manifest文件所在的目录 + * @return + */ + MetadataPackage getPackageEntity(String packagePath); + + /** + * 从包中获取元数据 + * + * @param metadataPath 元数据文件具体路径 + * @return + */ + GspMetadata getMetadataFromPackage(String metadataPath); + + /** + * 从指定目录下检索包文件 + * + * @param path 指定位置(目录),一般从服务端环境信息获取包部署路径。部署路径按照应用隔离,部署路径有多个 + * @param packageName 包名称 + * @return + */ + Map retrieveSingleMetadataPackage(String path, String packageName); + + /** + * 从指定目录下检索包文件 + * + * @param path 指定位置(目录),一般从服务端环境信息获取包部署路径。部署路径按照应用隔离,部署路径有多个 + * @return + */ + Map retrieveAllMdPkg(String path) throws IOException; + + /** + * 获取某一路径下的所有元数据包清单文件信息 + * + * @param originalPath + * @param manifestPath + */ + void getManifestFilesPath(String originalPath, List manifestPath); + + /** + * 获取某一路径下的所有元数据包清单文件信息 + * + * @param originalPath + * @param mdpkgPath + */ + void getMdpkgFilesPath(String originalPath, List mdpkgPath); + + /** + * 获取拼接路径信息 + * + * @param path1 + * @param path2 + * @return + */ + String getCombinePath(String path1, String path2); + + /** + * 获取目录名 + * + * @param path + * @return + */ + String getDirectoryName(String path); + + /** + * 根据元数据包文件,获取元数据包信息,读取manifest文件 + * + * @param packageFile + * @return MetadataPackage + */ + MetadataPackage getMetadataPackage(File packageFile) throws IOException; + +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepositoryImp.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepositoryImp.java new file mode 100644 index 0000000..30b2c0e --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepositoryImp.java @@ -0,0 +1,196 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.servermanager.persistent; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.servermanager.util.MetadataUtils; +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipInputStream; +import lombok.extern.slf4j.Slf4j; + +/** + * Classname MetadataPackageRepositoryImp Description TODO Date 2019/8/21 17:04 + * + * @author zhongchq + * @version 1.0 + */ +@Slf4j +public class MetadataPackageRepositoryImp implements MetadataPackageRepository { + + // @Autowired //TODO 依赖注入会是null,此类还未被初始化。 + FileService fileService = new FileServiceImp(); + + ObjectMapper mapper = Utils.getMapper(); + + @Override + public MetadataPackage getPackageEntity(String packagePath) { + return null; + } + + @Override + public GspMetadata getMetadataFromPackage(String metadataPath) { + return null; + } + + @Override + public HashMap retrieveSingleMetadataPackage(String path, String packageName) { + return null; + } + + @Override + public HashMap retrieveAllMdPkg(String path) throws IOException { + HashMap packageDic = new HashMap<>(); + retrieveMdPkgRecursively(path, packageDic); + return packageDic; + } + + public void retrieveMdPkgRecursively(String path, HashMap packageDic) throws IOException { + if (path.isEmpty() || new File(path).getName().toLowerCase().equals("web")) { + return; + } + List files = fileService.getAllFiles(path); + if (files.size() > 0) { + List fileList = new ArrayList<>(); + for (File file : files) { + if (fileService.getExtension(file.toString()).equals(MetadataUtils.getMetadataPackageExtension())) { + fileList.add(file); + } + } + if (fileList != null && fileList.size() > 0) { + for (File file1 : fileList) { + try { + MetadataPackage metadataPackage = getMetadataPackage(file1); + packageDic.put(Utils.handlePath(file1.toString()), metadataPackage); + } catch (IOException e) { + e.printStackTrace(); + System.out.println(e.getMessage() + ":" + file1.getAbsolutePath()); + log.error(e.getMessage() + ":" + file1.getAbsolutePath()); + } + } + } + } + // 路径中目录 + List dirs = fileService.getDirectorys(path); + for (int i = 0; i < dirs.size(); i++) { + retrieveMdPkgRecursively(dirs.get(i).toString(), packageDic); + } + } + + @Override + public MetadataPackage getMetadataPackage(File packageFile) throws IOException { + String manifestStr = ""; + MetadataPackage metadataPackage; + StringBuilder sb = new StringBuilder(); + InputStream in = new BufferedInputStream(new FileInputStream(packageFile)); + ZipFile zf = new ZipFile(packageFile); + Charset utf8 = Charset.forName("UTF-8"); + ZipInputStream zipInputStream = new ZipInputStream(in, utf8); + ZipEntry zipEntry; + try { + while ((zipEntry = zipInputStream.getNextEntry()) != null) { + BufferedReader br = new BufferedReader( + new InputStreamReader(zf.getInputStream(zipEntry), "UTF-8")); + if (zipEntry.toString().equals(MetadataUtils.getManifestFileName())) { + String line; + while ((line = br.readLine()) != null) { + sb.append(line); + } + manifestStr = sb.toString(); + } + br.close(); + } + } catch (IOException e) { + log.error("Error in reading mdpkg, Package is " + packageFile.getAbsolutePath(), e); + throw new RuntimeException("Error in reading mdpkg, Package is " + packageFile.getAbsolutePath(), e); + } finally { + zipInputStream.close(); + zf.close(); + in.close(); + } +// String jsonString = handleJsonString(manifestStr);//TODO可能会引起序列化失败 + try { + metadataPackage = mapper.readValue(manifestStr, MetadataPackage.class); + log.debug("元数据包:" + packageFile + "已加载。"); + } catch (Exception e) { + log.error("元数据包中manifest.json反序列化失败,元数据包为" + packageFile, e); + throw new RuntimeException("元数据包中manifest.json反序列化失败,元数据包为" + packageFile, e); + } + return metadataPackage; + } + + @Override + public void getManifestFilesPath(String originalPath, List manifestPath) { + + } + + @Override + public void getMdpkgFilesPath(String originalPath, List mdpkgPath) { + File dir = new File(originalPath); + List paths = fileService.getAllFiles(originalPath); + if (paths.size() > 0) { + paths.forEach(path -> { + String extension = fileService.getExtension(path); + if (extension.equals(MetadataUtils.getMetadataPackageExtension())) { + mdpkgPath.add(handlePath(path.toString())); + } + }); + searchChildPath4Mdpkg(originalPath, mdpkgPath, dir); + } else { + searchChildPath4Mdpkg(originalPath, mdpkgPath, dir); + } + } + + private void searchChildPath4Mdpkg(String originalPath, List mdpkgPath, File dir) { + List dirs = fileService.getDirectorys(dir.toString()); + if (dirs.size() > 0) { + for (int i = 0; i < dirs.size(); i++) { + String temPath = originalPath + "/" + fileService.getFileName(handlePath(dirs.get(i).toString())); + getMdpkgFilesPath(temPath, mdpkgPath); + } + } + } + + private String handlePath(String path) { + return path.replace("\\", "/"); + } + + @Override + public String getCombinePath(String path1, String path2) { + return null; + } + + @Override + public String getDirectoryName(String path) { + return null; + } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/RepositoryFactory.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/RepositoryFactory.java new file mode 100644 index 0000000..aaa3677 --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/RepositoryFactory.java @@ -0,0 +1,46 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.servermanager.persistent; + +/** + * Classname RepositoryFactory Description TODO Date 2019/8/21 16:47 + * + * @author zhongchq + * @version 1.0 + */ +public class RepositoryFactory { + + private static RepositoryFactory singleton = null; + + public RepositoryFactory() { + } + + public static RepositoryFactory getInstance() { + if (singleton == null) { + singleton = new RepositoryFactory(); + } + return singleton; + } + + private MetadataPackageRepository metadataPackageRepository; + + public MetadataPackageRepository getMetadataPackageRepository() { + if (metadataPackageRepository == null) { + metadataPackageRepository = new MetadataPackageRepositoryImp(); + } + return metadataPackageRepository; + } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/util/MetadataServerManagerUitls.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/util/MetadataServerManagerUitls.java new file mode 100644 index 0000000..8f8df6d --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/util/MetadataServerManagerUitls.java @@ -0,0 +1,77 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.servermanager.util; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4Ref; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataRTFilter; +import com.inspur.edp.lcm.metadata.common.MetadataDtoConverter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class MetadataServerManagerUitls { + + public List buildMetadata4RefDto(List metadata4Refs) { + if (metadata4Refs == null || metadata4Refs.size() <= 0) { + return null; + } + List metadata4RefDtos = new ArrayList<>(); + for (Metadata4Ref metadata4Ref : metadata4Refs) { + Metadata4RefDto dto = new Metadata4RefDto(); + MetadataDto metadataDto = MetadataDtoConverter.asDto(metadata4Ref.getMetadata()); + dto.setPackageHeader(metadata4Ref.getPackageHeader()); + dto.setMetadata(metadataDto); + dto.setServiceUnitInfo(metadata4Ref.getServiceUnitInfo()); + metadata4RefDtos.add(dto); + } + + return metadata4RefDtos; + } + + public String serializeMetadata4RefDtos(List metadataDtos) { + String result = ""; + ObjectMapper mapper = new ObjectMapper(); + mapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE); + try { + result = mapper.writeValueAsString(metadataDtos); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + return result; + } + + public MetadataRTFilter deserializerMetadataRTFilter(String content) { + MetadataRTFilter result = null; + ObjectMapper mapper = new ObjectMapper(); + mapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE); + mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + try { + result = mapper.readValue(content, MetadataRTFilter.class); + } catch (IOException e) { + e.printStackTrace(); + } + return result; + } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/util/MetadataUtils.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/util/MetadataUtils.java new file mode 100644 index 0000000..6f4b7e0 --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/util/MetadataUtils.java @@ -0,0 +1,35 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.servermanager.util; + +/** + * Classname MetadataUtils Description TODO Date 2019/8/20 16:43 + * + * @author zhongchq + * @version 1.0 + */ +public class MetadataUtils { + + public static String manifestFileName = "manifest.json"; + + public static String getManifestFileName() { + return manifestFileName; + } + + public static String getMetadataPackageExtension() { + return ".mdpkg"; + } +} diff --git a/model/framework/runtime-spi/pom.xml b/model/framework/runtime-spi/pom.xml index 2d92872..34de7a9 100644 --- a/model/framework/runtime-spi/pom.xml +++ b/model/framework/runtime-spi/pom.xml @@ -10,8 +10,6 @@ 4.0.0 ubml-model-framework-runtime-spi - - ubml-model-framework-runtime-spi ${project.version} diff --git a/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MdPkgChangedArgs.java b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MdPkgChangedArgs.java index 035e44e..30ce52a 100644 --- a/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MdPkgChangedArgs.java +++ b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MdPkgChangedArgs.java @@ -24,4 +24,12 @@ import io.iec.edp.caf.commons.event.CAFEventArgs; public class MdPkgChangedArgs extends CAFEventArgs { private MetadataPackage metadataPackage; + + public MetadataPackage getMetadataPackage() { + return metadataPackage; + } + + public void setMetadataPackage(MetadataPackage metadataPackage) { + this.metadataPackage = metadataPackage; + } } -- Gitee From ef28d5a31bc2358828a71ec9b7cd8c0c608eb3f3 Mon Sep 17 00:00:00 2001 From: Q-Lee Date: Tue, 11 May 2021 10:23:36 +0800 Subject: [PATCH 49/61] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Dlcm-metadata-framework=E6=A8=A1=E5=9D=97=E4=B8=8B?= =?UTF-8?q?=E6=89=80=E6=9C=89checkstyle=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/ConfigData/FilterConfigData.java | 1 - .../IndexServerConfiguration.java | 10 +- .../metadata/cache/MetadataCacheManager.java | 142 +++++++++--------- .../lcm/metadata/cache/RtCacheHandler.java | 18 +-- .../lcm/metadata/common/FileServiceImp.java | 12 +- .../inspur/edp/lcm/metadata/common/Graph.java | 14 +- .../edp/lcm/metadata/common/MavenUtils.java | 8 +- .../inspur/edp/lcm/metadata/common/Utils.java | 6 +- .../edp/lcm/metadata/common/Vertex.java | 9 +- .../GspProjectConfigurationLoader.java | 4 +- .../MdExtRuleSerializerHelper.java | 50 +++--- .../configuration/MenuConfigLoader.java | 2 +- .../MetadataConfigurationLoader.java | 4 +- .../configuration/MetadataServiceHelper.java | 1 - .../common/logging/MvnStreamConsumer.java | 1 - .../lcm/metadata/common/util/CommandUtil.java | 29 ++-- .../lcm/metadata/common/util/EncryptUtil.java | 8 +- .../lcm/metadata/devcommon/ManagerUtils.java | 32 ++-- .../api/exception/MetadataExceptionCode.java | 2 +- .../lcm/metadata/core/I18nCoreService.java | 12 +- .../metadata/core/MetadataCoreManager.java | 8 +- .../core/MetadataProjectCoreService.java | 5 +- .../core/MetadataProjectServiceImp.java | 1 - .../lcm/metadata/core/PackageCoreService.java | 46 +++--- .../core/ProjectExtendCoreService.java | 11 +- .../core/config/JitRuntimeConfigLoader.java | 4 +- .../core/config/JitRuntimeHelper.java | 2 +- .../MetadataCreateEventListenerImpl.java | 4 +- .../core/exception/MvnExceptionHandler.java | 8 +- .../index/MetadataPackageIndexService.java | 22 +-- .../index/ProjectMetadataCacheService.java | 5 +- .../manager/MavenDeploymentForJarManager.java | 2 +- .../MavenDeploymentForMdpkgManager.java | 8 +- .../lcm/metadata/core/manager/PomManager.java | 2 +- .../MetadataProjectRepository.java | 2 +- .../core/persistence/MetadataRepository.java | 9 +- .../core/persistence/PomRepository.java | 16 +- .../core/sync/InstallJarRunnable.java | 6 +- .../extend/action/ExtractActionImpl.java | 3 +- .../edp/lcm/metadata/ref/MdpkgServiceImp.java | 4 +- model/framework/generator-api/pom.xml | 8 +- .../context/common/FileUtilsTest.java | 23 ++- model/framework/pom.xml | 10 +- .../rtservice/MetadataRTServiceImp.java | 3 +- .../MetadataRTServerServiceImpl.java | 21 ++- .../event/MdPkgChangedEventManager.java | 4 +- .../monitor/MdpkgListenerAdapter.java | 18 +-- .../MetadataPackageRepositoryImp.java | 3 +- 48 files changed, 309 insertions(+), 314 deletions(-) diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/FilterConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/FilterConfigData.java index ae0484e..1bbcbbf 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/FilterConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/FilterConfigData.java @@ -15,7 +15,6 @@ */ package com.inspur.edp.lcm.metadata.api.ConfigData; -import com.inspur.edp.lcm.metadata.api.ConfigData.BaseConfig; import java.io.Serializable; /** diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/IndexServerConfiguration.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/IndexServerConfiguration.java index 1ab08dd..92472ba 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/IndexServerConfiguration.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/IndexServerConfiguration.java @@ -16,16 +16,16 @@ package com.inspur.edp.lcm.metadata.api.entity.metadataindex; public class IndexServerConfiguration { - private String IP; + private String ip; private String port; - public String getIP() { - return IP; + public String getIp() { + return ip; } - public void setIP(String IP) { - this.IP = IP; + public void setIp(String ip) { + this.ip = ip; } public String getPort() { diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataCacheManager.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataCacheManager.java index 984b22c..04742a9 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataCacheManager.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataCacheManager.java @@ -30,211 +30,211 @@ import java.util.concurrent.locks.ReentrantLock; public class MetadataCacheManager { //元数据包基本信息 - private static final Map medataPackageInfo = new HashMap<>(); + private static final Map MEDATA_PACKAGE_INFO = new HashMap<>(); //元数据包清单列表信息 - private static final Map> metadataManifestInfo = new HashMap<>(); + private static final Map> METADATA_MANIFEST_INFO = new HashMap<>(); //元数据基础信息 - private static final Map metadataInfo = new HashMap<>(); + private static final Map METADATA_INFO = new HashMap<>(); //元数据依赖关系 - private static final Map metadataDependence = new HashMap<>(); + private static final Map METADATA_DEPENDENCE = new HashMap<>(); //元数据与元数据包名的映射关系 - private static final Map metadataPathMapping = new HashMap<>(); + private static final Map METADATA_PATH_MAPPING = new HashMap<>(); //所有的元数据包信息 - private static final Map> allMetadataPackageInfo = new HashMap<>(); + private static final Map> ALL_METADATA_PACKAGE_INFO = new HashMap<>(); //所有的元数据信息 - private static final Map> allMetadataInfo = new HashMap<>(); + private static final Map> ALL_METADATA_INFO = new HashMap<>(); private static Map> metadataListCache = new HashMap<>(); - private static final ReentrantLock lock = new ReentrantLock(); + private static final ReentrantLock LOCK = new ReentrantLock(); MetadataCacheManager() { } public static void removeMetadataInfo(String key) { - lock.lock(); + LOCK.lock(); try { - metadataInfo.remove(key); + METADATA_INFO.remove(key); } finally { - lock.unlock(); + LOCK.unlock(); } } public static Object getMetadataInfo(String metadataKey) { - lock.lock(); + LOCK.lock(); try { - return metadataInfo.get(metadataKey); + return METADATA_INFO.get(metadataKey); } finally { - lock.unlock(); + LOCK.unlock(); } } public static void addMetadataInfo(String key, GspMetadata metadata) { - lock.lock(); + LOCK.lock(); try { - metadataInfo.put(key, metadata); + METADATA_INFO.put(key, metadata); } finally { - lock.unlock(); + LOCK.unlock(); } } public static void removeMDDependence(String key) { - lock.lock(); + LOCK.lock(); try { - metadataDependence.remove(key); + METADATA_DEPENDENCE.remove(key); } finally { - lock.unlock(); + LOCK.unlock(); } } public static void addMDDependence(String key, List refs) { - lock.lock(); + LOCK.lock(); try { - metadataDependence.put(key, refs); + METADATA_DEPENDENCE.put(key, refs); } finally { - lock.unlock(); + LOCK.unlock(); } } public static void removeMetadataPackageInfo(String key) { - lock.lock(); + LOCK.lock(); try { - medataPackageInfo.remove(key); + MEDATA_PACKAGE_INFO.remove(key); } finally { - lock.unlock(); + LOCK.unlock(); } } public static void addMetadataPackageInfo(String key, MetadataPackage value) { - lock.lock(); + LOCK.lock(); try { - medataPackageInfo.put(key, value); + MEDATA_PACKAGE_INFO.put(key, value); } finally { - lock.unlock(); + LOCK.unlock(); } } public static Object getMetadataPackageInfo(String key) { - lock.lock(); + LOCK.lock(); try { - return medataPackageInfo.get(key); + return MEDATA_PACKAGE_INFO.get(key); } finally { - lock.unlock(); + LOCK.unlock(); } } public static void removeMDManifestInfo(String key) { - lock.lock(); + LOCK.lock(); try { - metadataManifestInfo.remove(key); + METADATA_MANIFEST_INFO.remove(key); } finally { - lock.unlock(); + LOCK.unlock(); } } public static void addMDManifestInfo(String key, List value) { - lock.lock(); + LOCK.lock(); try { - metadataManifestInfo.put(key, value); + METADATA_MANIFEST_INFO.put(key, value); } finally { - lock.unlock(); + LOCK.unlock(); } } public static Object getMDManifestInfo(String key) { - lock.lock(); + LOCK.lock(); try { - return metadataManifestInfo.get(key); + return METADATA_MANIFEST_INFO.get(key); } finally { - lock.unlock(); + LOCK.unlock(); } } public static void removeMPDependence(String key) { - lock.lock(); + LOCK.lock(); try { - metadataDependence.remove(key); + METADATA_DEPENDENCE.remove(key); } finally { - lock.unlock(); + LOCK.unlock(); } } public static void addMPDependence(String key, List value) { - lock.lock(); + LOCK.lock(); try { - metadataDependence.put(key, value); + METADATA_DEPENDENCE.put(key, value); } finally { - lock.unlock(); + LOCK.unlock(); } } public static Object getMetadataPathMapping(String key) { - lock.lock(); + LOCK.lock(); try { - return metadataPathMapping.get(key); + return METADATA_PATH_MAPPING.get(key); } finally { - lock.unlock(); + LOCK.unlock(); } } public static void addMetadataPathMapping(String key, String value) { - lock.lock(); + LOCK.lock(); try { - metadataPathMapping.put(key, value); + METADATA_PATH_MAPPING.put(key, value); } finally { - lock.unlock(); + LOCK.unlock(); } } public static void removeMetadataPathMapping(String key) { - lock.lock(); + LOCK.lock(); try { - metadataPathMapping.remove(key); + METADATA_PATH_MAPPING.remove(key); } finally { - lock.unlock(); + LOCK.unlock(); } } public static Object getAllMetadataPackageInfo(String key) { - lock.lock(); + LOCK.lock(); try { - return allMetadataPackageInfo.get(key); + return ALL_METADATA_PACKAGE_INFO.get(key); } finally { - lock.unlock(); + LOCK.unlock(); } } public static void addAllMetadataPackageInfo(String key, List value) { - lock.lock(); + LOCK.lock(); try { - allMetadataPackageInfo.put(key, value); + ALL_METADATA_PACKAGE_INFO.put(key, value); } finally { - lock.unlock(); + LOCK.unlock(); } } public static void removeAllMetadataPackageInfo(String key) { - lock.lock(); + LOCK.lock(); try { - allMetadataPackageInfo.remove(key); + ALL_METADATA_PACKAGE_INFO.remove(key); } finally { - lock.unlock(); + LOCK.unlock(); } } public static Object getAllMetadataInfo(String key) { - lock.lock(); + LOCK.lock(); try { - return allMetadataInfo.get(key); + return ALL_METADATA_INFO.get(key); } finally { - lock.unlock(); + LOCK.unlock(); } } public static void addAllMetadataInfo(String key, List value) { - lock.lock(); + LOCK.lock(); try { - allMetadataInfo.put(key, value); + ALL_METADATA_INFO.put(key, value); } finally { - lock.unlock(); + LOCK.unlock(); } } diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/RtCacheHandler.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/RtCacheHandler.java index eb31dda..b94e7fa 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/RtCacheHandler.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/RtCacheHandler.java @@ -21,21 +21,21 @@ import com.inspur.edp.lcm.metadata.common.context.RuntimeContext; public class RtCacheHandler { - public static final String allMetadataInfoCacheKey = "allMetadata"; - public static final String allPackagesCacheKey = "allPackages"; + public static final String ALL_METADATA_INFO_CACHE_KEY = "allMetadata"; + public static final String ALL_PACKAGES_CACHE_KEY = "allPackages"; - public static void updateMetadataPackageCache(String packageKey, MetadataPackage package_Renamed) { - if (package_Renamed.getHeader() != null) { + public static void updateMetadataPackageCache(String packageKey, MetadataPackage packageRenamed) { + if (packageRenamed.getHeader() != null) { MetadataCacheManager.removeMetadataPackageInfo(packageKey); - MetadataCacheManager.addMetadataPackageInfo(packageKey, package_Renamed); + MetadataCacheManager.addMetadataPackageInfo(packageKey, packageRenamed); } - if (package_Renamed.getMetadataList() != null) { + if (packageRenamed.getMetadataList() != null) { MetadataCacheManager.removeMDManifestInfo(packageKey); - MetadataCacheManager.addMDManifestInfo(packageKey, package_Renamed.getMetadataList()); + MetadataCacheManager.addMDManifestInfo(packageKey, packageRenamed.getMetadataList()); } - if (package_Renamed.getReference() != null) { + if (packageRenamed.getReference() != null) { MetadataCacheManager.removeMPDependence(packageKey); - MetadataCacheManager.addMPDependence(packageKey, package_Renamed.getReference()); + MetadataCacheManager.addMPDependence(packageKey, packageRenamed.getReference()); } } diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/FileServiceImp.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/FileServiceImp.java index 2063e00..a8aa0a1 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/FileServiceImp.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/FileServiceImp.java @@ -483,7 +483,7 @@ public class FileServiceImp implements FileService { @Override public boolean renameDirectory(String fromDir, String toDir) throws IOException { File from = new File(fromDir); - if ((!from.exists() || !from.isDirectory())) { + if (!from.exists() || !from.isDirectory()) { final String message = "Directory does not exist: " + fromDir; throw new IOException(message); @@ -561,7 +561,6 @@ public class FileServiceImp implements FileService { // targetpath.substring("java"); // list.add(targetpath); // } -// System.out.println("正在访问:" + dir + " 目录"); // return FileVisitResult.CONTINUE; // } }); @@ -617,7 +616,7 @@ public class FileServiceImp implements FileService { String entryName; String targetFileName; byte[] buffer = new byte[4096]; - int bytes_read; + int bytesRead; Enumeration entrys = zipFile.entries(); // 获取ZIP文件里所有的文件条目的名字 while (entrys.hasMoreElements()) { // 循环遍历所有的文件条目的名字 zn = (ZipEntry) entrys.nextElement(); @@ -630,16 +629,14 @@ public class FileServiceImp implements FileService { new File(targetFileName).getParentFile().mkdirs();// 如果zn是文件,则创建父目录 } File targetFile = new File(targetFileName); // 否则创建文件 -// System.out.println("正在创建文件:" + targetFile.getAbsolutePath()); FileOutputStream os = new FileOutputStream(targetFile);// 打开文件输出流 InputStream is = zipFile.getInputStream(zn); // 从ZipFile对象中打开entry的输入流 - while ((bytes_read = is.read(buffer)) != -1) { - os.write(buffer, 0, bytes_read); + while ((bytesRead = is.read(buffer)) != -1) { + os.write(buffer, 0, bytesRead); } os.close(); // 关闭流 is.close(); } -// System.out.println("解压缩"+zipName+"成功!"); } catch (IOException err) { throw new ZipException("解压缩" + zipName + "失败: " + err); } @@ -733,7 +730,6 @@ public class FileServiceImp implements FileService { public String getRelPath(String a, String b) { a = Utils.handlePath(a).replace("//", "/"); b = Utils.handlePath(b).replace("//", "/"); - ; if (a.indexOf(':') > -1) { a = a.substring(a.indexOf(':') + 1); } diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Graph.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Graph.java index d8c74fa..1db0529 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Graph.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Graph.java @@ -218,19 +218,17 @@ public class Graph { Vertex vertex; Edge edge; T label; - System.out.println("图是否为有向图:" + isDirect + ",图的顶点个数:" + getVertexCount() + ",图的总边个数:" + getEdgeCount()); +// "图是否为有向图:" + isDirect + ",图的顶点个数:" + getVertexCount() + ",图的总边个数:" + getEdgeCount() while (iteratorVertex.hasNext()) { vertex = iteratorVertex.next(); label = vertex.getLabel(); iteratorEdge = vertex.getEdgeIterator(); - System.out.println("顶点:" + label + ",以这个顶点为出发点的边的个数:" + getEdgeCount(label) + ",该顶点的权值为:" + vertex.getCost()); +// "顶点:" + label + ",以这个顶点为出发点的边的个数:" + getEdgeCount(label) + ",该顶点的权值为:" + vertex.getCost() while (iteratorEdge.hasNext()) { edge = iteratorEdge.next(); - System.out.print("边:从 " + label + " 到 " + edge.getEndVertex().getLabel() + " ,权值:" + edge.getWeight() + " "); +// "边:从 " + label + " 到 " + edge.getEndVertex().getLabel() + " ,权值:" + edge.getWeight() + " " } - System.out.println(); } - System.out.println(); } //下面与拓扑排序相关 @@ -245,7 +243,7 @@ public class Graph { Iterator> iterator = getVertexIterator(); while (iterator.hasNext()) { vertex = iterator.next(); - if ((vertex.isVisited() == false) && (vertex.getUnvisitedVertex() == null)) { + if ((!vertex.isVisited()) && (vertex.getUnvisitedVertex() == null)) { //返回一个出度为0(以该点出发的边数为0或者以该点出发的边的结束点都被访问过了),而且没有被访问过的顶点 return vertex; } @@ -267,13 +265,13 @@ public class Graph { vertex = getNextTuopoVertex(); if (vertex == null) { //如果得不到下一个出度为0的节点,直接返回stack - System.out.println("拓扑排序结束"); +// "拓扑排序结束" return stack; } //顶点入栈并被访问,遍历完成后,出栈就可以获得图的一个拓扑序列 stack.push(vertex); vertex.visit(); - System.out.println("拓扑排序:入栈节点:" + vertex.getLabel()); +// "拓扑排序:入栈节点:" + vertex.getLabel() } } diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MavenUtils.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MavenUtils.java index 54b43bc..37d1c83 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MavenUtils.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MavenUtils.java @@ -16,11 +16,11 @@ package com.inspur.edp.lcm.metadata.common; public class MavenUtils { - public static final String pomFile = "pom.xml"; + public static final String POM_FILE = "pom.xml"; - public static final String tempFolder = "temp"; + public static final String TEMP_FOLDER = "temp"; - public static final String resourcesDir = "src/main/resources"; + public static final String RESOURCES_DIR = "src/main/resources"; - public static final String snapShot = "SNAPSHOT"; + public static final String SNAP_SHOT = "SNAPSHOT"; } diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Utils.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Utils.java index 3932b5e..8d0bb30 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Utils.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Utils.java @@ -41,7 +41,7 @@ import java.util.zip.ZipOutputStream; import org.codehaus.plexus.util.StringUtils; public class Utils { - private static final Lock lock = new ReentrantLock(); + private static final Lock LOCK = new ReentrantLock(); //元数据工程后缀 private static String metadataProjSuffix; // pom后缀 @@ -260,7 +260,7 @@ public class Utils { if (metadataPostfixTypes != null && metadataPostfixTypes.size() > 0) { return metadataPostfixTypes; } - lock.lock(); + LOCK.lock(); try { if (metadataPostfixTypes != null && metadataPostfixTypes.size() > 0) { return metadataPostfixTypes; @@ -276,7 +276,7 @@ public class Utils { } catch (Exception e) { e.printStackTrace(); } finally { - lock.unlock(); + LOCK.unlock(); } return null; diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Vertex.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Vertex.java index aaacd01..688cbe4 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Vertex.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Vertex.java @@ -94,6 +94,13 @@ public class Vertex { return result; } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + (label == null ? 0 : label.hashCode()); + return result; + } + //下面与顶点的边相关 /** @@ -222,7 +229,7 @@ public class Vertex { while (iterator.hasNext()) { edge = iterator.next(); vertex = edge.getEndVertex(); - if (vertex.isVisited() == false) { + if (!vertex.isVisited()) { return vertex; } } diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectConfigurationLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectConfigurationLoader.java index 05f70cf..7480eca 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectConfigurationLoader.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectConfigurationLoader.java @@ -33,7 +33,7 @@ public class GspProjectConfigurationLoader implements Serializable { public static List gspProjectConfigurations; private static String fileName = "config/platform/common/lcm_gspprojectextend.json"; - private static final String sectionName = "ProjectConfiguration"; + private static final String SECTION_NAME = "ProjectConfiguration"; public GspProjectConfigurationLoader() { loadGspProjectConfigurations(); @@ -53,7 +53,7 @@ public class GspProjectConfigurationLoader implements Serializable { FileServiceImp fileService = new FileServiceImp(); fileName = fileService.getCombinePath(EnvironmentUtil.getServerRTPath(), fileName); if (gspProjectConfigurations == null || gspProjectConfigurations.size() <= 0) { - gspProjectConfigurations = metadataServiceHelper.getProjectConfiguration(fileName, sectionName); + gspProjectConfigurations = metadataServiceHelper.getProjectConfiguration(fileName, SECTION_NAME); return gspProjectConfigurations; } else { return gspProjectConfigurations; diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MdExtRuleSerializerHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MdExtRuleSerializerHelper.java index 20e4bc4..d47f3ec 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MdExtRuleSerializerHelper.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MdExtRuleSerializerHelper.java @@ -18,32 +18,32 @@ package com.inspur.edp.lcm.metadata.common.configuration; import com.inspur.edp.lcm.metadata.api.ConfigData.MetadataConfiguration; import com.inspur.edp.lcm.metadata.spi.MdExtendRuleSerializer; -public class MdExtRuleSerializerHelper extends MetadataConfigurationLoader { - private static MdExtRuleSerializerHelper singleton = null; +public class MdExtRuleSerializerHelper extends MetadataConfigurationLoader { + private static MdExtRuleSerializerHelper singleton = null; - private MdExtRuleSerializerHelper(){ - } + private MdExtRuleSerializerHelper() { + } - public static MdExtRuleSerializerHelper getInstance(){ - if (singleton == null){ - singleton = new MdExtRuleSerializerHelper(); - } - return singleton; - } + public static MdExtRuleSerializerHelper getInstance() { + if (singleton == null) { + singleton = new MdExtRuleSerializerHelper(); + } + return singleton; + } - public MdExtendRuleSerializer getManager(String typeName) { - MdExtendRuleSerializer manager = null; - MetadataConfiguration data = getMetadataConfigurationData(typeName); - if (data != null&&data.getMdExtRuleSerializer()!=null){ - Class cls = null; - try { - cls = Class.forName(data.getMdExtRuleSerializer().getName()); - manager = (MdExtendRuleSerializer)cls.newInstance(); - } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - } - return manager; - } + public MdExtendRuleSerializer getManager(String typeName) { + MdExtendRuleSerializer manager = null; + MetadataConfiguration data = getMetadataConfigurationData(typeName); + if (data != null && data.getMdExtRuleSerializer() != null) { + Class cls = null; + try { + cls = Class.forName(data.getMdExtRuleSerializer().getName()); + manager = (MdExtendRuleSerializer) cls.newInstance(); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + return manager; + } } diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MenuConfigLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MenuConfigLoader.java index 9d5d34b..78a1e08 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MenuConfigLoader.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MenuConfigLoader.java @@ -37,7 +37,7 @@ public class MenuConfigLoader { contents = fileService.fileRead(fileName); - String flag = status == true ? "on:" : "off:"; + String flag = status ? "on:" : "off:"; menuExtendConfiguration = contents.substring(contents.indexOf(flag) + flag.length(), contents.indexOf("\n", contents.indexOf(flag)) - 1); return menuExtendConfiguration; } diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationLoader.java index ae28f17..744600b 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationLoader.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationLoader.java @@ -37,7 +37,7 @@ public class MetadataConfigurationLoader implements Serializable { @Getter public static List metadataConfigurations; private static String fileName = "config/platform/common/lcm_metadataextend.json"; - private static final String sectionName = "MetadataConfiguration"; + private static final String SECTION_NAME = "MetadataConfiguration"; public MetadataConfigurationLoader() { loadMetadataConfigurations(); @@ -58,7 +58,7 @@ public class MetadataConfigurationLoader implements Serializable { fileName = fileService.getCombinePath(EnvironmentUtil.getServerRTPath(), fileName); if (metadataConfigurations == null || metadataConfigurations.size() <= 0) { - metadataConfigurations = metadataServiceHelper.getMetadataConfigurationList(fileName, sectionName); + metadataConfigurations = metadataServiceHelper.getMetadataConfigurationList(fileName, SECTION_NAME); return metadataConfigurations; } else { return metadataConfigurations; diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataServiceHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataServiceHelper.java index da4b380..787fb86 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataServiceHelper.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataServiceHelper.java @@ -15,7 +15,6 @@ */ package com.inspur.edp.lcm.metadata.common.configuration; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonNode; diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/logging/MvnStreamConsumer.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/logging/MvnStreamConsumer.java index 476f7fb..3620543 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/logging/MvnStreamConsumer.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/logging/MvnStreamConsumer.java @@ -34,7 +34,6 @@ public class MvnStreamConsumer implements InvocationOutputHandler { @Override public void consumeLine(String line) { if (line.contains("[INFO]")) { -// System.out.println("mvn userId :"+CAFContext.current.getUserId()); LoggerDisruptorQueue.publishEvent(line, CAFContext.current.getUserId()); log.info(line); } else if (line.contains("[WARNING]")) { diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/CommandUtil.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/CommandUtil.java index 086b1fb..882b03f 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/CommandUtil.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/CommandUtil.java @@ -59,7 +59,6 @@ public class CommandUtil { if (line == null) { break; } - System.out.println(line); } p.waitFor(); @@ -379,7 +378,8 @@ public class CommandUtil { } // 对启动路径和运行参数的拼接 - public static String getCommandFormatStr(String proPath) {// 这样的思路就可以控制俩种参数的输入 + // 这样的思路就可以控制俩种参数的输入 + public static String getCommandFormatStr(String proPath) { return getCommandFormatStr(proPath, null); } @@ -403,7 +403,8 @@ public class CommandUtil { } // 通过cmd打开对应的文件 - public static void openDir(String fileDir) throws Exception {// 打开cmd,执行explorer + // 打开cmd,执行explorer + public static void openDir(String fileDir) throws Exception { Runtime.getRuntime().exec("cmd /c start explorer " + fileDir);// explorer.exe是Windows的程序管理器或者文件资源管理器 } @@ -416,10 +417,10 @@ public class CommandUtil { InputStreamReader ir = null; BufferedReader br = null; String line = ""; - String LISTENING_STATE_TYPE = "LISTENING";// 状态值 + String listeningStateType = "LISTENING";// 状态值 String[] array; try { - Process p = Runtime.getRuntime().exec("cmd /c netstat /ano | findstr [ | findstr " + pid + " | findstr " + LISTENING_STATE_TYPE); + Process p = Runtime.getRuntime().exec("cmd /c netstat /ano | findstr [ | findstr " + pid + " | findstr " + listeningStateType); is = p.getInputStream(); ir = new InputStreamReader(is); br = new BufferedReader(ir); @@ -464,14 +465,14 @@ public class CommandUtil { InputStreamReader ir = null; BufferedReader br = null; String line = null; - String TCP_TYPE = "TCP"; - String UDP_TYPE = "UDP"; - String LISTENING_STATE_TYPE = "LISTENING";// 状态值 + String tcpType = "TCP"; + String udpType = "UDP"; + String listeningStateType = "LISTENING";// 状态值 Map> portMap = new HashMap<>(); List tcpPortList = new ArrayList<>(); List udpPortList = new ArrayList<>(); - portMap.put(TCP_TYPE, tcpPortList); - portMap.put(UDP_TYPE, udpPortList); + portMap.put(tcpType, tcpPortList); + portMap.put(udpType, udpPortList); String[] array; try { Process p = Runtime.getRuntime().exec("netstat /ano"); @@ -481,8 +482,8 @@ public class CommandUtil { do { if (line.indexOf(pid) != -1) { line = line.replaceFirst("\\s+", ""); - if (line.indexOf(TCP_TYPE) != -1) { - if (line.indexOf(LISTENING_STATE_TYPE) != -1) { + if (line.indexOf(tcpType) != -1) { + if (line.indexOf(listeningStateType) != -1) { array = line.split("\\s+"); String port = array[1].split(":")[1]; tcpPortList.add(port); @@ -602,8 +603,8 @@ public class CommandUtil { } public static boolean isWindows() { - String OS = System.getProperty("os.name").toLowerCase(); - boolean isWindows = OS.startsWith("windows"); + String os = System.getProperty("os.name").toLowerCase(); + boolean isWindows = os.startsWith("windows"); return isWindows; } diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/EncryptUtil.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/EncryptUtil.java index 73adf48..e5cd47e 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/EncryptUtil.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/EncryptUtil.java @@ -22,12 +22,12 @@ import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; public class EncryptUtil { - final static BASE64Decoder decoder = new BASE64Decoder(); - final static BASE64Encoder encoder = new BASE64Encoder(); + final static BASE64Decoder DECODER = new BASE64Decoder(); + final static BASE64Encoder ENCODER = new BASE64Encoder(); public static String decryptInBASE64(String decryptString) { try { - return new String(decoder.decodeBuffer(decryptString), StandardCharsets.UTF_8); + return new String(DECODER.decodeBuffer(decryptString), StandardCharsets.UTF_8); } catch (Exception e) { throw new RuntimeException("配置解密失败, 请重新配置或者联系系统管理员。", e); } @@ -38,7 +38,7 @@ public class EncryptUtil { return ""; } try { - return encoder.encode(encodeString.getBytes(StandardCharsets.UTF_8.name())); + return ENCODER.encode(encodeString.getBytes(StandardCharsets.UTF_8.name())); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/devcommon/ManagerUtils.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/devcommon/ManagerUtils.java index 020a72c..21fdb96 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/devcommon/ManagerUtils.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/devcommon/ManagerUtils.java @@ -19,10 +19,10 @@ import com.inspur.edp.lcm.metadata.common.FileServiceImp; import com.inspur.edp.lcm.metadata.common.configuration.WorkspaceHelper; public class ManagerUtils { - public static final String Spring_Shell_Flag_Name = "spring-shell"; - public static final String Spring_Shell_Flag_True = "1"; - public static final boolean Shell_Flag = Spring_Shell_Flag_True.equals(System.getProperty(Spring_Shell_Flag_Name)); - private static final FileServiceImp fileService = new FileServiceImp(); + public static final String SPRING_SHELL_FLAG_NAME = "spring-shell"; + public static final String SPRING_SHELL_FLAG_TRUE = "1"; + public static final boolean SHELL_FLAG = SPRING_SHELL_FLAG_TRUE.equals(System.getProperty(SPRING_SHELL_FLAG_NAME)); + private static final FileServiceImp FILE_SERVICE = new FileServiceImp(); /** * 获取开发根路径 */ @@ -31,28 +31,28 @@ public class ManagerUtils { private static String metadataPackageLocation; public static String getDevRootPath() { - if (Shell_Flag) { + if (SHELL_FLAG) { return devRootPath; } return WorkspaceHelper.getInstance().getDevRootPath(); } public static void setDevRootPath(String path) { - if (Shell_Flag) { + if (SHELL_FLAG) { devRootPath = path; } } public static String getMetadataPackageLocation() { - if (Shell_Flag) { + if (SHELL_FLAG) { return metadataPackageLocation; } - return fileService.getCombinePath(getDevRootPath(), "packages"); + return FILE_SERVICE.getCombinePath(getDevRootPath(), "packages"); } public static void setMetadataPackageLocation(String metadataPackageLoc) { - if (Shell_Flag) { + if (SHELL_FLAG) { metadataPackageLocation = metadataPackageLoc; } } @@ -63,7 +63,7 @@ public class ManagerUtils { */ public static String getAbsolutePath(String path) { path = handlePath(path); - if (Shell_Flag) { + if (SHELL_FLAG) { if (isAbsolutePath(path)) { return path; } else { @@ -84,7 +84,7 @@ public class ManagerUtils { if (path.startsWith("/")) { path = path.substring(1); } - String absolutePath = fileService.getCombinePath(devRootPath, path); + String absolutePath = FILE_SERVICE.getCombinePath(devRootPath, path); // TODO 判断路径是否存在 return handlePath(absolutePath); } @@ -98,22 +98,22 @@ public class ManagerUtils { } public static String getMavenStoragePath() { - if (Shell_Flag) { + if (SHELL_FLAG) { return mavenStoragePath; } - return fileService.getCombinePath(getDevRootPath(), "maven"); + return FILE_SERVICE.getCombinePath(getDevRootPath(), "maven"); } public static void setMavenStoragePath(String mavenStorageP) { - if (Shell_Flag) { + if (SHELL_FLAG) { mavenStoragePath = mavenStorageP; } } public static String getRalativePath(String relativeFullPath) { String relativePath; - if (!getDevRootPath().isEmpty() && fileService.startWith(relativeFullPath, getDevRootPath())) { - relativePath = fileService.getRelPath(relativeFullPath, getDevRootPath()); + if (!getDevRootPath().isEmpty() && FILE_SERVICE.startWith(relativeFullPath, getDevRootPath())) { + relativePath = FILE_SERVICE.getRelPath(relativeFullPath, getDevRootPath()); } else { relativePath = relativeFullPath; } diff --git a/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/exception/MetadataExceptionCode.java b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/exception/MetadataExceptionCode.java index f0766d0..45feca0 100644 --- a/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/exception/MetadataExceptionCode.java +++ b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/exception/MetadataExceptionCode.java @@ -16,5 +16,5 @@ package com.inspur.edp.lcm.metadata.api.exception; public class MetadataExceptionCode { - public final String Unknown = "GSP_LCM_Meta_0000"; + public final String unknown = "GSP_LCM_Meta_0000"; } diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/I18nCoreService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/I18nCoreService.java index a781878..89ee2ca 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/I18nCoreService.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/I18nCoreService.java @@ -39,8 +39,8 @@ public class I18nCoreService { private final MetadataCoreManager metadataCoreManager = new MetadataCoreManager(); - private final String RESOURCE_METADATA_TYPE = "ResourceMetadata"; - private final String LINGUISTIC_RESOURCE_METADATA_TYPE = "LinguisticResource"; + private final String resourceMetadataType = "ResourceMetadata"; + private final String linguisticResourceMetadataType = "LinguisticResource"; public static I18nCoreService getInstance() { if (sigleton == null) { @@ -102,7 +102,7 @@ public class I18nCoreService { header.setFileName(resourceMetadataFileName); header.setNameSpace(metadata.getHeader().getNameSpace()); header.setBizObjectId(metadata.getHeader().getBizObjectId()); - header.setType(RESOURCE_METADATA_TYPE); + header.setType(resourceMetadataType); resourceMetadata.setHeader(header); } II18nResourceDTManager i18nResourceDTManager = SpringBeanUtils.getBean(II18nResourceDTManager.class); @@ -136,7 +136,7 @@ public class I18nCoreService { private String getResourceMetadataFileName(GspMetadata metadata) { String metadataSuffix = getMetadataSuffix(metadata.getHeader().getType()); - String resourceMetadataSuffix = getMetadataSuffix(RESOURCE_METADATA_TYPE); + String resourceMetadataSuffix = getMetadataSuffix(resourceMetadataType); return metadata.getHeader().getCode() + metadataSuffix + resourceMetadataSuffix; } @@ -193,7 +193,7 @@ public class I18nCoreService { header.setFileName(languageMetadataFileName); header.setNameSpace(metadata.getHeader().getNameSpace()); header.setBizObjectId(metadata.getHeader().getBizObjectId()); - header.setType(LINGUISTIC_RESOURCE_METADATA_TYPE); + header.setType(linguisticResourceMetadataType); languageMetadata.setHeader(header); } II18nResourceDTManager i18nResourceDTManager = SpringBeanUtils.getBean(II18nResourceDTManager.class); @@ -209,7 +209,7 @@ public class I18nCoreService { private String getLanguageMetadataFileName(GspMetadata metadata) { String language = metadata.getHeader().getLanguage(); String metadataSuffix = getMetadataSuffix(metadata.getHeader().getType()); - String linguisticMetadataSuffix = getMetadataSuffix(LINGUISTIC_RESOURCE_METADATA_TYPE); + String linguisticMetadataSuffix = getMetadataSuffix(linguisticResourceMetadataType); return metadata.getHeader().getCode() + metadataSuffix + "." + language + linguisticMetadataSuffix; } } diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java index 4cdb631..7d2e459 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java @@ -739,7 +739,7 @@ public class MetadataCoreManager { try { String pageWebapiOfIndexServer = IndexServerManager.getInstance().getPageWebapiOfIndexServerWithProcessMode(); - // pageWebapiOfIndexServer = pageWebapiOfIndexServer.replace("10.24.15.33", "localhost"); +// pageWebapiOfIndexServer = pageWebapiOfIndexServer.replace("10.24.15.33", "localhost"); ProcessMode processMode = metadataProjInfo.getMetadataPackageInfo().getProcessMode() == null ? ProcessMode.GENERATION : metadataProjInfo.getMetadataPackageInfo().getProcessMode(); MetadataInfoFilterWithProcessMode filter = getMetadataInfoFilter(text, typeList, page, pageSize, pageIndex, selectedPackageSource, path, isFilterByRefs, processMode); PageMetadataInfoWithProcessMode pageMetadataInfoWithProcessMode = RestTemplateService.instance.getObjectByPost(pageWebapiOfIndexServer, filter); @@ -748,7 +748,7 @@ public class MetadataCoreManager { } catch (Exception e) { String pageWebapiOfIndexServer = IndexServerManager.getInstance().getPageWebapiOfIndexServer(); - // pageWebapiOfIndexServer = pageWebapiOfIndexServer.replace("10.24.15.33", "localhost"); +// pageWebapiOfIndexServer = pageWebapiOfIndexServer.replace("10.24.15.33", "localhost"); MetadataInfoFilter filter = getMetadataInfoFilter(text, typeList, page, pageSize, pageIndex, selectedPackageSource, path, isFilterByRefs); PageMetadataInfo pageMetadataInfo = RestTemplateService.instance.getObjectByPost(pageWebapiOfIndexServer, filter); List metadataInfos = pageMetadataInfo.getMetadataInfos(); @@ -1015,7 +1015,7 @@ public class MetadataCoreManager { metadataIndexRepoItemDto.setProcessMode(ProcessMode.GENERATION.toString()); metadataIndexRepoItemDtoList.add(metadataIndexRepoItemDto); }); - if ((version.getMavenInfos() == null || version.getMavenInfos().size() < 1)) { + if (version.getMavenInfos() == null || version.getMavenInfos().size() < 1) { indexDto.setRepoPkg(new ArrayList<>()); } else { indexDto.setRepoPkg(metadataIndexRepoItemDtoList); @@ -1053,7 +1053,7 @@ public class MetadataCoreManager { metadataIndexRepoItemDto.setProcessMode(maveninfo.getProcessMode()); metadataIndexRepoItemDtoList.add(metadataIndexRepoItemDto); }); - if ((version.getMavenInfos() == null || version.getMavenInfos().size() < 1)) { + if (version.getMavenInfos() == null || version.getMavenInfos().size() < 1) { indexDto.setRepoPkg(new ArrayList<>()); } else { indexDto.setRepoPkg(metadataIndexRepoItemDtoList); diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectCoreService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectCoreService.java index 327e871..f947042 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectCoreService.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectCoreService.java @@ -44,7 +44,6 @@ import java.util.List; import java.util.Map; import java.util.Stack; import java.util.concurrent.ConcurrentHashMap; -import lombok.var; import org.codehaus.plexus.util.StringUtils; public class MetadataProjectCoreService { @@ -607,7 +606,7 @@ public class MetadataProjectCoreService { getAllFilesUnderDir(filePathList, temPath); } } - var paths = fileService.getAllFiles(dirPath); + List paths = fileService.getAllFiles(dirPath); if (paths.size() > 0) { for (File path : paths) { filePathList.add(Utils.handlePath(path.getPath())); @@ -718,7 +717,7 @@ public class MetadataProjectCoreService { break; } } catch (Exception e) { - System.out.println("无法读取工程" + projPath + "的信息。"); +// "无法读取工程" + projPath + "的信息。" } } boInfo.setProjectCount(projPaths.size()); diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectServiceImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectServiceImp.java index ed88181..aca29e8 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectServiceImp.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectServiceImp.java @@ -113,7 +113,6 @@ public class MetadataProjectServiceImp implements MetadataProjectService { if (StringUtils.isEmpty(path)) { throw new RuntimeException("路径不能为空"); } - ; //全路径 String absolutePath = ManagerUtils.getAbsolutePath(path); projectCoreService.createGspProject(absolutePath, projectData); diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageCoreService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageCoreService.java index 773820a..2a8bb8c 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageCoreService.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageCoreService.java @@ -205,7 +205,7 @@ public class PackageCoreService { e.printStackTrace(); } if (!errorMsgs.isEmpty()) { - String log = ("[LCM Error]以下工程批量操作失败,请排除问题后重新编译:"); + String log = "[LCM Error]以下工程批量操作失败,请排除问题后重新编译:"; LoggerDisruptorQueue.publishEvent(log, CAFContext.current.getUserId()); for (String msg : errorMsgs) { LoggerDisruptorQueue.publishEvent("[LCM Error]" + msg, CAFContext.current.getUserId()); @@ -283,7 +283,7 @@ public class PackageCoreService { } String metadataPath = fileServiceImp.getCombinePath(absolutePath, Utils.getMetadataProjPath()); - String pomPath = fileServiceImp.getCombinePath(metadataPath, MavenUtils.pomFile); + String pomPath = fileServiceImp.getCombinePath(metadataPath, MavenUtils.POM_FILE); ProcessMode processMode = metadataProjectCoreService.getProcessMode(absolutePath); try { // 创建pom @@ -291,7 +291,7 @@ public class PackageCoreService { pomManager.createPomForDependencyCopy(refs, pomPath); // copy dependency - downloadPath = fileServiceImp.getCombinePath(mavenPath, MavenUtils.tempFolder); + downloadPath = fileServiceImp.getCombinePath(mavenPath, MavenUtils.TEMP_FOLDER); copyDependencies(metadataPath, mavenPath, downloadPath, forceUpdateFlag); // 解压并复制下载的元数据包到maven目录下 @@ -370,14 +370,14 @@ public class PackageCoreService { //添加api依赖 String apiPath = fileServiceImp.getApiModulePath(absolutePath); if (apiPath != null && !apiPath.isEmpty()) { - String pomApi = fileServiceImp.getCombinePath(fileServiceImp.getApiModulePath(absolutePath), MavenUtils.pomFile); + String pomApi = fileServiceImp.getCombinePath(fileServiceImp.getApiModulePath(absolutePath), MavenUtils.POM_FILE); if (fileServiceImp.isFileExist(pomApi)) { addProjectDependency(pomApi, groupId, artifactId, version); } } } finally { - String metadataPomPath = fileServiceImp.getCombinePath(metadataPath, MavenUtils.pomFile); + String metadataPomPath = fileServiceImp.getCombinePath(metadataPath, MavenUtils.POM_FILE); //删除pom.xml if (fileServiceImp.isFileExist(metadataPomPath)) { fileServiceImp.fileDelete(metadataPomPath); @@ -466,7 +466,7 @@ public class PackageCoreService { } String codepath = projPath + File.separator + "java" + File.separator + Utils.getMavenProName(); - String apiPomPath = fileServiceImp.getApiModulePath(projPath) + File.separator + MavenUtils.pomFile; + String apiPomPath = fileServiceImp.getApiModulePath(projPath) + File.separator + MavenUtils.POM_FILE; String revertCommand = "versions:revert"; String commitCommand = "versions:commit"; String command = String.format("versions:set -DnewVersion=%s", version); @@ -482,7 +482,7 @@ public class PackageCoreService { list = model.getDependencies(); for (Dependency dependency : list) { if (dependency.getVersion() != null) { - if (dependency.getVersion().endsWith(MavenUtils.snapShot)) { + if (dependency.getVersion().endsWith(MavenUtils.SNAP_SHOT)) { dependency.setVersion(dependenciesVersion); } } @@ -555,16 +555,16 @@ public class PackageCoreService { //接下来拷贝元数据 String moduleApiPath; String codePath = proPath + File.separator + "java" + File.separator + Utils.getMavenProName(); - String codePom = fileServiceImp.getCombinePath(codePath, MavenUtils.pomFile); + String codePom = fileServiceImp.getCombinePath(codePath, MavenUtils.POM_FILE); String apiPomPath; String metadataBin = File.separator + "metadata" + File.separator + "bin"; String metadataBinPath = proPath + metadataBin; String metadataPath = File.separator + "metadata"; String metadataDir = proPath + metadataPath; - String metadataTempDir = fileServiceImp.getCombinePath(metadataDir, MavenUtils.tempFolder); + String metadataTempDir = fileServiceImp.getCombinePath(metadataDir, MavenUtils.TEMP_FOLDER); if (isModelExist) { moduleApiPath = fileServiceImp.getApiModulePath(proPath); - apiPomPath = fileServiceImp.getCombinePath(moduleApiPath, MavenUtils.pomFile); + apiPomPath = fileServiceImp.getCombinePath(moduleApiPath, MavenUtils.POM_FILE); //读mdproj获取依赖信息 metadataProject = metadataProjectCoreService.getMetadataProjInfo(metadataDir); List refsList = metadataProject.getMavenPackageRefs(); @@ -572,7 +572,7 @@ public class PackageCoreService { //获取api module的groupId,artifactId,version apiModuleInfo = getApiModuleInfo(apiPomPath); if (apiModuleInfo != null) { - boolean isSnapshot = apiModuleInfo.getVersion().endsWith(MavenUtils.snapShot); + boolean isSnapshot = apiModuleInfo.getVersion().endsWith(MavenUtils.SNAP_SHOT); setRepoUrl(codePom, repoUrl, repoId, isSnapshot); } createPomForDeploy(apiModuleInfo, refsList, metadataTempDir, repoUrl, repoId, dependencyVersion); @@ -595,7 +595,7 @@ public class PackageCoreService { throw new RuntimeException("找不到元数据包,请先编译!"); } String metadataFullPath = metadataBinPath + File.separator + metadaPackageName; - String destPath = metadataTempDir + File.separator + MavenUtils.resourcesDir + File.separator + metadaPackageName; + String destPath = metadataTempDir + File.separator + MavenUtils.RESOURCES_DIR + File.separator + metadaPackageName; try { fileServiceImp.fileCopy(metadataFullPath, destPath); } catch (IOException e) { @@ -838,7 +838,7 @@ public class PackageCoreService { } // 是临时包则下载;maven文件夹下需要元数据包和pom文件,缺一则下载;packages文件夹下需要元数据包,缺少则下载 - boolean installFlag = ref.getVersion().contains(MavenUtils.snapShot) && force; + boolean installFlag = ref.getVersion().contains(MavenUtils.SNAP_SHOT) && force; if (!installFlag) { List fileInMaven = fileServiceImp.getAllFiles(mavenPath + File.separator + ref.getGroupId() + "-" + ref.getArtifactId() + "-" + ref.getVersion()); installFlag = fileInMaven.size() < 2; @@ -1046,7 +1046,7 @@ public class PackageCoreService { private boolean createPomAndDownloadMdproj(String groupid, String artifactid, String version, String path, Boolean forceUpdateFlag, String mavenPath) throws IOException { - File pomFile = new File(fileServiceImp.getCombinePath(path, MavenUtils.pomFile)); + File pomFile = new File(fileServiceImp.getCombinePath(path, MavenUtils.POM_FILE)); if (!pomFile.exists()) { if (pomFile.createNewFile()) { log.debug("创建下载pom.xml完成"); @@ -1070,7 +1070,7 @@ public class PackageCoreService { MavenXpp3Writer mavenXpp3Writer = new MavenXpp3Writer(); mavenXpp3Writer.write(fileOutputStream, model); fileOutputStream.close(); - downloadPath = fileServiceImp.getCombinePath(mavenPath, MavenUtils.tempFolder); + downloadPath = fileServiceImp.getCombinePath(mavenPath, MavenUtils.TEMP_FOLDER); //获取排除的artifact MetadataProject metadataProject = metadataProjectCoreService.getMetadataProjInfo(metadataProjectCoreService.getProjPath(path)); @@ -1132,7 +1132,7 @@ public class PackageCoreService { throw new IllegalArgumentException("工程路径不能为空"); } if (ref.getGroupId() != null && ref.getArtifactId() != null && ref.getVersion() != null) { - if (ref.getVersion().contains(MavenUtils.snapShot)) { + if (ref.getVersion().contains(MavenUtils.SNAP_SHOT)) { try { installMdpkg(ref.getGroupId(), ref.getArtifactId(), ref.getVersion(), path, mavenPath, packagePath); } catch (IOException e) { @@ -1162,19 +1162,19 @@ public class PackageCoreService { log.debug("创建打包目录完成"); } } - File pom_file = new File(fileServiceImp.getCombinePath(pomDir.toString(), MavenUtils.pomFile)); - if (!pom_file.exists()) { - if (pom_file.createNewFile()) { + File pomFile = new File(fileServiceImp.getCombinePath(pomDir.toString(), MavenUtils.POM_FILE)); + if (!pomFile.exists()) { + if (pomFile.createNewFile()) { log.debug("创建打包pom.xml完成"); } } - try (FileOutputStream fileOutputStream = new FileOutputStream(pom_file)) { + try (FileOutputStream fileOutputStream = new FileOutputStream(pomFile)) { Model model = new Model(); //构造父pom信息 Parent parent = new Parent(); parent.setArtifactId("metadata-parent"); parent.setGroupId("com.inspur.edp"); - boolean isSnotshot = apiModuleInfo.getVersion().endsWith(MavenUtils.snapShot); + boolean isSnotshot = apiModuleInfo.getVersion().endsWith(MavenUtils.SNAP_SHOT); parent.setVersion("0.1.0"); model.setParent(parent); model.setArtifactId(info.getArtifactId()); @@ -1190,7 +1190,7 @@ public class PackageCoreService { Dependency dependency = new Dependency(); dependency.setGroupId(ref.getGroupId()); dependency.setArtifactId(ref.getArtifactId()); - if (dependencyVersion != null && ref.getVersion().endsWith(MavenUtils.snapShot)) { + if (dependencyVersion != null && ref.getVersion().endsWith(MavenUtils.SNAP_SHOT)) { dependency.setVersion("m" + dependencyVersion); } else { @@ -1224,7 +1224,7 @@ public class PackageCoreService { } private boolean createSrcDir(String mdpkgPath) { - String resDir = mdpkgPath + File.separator + MavenUtils.resourcesDir; + String resDir = mdpkgPath + File.separator + MavenUtils.RESOURCES_DIR; File resourceFile = new File(resDir); return resourceFile.mkdirs(); } diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/ProjectExtendCoreService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/ProjectExtendCoreService.java index 8b405c4..9eb015d 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/ProjectExtendCoreService.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/ProjectExtendCoreService.java @@ -99,7 +99,7 @@ public class ProjectExtendCoreService { List extractConfigrationList = ExtractHelper.getInstance().getExtractConfigrationList(); extractConfigrationList.forEach(item -> { if (item.isEnable()) { - if (extractContext.getDeployType() != null && ("WEB").equals(item.getTypeCode()) && !"all".equals(extractContext.getDeployType()) && !extractContext.getDeployType().contains("web")) { + if (extractContext.getDeployType() != null && "WEB".equals(item.getTypeCode()) && !"all".equals(extractContext.getDeployType()) && !extractContext.getDeployType().contains("web")) { return; } ExtractAction extractAction = ExtractHelper.getInstance().getManager(item.getTypeCode()); @@ -239,12 +239,14 @@ public class ProjectExtendCoreService { List disabledExtsList = disabledExts.isEmpty() ? new ArrayList<>() : Arrays.asList(disabledExts.split(",")); for (String projPath : projPaths) { - System.out.println("正在编译:" + projPath); + //todo +// "正在编译:" + projPath String projectMetadataPath = Paths.get(projPath).resolve(Utils.getMetadataProjPath()).toString(); MetadataCompilerContext metadataCompilerContext = new MetadataCompilerContext(); metadataCompilerContext.setProjectPath(projectMetadataPath); compile(metadataCompilerContext, extsList, disabledExtsList); - System.out.println("编译完成:" + projPath); + //todo +// "编译完成:" + projPath } return null; @@ -265,7 +267,8 @@ public class ProjectExtendCoreService { if (manager != null) { manager.metadataCompile(metadataCompilerContext); } else { - System.out.println(item.getTypeCode() + "无法获取类"); + //todo +// item.getTypeCode() + "无法获取类" } } } diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeConfigLoader.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeConfigLoader.java index fde9144..b49f2c4 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeConfigLoader.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeConfigLoader.java @@ -30,7 +30,7 @@ import lombok.Setter; public class JitRuntimeConfigLoader { - private static final String sectionName = "JitRuntimeConfigration"; + private static final String SECTION_NAME = "JitRuntimeConfigration"; @Getter @Setter static JitRuntimeConfigration jitRuntimeConfigration; @@ -51,7 +51,7 @@ public class JitRuntimeConfigLoader { FileServiceImp fileService = new FileServiceImp(); String fileContents = fileService.fileRead(fileName); JsonNode jsonNode = objectMapper.readTree(fileContents); - String jitRuntimeConfigrationJson = jsonNode.findValue(sectionName).toString(); + String jitRuntimeConfigrationJson = jsonNode.findValue(SECTION_NAME).toString(); jitRuntimeConfigration = objectMapper.readValue(jitRuntimeConfigrationJson, new TypeReference() { }); return jitRuntimeConfigration; diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeHelper.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeHelper.java index 16aec0f..db603ec 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeHelper.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeHelper.java @@ -42,7 +42,7 @@ public class JitRuntimeHelper extends JitRuntimeConfigLoader { public JitRuntimeAction getManager() { JitRuntimeAction manager = null; JitRuntimeConfigration data = getJitRuntimeConfigration(); - if (data != null && data.getEnable() == true) { + if (data != null && data.getEnable()) { Class cls = null; if (data.getAction() != null) { try { diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventListenerImpl.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventListenerImpl.java index 06bde56..729f257 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventListenerImpl.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventListenerImpl.java @@ -22,11 +22,11 @@ public class MetadataCreateEventListenerImpl implements MetadataCreateEventListe @Override public void fireMetadataCreatingEvent(MetadataEventArgs args) { - System.out.println("fireMetadataCreatingEvent"); +// "fireMetadataCreatingEvent" } @Override public void fireMetadataCreatedEvent(MetadataEventArgs args) { - System.out.println("fireMetadataCreatedEvent"); +// "fireMetadataCreatedEvent" } } diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionHandler.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionHandler.java index 5bac860..b78a851 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionHandler.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionHandler.java @@ -18,7 +18,7 @@ package com.inspur.edp.lcm.metadata.core.exception; import io.iec.edp.caf.commons.exception.handle.DefaultExceptionHandler; public class MvnExceptionHandler extends DefaultExceptionHandler { - private static final String errorKeyword = "[ERROR]"; + private static final String ERROR_KEYWORD = "[ERROR]"; private String messageHandled = ""; public String handleMessage(String message) { @@ -103,10 +103,10 @@ public class MvnExceptionHandler extends DefaultExceptionHandler { String errorString = ""; final int keywordIndex = message.indexOf(keyword); if (keywordIndex > -1) { - int lastErrorIndex = message.substring(0, keywordIndex).lastIndexOf(errorKeyword); - lastErrorIndex = lastErrorIndex == -1 ? errorKeyword.length() : lastErrorIndex + errorKeyword.length(); + int lastErrorIndex = message.substring(0, keywordIndex).lastIndexOf(ERROR_KEYWORD); + lastErrorIndex = lastErrorIndex == -1 ? ERROR_KEYWORD.length() : lastErrorIndex + ERROR_KEYWORD.length(); - int nextErrorIndex = message.substring(keywordIndex).indexOf(errorKeyword) + keywordIndex; + int nextErrorIndex = message.substring(keywordIndex).indexOf(ERROR_KEYWORD) + keywordIndex; if (nextErrorIndex == -1) { errorString = message.substring(lastErrorIndex).trim(); } else { diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexService.java index 5281c6c..600d246 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexService.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexService.java @@ -35,11 +35,11 @@ public class MetadataPackageIndexService { FileServiceImp fileServiceImp = new FileServiceImp(); - protected String KEY_CONNECTOR = "_"; + protected String keyConnector = "_"; - protected String LINE = "-"; + protected String line = "-"; - protected String FEATURE_IN_NAME = "-api-"; + protected String featureInName = "-api-"; public String location; @@ -93,8 +93,8 @@ public class MetadataPackageIndexService { private void update(List retainKeys) { for (String key : retainKeys) { - String[] fileNameArray = key.split(KEY_CONNECTOR); - if (!fileNameArray[1].contains(LINE) || fileNameArray[1].endsWith(Utils.getVersionSuffix())) { + String[] fileNameArray = key.split(keyConnector); + if (!fileNameArray[1].contains(line) || fileNameArray[1].endsWith(Utils.getVersionSuffix())) { Long lastModified = new File(location + File.separator + fileNameArray[1] + File.separator + fileNameArray[0]).lastModified(); boolean changeFlag = lastModified - metadataPackageIndexHashMap.get(key).getLastModified() != 0; if (changeFlag) { @@ -107,7 +107,7 @@ public class MetadataPackageIndexService { private void insert(List insertKeys) { for (String key : insertKeys) { - String[] fileNameArray = key.split(KEY_CONNECTOR); + String[] fileNameArray = key.split(keyConnector); File dir = new File(location + File.separator + fileNameArray[1]); getSingleMetadataPackageForIndex(dir); } @@ -159,8 +159,8 @@ public class MetadataPackageIndexService { metadataPackageForIndex.setLocation(file.getAbsolutePath()); metadataPackageForIndex.setLastModified(file.lastModified()); metadataPackageForIndex.setSourceName(dir.getName()); - if (dir.getName().contains(FEATURE_IN_NAME)) { - String sourceVersion = dir.getName().substring(dir.getName().lastIndexOf(FEATURE_IN_NAME) + FEATURE_IN_NAME.length()); + if (dir.getName().contains(featureInName)) { + String sourceVersion = dir.getName().substring(dir.getName().lastIndexOf(featureInName) + featureInName.length()); metadataPackageForIndex.setSourceVersion(sourceVersion); } } @@ -174,7 +174,7 @@ public class MetadataPackageIndexService { } protected String handleKey(String metadataPackageName, String name) { - String key = metadataPackageName + KEY_CONNECTOR + name; + String key = metadataPackageName + keyConnector + name; return key; } @@ -215,7 +215,7 @@ public class MetadataPackageIndexService { if (depFileLocation != null) { Model model = getModel(depFileLocation); model.getDependencies().forEach(dependency -> { - String gav = dependency.getGroupId() + LINE + dependency.getArtifactId() + LINE + dependency.getVersion(); + String gav = dependency.getGroupId() + line + dependency.getArtifactId() + line + dependency.getVersion(); metadataPackageIndexHashMap.keySet().forEach(key -> { if (key.endsWith(gav)) { depMetadataPackages.put(key, metadataPackageIndexHashMap.get(key)); @@ -236,7 +236,7 @@ public class MetadataPackageIndexService { } } if (!existFlag) { - String key = depMetadataPackageName + KEY_CONNECTOR + depMetadataPackageName; + String key = depMetadataPackageName + keyConnector + depMetadataPackageName; depMetadataPackages.put(key, MetadataPackageIndexServiceForPackages.getInstance(null).getMetadataPackageIndexForPackagesHashMap().get(key)); } }); diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/ProjectMetadataCacheService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/ProjectMetadataCacheService.java index f261d43..04646f9 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/ProjectMetadataCacheService.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/ProjectMetadataCacheService.java @@ -192,8 +192,7 @@ public class ProjectMetadataCacheService { references.put(key, metadataPackageIndexForPackagesHashMap.get(key)); return; } - - System.out.println("找不到对元数据包" + metadataPackageName + "的引用。"); +// "找不到对元数据包" + metadataPackageName + "的引用。" }); // 存在多余的maven引用 @@ -338,7 +337,7 @@ public class ProjectMetadataCacheService { if (ref != null && ref.getMetadataIds() != null) { ref.getMetadataIds().forEach(metadataId -> metadataPackageLocations.put(metadataId, ref.getLocation())); } else { - System.out.println("ref:" + ref.getLocation()); +// "ref:" + ref.getLocation() } }); projectMetadataCache.setMetadataPackageLocations(metadataPackageLocations); diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForJarManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForJarManager.java index a9a55e1..ee772e8 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForJarManager.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForJarManager.java @@ -88,7 +88,7 @@ public class MavenDeploymentForJarManager extends MavenDeploymentManager { } private void setCodeRepoUrl(String projPath, String repoId) { - String codePomPath = projPath + File.separator + "java" + File.separator + Utils.getMavenProName() + File.separator + MavenUtils.pomFile; + String codePomPath = projPath + File.separator + "java" + File.separator + Utils.getMavenProName() + File.separator + MavenUtils.POM_FILE; pomManager.setRepoUrl(codePomPath, repoId); } diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForMdpkgManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForMdpkgManager.java index 1c46b01..2653564 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForMdpkgManager.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForMdpkgManager.java @@ -74,8 +74,8 @@ public class MavenDeploymentForMdpkgManager extends MavenDeploymentManager { this.dependencyVersion = dependencyVersion; this.mavenPath = mavenPath; metadataBinPath = projPath + File.separator + "metadata" + File.separator + "bin"; - metadataTempDir = fileServiceImp.getCombinePath(projPath + File.separator + "metadata", MavenUtils.tempFolder); - metadataPomPath = fileServiceImp.getCombinePath(metadataTempDir, MavenUtils.pomFile); + metadataTempDir = fileServiceImp.getCombinePath(projPath + File.separator + "metadata", MavenUtils.TEMP_FOLDER); + metadataPomPath = fileServiceImp.getCombinePath(metadataTempDir, MavenUtils.POM_FILE); beforeDeploy(); @@ -122,7 +122,7 @@ public class MavenDeploymentForMdpkgManager extends MavenDeploymentManager { mdpkgPath = metadataProjectCoreService.getMdpkgPath(projPath); Utils.checkEmpty(mdpkgPath, "未找到元数据包,请先编译:" + projPath); createSrcDir(metadataTempDir); - String destPath = metadataTempDir + File.separator + MavenUtils.resourcesDir + File.separator + new File(mdpkgPath).getName(); + String destPath = metadataTempDir + File.separator + MavenUtils.RESOURCES_DIR + File.separator + new File(mdpkgPath).getName(); try { fileServiceImp.fileCopy(mdpkgPath, destPath); } catch (IOException e) { @@ -176,7 +176,7 @@ public class MavenDeploymentForMdpkgManager extends MavenDeploymentManager { } private boolean createSrcDir(String mdpkgPath) { - String resDir = mdpkgPath + File.separator + MavenUtils.resourcesDir; + String resDir = mdpkgPath + File.separator + MavenUtils.RESOURCES_DIR; File resourceFile = new File(resDir); return resourceFile.mkdirs(); } diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/PomManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/PomManager.java index 2902b4f..7fd3c58 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/PomManager.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/PomManager.java @@ -39,7 +39,7 @@ public class PomManager { public void setRepoUrl(String pomPath, String repoId) { final Model model = getModel(pomPath); - final DistributionManagement distributionManagement = RepositoryFactory.getInstance().getMavenSettingsRepository().getDistributionManagement(repoId, model.getVersion().endsWith(MavenUtils.snapShot)); + final DistributionManagement distributionManagement = RepositoryFactory.getInstance().getMavenSettingsRepository().getDistributionManagement(repoId, model.getVersion().endsWith(MavenUtils.SNAP_SHOT)); model.setDistributionManagement(distributionManagement); writeModel(pomPath, model); } diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataProjectRepository.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataProjectRepository.java index 5505857..a1e72a9 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataProjectRepository.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataProjectRepository.java @@ -109,7 +109,7 @@ public class MetadataProjectRepository { e.printStackTrace(); } } - String feature = flag == true ? " -U" : ""; + String feature = flag ? " -U" : ""; fileService.fileUpdate(filePath, feature, false); } diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataRepository.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataRepository.java index 00db729..e7965ee 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataRepository.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataRepository.java @@ -25,15 +25,14 @@ import com.inspur.edp.lcm.metadata.common.Utils; import java.io.File; import java.io.IOException; import java.util.List; -import lombok.var; public class MetadataRepository { private FileServiceImp fileService = new FileServiceImp(); MetadataSerializer metadataSerializer = new MetadataSerializer(); public GspMetadata load(String absolutePath) { - var fileString = fileService.fileRead(absolutePath); - var metadata = metadataSerializer.deserialize(fileString, GspMetadata.class); + String fileString = fileService.fileRead(absolutePath); + GspMetadata metadata = metadataSerializer.deserialize(fileString, GspMetadata.class); metadata.setRelativePath(absolutePath.substring(0, Utils.handlePath(absolutePath).lastIndexOf('/'))); return metadata; } @@ -58,7 +57,7 @@ public class MetadataRepository { } public void getMetadatasUnderDir(List mdPathList, String dirPath) { - var dirs = fileService.getDirectorys(dirPath); + List dirs = fileService.getDirectorys(dirPath); if (dirs.size() > 0) { for (int i = 0; i < dirs.size(); i++) { String dirName = fileService.getFileName(Utils.handlePath(dirs.get(i).getPath())); @@ -68,7 +67,7 @@ public class MetadataRepository { } } } - var paths = fileService.getAllFiles(dirPath); + List paths = fileService.getAllFiles(dirPath); if (paths.size() > 0) { for (File path : paths) { mdPathList.add(Utils.handlePath(path.getPath())); diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/PomRepository.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/PomRepository.java index dd0af2d..e098b17 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/PomRepository.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/PomRepository.java @@ -34,11 +34,11 @@ import org.apache.maven.model.io.xpp3.MavenXpp3Writer; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; public class PomRepository { - private final String GROUP_ID = "com.inspur.edp"; - private final String ARTIFACT_ID = "download-tools"; - private final String VERSION = "0.1.0-SNAPSHOT"; - private final String MODEL_VERSION = "4.0.0"; - private final String PACKAGING = "pom"; + private final String groupId = "com.inspur.edp"; + private final String artifactId = "download-tools"; + private final String version = "0.1.0-SNAPSHOT"; + private final String modelVersion = "4.0.0"; + private final String packaging = "pom"; FileServiceImp fileServiceImp = new FileServiceImp(); @@ -76,7 +76,7 @@ public class PomRepository { fileServiceImp.createFile(pomPath); // 创建model并写入 final List dependencies = createDependencies(refs, PackageType.zip.toString()); - final Model model = createModel(GROUP_ID, ARTIFACT_ID, VERSION, MODEL_VERSION, PACKAGING, dependencies); + final Model model = createModel(groupId, artifactId, version, modelVersion, packaging, dependencies); writeModel(pomPath, model); } @@ -101,7 +101,7 @@ public class PomRepository { model.setModelVersion("4.0.0"); model.setPackaging("metadata-pack"); - final boolean isSnotshot = sourceModel.getVersion().endsWith(MavenUtils.snapShot); + final boolean isSnotshot = sourceModel.getVersion().endsWith(MavenUtils.SNAP_SHOT); DistributionManagement distributionManagement = RepositoryFactory.getInstance().getMavenSettingsRepository().getDistributionManagement(repoId, isSnotshot); model.setDistributionManagement(distributionManagement); @@ -111,7 +111,7 @@ public class PomRepository { Dependency dependency = new Dependency(); dependency.setGroupId(sourceDependency.getGroupId()); dependency.setArtifactId(sourceDependency.getArtifactId()); - boolean dependencyVersionFlag = dependencyVersion != null && sourceDependency.getVersion().endsWith(MavenUtils.snapShot); + boolean dependencyVersionFlag = dependencyVersion != null && sourceDependency.getVersion().endsWith(MavenUtils.SNAP_SHOT); String actingVersion = "m" + (dependencyVersionFlag ? dependencyVersion : sourceDependency.getVersion()); dependency.setVersion(actingVersion); dependency.setType("zip"); diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/InstallJarRunnable.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/InstallJarRunnable.java index 211faa0..8b0d6cd 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/InstallJarRunnable.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/InstallJarRunnable.java @@ -35,7 +35,7 @@ public class InstallJarRunnable implements Runnable { protected final FileServiceImp fileServiceImp = new FileServiceImp(); protected final MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); private List downloadMdpkgPaths; - private String FEATURE_IN_NAME = "-api-"; + private String featureInName = "-api-"; @Override public void run() { @@ -75,8 +75,8 @@ public class InstallJarRunnable implements Runnable { String dirName = new File(new File(path).getParent()).getName(); MavenPackageRefs mavenPackageRefs = new MavenPackageRefs(); String groupId = dirName.substring(0, dirName.indexOf("-")); - String version = dirName.substring(dirName.lastIndexOf(FEATURE_IN_NAME) + FEATURE_IN_NAME.length() + 1); - String artifactId = dirName.substring(dirName.indexOf("-") + 1, dirName.lastIndexOf(FEATURE_IN_NAME) + FEATURE_IN_NAME.length() - 1); + String version = dirName.substring(dirName.lastIndexOf(featureInName) + featureInName.length() + 1); + String artifactId = dirName.substring(dirName.indexOf("-") + 1, dirName.lastIndexOf(featureInName) + featureInName.length() - 1); mavenPackageRefs.setGroupId(groupId); mavenPackageRefs.setArtifactId(artifactId); mavenPackageRefs.setVersion(version); diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/ExtractActionImpl.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/ExtractActionImpl.java index d5af8be..3fd83a9 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/ExtractActionImpl.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/ExtractActionImpl.java @@ -80,7 +80,8 @@ public class ExtractActionImpl implements ExtractAction { return files[0].getPath(); } } - System.out.println("无" + module + "jar包。"); + //todo +// "无" + module + "jar包。" return ""; } diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MdpkgServiceImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MdpkgServiceImp.java index f31dc01..425bbad 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MdpkgServiceImp.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MdpkgServiceImp.java @@ -137,8 +137,8 @@ public class MdpkgServiceImp implements MdpkgService { } @Override - public void addProjectDependency(String pomp_ath, String groupId, String artifactId, String version) { - packageCoreService.addProjectDependency(pomp_ath, groupId, artifactId, version); + public void addProjectDependency(String pompAth, String groupId, String artifactId, String version) { + packageCoreService.addProjectDependency(pompAth, groupId, artifactId, version); } @Override diff --git a/model/framework/generator-api/pom.xml b/model/framework/generator-api/pom.xml index 6526661..bd95e60 100644 --- a/model/framework/generator-api/pom.xml +++ b/model/framework/generator-api/pom.xml @@ -25,10 +25,10 @@ 0.9.0-SNAPSHOT compile - - org.springframework.boot - spring-boot-starter-test - + + + + diff --git a/model/framework/generator-api/src/test/java/com/inspur/edp/jittojava/context/common/FileUtilsTest.java b/model/framework/generator-api/src/test/java/com/inspur/edp/jittojava/context/common/FileUtilsTest.java index 7f53b07..7d6f136 100644 --- a/model/framework/generator-api/src/test/java/com/inspur/edp/jittojava/context/common/FileUtilsTest.java +++ b/model/framework/generator-api/src/test/java/com/inspur/edp/jittojava/context/common/FileUtilsTest.java @@ -1,20 +1,19 @@ package com.inspur.edp.jittojava.context.common; -import org.junit.Assert; -import org.junit.Test; -import org.springframework.boot.test.context.SpringBootTest; +//import org.junit.Assert; +//import org.junit.Test; +//import org.springframework.boot.test.context.SpringBootTest; +//import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.is; - -@SpringBootTest +//@SpringBootTest public class FileUtilsTest { private static String TEST_FILE_NAME = "/fileUtils-test-file.txt"; private static String EXPECT_RESULT = "junit test"; - @Test - public void fileReadTest() { - String testFilePath = this.getClass().getResource(TEST_FILE_NAME).getPath(); - String content = FileUtils.fileRead(testFilePath); - Assert.assertThat(content, is(EXPECT_RESULT)); - } +// @Test +// public void fileReadTest() { +// String testFilePath = this.getClass().getResource(TEST_FILE_NAME).getPath(); +// String content = FileUtils.fileRead(testFilePath); +// Assert.assertThat(content, is(EXPECT_RESULT)); +// } } \ No newline at end of file diff --git a/model/framework/pom.xml b/model/framework/pom.xml index cce6c08..1a25352 100644 --- a/model/framework/pom.xml +++ b/model/framework/pom.xml @@ -51,11 +51,11 @@ - - org.springframework.boot - spring-boot-starter-test - ${spring-boot.version} - + + + + + com.alibaba fastjson diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRTServiceImp.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRTServiceImp.java index f74189d..512e9e1 100644 --- a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRTServiceImp.java +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRTServiceImp.java @@ -37,7 +37,6 @@ import io.iec.edp.caf.rpc.api.service.RpcClient; import java.util.LinkedHashMap; import java.util.List; import lombok.extern.slf4j.Slf4j; -import lombok.var; @Slf4j public class MetadataRTServiceImp implements MetadataRTService { @@ -95,7 +94,7 @@ public class MetadataRTServiceImp implements MetadataRTService { List resources = SpringBeanUtils.getBean(II18nResourceRTManager.class).getI18nResource(metadata, language); MetadataI18nService service = I18nManagerHelper.getInstance().getI18nManager(metadata.getHeader().getType()); if (service != null && resources != null && resources.size() > 0) { - var result = service.merge(metadata, resources); + GspMetadata result = service.merge(metadata, resources); RtCacheHandler.updateMetadataCache(metadataKey, result); return result; } diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/MetadataRTServerServiceImpl.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/MetadataRTServerServiceImpl.java index a0b1d15..b2989c5 100644 --- a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/MetadataRTServerServiceImpl.java +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/MetadataRTServerServiceImpl.java @@ -70,7 +70,6 @@ import java.util.zip.ZipFile; import java.util.zip.ZipInputStream; import javax.annotation.PostConstruct; import lombok.extern.slf4j.Slf4j; -import lombok.var; import org.codehaus.plexus.util.StringUtils; /** @@ -201,7 +200,7 @@ public class MetadataRTServerServiceImpl implements MetadataRTServerService { List resources = getI18nResourceRtManager().getI18nResource(originalData, language); MetadataI18nService service = I18nManagerHelper.getInstance().getI18nManager(originalData.getHeader().getType()); if (service != null && resources != null && resources.size() > 0) { - var result = service.merge(originalData, resources); + GspMetadata result = service.merge(originalData, resources); RtCacheHandler.updateMetadataCache(metadataKey, result); return result; } @@ -353,7 +352,7 @@ public class MetadataRTServerServiceImpl implements MetadataRTServerService { MetadataCacheManager.addMetadataPathMapping(metadataKey, metadataPackagePath + item.getRelativePath()); metadataInfoList.add(item); } - MetadataCacheManager.addAllMetadataInfo(RtCacheHandler.allMetadataInfoCacheKey, metadataInfoList); + MetadataCacheManager.addAllMetadataInfo(RtCacheHandler.ALL_METADATA_INFO_CACHE_KEY, metadataInfoList); } } Cache metadataCache = MetadataDistCacheManager.getMetadataCache(); @@ -405,14 +404,14 @@ public class MetadataRTServerServiceImpl implements MetadataRTServerService { metadataInfoList.add(item); } } - MetadataCacheManager.addAllMetadataInfo(RtCacheHandler.allMetadataInfoCacheKey, metadataInfoList); + MetadataCacheManager.addAllMetadataInfo(RtCacheHandler.ALL_METADATA_INFO_CACHE_KEY, metadataInfoList); } // 预加载序反列化器 MetadataSerializerHelper.getInstance(); } public List getMetadataList(String metadataTypes) { - var result = getMetadataRefListWithTypes(metadataTypes); + List result = getMetadataRefListWithTypes(metadataTypes); return utils.buildMetadata4RefDto(result); } @@ -426,7 +425,7 @@ public class MetadataRTServerServiceImpl implements MetadataRTServerService { public List getMetadataRefList() { List metadataList = new ArrayList<>(); //首先从缓存获取 - List packagesCache = (List) MetadataCacheManager.getAllMetadataPackageInfo(RtCacheHandler.allPackagesCacheKey); + List packagesCache = (List) MetadataCacheManager.getAllMetadataPackageInfo(RtCacheHandler.ALL_PACKAGES_CACHE_KEY); if (packagesCache != null && packagesCache.size() > 0) { for (MetadataPackage pack : packagesCache) { List metadata4Ref = getMetadata4Ref(pack, null); @@ -439,7 +438,7 @@ public class MetadataRTServerServiceImpl implements MetadataRTServerService { List metadata4Ref = getMetadata4Ref(metadataPackage, null); metadataList.addAll(metadata4Ref); } - MetadataCacheManager.addAllMetadataPackageInfo(RtCacheHandler.allPackagesCacheKey, metadataPackages); + MetadataCacheManager.addAllMetadataPackageInfo(RtCacheHandler.ALL_PACKAGES_CACHE_KEY, metadataPackages); return metadataList; } @@ -541,7 +540,7 @@ public class MetadataRTServerServiceImpl implements MetadataRTServerService { } List metadataList = new ArrayList<>(); //首先从缓存获取 - List packagesCache = (List) MetadataCacheManager.getAllMetadataPackageInfo(RtCacheHandler.allPackagesCacheKey); + List packagesCache = (List) MetadataCacheManager.getAllMetadataPackageInfo(RtCacheHandler.ALL_PACKAGES_CACHE_KEY); if (packagesCache != null && packagesCache.size() > 0) { for (MetadataPackage pack : packagesCache) { List metadata4Ref = getMetadata4Ref(pack, typeList); @@ -556,7 +555,7 @@ public class MetadataRTServerServiceImpl implements MetadataRTServerService { metadataList.addAll(metadata4Ref); } - MetadataCacheManager.addAllMetadataPackageInfo(RtCacheHandler.allPackagesCacheKey, metadataPackages); + MetadataCacheManager.addAllMetadataPackageInfo(RtCacheHandler.ALL_PACKAGES_CACHE_KEY, metadataPackages); return metadataList; } @@ -565,7 +564,7 @@ public class MetadataRTServerServiceImpl implements MetadataRTServerService { if (metadataTypes != null && metadataTypes.size() > 0) { metadataTypes.forEach(type -> { - var result = packageInfo.getMetadataList().stream().filter(item -> item.getHeader().getType().toLowerCase().equals(type.toLowerCase())).collect(Collectors.toList()); + List result = packageInfo.getMetadataList().stream().filter(item -> item.getHeader().getType().toLowerCase().equals(type.toLowerCase())).collect(Collectors.toList()); if (result.size() > 0) { result.forEach(metadata -> { Metadata4Ref metadata4Ref = new Metadata4Ref(); @@ -598,7 +597,7 @@ public class MetadataRTServerServiceImpl implements MetadataRTServerService { private GspMetadata getMetadataBySemanticId(String metadataNamespace, String metadataCode, String metadataTypeCode) { - List allMetadataInfo = (List) MetadataCacheManager.getAllMetadataInfo(RtCacheHandler.allMetadataInfoCacheKey); + List allMetadataInfo = (List) MetadataCacheManager.getAllMetadataInfo(RtCacheHandler.ALL_METADATA_INFO_CACHE_KEY); if (allMetadataInfo != null) { for (GspMetadata item : allMetadataInfo) { if (item.getHeader().getNameSpace().toLowerCase().equals(metadataNamespace.toLowerCase()) diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/event/MdPkgChangedEventManager.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/event/MdPkgChangedEventManager.java index b0414ba..fea5b06 100644 --- a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/event/MdPkgChangedEventManager.java +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/event/MdPkgChangedEventManager.java @@ -47,7 +47,7 @@ public class MdPkgChangedEventManager extends EventManager { @Override public void addListener(IEventListener iEventListener) { - if (iEventListener instanceof MdPkgChangedEventListener == false) { + if (!(iEventListener instanceof MdPkgChangedEventListener)) { throw new RuntimeException("指定的监听者没有实现IDemoEventListener接口"); } MdPkgChangedEventListener mdPkgChangedEventListener = (MdPkgChangedEventListener) iEventListener; @@ -57,7 +57,7 @@ public class MdPkgChangedEventManager extends EventManager { @Override public void removeListener(IEventListener iEventListener) { - if (iEventListener instanceof MdPkgChangedEventListener == false) { + if (!(iEventListener instanceof MdPkgChangedEventListener)) { throw new RuntimeException("指定的监听者没有实现IDemoEventListener接口"); } MdPkgChangedEventListener mdPkgChangedEventListener = (MdPkgChangedEventListener) iEventListener; diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MdpkgListenerAdapter.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MdpkgListenerAdapter.java index 86d0006..f253760 100644 --- a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MdpkgListenerAdapter.java +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MdpkgListenerAdapter.java @@ -42,13 +42,11 @@ public class MdpkgListenerAdapter extends FileAlterationListenerAdaptor { } // @Override // public void onStart(FileAlterationObserver observer) { -// System.out.println("start"); // super.onStart(observer); // } // // @Override // public void onStop(FileAlterationObserver observer) { -// System.out.println("stop"); // super.onStop(observer); // } @@ -59,7 +57,7 @@ public class MdpkgListenerAdapter extends FileAlterationListenerAdaptor { updateMdpkgAndMetadataCache(file, true); } catch (Exception e) { - System.out.println(e); + //todo } } @@ -70,7 +68,7 @@ public class MdpkgListenerAdapter extends FileAlterationListenerAdaptor { super.onFileDelete(file); deleteMdpkgAndMetadataCache(file); } catch (Exception e) { - System.out.println(e); + //todo } } @@ -81,7 +79,7 @@ public class MdpkgListenerAdapter extends FileAlterationListenerAdaptor { super.onFileChange(file); updateMdpkgAndMetadataCache(file, false); } catch (Exception e) { - System.out.println(e); + //todo } } @@ -98,11 +96,11 @@ public class MdpkgListenerAdapter extends FileAlterationListenerAdaptor { Cache metadataCache = MetadataDistCacheManager.getMetadataCache(); Cache metadataRtCache = MetadataRtDistCache.getMetadataCache(); MetadataPackage metadataPackage = RepositoryFactory.getInstance().getMetadataPackageRepository().getMetadataPackage(file); - MetadataCacheManager.removeAllMetadataPackageInfo(RtCacheHandler.allPackagesCacheKey); + MetadataCacheManager.removeAllMetadataPackageInfo(RtCacheHandler.ALL_PACKAGES_CACHE_KEY); //清理元数据内容缓存,将原有缓存的包中元数据列表从元数据内容缓存移除 String metadataKey = ""; List oldPackageMetadataList = (List) MetadataCacheManager.getMDManifestInfo(metadataPackage.getHeader().getName()); - List allMetadataList = (List) MetadataCacheManager.getAllMetadataInfo(RtCacheHandler.allMetadataInfoCacheKey); + List allMetadataList = (List) MetadataCacheManager.getAllMetadataInfo(RtCacheHandler.ALL_METADATA_INFO_CACHE_KEY); if (oldPackageMetadataList != null && oldPackageMetadataList.size() > 0) { for (GspMetadata item : oldPackageMetadataList) { metadataKey = RtCacheHandler.getMetadataCacheKey(item.getHeader().getId(), ""); @@ -122,7 +120,7 @@ public class MdpkgListenerAdapter extends FileAlterationListenerAdaptor { allMetadataList.removeAll(oldPackageMetadataList); } allMetadataList.addAll(metadataPackage.getMetadataList()); - MetadataCacheManager.addAllMetadataInfo(RtCacheHandler.allMetadataInfoCacheKey, allMetadataList); + MetadataCacheManager.addAllMetadataInfo(RtCacheHandler.ALL_METADATA_INFO_CACHE_KEY, allMetadataList); //清理并更新包中<元数据标识,元数据所在位置信息缓存>,清理过程在旧包处理过程中 String metadataPackagePath = Utils.handlePath(file.toString()); for (GspMetadata item : metadataPackage.getMetadataList()) { @@ -156,7 +154,7 @@ public class MdpkgListenerAdapter extends FileAlterationListenerAdaptor { Cache metadataRtCache = MetadataRtDistCache.getMetadataCache(); List oldPackageMetadataList = (List) MetadataCacheManager.getMDManifestInfo(packageName); - List allMetadataList = (List) MetadataCacheManager.getAllMetadataInfo(RtCacheHandler.allMetadataInfoCacheKey); + List allMetadataList = (List) MetadataCacheManager.getAllMetadataInfo(RtCacheHandler.ALL_METADATA_INFO_CACHE_KEY); if (oldPackageMetadataList != null && oldPackageMetadataList.size() > 0) { for (GspMetadata item : oldPackageMetadataList) { metadataKey = RtCacheHandler.getMetadataCacheKey(item.getHeader().getId(), ""); @@ -178,7 +176,7 @@ public class MdpkgListenerAdapter extends FileAlterationListenerAdaptor { MetadataCacheManager.removeMetadataPackageInfo(packageName); MetadataCacheManager.removeMDManifestInfo(packageName); MetadataCacheManager.removeMPDependence(packageName); - MetadataCacheManager.removeAllMetadataPackageInfo(RtCacheHandler.allPackagesCacheKey); + MetadataCacheManager.removeAllMetadataPackageInfo(RtCacheHandler.ALL_PACKAGES_CACHE_KEY); } private static List languages; diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepositoryImp.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepositoryImp.java index 30b2c0e..3e8a7d5 100644 --- a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepositoryImp.java +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepositoryImp.java @@ -93,7 +93,8 @@ public class MetadataPackageRepositoryImp implements MetadataPackageRepository { packageDic.put(Utils.handlePath(file1.toString()), metadataPackage); } catch (IOException e) { e.printStackTrace(); - System.out.println(e.getMessage() + ":" + file1.getAbsolutePath()); + //todo +// e.getMessage() + ":" + file1.getAbsolutePath() log.error(e.getMessage() + ":" + file1.getAbsolutePath()); } } -- Gitee From 58f9fc3d143a30d278f96b20d1b94d5d0e5f8239 Mon Sep 17 00:00:00 2001 From: Q-Lee Date: Tue, 11 May 2021 17:10:04 +0800 Subject: [PATCH 50/61] =?UTF-8?q?=E9=87=8D=E6=9E=84=EF=BC=9Ametadata-jit-t?= =?UTF-8?q?o-java=E5=B7=A5=E7=A8=8B=E4=BB=A3=E7=A0=81=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/framework/common/pom.xml | 6 + model/framework/generator-api/pom.xml | 11 + .../edp/jittojava/context/JitContext.java | 2 +- model/framework/generator-core/pom.xml | 8 + .../edp/jittojava/action/AfterGenerator.java | 49 ++ .../inspur/edp/jittojava/action/Utils.java | 72 +++ .../edp/jittojava/core/CommonServiceCore.java | 102 ++++ .../edp/jittojava/core/CommonServiceImp.java | 61 ++ .../jittojava/core/GenerateServiceCore.java | 118 ++++ .../jittojava/core/GenerateServiceImp.java | 109 ++++ .../edp/jittojava/core/JitCompilerHelper.java | 90 +++ .../inspur/edp/jittojava/core/JitUtils.java | 136 +++++ .../jittojava/core/MavenDependencyConst.java | 34 ++ .../core/config/ServiceAutoConfiguration.java | 44 ++ .../core/manager/GeneratorManager.java | 566 ++++++++++++++++++ .../core/manager/GeneratorManagerFactory.java | 36 ++ .../GeneratorManagerForGeneration.java} | 17 +- .../GeneratorManagerForInterpretation.java | 117 ++++ .../core/persistence/GenerateRepository.java | 134 +++++ .../core/persistence/RepositoryFactory.java | 39 ++ .../edp/jittojava/temp/AfterGenerator.java | 70 +++ .../jittojava/temp/MavenDependencyConst.java | 34 ++ .../com/inspur/edp/jittojava/temp/Utils.java | 141 +++++ model/framework/generator-webapi/pom.xml | 30 + .../jittojava/webapi/GenerateController.java | 51 ++ .../webapi/config/Configuration.java | 38 ++ model/framework/pom.xml | 7 + 27 files changed, 2114 insertions(+), 8 deletions(-) create mode 100644 model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/action/AfterGenerator.java create mode 100644 model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/action/Utils.java create mode 100644 model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/CommonServiceCore.java create mode 100644 model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/CommonServiceImp.java create mode 100644 model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceCore.java create mode 100644 model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceImp.java create mode 100644 model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/JitCompilerHelper.java create mode 100644 model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/JitUtils.java create mode 100644 model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/MavenDependencyConst.java create mode 100644 model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/config/ServiceAutoConfiguration.java create mode 100644 model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManager.java create mode 100644 model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManagerFactory.java rename model/framework/{generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/ModuleGenerator.java => generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManagerForGeneration.java} (59%) create mode 100644 model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManagerForInterpretation.java create mode 100644 model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/persistence/GenerateRepository.java create mode 100644 model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/persistence/RepositoryFactory.java create mode 100644 model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/AfterGenerator.java create mode 100644 model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/MavenDependencyConst.java create mode 100644 model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/Utils.java create mode 100644 model/framework/generator-webapi/pom.xml create mode 100644 model/framework/generator-webapi/src/main/java/com/inspur/edp/jittojava/webapi/GenerateController.java create mode 100644 model/framework/generator-webapi/src/main/java/com/inspur/edp/jittojava/webapi/config/Configuration.java diff --git a/model/framework/common/pom.xml b/model/framework/common/pom.xml index bad6930..5e269a1 100644 --- a/model/framework/common/pom.xml +++ b/model/framework/common/pom.xml @@ -42,6 +42,12 @@ com.inspur.edp lcm-project-deployer-spi + + + lcm-metadata-api + com.inspur.edp + + org.apache.maven diff --git a/model/framework/generator-api/pom.xml b/model/framework/generator-api/pom.xml index bd95e60..4ea0623 100644 --- a/model/framework/generator-api/pom.xml +++ b/model/framework/generator-api/pom.xml @@ -13,6 +13,17 @@ ubml-model-framework-generator-api + + com.inspur.edp + caf-generator + + + lcm-metadata-api + com.inspur.edp + + + + org.openatom.ubml ubml-model-framework-common diff --git a/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/JitContext.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/JitContext.java index 345f062..7f40fd5 100644 --- a/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/JitContext.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/JitContext.java @@ -15,8 +15,8 @@ */ package com.inspur.edp.jittojava.context; +import com.inspur.edp.caf.generator.module.ModuleGenerator; import com.inspur.edp.jittojava.context.temp.ModuleGenerateInfo; -import com.inspur.edp.jittojava.context.temp.ModuleGenerator; 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.entity.MetadataProject; diff --git a/model/framework/generator-core/pom.xml b/model/framework/generator-core/pom.xml index e9652f8..6e552f5 100644 --- a/model/framework/generator-core/pom.xml +++ b/model/framework/generator-core/pom.xml @@ -18,4 +18,12 @@ 8 + + + org.openatom.ubml + ubml-model-framework-generator-spi + ${project.version} + + + \ No newline at end of file diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/action/AfterGenerator.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/action/AfterGenerator.java new file mode 100644 index 0000000..ce078e2 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/action/AfterGenerator.java @@ -0,0 +1,49 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.jittojava.action; + +import com.inspur.edp.jittojava.core.GenerateServiceCore; +import com.inspur.edp.jittojava.spi.AfterGeneratorAction; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import java.io.IOException; +import java.nio.file.Paths; + +/** + * @Classname AfterGenerator + * @Description TODO + * @Date 2019/12/24 17:18 + * @Created by liu_bintr + * @Version 1.0 + */ +public class AfterGenerator implements AfterGeneratorAction { + GenerateServiceCore generateService = new GenerateServiceCore(); + Utils utils = new Utils(); + + @Override + public void afterGenerator(String projPath) { + FileServiceImp fileService = new FileServiceImp(); + String runtimePath = Paths.get(projPath).resolve("java/code/runtime").toString(); + if (fileService.isDirectoryExist(runtimePath)) { + try { + fileService.deleteAllFilesUnderDirectory(runtimePath); + } catch (IOException e) { + throw new RuntimeException(e); + } + generateService.removeRuntimeModule(projPath); + } + generateService.modifyPom(projPath, utils.getExtendDependency()); + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/action/Utils.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/action/Utils.java new file mode 100644 index 0000000..1620d0d --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/action/Utils.java @@ -0,0 +1,72 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.jittojava.action; + +import com.inspur.edp.jittojava.context.entity.MavenDependency; +import com.inspur.edp.jittojava.core.MavenDependencyConst; +import java.util.ArrayList; +import java.util.List; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; + +/** + * @Classname Utils + * @Description TODO + * @Date 2019/12/24 17:20 + * @Created by liu_bintr + * @Version 1.0 + */ +public class Utils { + + public ArrayList getExtendDependency() { + String extendDependencyPath = + this.getClass().getResource("/CommonExtendMavenDependency.xml").toString(); + return readInternalDependency(extendDependencyPath); + } + + private ArrayList readInternalDependency(String defaultDependencyPath) { + ArrayList result = new ArrayList<>(); + Document doc = readDocument(defaultDependencyPath); + Element rootElement = doc.getRootElement(); + List list = rootElement.elements(); + for (int i = 0; i < list.size(); i++) { + Element ele = (Element) list.get(i); + result.add(new MavenDependency(getTagValue(ele, MavenDependencyConst.groupId), getTagValue(ele, MavenDependencyConst.artifactId), + getTagValue(ele, MavenDependencyConst.version), getTagValue(ele, MavenDependencyConst.file))); + } + return result; + } + + private Document readDocument(String filePath) { + SAXReader sr = new SAXReader(); + try { + return sr.read(filePath); + } catch (DocumentException e) { + throw new RuntimeException("无效路径" + filePath); + } + } + + private String getTagValue(Element ele, String tagName) { + Element tagElement = (Element) ele.element(tagName); + if (tagElement == null) { + return null; + } + return tagElement.getText(); + } + +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/CommonServiceCore.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/CommonServiceCore.java new file mode 100644 index 0000000..ed4cb09 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/CommonServiceCore.java @@ -0,0 +1,102 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.jittojava.core; + +import com.inspur.edp.jittojava.context.service.CommonService; +import com.inspur.edp.lcm.metadata.common.Utils; +import java.io.File; +import java.io.IOException; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * Classname CommonServiceCore Description 实现类 Date 2019/8/8 16:42 + * + * @author zhongchq + * @version 1.0 + */ +public class CommonServiceCore implements CommonService { + + @Override + public String getProjectPath(String absJavaPath) { + //java目录下进行判断 + File file = new File(absJavaPath); + if (file.isDirectory()) { + File[] files = file.listFiles(); + if (files.length == 0) { + return null; + } + //遍历java目录下目录 + for (int i = 0; i < files.length; i++) { + //对目录进行判断 + if (files[i].isDirectory()) { + File[] fileInPoject = files[i].listFiles(); + for (File file1 : fileInPoject) { + if (file1.isFile() && file1.toString().contains("pom.xml")) { + return Utils.handlePath(file1.getParent().substring(file1.toString().indexOf("java"))); + } + } + } + } + } + return null; + } + + @Override + public List getJarPath(String absJavaPath) { + Path path = Paths.get(absJavaPath); + List filename = new ArrayList<>(); + try { + Files.walkFileTree(path + , new SimpleFileVisitor() { + // 访问文件时触发 + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + if (file.toString().endsWith(".jar")) { + String filepaths = file.toString(); + if (filepaths.contains("out") || filepaths.contains("target")) { + filename.add(Utils.handlePath(filepaths.substring(filepaths.indexOf("java")))); + } + return FileVisitResult.CONTINUE; + } + return FileVisitResult.CONTINUE; + } +// +// // 访问目录时触发 +// @Override +// public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { +// if (dir.endsWith("target")) { +// String targetpath = dir.getParent().toAbsolutePath().toString().su +// targetpath.substring("java"); +// list.add(targetpath); +// } +// System.out.println("正在访问:" + dir + " 目录"); +// return FileVisitResult.CONTINUE; +// } + }); + } catch (IOException e) { + e.printStackTrace(); + } + Collections.sort(filename); + return filename; + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/CommonServiceImp.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/CommonServiceImp.java new file mode 100644 index 0000000..a1152d6 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/CommonServiceImp.java @@ -0,0 +1,61 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.jittojava.core; + +import com.inspur.edp.jittojava.context.service.CommonService; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.core.MetadataProjectServiceImp; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import java.util.List; + +/** + * Classname CommonServiceImp Description 实现类 Date 2019/8/8 16:42 + * + * @author zhongchq + * @version 1.0 + */ +public class CommonServiceImp implements CommonService { + + FileService fileService = new FileServiceImp(); + + MetadataProjectService metadataProjectService = new MetadataProjectServiceImp(); + + CommonServiceCore commonServiceCore = new CommonServiceCore(); + + /** + * @param proPath 相对路径 + * @return java.lang.String + * @throws + * @author zhongchq + **/ + @Override + public String getProjectPath(String proPath) { + String javaPath = fileService.getCombinePath(metadataProjectService.getProjPath(proPath), "java"); + String absJavaPath = ManagerUtils.getAbsolutePath(javaPath); + + return commonServiceCore.getProjectPath(absJavaPath); + + } + + @Override + public List getJarPath(String proPath) { + String javaPath = fileService.getCombinePath(metadataProjectService.getProjPath(proPath), "java"); + String absJavaPath = ManagerUtils.getAbsolutePath(javaPath); + return commonServiceCore.getJarPath(absJavaPath); + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceCore.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceCore.java new file mode 100644 index 0000000..1ab8798 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceCore.java @@ -0,0 +1,118 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.jittojava.core; + +import com.inspur.edp.jittojava.context.entity.MavenDependency; +import com.inspur.edp.jittojava.core.manager.GeneratorManager; +import com.inspur.edp.jittojava.core.manager.GeneratorManagerFactory; +import com.inspur.edp.lcm.metadata.common.Utils; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; +import org.apache.maven.model.Model; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.apache.maven.model.io.xpp3.MavenXpp3Writer; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import org.dom4j.Document; +import org.dom4j.Element; + +@Slf4j +public class GenerateServiceCore { + public void generate(String absolutePath, String mavenPath) throws Exception { + final GeneratorManager generatorManager = GeneratorManagerFactory.createGeneratorManager(absolutePath); + generatorManager.generate(absolutePath, mavenPath); + } + + public void generateApi(String absolutePath, String mavenPath) throws Exception { + final GeneratorManager generatorManager = GeneratorManagerFactory.createGeneratorManager(absolutePath); + generatorManager.generateApi(absolutePath, mavenPath); + } + + public void removeRuntimeModule(String absolutePath) { + String pomPath = getPomFilePath(absolutePath); + Model model = getModel(pomPath); + List modules = model.getModules(); + List newMudules = modules.stream().filter(module -> !"runtime".equals(module)).collect(Collectors.toList()); + model.setModules(newMudules); + writeModel(pomPath, model); + } + + public void writeModel(String pomPath, Model model) { + File pom = new File(pomPath); + if (!pom.exists()) { + pom.getParentFile().mkdirs(); + try { + pom.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + } + try (FileOutputStream fileOutputStream = new FileOutputStream(pomPath)) { + MavenXpp3Writer mavenXpp3Writer = new MavenXpp3Writer(); + mavenXpp3Writer.write(fileOutputStream, model); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public Model getModel(String pomPath) { + try (FileInputStream fis = new FileInputStream(pomPath)) { + MavenXpp3Reader reader = new MavenXpp3Reader(); + final Model model = reader.read(fis); + return model; + } catch (IOException | XmlPullParserException e) { + throw new RuntimeException(e); + } + } + + public void modifyPom(String absolutePath, List mavenDependencyList) { + if (mavenDependencyList == null || mavenDependencyList.size() == 0) { + return; + } + String pomPath = getPomFilePath(absolutePath); + Document doc = JitUtils.readDocument(pomPath); + Element projectElement = doc.getRootElement(); + Element dependenciesElement = projectElement.element(MavenDependencyConst.dependencies); + + if (dependenciesElement == null) { + dependenciesElement = projectElement.addElement(MavenDependencyConst.dependencies); + } + List existValues = dependenciesElement.elements(); + ArrayList existDependencies = JitUtils.readExistDependencies(existValues); + for (MavenDependency newDependency : mavenDependencyList) { + if (JitUtils.checkContainDependency(newDependency, existDependencies)) { + continue; + } + JitUtils.addDependencyDom(newDependency, dependenciesElement); + } + JitUtils.saveDocument(doc, new File(pomPath)); + } + + private String getPomFilePath(String projPath) { + String javaPath = Paths.get(projPath).resolve("java").toString(); + String javaProjPath = Paths.get(javaPath).resolve(Utils.getMavenProName()).toString(); + String pomFilePath = Paths.get(javaProjPath).resolve("pom.xml").toString(); + + return pomFilePath; + } + +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceImp.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceImp.java new file mode 100644 index 0000000..fb19618 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceImp.java @@ -0,0 +1,109 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.jittojava.core; + +import com.inspur.edp.jittojava.context.GenerateService; +import com.inspur.edp.jittojava.context.entity.MavenDependency; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.List; +import java.util.Properties; +import lombok.extern.slf4j.Slf4j; +import org.codehaus.plexus.util.StringUtils; + +@Slf4j +public class GenerateServiceImp implements GenerateService { + + GenerateServiceCore generateServiceCore = new GenerateServiceCore(); + + @Override + public void generate(String path) throws Exception { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String mavenPath = ManagerUtils.getMavenStoragePath(); + generateServiceCore.generate(absolutePath, mavenPath); + } + + @Override + public void generateApi(String path) throws Exception { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String mavenPath = ManagerUtils.getMavenStoragePath(); + generateServiceCore.generateApi(absolutePath, mavenPath); + } + + @Override + public void modifyPom(String projPath, List mavenDependencyList) { + String absolutePath = ManagerUtils.getAbsolutePath(projPath); + generateServiceCore.modifyPom(absolutePath, mavenDependencyList); + } + + @Override + public void addProperties(String codePath, String propertyKey, String property) { + String factoriesFilePath = Paths.get(codePath).getParent().resolve(JitUtils.getSpringPeopertiesPath()).toString(); + FileService fileService = SpringBeanUtils.getBean(FileService.class); + if (!fileService.isFileExist(factoriesFilePath)) { + try { + fileService.createDirectory(Paths.get(factoriesFilePath).getParent().toString()); + fileService.createFile(factoriesFilePath); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + Properties properties = loadProperties(factoriesFilePath); + String valueStr = properties.getProperty(propertyKey); + if (StringUtils.isEmpty(valueStr)) { + properties.put(propertyKey, property); + updatePropertyFile(factoriesFilePath, properties); + } else { + List values = Arrays.asList(valueStr.split(",").clone()); + if (!values.contains(property)) { + valueStr = valueStr + "," + property; + properties.put(propertyKey, valueStr); + updatePropertyFile(factoriesFilePath, properties); + } + } + } + + public Properties loadProperties(String paramFile) { + Properties props = new Properties();//使用Properties类来加载属性文件 + try { + FileInputStream iFile = new FileInputStream(paramFile); + props.load(iFile); + iFile.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + + return props; + } + + private void updatePropertyFile(String filePath, Properties properties) { + try { + FileService fileService = SpringBeanUtils.getBean(FileService.class); + fileService.fileUpdate(filePath, "", false); + FileOutputStream oFile = new FileOutputStream(filePath, true); + properties.store(oFile, ""); + oFile.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/JitCompilerHelper.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/JitCompilerHelper.java new file mode 100644 index 0000000..fbf85c8 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/JitCompilerHelper.java @@ -0,0 +1,90 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.jittojava.core; + +import com.inspur.edp.jittojava.context.common.JitCompilerConfigLoader; +import com.inspur.edp.jittojava.context.entity.JitCompilerConfigration; +import com.inspur.edp.jittojava.spi.AfterGeneratorAction; +import com.inspur.edp.jittojava.spi.JitAction; +import java.util.List; + +/** + * @Classname JitCompilerHelper + * @Description TODO + * @Date 2019/7/29 16:06 + * @Created by zhongchq + * @Version 1.0 + */ +public class JitCompilerHelper extends JitCompilerConfigLoader { + + private static JitCompilerHelper singleton = null; + + public JitCompilerHelper() { + } + + public static JitCompilerHelper getInstance() { + if (singleton == null) { + singleton = new JitCompilerHelper(); + } + return singleton; + } + + /** + * @param typeName + * @return com.inspur.edp.lcm.metadata.spi.MetadataContentSerializer + * @throws + * @author zhongchq + * @description 返回各元数据序列化器 + * @date 9:34 2019/7/24 + **/ + public JitAction getManager(String typeName) { + JitAction manager = null; + JitCompilerConfigration data = getCompilerConfigurations(typeName); + if (data != null && data.getEnable() == true) { + Class cls = null; + if (data.getBeforeCompiler() != null) { + try { + cls = Class.forName(data.getBeforeCompiler().getName()); + manager = (JitAction) cls.newInstance(); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + } + } + } + return manager; + } + + public AfterGeneratorAction getAfterActionManager(String typeName) { + AfterGeneratorAction manager = null; + JitCompilerConfigration data = getCompilerConfigurations(typeName); + if (data != null && data.getEnable() == true) { + Class cls = null; + if (data.getAfterCompiler() != null) { + try { + cls = Class.forName(data.getAfterCompiler().getName()); + manager = (AfterGeneratorAction) cls.newInstance(); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + } + } + } + return manager; + } + + public List getCompilerTypeList() { + return getCompilerConfigurations(); + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/JitUtils.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/JitUtils.java new file mode 100644 index 0000000..576ef49 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/JitUtils.java @@ -0,0 +1,136 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.jittojava.core; + +import com.inspur.edp.jittojava.context.entity.MavenDependency; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.ArrayList; +import java.util.List; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.OutputFormat; +import org.dom4j.io.SAXReader; +import org.dom4j.io.XMLWriter; + +/** + * @Classname JitUtils + * @Description TODO + * @Date 2019/12/16 16:30 + * @Created by liu_bintr + * @Version 1.0 + */ +public class JitUtils { + public static String getArchetypePath() { + return "platform/dev/main/libs/resources/archetypefront"; + } + + public static String getSpringPeopertiesPath() { + return "resources/META-INF/spring.factories"; + } + + public static String getArchetypeArtifactId() { + return "bf-df-bank-front-archetype"; + } + + public static String getArchetypeTarget() { + return "target/" + getArchetypeArtifactId() + "-0.1.3.jar"; + } + + public static String getCompArchetypePath() { + return "platform/dev/main/libs/resources/archetypefront-comp"; + } + + public static String getCompArchetypeArtifactId() { + return "archetype-comp"; + } + + public static String getCompArchetypeTarget() { + return "target/" + getCompArchetypeArtifactId() + "-0.1.3.jar"; + } + + public static Document readDocument(String filePath) { + SAXReader sr = new SAXReader(); + try { + return sr.read(filePath); + } catch (DocumentException e) { + throw new RuntimeException("无效路径" + filePath); + } + } + + public static ArrayList readExistDependencies(List existValues) { + ArrayList list = new ArrayList<>(); + if (existValues == null || existValues.size() == 0) { + return list; + } + for (int i = 0; i < existValues.size(); i++) { + Element ele = (Element) existValues.get(i); + list.add(new MavenDependency(getTagValue(ele, MavenDependencyConst.groupId), getTagValue(ele, MavenDependencyConst.artifactId), + getTagValue(ele, MavenDependencyConst.version))); + } + return list; + } + + public static boolean checkContainDependency(MavenDependency dependency, ArrayList dependencies) { + for (MavenDependency item : dependencies) { + if (item.equals(dependency)) { + return true; + } + } + return false; + } + + public static void addDependencyDom(MavenDependency dependency, Element parentElement) { + Element element = parentElement.addElement(MavenDependencyConst.dependency); + Element gourpId = element.addElement(MavenDependencyConst.groupId); + Element artifactId = element.addElement(MavenDependencyConst.artifactId); + gourpId.setText(dependency.getGroupId()); + artifactId.setText(dependency.getArtifactId()); + if (dependency.getVersion() != null && !dependency.getVersion().isEmpty()) { + Element version = element.addElement(MavenDependencyConst.version); + version.setText(dependency.getVersion()); + } + } + + public static void saveDocument(Document document, File xmlFile) { + Writer osWrite = null;// 创建输出流 + try { + osWrite = new OutputStreamWriter(new FileOutputStream(xmlFile)); + + OutputFormat format = OutputFormat.createPrettyPrint(); // 获取输出的指定格式 + format.setEncoding("UTF-8");// 设置编码 ,确保解析的xml为UTF-8格式 + XMLWriter writer = new XMLWriter(osWrite, format);// XMLWriter + // 指定输出文件以及格式 + writer.write(document);// 把document写入xmlFile指定的文件(可以为被解析的文件或者新创建的文件) + writer.flush(); + writer.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private static String getTagValue(Element ele, String tagName) { + Element tagElement = (Element) ele.element(tagName); + if (tagElement == null) { + return null; + } + return tagElement.getText(); + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/MavenDependencyConst.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/MavenDependencyConst.java new file mode 100644 index 0000000..c569dac --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/MavenDependencyConst.java @@ -0,0 +1,34 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.jittojava.core; + +/** + * @Classname MavenDependencyConst + * @Description TODO + * @Date 2019/12/16 16:36 + * @Created by liu_bintr + * @Version 1.0 + */ +public class MavenDependencyConst { + public static String groupId = "groupId"; + public static String artifactId = "artifactId"; + public static String version = "version"; + public static String file = "file"; + public static String dependency = "dependency"; + public static String dependencies = "dependencies"; + + public static String modules = "modules"; +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/config/ServiceAutoConfiguration.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/config/ServiceAutoConfiguration.java new file mode 100644 index 0000000..3fba2b6 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/config/ServiceAutoConfiguration.java @@ -0,0 +1,44 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.jittojava.core.config; + +import com.inspur.edp.jittojava.context.GenerateService; +import com.inspur.edp.jittojava.context.service.CommonService; +import com.inspur.edp.jittojava.core.CommonServiceImp; +import com.inspur.edp.jittojava.core.GenerateServiceImp; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @Classname ServiceAutoConfiguration + * @Description TODO + * @Date 2019/7/30 13:43 + * @Created by liu_bintr + * @Version 1.0 + */ +@Configuration +public class ServiceAutoConfiguration { + + @Bean + public CommonService createCommonService() { + return new CommonServiceImp(); + } + + @Bean + public GenerateService createGenerateService() { + return new GenerateServiceImp(); + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManager.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManager.java new file mode 100644 index 0000000..3e2e153 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManager.java @@ -0,0 +1,566 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.jittojava.core.manager; + +import com.inspur.edp.caf.generator.compileunit.CompileUnitGenerator; +import com.inspur.edp.caf.generator.module.ModuleGenerator; +import com.inspur.edp.jittojava.context.JitContext; +import com.inspur.edp.jittojava.context.entity.JitCompilerConfigration; +import com.inspur.edp.jittojava.core.CommonServiceCore; +import com.inspur.edp.jittojava.core.JitCompilerHelper; +import com.inspur.edp.jittojava.core.JitUtils; +import com.inspur.edp.jittojava.core.persistence.RepositoryFactory; +import com.inspur.edp.jittojava.spi.AfterGeneratorAction; +import com.inspur.edp.jittojava.spi.JitAction; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.api.service.MdpkgService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.core.GspProjectCoreService; +import com.inspur.edp.lcm.metadata.core.MavenUtilsCore; +import com.inspur.edp.lcm.metadata.core.MetadataCoreManager; +import com.inspur.edp.lcm.metadata.core.MetadataProjectCoreService; +import com.inspur.lcm.metadata.logging.LoggerDisruptorQueue; +import io.iec.edp.caf.boot.context.CAFContext; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import lombok.extern.slf4j.Slf4j; +import lombok.var; +import org.apache.commons.io.FileUtils; +import org.apache.maven.model.Model; +import org.apache.maven.model.Parent; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.apache.maven.model.io.xpp3.MavenXpp3Writer; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +@Slf4j +public class GeneratorManager { + MetadataProjectCoreService metadataProjectCoreService = new MetadataProjectCoreService(); + GspProjectCoreService gspProjectCoreService = new GspProjectCoreService(); + MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + MetadataCoreManager metadataCoreManager = new MetadataCoreManager(); + FileServiceImp fileService = new FileServiceImp(); + CommonServiceCore commonServiceCore = new CommonServiceCore(); + MdpkgService mdpkgService = SpringBeanUtils.getBean(MdpkgService.class); + + protected List metadataList = new ArrayList<>(); + protected JitContext jitContext; + protected final String fixedPath = "src/main/java"; + protected boolean isModelExist; + protected boolean isOldProject = false; + protected Model model; + + protected String archetypePath; + protected String archetypeTarget; + protected String archetypeArtifactId; + protected String refModule; + + public void generate(String absolutePath, String mavenPath) throws Exception { + beforeGenerate(absolutePath); + try { + //构建生成上下文 + jitContext = buildJitContext(absolutePath); + //创建maven工程与模块 + createMavenProject(jitContext, mavenPath); + //生成源代码 + generateCode(jitContext); + //生成后事件 + afterGenerate(absolutePath); + } finally { + isOldProject = false; + } + } + + public void generateApi(String absolutePath, String mavenPath) throws Exception { + try { + //构建生成上下文 + jitContext = buildJitContext(absolutePath); + //创建maven工程与模块 + createMavenProject(jitContext, mavenPath); + //生成api代码 + generateApi(jitContext); + } finally { + } + } + + protected void generateApi(JitContext jitContext) { + //获取所有注册的Jit类型 + List compilerTypeList = JitCompilerHelper.getInstance().getCompilerTypeList(); + generateApiCode(compilerTypeList, jitContext); + } + + protected void generateCode(JitContext jitContext) { + //获取所有注册的Jit类型 + List compilerTypeList = JitCompilerHelper.getInstance().getCompilerTypeList(); + + generateApiCode(compilerTypeList, jitContext); + + generateCoreCode(compilerTypeList, jitContext); + } + + protected void generateApiCode(List compilerTypeList, JitContext jitContext) { + String loStr = "开始:生成API代码"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + //组织API生成的上下文 + generateApiCode(compilerTypeList); + //生成API代码 + jitContext.getApiModuleGenerator().initialize(); + jitContext.getApiModuleGenerator().generate(); + loStr = "完成:生成API代码"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } + + protected void generateApiCode(List compilerTypeList) { + //组织api代码生成路径 + setPath("api"); + metadataList.forEach(item -> { + for (JitCompilerConfigration config : compilerTypeList) { + if (item.getHeader().getType().equals(config.getTypeCode())) { + // 获取元数据实体传给各元数据编译器 + if (item.getHeader().getFileName() == null) { + throw new IllegalArgumentException("路径" + item.getRelativePath() + "下有元数据FileName属性为空,请检查"); + } + GspMetadata metadata = metadataCoreManager.loadMetadata(item.getHeader().getFileName(), item.getRelativePath()); + if (metadata == null) { + String loStr = "没有拿到元数据"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } + + jitContext.setMetadata(metadata); + + if (jitContext.getMetadataCache(metadata.getHeader().getId()) == null) { + jitContext.setMetadataCache(metadata.getHeader().getId(), metadata); + } + + JitAction jitAction = JitCompilerHelper.getInstance().getManager(item.getHeader().getType()); + if (jitAction != null) { + String loStr = "jitInfo " + jitAction.toString(); + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } + if (jitAction != null) { + jitAction.generateApi(jitContext); + } + } + } + }); + } + + protected void generateCoreCode(List compilerTypeList, JitContext jitContext) { + String loStr = "开始:生成CORE代码"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + //组织CORE生成的上下文 + generateCoreCode(compilerTypeList); + //生成CORE代码 + jitContext.getCoreModuleGenerator().initialize(); + jitContext.getCoreModuleGenerator().generate(); + loStr = "完成:生成CORE代码"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } + + protected void generateCoreCode(List compilerTypeList) { + //组织api代码生成路径 + setPath("core"); + metadataList.forEach(item -> { + for (JitCompilerConfigration config : compilerTypeList) { + if (item.getHeader().getType().equals(config.getTypeCode())) { + // 获取元数据实体传给各元数据编译器 + var metadata = metadataCoreManager.loadMetadata(item.getHeader().getFileName(), item.getRelativePath()); + jitContext.setMetadata(metadata); + if (jitContext.getMetadataCache(metadata.getHeader().getId()) == null) { + jitContext.setMetadataCache(metadata.getHeader().getId(), metadata); + } + JitAction jitAction = JitCompilerHelper.getInstance().getManager(item.getHeader().getType()); + if (jitAction != null) { + jitAction.generateCore(jitContext); + } + } + } + }); + } + + protected void afterGenerate(String absolutePath) { + String loStr = "开始:生成后事件"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + List metadataTypes = new ArrayList<>(); + List metadataList = metadataCoreManager.getMetadataList(absolutePath); + if (metadataList == null || metadataList.size() <= 0) { + return; + } + metadataTypes.add("CommonExtend"); + metadataList.forEach(item -> { + if (!metadataTypes.contains(item.getHeader().getType())) { + metadataTypes.add(item.getHeader().getType()); + } + }); + metadataTypes.forEach(type -> { + AfterGeneratorAction action = JitCompilerHelper.getInstance().getAfterActionManager(type); + if (action != null) { + action.afterGenerator(absolutePath); + } + }); + + ArrayList types = new ArrayList<>(); + types.add("api_src"); + types.add("metadata"); + metadataProjectCoreService.setSourceDataModifiedTime(absolutePath, types); + loStr = "完成:生成后事件"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } + + protected void beforeGenerate(String absolutePath) { + SpringBeanUtils.getBean(MdpkgService.class).restore(absolutePath, false); + } + + protected void setPath(String flag) { + String javaProjectPath = fileService.getCombinePath(jitContext.getGspProjectpath(), Utils.getJavaProjectPath()); + + String artifactID; + String dir; + if (isOldProject) { + artifactID = getArtifactId(jitContext); + dir = artifactID + "-" + flag; + } else { + dir = flag; + artifactID = Utils.getMavenProName(); + } + String codePath = Paths.get(javaProjectPath).resolve(artifactID).resolve(dir).resolve(fixedPath).toString(); + String resPath = Paths.get(javaProjectPath).resolve(artifactID).resolve(dir).resolve(Utils.getResourcesPath()).toString(); + jitContext.setCodePath(codePath); + jitContext.setResourcePath(resPath); + } + + protected JitContext buildJitContext(String absolutePath) { + String loStr = "开始:构建生成上下文"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + //构建上下文内容,此处需要确定是否包含工程信息,元数据信息等 + var context = new JitContext(); + try { + context.setGspProjectpath(absolutePath); + Utils.setMetadataPath(absolutePath); + var gspProjectInfo = gspProjectCoreService.getGspProjectInfo(absolutePath); + var metadataProjectInfo = metadataProjectCoreService.getMetadataProjInfo(absolutePath); + context.setMetadataProjectInfo(metadataProjectInfo); + context.setGspProjectInfo(gspProjectInfo); + context.setApiModuleGenerator(new ModuleGenerator() { + @Override + protected ArrayList getCompileUnitGenrators() { + return null; + } + }); + context.setCoreModuleGenerator(new ModuleGenerator() { + @Override + protected ArrayList getCompileUnitGenrators() { + return null; + } + }); + MetadataCoreManager metadataCoreManager = new MetadataCoreManager(); + this.metadataList = metadataCoreManager.getMetadataList(absolutePath); +// MetadataDevCacheManager.setMetadataListInProjectCache(new File(absolutePath).getName(), this.metadataList); +// List refProjPaths = new ArrayList<>(); +// metadataProjectCoreService.getRefProjPaths(absolutePath, refProjPaths); +// for (String projPath : refProjPaths) { +// List metadataList = metadataCoreManager.getMetadataList(projPath); +// MetadataDevCacheManager.setMetadataListInProjectCache(new File(projPath).getName(), metadataList); +// } + } catch (Exception e) { + e.printStackTrace(); + } + loStr = "结束:构建生成上下文"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + return context; + } + + protected void createMavenProject(JitContext jitContext, String mavenPath) throws Exception { + String loStr = "开始:创建maven工程"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + + // 模板 + installArchetype(mavenPath); + + // 判断maven模板是否生成 + String javaProjectPath = fileService.getCombinePath(jitContext.getGspProjectpath(), Utils.getJavaProjectPath()); + isModelExist = isModelExist(javaProjectPath); + + // 生成模板工程的过程中如果同名工程存在,maven会报错. + if (!isModelExist) { + generateArchetype(javaProjectPath, mavenPath); + } else { + // 清理api和core + clearCode(javaProjectPath); + } + updateEdpParentVersion(javaProjectPath); + + updateModuleRefs(javaProjectPath, mavenPath); + + loStr = "完成:创建maven工程"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } + + protected void updateModuleRefs(String javaProjectPath, String mavenPath) { + String refPomPath = javaProjectPath + File.separator + "code" + File.separator + refModule + File.separator + Utils.getPomFile(); + String metadataPath = javaProjectPath.substring(0, javaProjectPath.length() - 4) + "metadata"; + if (fileService.isFileExist(refPomPath)) { + MetadataProject metadataProject = metadataCoreManager.getMetadataProjInfo(metadataPath); + if (metadataProject.getMavenPackageRefs() != null && metadataProject.getMavenPackageRefs().size() > 0) { + final List generationMavenPackageRefs = getGenerationMavenPackageRefs(metadataProject, mavenPath); + RepositoryFactory.getInstance().getGenerateRepository().updateModuleRefs(refPomPath, generationMavenPackageRefs, true); + } + } + } + + protected List getGenerationMavenPackageRefs(MetadataProject metadataProject, String mavenPath) { + return metadataProject.getMavenPackageRefs(); + } + + protected void updateEdpParentVersion(String javaProjectPath) throws IOException { + String pomPath = javaProjectPath + File.separator + Utils.getMavenProName() + File.separator + Utils.getPomFile(); + if (fileService.isFileExist(pomPath)) { + String version = getEdpParentVersionInProject(pomPath); + String nVersion = Utils.getEdpParentVersion(); + if (checkVersion(version, nVersion)) { + updateEdpParentVersionInProject(pomPath, nVersion); + } + } + } + + protected void updateEdpParentVersionInProject(String path, String version) throws IOException { + FileOutputStream fileOutputStream = null; + try { + Parent parent = model.getParent(); + parent.setVersion(version); + model.setParent(parent); + fileOutputStream = new FileOutputStream(path); + MavenXpp3Writer mavenXpp3Writer = new MavenXpp3Writer(); + mavenXpp3Writer.write(fileOutputStream, model); + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (!(null == fileOutputStream)) { + fileOutputStream.close(); + } + } + } + + protected String getEdpParentVersionInProject(String path) throws IOException { + FileInputStream fis = null; + try { + fis = new FileInputStream(path); + MavenXpp3Reader reader = new MavenXpp3Reader(); + model = reader.read(fis); + return model.getParent().getVersion(); + } catch (XmlPullParserException | IOException e) { + e.printStackTrace(); + } finally { + if (!(null == fis)) { + fis.close(); + } + } + return null; + } + + protected boolean checkVersion(String oldVersion, String newVersion) { + String[] minerOldVersion = oldVersion.split("\\."); + String[] minerNewVersion = newVersion.split("\\."); + for (int i = 0; i < minerNewVersion.length; i++) { + if (Integer.parseInt(minerNewVersion[i]) > Integer.parseInt(minerOldVersion[i])) { + return true; + } + } + return false; + } + + protected boolean isModelExist(String javaProjectPath) { + if (!fileService.isDirectoryExist(javaProjectPath)) { + fileService.createDirectory(javaProjectPath); + } + String relativeCodePath = commonServiceCore.getProjectPath(javaProjectPath); + if (relativeCodePath == null) { + isModelExist = false; + } else { + String absoluteCodePath = fileService.getCombinePath(jitContext.getGspProjectpath(), relativeCodePath); + List list = fileService.getAllFiles(absoluteCodePath); + for (File file : list) { + if (file.toString().endsWith(Utils.getPomFile())) { + return true; + } + } + } + return false; + } + + protected void clearCode(String javaProjectPath) throws IOException { + /** + * 由于路径过长,需要优化长度。考虑生成代码兼容问题。判断是否是老工程。老工程将代码继续生成在老工程下 + * 根据api module的名称即可 + */ + String relativeCodePath = commonServiceCore.getProjectPath(javaProjectPath); + String absoluteCodePath = fileService.getCombinePath(jitContext.getGspProjectpath(), relativeCodePath); + List allModuleName = fileService.getDirectorys(absoluteCodePath); + for (File module : allModuleName) { + if (module.getName().startsWith(jitContext.getGspProjectInfo().getAppCode().toLowerCase())) { + isOldProject = true; + } + if (module.getName().endsWith("api")) { + if (fileService.isDirectoryExist(module.toString() + File.separator + fixedPath)) { + fileService.deleteAllFilesUnderDirectory(module.toString() + File.separator + fixedPath); + clearProperties(jitContext, module.getName()); + } + } else if (module.getName().endsWith("core")) { + if (fileService.isDirectoryExist(module.toString() + File.separator + fixedPath)) { + fileService.deleteAllFilesUnderDirectory(module.toString() + File.separator + fixedPath); + clearProperties(jitContext, module.getName()); + } + } + } + } + + protected void installArchetype(String mavenPath) { + final String absoluteArchetypePath = fileService.getCombinePath(EnvironmentUtil.getServerRTPath(), archetypePath); + final String absoluteArchetypeTargetPath = fileService.getCombinePath(absoluteArchetypePath, archetypeTarget); + if (!fileService.isFileExist(absoluteArchetypeTargetPath)) { + //将程序运行目录中的maven模板安装到本地仓库 + String loStr = "开始:创建Maven模板"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + if (mavenUtilsCore.exeMavenCommand(absoluteArchetypePath, mavenPath, "install")) { + loStr = "完成:创建Maven模板"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } else { + throw new RuntimeException("Maven模板创建失败,请检查Maven配置"); + } + } + } + + private void clearProperties(JitContext context, String module) { + String factoriesFilePath = context.getGspProjectpath() + "/java/code/" + module + "/src/main/" + JitUtils.getSpringPeopertiesPath(); + if (fileService.isFileExist(factoriesFilePath)) { + fileService.fileUpdate(factoriesFilePath, "", false); + } + } + + protected void generateArchetype(String javaProjectPath, String mavenPath) throws IOException { + String loStr = "开始:生成maven模板"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + final String groupId = getGroupId(jitContext); + final String artifactId = getArtifactId(jitContext); + String mvnCommand = String.format("archetype:generate -DarchetypeCatalog=local -DarchetypeArtifactId=%s -DarchetypeGroupId=com.inspur.edp -DarchetypeVersion=0.1.3 -DgroupId=%s -DartifactId=%s -Dversion=0.1.0-SNAPSHOT -Dpackage=com.inspur -DinteractiveMode=false", archetypeArtifactId, groupId, artifactId); + if (mavenUtilsCore.exeMavenCommand(javaProjectPath, mavenPath, mvnCommand)) { + loStr = "完成:生成maven模板"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } else { + throw new RuntimeException("生成maven模板失败,请检查Maven配置"); + } + String javaProPath = javaProjectPath + File.separator + artifactId; + //重命名生成的目录 + renameDir(javaProjectPath, javaProPath); + } + + protected void renameDir(String basedir, String pro) throws IOException { + String final_proName = basedir + File.separator + Utils.getMavenProName(); + if (fileService.isDirectoryExist(final_proName)) { + String compPath = final_proName + File.separator + "comp"; + if (fileService.isDirectoryExist(compPath)) { + FileUtils.copyDirectory(new File(compPath), new File(pro + File.separator + "comp")); + } + try { + fileService.deleteAllFilesUnderDirectory(final_proName); + } catch (Exception e) { + + } finally { + if (fileService.isDirectoryExist(final_proName)) { + FileUtils.copyDirectory(new File(pro), new File(final_proName)); + fileService.deleteAllFilesUnderDirectory(pro); + } else { + boolean renameResult = fileService.renameDirectory(pro, final_proName); + if (!renameResult) { + throw new RuntimeException("重命名异常,原目录已存在"); + } + if (fileService.isFileExist(final_proName + File.separator + "pom.xml")) { + String loStr = "重命名目录成功!"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } else { + String loStr = "重命名目录失败!"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } + } + } + } else { + boolean renameResult = fileService.renameDirectory(pro, final_proName); + if (!renameResult) { + throw new RuntimeException("重命名异常,原目录已存在"); + } + if (fileService.isFileExist(final_proName + File.separator + "pom.xml")) { + String loStr = "重命名目录成功!"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } else { + String loStr = "重命名目录失败!"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } + } + } + + protected String getArtifactId(JitContext jitContext) { + String appCode = jitContext.getGspProjectInfo().getAppCode().toLowerCase(); + String suCode = jitContext.getGspProjectInfo().getServiceUnitCode().toLowerCase(); + String boCode = jitContext.getGspProjectInfo().getMetadataProjectName().toLowerCase(); + if (boCode.startsWith("bo-")) { + boCode = boCode.substring(boCode.indexOf("-") + 1); + } + String artifactId = String.format("%s-%s-%s", appCode, suCode, boCode); + + return artifactId; + } + + protected String getGroupId(JitContext jitContext) { + String groupId; + String prepareGroupId = jitContext.getGspProjectInfo().getProjectNameSpace().toLowerCase(); + String firstGroupId = "com."; + if (!prepareGroupId.contains(".")) { + return firstGroupId + prepareGroupId; + } + String[] subGroupId = prepareGroupId.split("\\."); + groupId = firstGroupId + (subGroupId[0] + "." + subGroupId[1]).toLowerCase(); + return groupId; + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManagerFactory.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManagerFactory.java new file mode 100644 index 0000000..68d6fa8 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManagerFactory.java @@ -0,0 +1,36 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.jittojava.core.manager; + +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; + +public class GeneratorManagerFactory { + public static GeneratorManager createGeneratorManager(String projPath) { + final ProcessMode processMode = SpringBeanUtils.getBean(MetadataProjectService.class).getProcessMode(projPath); + GeneratorManager generatorManager; + switch (processMode.toString()) { + case "interpretation": + generatorManager = new GeneratorManagerForInterpretation(); + break; + default: + generatorManager = new GeneratorManagerForGeneration(); + break; + } + return generatorManager; + } +} diff --git a/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/ModuleGenerator.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManagerForGeneration.java similarity index 59% rename from model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/ModuleGenerator.java rename to model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManagerForGeneration.java index ae417d2..210f460 100644 --- a/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/ModuleGenerator.java +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManagerForGeneration.java @@ -13,12 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.inspur.edp.jittojava.context.temp; +package com.inspur.edp.jittojava.core.manager; -/** - * The type ModuleGenerator - * - * @author: Jack Lee - */ -public class ModuleGenerator { +import com.inspur.edp.jittojava.core.JitUtils; + +public class GeneratorManagerForGeneration extends GeneratorManager { + public GeneratorManagerForGeneration() { + archetypePath = JitUtils.getArchetypePath(); + archetypeTarget = JitUtils.getArchetypeTarget(); + archetypeArtifactId = JitUtils.getArchetypeArtifactId(); + refModule = "api"; + } } diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManagerForInterpretation.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManagerForInterpretation.java new file mode 100644 index 0000000..94317fc --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManagerForInterpretation.java @@ -0,0 +1,117 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.jittojava.core.manager; + +import com.inspur.edp.jittojava.context.JitContext; +import com.inspur.edp.jittojava.core.JitUtils; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.entity.ProjectHeader; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.common.Utils; +import java.io.File; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class GeneratorManagerForInterpretation extends GeneratorManager { + + public GeneratorManagerForInterpretation() { + archetypePath = JitUtils.getCompArchetypePath(); + archetypeTarget = JitUtils.getCompArchetypeTarget(); + archetypeArtifactId = JitUtils.getCompArchetypeArtifactId(); + refModule = "comp"; + } + + @Override + public void generate(String absolutePath, String mavenPath) throws Exception { + try { + //构建生成上下文 + jitContext = buildJitContext(absolutePath); + //创建maven工程与模块 + createMavenProject(jitContext, mavenPath); + //生成后事件 + afterGenerate(absolutePath); + } finally { + } + } + + @Override + public void generateApi(String absolutePath, String mavenPath) { + } + + @Override + protected void beforeGenerate(String absolutePath) { + } + + @Override + protected void clearCode(String javaProjectPath) { + } + + @Override + protected void generateCode(JitContext jitContext) { + } + + @Override + protected List getGenerationMavenPackageRefs(MetadataProject metadataProject, String mavenPath) { + List generationMavenPackageRefsWithVersion = new ArrayList<>(); + if (metadataProject.getMavenPackageRefs() != null && metadataProject.getMavenPackageRefs().size() > 0) { + for (MavenPackageRefs mavenPackageRefs : metadataProject.getMavenPackageRefs()) { + // 如果有bo内引用,可以根据bo内引用确定元数据包名 + if (metadataProject.getProjectRefs() != null && metadataProject.getProjectRefs().size() > 0) { + final String[] split = mavenPackageRefs.getArtifactId().split("-"); + String projectName = split[2]; + String projectNameOrElse = "bo-" + split[2]; + final ProjectHeader projectHeader = metadataProject.getProjectRefs().stream().filter(ref -> ref.getProjectPath().endsWith(projectName) || ref.getProjectPath().endsWith(projectNameOrElse)).findFirst().orElse(null); + if (projectHeader != null) { + final MetadataPackageHeader metadataPackageHeader = metadataProject.getMetadataPackageRefs().stream().filter(ref -> ref.getName().equals(projectHeader.getName())).findFirst().orElse(null); + if (metadataPackageHeader != null) { + if (metadataPackageHeader.getProcessMode() == null || ProcessMode.GENERATION.equals(metadataPackageHeader.getProcessMode())) { + generationMavenPackageRefsWithVersion.add(mavenPackageRefs); + } + continue; + } + } + } + + // 如果不是bo内引用,则去maven文件夹下去找元数据包名 + File mavenPackagePath = Paths.get(mavenPath).resolve(mavenPackageRefs.getGroupId() + "-" + mavenPackageRefs.getArtifactId() + "-" + mavenPackageRefs.getVersion()).toFile(); + // 如果不存在,先install + if (!mavenPackagePath.exists()) { + try { + mdpkgService.installMdpkg(mavenPackageRefs.getGroupId(), mavenPackageRefs.getArtifactId(), mavenPackageRefs.getVersion(), jitContext.getGspProjectpath(), false); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (!mavenPackagePath.exists()) { + continue; + } + final File mdpkgFile = Arrays.stream(mavenPackagePath.listFiles()).filter(file -> file.getName().endsWith(Utils.getMetadataPackageExtension())).findFirst().orElse(null); + if (mdpkgFile != null) { + final MetadataPackageHeader metadataPackageHeader = metadataProject.getMetadataPackageRefs().stream().filter(header -> (header.getName() + Utils.getMetadataPackageExtension()).equals(mdpkgFile.getName())).findFirst().orElse(null); + if (metadataPackageHeader != null && (metadataPackageHeader.getProcessMode() == null || ProcessMode.GENERATION.equals(metadataPackageHeader.getProcessMode()))) { + generationMavenPackageRefsWithVersion.add(mavenPackageRefs); + } + } + } + } + return generationMavenPackageRefsWithVersion; + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/persistence/GenerateRepository.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/persistence/GenerateRepository.java new file mode 100644 index 0000000..52d6f0c --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/persistence/GenerateRepository.java @@ -0,0 +1,134 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.jittojava.core.persistence; + +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.apache.maven.model.Dependency; +import org.apache.maven.model.Model; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.apache.maven.model.io.xpp3.MavenXpp3Writer; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +public class GenerateRepository { + + public void updateModuleRefs(String pomPath, List mavenPackageRefs, boolean appendFlag) { + if (mavenPackageRefs == null || mavenPackageRefs.size() < 1) { + return; + } + + Model model = getModel(pomPath); + if (model == null) { + throw new RuntimeException("解析pom失败:" + pomPath); + } + + if (appendFlag && dependenciesContainsAll(model.getDependencies(), mavenPackageRefs)) { + return; + } + + List dependencies = appendFlag ? getDependencies(model.getDependencies(), mavenPackageRefs) : getDependencies(mavenPackageRefs); + model.setDependencies(dependencies); + saveModel(pomPath, model); + } + + private boolean dependenciesContainsAll(List dependencies, List mavenPackageRefs) { + if (mavenPackageRefs == null) { + return true; + } + for (MavenPackageRefs ref : mavenPackageRefs) { + boolean existFlag = false; + for (Dependency dependency : dependencies) { + if (dependency.getGroupId().equals(ref.getGroupId()) + && dependency.getArtifactId().equals(ref.getArtifactId()) + && dependency.getVersion().equals(ref.getVersion().substring(1))) { + existFlag = true; + break; + } + } + if (existFlag == false) { + return false; + } + } + return true; + } + + private List getDependencies(List mavenPackageRefs) { + ArrayList dependencies = new ArrayList<>(); + mavenPackageRefs.forEach(ref -> { + Dependency dependency = new Dependency(); + dependency.setGroupId(ref.getGroupId()); + dependency.setArtifactId(ref.getArtifactId()); + dependency.setVersion(ref.getVersion().substring(1)); + dependencies.add(dependency); + }); + return dependencies; + } + + private List getDependencies(List dependencies, List mavenPackageRefs) { + if (dependencies == null) { + dependencies = new ArrayList<>(); + } + List finalDependencies = dependencies; + mavenPackageRefs.forEach(ref -> { + int existInt = -1; + for (int i = 0; i < finalDependencies.size(); i++) { + if (ref.getArtifactId().equals(finalDependencies.get(i).getArtifactId()) + && ref.getGroupId().equals(finalDependencies.get(i).getGroupId())) { + existInt = i; + break; + } + } + if (existInt != -1) { + finalDependencies.get(existInt).setVersion(ref.getVersion().substring(1)); + } else { + Dependency dependency = new Dependency(); + dependency.setGroupId(ref.getGroupId()); + dependency.setArtifactId(ref.getArtifactId()); + dependency.setVersion(ref.getVersion().substring(1)); + finalDependencies.add(dependency); + } + }); + return finalDependencies; + } + + private Model getModel(String pomPath) { + try { + FileInputStream fis = new FileInputStream(pomPath); + MavenXpp3Reader reader = new MavenXpp3Reader(); + Model model = reader.read(fis); + fis.close(); + return model; + } catch (XmlPullParserException | IOException e) { + e.printStackTrace(); + } + return null; + } + + private void saveModel(String pomPath, Model model) { + MavenXpp3Writer writer = new MavenXpp3Writer(); + try { + FileOutputStream fos = new FileOutputStream(pomPath); + writer.write(fos, model); + fos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/persistence/RepositoryFactory.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/persistence/RepositoryFactory.java new file mode 100644 index 0000000..305336b --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/persistence/RepositoryFactory.java @@ -0,0 +1,39 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.jittojava.core.persistence; + +public class RepositoryFactory { + private RepositoryFactory() { + } + + private static RepositoryFactory instance; + + public static RepositoryFactory getInstance() { + if (instance == null) { + instance = new RepositoryFactory(); + } + return instance; + } + + private GenerateRepository generateRepository; + + public GenerateRepository getGenerateRepository() { + if (generateRepository == null) { + generateRepository = new GenerateRepository(); + } + return generateRepository; + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/AfterGenerator.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/AfterGenerator.java new file mode 100644 index 0000000..0d903c4 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/AfterGenerator.java @@ -0,0 +1,70 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.jittojava.temp; + +import com.inspur.edp.jittojava.context.entity.MavenDependency; +import com.inspur.edp.jittojava.core.GenerateServiceCore; +import com.inspur.edp.jittojava.spi.AfterGeneratorAction; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.ArrayList; + +/** + * @Classname AfterGenerator + * @Description TODO + * @Date 2019/12/17 16:02 + * @Created by liu_bintr + * @Version 1.0 + */ +public class AfterGenerator implements AfterGeneratorAction { + + GenerateServiceCore generateService = new GenerateServiceCore(); + Utils utils = new Utils(); + + @Override + public void afterGenerator(String projPath) { + addProjectDependency(projPath, null, utils.getDefaultDependency()); + FileServiceImp fileService = new FileServiceImp(); + String runtimePath = Paths.get(projPath).resolve("java/code/runtime").toString(); + if (fileService.isDirectoryExist(runtimePath)) { + try { + fileService.deleteAllFilesUnderDirectory(runtimePath); + } catch (IOException e) { + throw new RuntimeException(e); + } + generateService.removeRuntimeModule(projPath); + } + generateService.modifyPom(projPath, utils.getExtendDependency()); + generateService.modifyPom(projPath, utils.getSgfExtendDependency()); + } + + public void addProjectDependency(String projectPath, String currentJarPath, + ArrayList dependencyArrayList) { + String javaPath = getJavaProjPath(projectPath); + // 安装jar包到maven仓库 + Utils.installPackage(javaPath, currentJarPath, dependencyArrayList); + // 修改pom文件 + generateService.modifyPom(projectPath, dependencyArrayList); + } + + private String getJavaProjPath(String projPath) { + String javaPath = Paths.get(projPath).resolve("java").toString(); + String javaProjPath = Paths.get(javaPath).resolve(com.inspur.edp.lcm.metadata.common.Utils.getMavenProName()).toString(); + + return javaProjPath; + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/MavenDependencyConst.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/MavenDependencyConst.java new file mode 100644 index 0000000..8e6d308 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/MavenDependencyConst.java @@ -0,0 +1,34 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.jittojava.temp; + +/** + * @Classname MavenDependencyConst + * @Description TODO + * @Date 2019/12/16 16:36 + * @Created by liu_bintr + * @Version 1.0 + */ +public class MavenDependencyConst { + public static String groupId = "groupId"; + public static String artifactId = "artifactId"; + public static String version = "version"; + public static String file = "file"; + public static String dependency = "dependency"; + public static String dependencies = "dependencies"; + + public static String modules = "modules"; +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/Utils.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/Utils.java new file mode 100644 index 0000000..bbd5197 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/Utils.java @@ -0,0 +1,141 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.jittojava.temp; + +import com.inspur.edp.jittojava.context.entity.MavenDependency; +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; + +/** + * @Classname Utils + * @Description TODO + * @Date 2019/12/17 16:05 + * @Created by liu_bintr + * @Version 1.0 + */ +public class Utils { + public static void installPackage(String projectPath, String currentJarPath, + ArrayList dependencyArrayList) { + // 组装命令 + String command = String.format("cmd /c cd %s", projectPath); + Process process = null; + if (currentJarPath != null && !currentJarPath.isEmpty()) { + String addDependencyCommand = "mvn install:install-file -DgroupId=%1$s " + + "-DartifactId=%2$s -Dversion=%3$s -Dpackaging=jar -Dfile=%4$s"; + for (MavenDependency dependency : dependencyArrayList) { + String addCommand = String.format(addDependencyCommand, dependency.getGroupId(), + dependency.getArtifactId(), dependency.getVersion(), getPathString(String.format(currentJarPath + "\\%1$s", + dependency.getFile()))); + command = command.concat(" && " + addCommand); + } + } + excecuteCommand(process, command, "添加bef相关jar包"); + } + + public static void excecuteCommand(Process process, String command, String funcMessage) { + // 执行命令 + try { + process = Runtime.getRuntime().exec(command); + log(funcMessage + "开始..."); + BufferedReader reader = new BufferedReader(new InputStreamReader( + process.getInputStream())); + String line; + while ((line = reader.readLine()) != null) { + log(line); + } + process.waitFor(); + if (process.exitValue() == 1) { + log(funcMessage + "失败"); + } + log(funcMessage + "完成"); + process.destroy(); + } catch (IOException | InterruptedException e) { + e.printStackTrace(); + } + } + + public static void log(String message) { + Boolean showLog = true; + if (showLog) { + System.out.println(message); + } + } + + public static String getAbsolutePathString(String path) { + return new File(path).getAbsolutePath(); + } + + public ArrayList getExtendDependency() { + String extendDependencyPath = + this.getClass().getResource("/BefExtendMavenDependency.xml").toString(); + return readInternalDependency(extendDependencyPath); + } + + private ArrayList readInternalDependency(String defaultDependencyPath) { + ArrayList result = new ArrayList<>(); + Document doc = readDocument(defaultDependencyPath); + Element rootElement = doc.getRootElement(); + List list = rootElement.elements(); + for (int i = 0; i < list.size(); i++) { + Element ele = (Element) list.get(i); + result.add(new MavenDependency(getTagValue(ele, MavenDependencyConst.groupId), getTagValue(ele, MavenDependencyConst.artifactId), + getTagValue(ele, MavenDependencyConst.version), getTagValue(ele, MavenDependencyConst.file))); + } + return result; + } + + private Document readDocument(String filePath) { + SAXReader sr = new SAXReader(); + try { + return sr.read(filePath); + } catch (DocumentException e) { + throw new RuntimeException("无效路径" + filePath); + } + } + + private String getTagValue(Element ele, String tagName) { + Element tagElement = (Element) ele.element(tagName); + if (tagElement == null) { + return null; + } + return tagElement.getText(); + } + + private static String getPathString(String path) { + return getAbsolutePathString(path); + } + + public ArrayList getDefaultDependency() { + String defaultDependencyPath = + this.getClass().getResource("/BefProjectMavenDependency.xml").toString(); + return readInternalDependency(defaultDependencyPath); + } + + public ArrayList getSgfExtendDependency() { + String extendDependencyPath = + this.getClass().getResource("/SgfExtendMavenDependency.xml").toString(); + return readInternalDependency(extendDependencyPath); + } + +} diff --git a/model/framework/generator-webapi/pom.xml b/model/framework/generator-webapi/pom.xml new file mode 100644 index 0000000..1153e91 --- /dev/null +++ b/model/framework/generator-webapi/pom.xml @@ -0,0 +1,30 @@ + + + + ubml-model-framework + org.openatom.ubml + 0.9.0-SNAPSHOT + + 4.0.0 + ubml-model-framework-generator-webapi ${project.version} + + + org.openatom.ubml + ubml-model-framework-generator-api + ${project.version} + + + io.iec.edp + caf-boot-starter-rest-server + + + ubml-model-framework-generator-webapi + + + 8 + 8 + + + \ No newline at end of file diff --git a/model/framework/generator-webapi/src/main/java/com/inspur/edp/jittojava/webapi/GenerateController.java b/model/framework/generator-webapi/src/main/java/com/inspur/edp/jittojava/webapi/GenerateController.java new file mode 100644 index 0000000..a4872eb --- /dev/null +++ b/model/framework/generator-webapi/src/main/java/com/inspur/edp/jittojava/webapi/GenerateController.java @@ -0,0 +1,51 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.jittojava.webapi; + +import com.inspur.edp.jittojava.context.GenerateService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname GenerateServiceWebApiImp + * @Description TODO + * @Date 2019/12/16 17:21 + * @Created by liu_bintr + * @Version 1.0 + */ +@Slf4j +@Path("/") +@Produces(MediaType.APPLICATION_JSON) +public class GenerateController { + + GenerateService generateService = SpringBeanUtils.getBean(GenerateService.class); + + @POST + public void generate(@QueryParam(value = "path") String path) throws Exception { + generateService.generate(path); + } + + @POST + @Path("/generateapi") + public void generateApi(@QueryParam(value = "path") String path) throws Exception { + generateService.generateApi(path); + } +} diff --git a/model/framework/generator-webapi/src/main/java/com/inspur/edp/jittojava/webapi/config/Configuration.java b/model/framework/generator-webapi/src/main/java/com/inspur/edp/jittojava/webapi/config/Configuration.java new file mode 100644 index 0000000..665dda3 --- /dev/null +++ b/model/framework/generator-webapi/src/main/java/com/inspur/edp/jittojava/webapi/config/Configuration.java @@ -0,0 +1,38 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.jittojava.webapi.config; + +import com.inspur.edp.jittojava.webapi.GenerateController; +import io.iec.edp.caf.rest.RESTEndpoint; +import org.springframework.context.annotation.Bean; + +/** + * Classname Configuration Description TODO Date 2019/12/17 10:19 + * + * @author zhongchq + * @version 1.0 + */ +public class Configuration { + + @Bean + public RESTEndpoint generateEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/generator", + new GenerateController() + ); + } + +} diff --git a/model/framework/pom.xml b/model/framework/pom.xml index 1a25352..48eebed 100644 --- a/model/framework/pom.xml +++ b/model/framework/pom.xml @@ -25,6 +25,7 @@ generator-api generator-spi generator-core + generator-webapi @@ -39,6 +40,7 @@ 0.3.2 0.3.8 0.3.2 + 0.1.0-SNAPSHOT 0.1.4 0.1.25 @@ -103,6 +105,11 @@ caf-rpc-api ${caf-rpc-api.version} + + com.inspur.edp + caf-generator + ${caf-generator.version} + com.inspur.edp -- Gitee From 2fa5935a85fee106031cb2232c8019ba5cf1a8db Mon Sep 17 00:00:00 2001 From: Q-Lee Date: Tue, 11 May 2021 17:31:47 +0800 Subject: [PATCH 51/61] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Dgenerator-xx=E6=A8=A1=E5=9D=97=E4=B8=8B=E6=89=80?= =?UTF-8?q?=E6=9C=89checkstyle=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../initializer/ExternalApiInitializer.java | 2 +- .../provider/ExternalApiMetadataBuilder.java | 6 ++-- .../metadata/common/MetadataDtoConverter.java | 6 ++-- .../edp/jittojava/core/CommonServiceCore.java | 1 - .../edp/jittojava/core/JitCompilerHelper.java | 4 +-- .../core/manager/GeneratorManager.java | 30 +++++++++---------- .../core/persistence/GenerateRepository.java | 2 +- .../com/inspur/edp/jittojava/temp/Utils.java | 3 +- .../MetadataRTServerServiceImpl.java | 2 +- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/initializer/ExternalApiInitializer.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/initializer/ExternalApiInitializer.java index e2fac1e..899c6d2 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/initializer/ExternalApiInitializer.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/initializer/ExternalApiInitializer.java @@ -38,7 +38,7 @@ public class ExternalApiInitializer implements MetadataContentManager { eapi.setName(metadata.getHeader().getName()); eapi.setVersion("1.0"); eapi.getService().setId(UUID.randomUUID().toString()); - eapi.setBusinessObject(metadata.getHeader().getBizobjectID()); + eapi.setBusinessObject(metadata.getHeader().getBizObjectId()); //TODO:后续添加SU/APP/RouteURL信息 metadata.setContent(eapi); } diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ExternalApiMetadataBuilder.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ExternalApiMetadataBuilder.java index 25a18a6..aba1d67 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ExternalApiMetadataBuilder.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ExternalApiMetadataBuilder.java @@ -99,7 +99,7 @@ public class ExternalApiMetadataBuilder { eApi.setId(eapiMetadata.getHeader().getId()); eApi.setCode(eapiMetadata.getHeader().getCode()); eApi.setName(eapiMetadata.getHeader().getName()); - eApi.setBusinessObject(eapiMetadata.getHeader().getBizobjectID()); + eApi.setBusinessObject(eapiMetadata.getHeader().getBizObjectId()); //TODO:set app&su eApi.setApplication(null); eApi.setMicroServiceUnit(null); @@ -179,11 +179,11 @@ public class ExternalApiMetadataBuilder { metadata.getHeader().setCode(vo.getHeader().getCode()); metadata.getHeader().setName(vo.getHeader().getName()); metadata.getHeader().setExtendable(vo.getHeader().isExtendable()); - if (StringUtils.isBlank(vo.getHeader().getBizobjectID())) { + if (StringUtils.isBlank(vo.getHeader().getBizObjectId())) { throw new RuntimeException( String.format("VO元数据【%s(ID:%s)】的业务对象不能为空", vo.getHeader().getCode(), vo.getHeader().getId())); } - metadata.getHeader().setBizobjectID(vo.getHeader().getBizobjectID()); + metadata.getHeader().setBizObjectId(vo.getHeader().getBizObjectId()); metadata.getHeader().setType(Constants.EXTERNAL_API_METADATA_TYPE); metadata.getHeader().setFileName(vo.getHeader().getCode() + EAPI_SUFFIX_NAME); metadata.setRelativePath(getEapiRelativePath(path)); diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataDtoConverter.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataDtoConverter.java index c089ef6..3afbc00 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataDtoConverter.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataDtoConverter.java @@ -49,7 +49,7 @@ public class MetadataDtoConverter { return null; } MetadataDto metadataDto = new MetadataDto(); - metadataDto.setBizobjectID(metadata.getHeader().getBizobjectID()); + metadataDto.setBizobjectID(metadata.getHeader().getBizObjectId()); metadataDto.setType(metadata.getHeader().getType()); metadataDto.setId(metadata.getHeader().getId()); metadataDto.setCode(metadata.getHeader().getCode()); @@ -59,7 +59,7 @@ public class MetadataDtoConverter { metadataDto.setLanguage(metadata.getHeader().getLanguage()); metadataDto.setRelativePath(metadata.getRelativePath()); //GspMetadata没有此属性 - metadataDto.setIsTranslating(metadata.getHeader().isTranslating()); + metadataDto.setTranslating(metadata.getHeader().getTranslating()); metadataDto.setExtendProperty(metadata.getExtendProperty()); metadataDto.setExtendable(metadata.getHeader().isExtendable()); metadataDto.setExtented(metadata.isExtended()); @@ -125,7 +125,7 @@ public class MetadataDtoConverter { GspMetadata metadata = new GspMetadata(); metadata.setHeader(new MetadataHeader()); metadata.getHeader().setId(metadataDto.getId()); - metadata.getHeader().setBizobjectID(metadataDto.getBizobjectID()); + metadata.getHeader().setBizObjectId(metadataDto.getBizobjectID()); metadata.getHeader().setNameSpace(metadataDto.getNameSpace()); metadata.getHeader().setType(metadataDto.getType()); metadata.getHeader().setFileName(metadataDto.getFileName()); diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/CommonServiceCore.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/CommonServiceCore.java index ed4cb09..b80e8e1 100644 --- a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/CommonServiceCore.java +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/CommonServiceCore.java @@ -89,7 +89,6 @@ public class CommonServiceCore implements CommonService { // targetpath.substring("java"); // list.add(targetpath); // } -// System.out.println("正在访问:" + dir + " 目录"); // return FileVisitResult.CONTINUE; // } }); diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/JitCompilerHelper.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/JitCompilerHelper.java index fbf85c8..46f34eb 100644 --- a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/JitCompilerHelper.java +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/JitCompilerHelper.java @@ -53,7 +53,7 @@ public class JitCompilerHelper extends JitCompilerConfigLoader { public JitAction getManager(String typeName) { JitAction manager = null; JitCompilerConfigration data = getCompilerConfigurations(typeName); - if (data != null && data.getEnable() == true) { + if (data != null && data.getEnable()) { Class cls = null; if (data.getBeforeCompiler() != null) { try { @@ -70,7 +70,7 @@ public class JitCompilerHelper extends JitCompilerConfigLoader { public AfterGeneratorAction getAfterActionManager(String typeName) { AfterGeneratorAction manager = null; JitCompilerConfigration data = getCompilerConfigurations(typeName); - if (data != null && data.getEnable() == true) { + if (data != null && data.getEnable()) { Class cls = null; if (data.getAfterCompiler() != null) { try { diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManager.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManager.java index 3e2e153..d32b9c2 100644 --- a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManager.java +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManager.java @@ -26,6 +26,7 @@ import com.inspur.edp.jittojava.core.persistence.RepositoryFactory; import com.inspur.edp.jittojava.spi.AfterGeneratorAction; import com.inspur.edp.jittojava.spi.JitAction; 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.entity.MetadataProject; import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; import com.inspur.edp.lcm.metadata.api.service.MdpkgService; @@ -47,7 +48,6 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import lombok.extern.slf4j.Slf4j; -import lombok.var; import org.apache.commons.io.FileUtils; import org.apache.maven.model.Model; import org.apache.maven.model.Parent; @@ -192,7 +192,7 @@ public class GeneratorManager { for (JitCompilerConfigration config : compilerTypeList) { if (item.getHeader().getType().equals(config.getTypeCode())) { // 获取元数据实体传给各元数据编译器 - var metadata = metadataCoreManager.loadMetadata(item.getHeader().getFileName(), item.getRelativePath()); + GspMetadata metadata = metadataCoreManager.loadMetadata(item.getHeader().getFileName(), item.getRelativePath()); jitContext.setMetadata(metadata); if (jitContext.getMetadataCache(metadata.getHeader().getId()) == null) { jitContext.setMetadataCache(metadata.getHeader().getId(), metadata); @@ -264,12 +264,12 @@ public class GeneratorManager { log.info(loStr); LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); //构建上下文内容,此处需要确定是否包含工程信息,元数据信息等 - var context = new JitContext(); + JitContext context = new JitContext(); try { context.setGspProjectpath(absolutePath); Utils.setMetadataPath(absolutePath); - var gspProjectInfo = gspProjectCoreService.getGspProjectInfo(absolutePath); - var metadataProjectInfo = metadataProjectCoreService.getMetadataProjInfo(absolutePath); + GspProject gspProjectInfo = gspProjectCoreService.getGspProjectInfo(absolutePath); + MetadataProject metadataProjectInfo = metadataProjectCoreService.getMetadataProjInfo(absolutePath); context.setMetadataProjectInfo(metadataProjectInfo); context.setGspProjectInfo(gspProjectInfo); context.setApiModuleGenerator(new ModuleGenerator() { @@ -493,26 +493,26 @@ public class GeneratorManager { } protected void renameDir(String basedir, String pro) throws IOException { - String final_proName = basedir + File.separator + Utils.getMavenProName(); - if (fileService.isDirectoryExist(final_proName)) { - String compPath = final_proName + File.separator + "comp"; + String finalProname = basedir + File.separator + Utils.getMavenProName(); + if (fileService.isDirectoryExist(finalProname)) { + String compPath = finalProname + File.separator + "comp"; if (fileService.isDirectoryExist(compPath)) { FileUtils.copyDirectory(new File(compPath), new File(pro + File.separator + "comp")); } try { - fileService.deleteAllFilesUnderDirectory(final_proName); + fileService.deleteAllFilesUnderDirectory(finalProname); } catch (Exception e) { } finally { - if (fileService.isDirectoryExist(final_proName)) { - FileUtils.copyDirectory(new File(pro), new File(final_proName)); + if (fileService.isDirectoryExist(finalProname)) { + FileUtils.copyDirectory(new File(pro), new File(finalProname)); fileService.deleteAllFilesUnderDirectory(pro); } else { - boolean renameResult = fileService.renameDirectory(pro, final_proName); + boolean renameResult = fileService.renameDirectory(pro, finalProname); if (!renameResult) { throw new RuntimeException("重命名异常,原目录已存在"); } - if (fileService.isFileExist(final_proName + File.separator + "pom.xml")) { + if (fileService.isFileExist(finalProname + File.separator + "pom.xml")) { String loStr = "重命名目录成功!"; log.info(loStr); LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); @@ -524,11 +524,11 @@ public class GeneratorManager { } } } else { - boolean renameResult = fileService.renameDirectory(pro, final_proName); + boolean renameResult = fileService.renameDirectory(pro, finalProname); if (!renameResult) { throw new RuntimeException("重命名异常,原目录已存在"); } - if (fileService.isFileExist(final_proName + File.separator + "pom.xml")) { + if (fileService.isFileExist(finalProname + File.separator + "pom.xml")) { String loStr = "重命名目录成功!"; log.info(loStr); LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/persistence/GenerateRepository.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/persistence/GenerateRepository.java index 52d6f0c..a7dd851 100644 --- a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/persistence/GenerateRepository.java +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/persistence/GenerateRepository.java @@ -62,7 +62,7 @@ public class GenerateRepository { break; } } - if (existFlag == false) { + if (!existFlag) { return false; } } diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/Utils.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/Utils.java index bbd5197..6fb5ba3 100644 --- a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/Utils.java +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/Utils.java @@ -78,7 +78,8 @@ public class Utils { public static void log(String message) { Boolean showLog = true; if (showLog) { - System.out.println(message); + //todo +// message } } diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/MetadataRTServerServiceImpl.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/MetadataRTServerServiceImpl.java index b2989c5..749c351 100644 --- a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/MetadataRTServerServiceImpl.java +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/MetadataRTServerServiceImpl.java @@ -502,7 +502,7 @@ public class MetadataRTServerServiceImpl implements MetadataRTServerService { // 根据BizobjectID进行过滤 if (filter.getBizobjectId() != null && filter.getBizobjectId().size() > 0) { for (String eachBizobjectId : filter.getBizobjectId()) { - metadataList = metadataList.stream().filter(item -> item.getMetadata().getHeader().getBizobjectID().equals(eachBizobjectId)).collect(Collectors.toList()); + metadataList = metadataList.stream().filter(item -> item.getMetadata().getHeader().getBizObjectId().equals(eachBizobjectId)).collect(Collectors.toList()); } } if (filter.getCode() != null) { -- Gitee From f27ca88380c41c37dae374cff669585b00419ff3 Mon Sep 17 00:00:00 2001 From: Q-Lee Date: Thu, 13 May 2021 15:10:14 +0800 Subject: [PATCH 52/61] =?UTF-8?q?=E9=87=8D=E6=9E=84=EF=BC=9A(1)lcm-metadat?= =?UTF-8?q?a-shell=E5=B7=A5=E7=A8=8B=E4=BB=A3=E7=A0=81=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E5=AE=8C=E6=AF=95=20(2)=E4=BF=AE=E5=A4=8Dcheckstyle=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(3)=20=E5=8E=BB=E6=8E=89=E6=89=80=E6=9C=89?= =?UTF-8?q?=E4=BD=BF=E7=94=A8lombok=E7=9A=84=E5=9C=B0=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/framework/common/pom.xml | 6 + .../entity/AdvancedFunctionConfiguration.java | 27 ++- .../metadata/api/entity/MetadataRTFilter.java | 63 +++++- .../api/entity/WorkspaceDataLocation.java | 38 +++- .../MavenSourceRuleConfigLoader.java | 13 +- .../MetadataConfigurationLoader.java | 13 +- .../common/context/RuntimeContext.java | 14 +- .../common/logging/MvnStreamConsumer.java | 5 +- model/framework/devtime-core/pom.xml | 6 + .../edp/lcm/metadata/core/MavenUtilsCore.java | 6 +- .../metadata/core/MetadataCoreManager.java | 5 +- .../core/MetadataIndexCacheService.java | 6 +- .../lcm/metadata/core/MetadataServiceImp.java | 6 +- .../lcm/metadata/core/PackageCoreService.java | 5 +- .../metadata/core/RefCommonCoreService.java | 2 - .../core/config/JitRuntimeConfigLoader.java | 9 +- .../edp/lcm/metadata/ref/MavenUtilsImp.java | 2 - .../edp/lcm/metadata/ref/MdpkgServiceImp.java | 2 - model/framework/devtime-webapi/pom.xml | 6 + .../jittojava/core/GenerateServiceCore.java | 2 - .../jittojava/core/GenerateServiceImp.java | 2 - .../core/manager/GeneratorManager.java | 6 +- model/framework/generator-webapi/pom.xml | 10 +- .../jittojava/webapi/GenerateController.java | 3 - model/framework/metadata-shell/pom.xml | 36 +++ .../edp/lcm/metadata/ShellApplication.java | 38 ++++ .../lcm/metadata/shell/MetadataCommand.java | 206 ++++++++++++++++++ .../metadata/shell/StringCommandRunner.java | 69 ++++++ .../metadata/shell/StringInputProvider.java | 50 +++++ .../metadata/shell/StringParsedLineInput.java | 51 +++++ .../inspur/edp/lcm/metadata/shell/Utils.java | 49 +++++ .../shell/config/ShellConfiguration.java | 34 +++ .../main/resources/META-INF/spring.factories | 1 + .../src/main/resources/application.yaml | 8 + .../src/main/resources/banner.txt | 10 + model/framework/pom.xml | 12 + .../rtservice/MetadataRTServiceImp.java | 2 - .../MetadataRTServerServiceImpl.java | 6 +- .../monitor/MonitorInitializer.java | 6 +- .../MetadataPackageRepositoryImp.java | 5 +- .../vo/definition/common/ConvertUtils.java | 1 - .../extendinfo/entity/GspVoExtendInfo.java | 5 +- .../VmActionCollectionSerializer.java | 1 - 43 files changed, 779 insertions(+), 68 deletions(-) create mode 100644 model/framework/metadata-shell/pom.xml create mode 100644 model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/ShellApplication.java create mode 100644 model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/MetadataCommand.java create mode 100644 model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/StringCommandRunner.java create mode 100644 model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/StringInputProvider.java create mode 100644 model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/StringParsedLineInput.java create mode 100644 model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/Utils.java create mode 100644 model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/config/ShellConfiguration.java create mode 100644 model/framework/metadata-shell/src/main/resources/META-INF/spring.factories create mode 100644 model/framework/metadata-shell/src/main/resources/application.yaml create mode 100644 model/framework/metadata-shell/src/main/resources/banner.txt diff --git a/model/framework/common/pom.xml b/model/framework/common/pom.xml index 5e269a1..06a5538 100644 --- a/model/framework/common/pom.xml +++ b/model/framework/common/pom.xml @@ -33,6 +33,12 @@ io.iec.edp caf-boot-starter-context + + + lombok + org.projectlombok + + diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/AdvancedFunctionConfiguration.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/AdvancedFunctionConfiguration.java index bcc578a..770f34b 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/AdvancedFunctionConfiguration.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/AdvancedFunctionConfiguration.java @@ -15,10 +15,31 @@ */ package com.inspur.edp.lcm.metadata.api.entity; -import lombok.Data; - -@Data public class AdvancedFunctionConfiguration { private boolean maven; private boolean menu; + + public boolean isMaven() { + return maven; + } + + public void setMaven(boolean maven) { + this.maven = maven; + } + + public boolean isMenu() { + return menu; + } + + public void setMenu(boolean menu) { + this.menu = menu; + } + + @Override + public String toString() { + return "AdvancedFunctionConfiguration{" + + "maven=" + maven + + ", menu=" + menu + + '}'; + } } diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataRTFilter.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataRTFilter.java index 109fb2b..b72a39e 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataRTFilter.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataRTFilter.java @@ -16,7 +16,6 @@ package com.inspur.edp.lcm.metadata.api.entity; import java.util.List; -import lombok.Data; /** * Classname MetadataRTFilter Description 过滤条件实体类 Date 2019/11/18 15:21 @@ -24,9 +23,7 @@ import lombok.Data; * @author zhongchq * @version 1.0 */ -@Data public class MetadataRTFilter { - //关键应用编号 public String appCode; //服务单元编号 @@ -39,4 +36,64 @@ public class MetadataRTFilter { public String code; public String nameSpace; + + public String getAppCode() { + return appCode; + } + + public void setAppCode(String appCode) { + this.appCode = appCode; + } + + public String getServiceUnitCode() { + return serviceUnitCode; + } + + public void setServiceUnitCode(String serviceUnitCode) { + this.serviceUnitCode = serviceUnitCode; + } + + public List getBizobjectId() { + return bizobjectId; + } + + public void setBizobjectId(List bizobjectId) { + this.bizobjectId = bizobjectId; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getNameSpace() { + return nameSpace; + } + + public void setNameSpace(String nameSpace) { + this.nameSpace = nameSpace; + } + + @Override + public String toString() { + return "MetadataRTFilter{" + + "appCode='" + appCode + '\'' + + ", serviceUnitCode='" + serviceUnitCode + '\'' + + ", bizobjectId=" + bizobjectId + + ", type='" + type + '\'' + + ", code='" + code + '\'' + + ", nameSpace='" + nameSpace + '\'' + + '}'; + } } diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/WorkspaceDataLocation.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/WorkspaceDataLocation.java index aca8a1f..413e6f9 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/WorkspaceDataLocation.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/WorkspaceDataLocation.java @@ -15,8 +15,6 @@ */ package com.inspur.edp.lcm.metadata.api.entity; -import lombok.Data; - /** * @Classname WorkspaceDataLocation * @Description TODO @@ -25,8 +23,40 @@ import lombok.Data; * @Version 1.0 */ -@Data public class WorkspaceDataLocation { - public String workspaceDataLocation; + + public String getWorkspaceDataLocation() { + return workspaceDataLocation; + } + + public void setWorkspaceDataLocation(String workspaceDataLocation) { + this.workspaceDataLocation = workspaceDataLocation; + } + + @Override + public String toString() { + return "WorkspaceDataLocation{" + + "workspaceDataLocation='" + workspaceDataLocation + '\'' + + '}'; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof WorkspaceDataLocation)) { + return false; + } + WorkspaceDataLocation item = (WorkspaceDataLocation) obj; + return workspaceDataLocation == null ? item.getWorkspaceDataLocation() == null : workspaceDataLocation.equals(item.getWorkspaceDataLocation()); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + (workspaceDataLocation == null ? 0 : workspaceDataLocation.hashCode()); + return result; + } } diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSourceRuleConfigLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSourceRuleConfigLoader.java index 06d293c..7374654 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSourceRuleConfigLoader.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSourceRuleConfigLoader.java @@ -20,8 +20,6 @@ import java.io.IOException; import java.nio.file.Paths; import java.util.List; import java.util.Map; -import lombok.Getter; -import lombok.Setter; /** * @Classname MavenSourceRuleConfigLoader @@ -34,14 +32,21 @@ public class MavenSourceRuleConfigLoader { private static String fileName = "config/platform/common/lcm_mavensourcerule.json"; private static String sectionName = "rule"; - @Setter - @Getter public static Map> mavenSourceRuleConfigurations; public MavenSourceRuleConfigLoader() { fileName = Paths.get(EnvironmentUtil.getServerRTPath()).resolve(fileName).toString(); } + public static Map> getMavenSourceRuleConfigurations() { + return mavenSourceRuleConfigurations; + } + + public static void setMavenSourceRuleConfigurations( + Map> mavenSourceRuleConfigurations) { + MavenSourceRuleConfigLoader.mavenSourceRuleConfigurations = mavenSourceRuleConfigurations; + } + protected Map> loadSourceRuleConfigration() { MetadataServiceHelper metadataServiceHelper = new MetadataServiceHelper(); try { diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationLoader.java index 744600b..9cc3d89 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationLoader.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationLoader.java @@ -21,8 +21,6 @@ import io.iec.edp.caf.common.environment.EnvironmentUtil; import java.io.IOException; import java.io.Serializable; import java.util.List; -import lombok.Getter; -import lombok.Setter; /** * @Classname MetadataConfigurationLoader @@ -33,8 +31,6 @@ import lombok.Setter; */ public class MetadataConfigurationLoader implements Serializable { - @Setter - @Getter public static List metadataConfigurations; private static String fileName = "config/platform/common/lcm_metadataextend.json"; private static final String SECTION_NAME = "MetadataConfiguration"; @@ -43,6 +39,15 @@ public class MetadataConfigurationLoader implements Serializable { loadMetadataConfigurations(); } + public static List getMetadataConfigurations() { + return metadataConfigurations; + } + + public static void setMetadataConfigurations( + List metadataConfigurations) { + MetadataConfigurationLoader.metadataConfigurations = metadataConfigurations; + } + /** * @param * @return java.util.List diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/context/RuntimeContext.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/context/RuntimeContext.java index 9635086..6b60dba 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/context/RuntimeContext.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/context/RuntimeContext.java @@ -16,7 +16,6 @@ package com.inspur.edp.lcm.metadata.common.context; import io.iec.edp.caf.boot.context.CAFContext; -import lombok.Setter; /** * Classname RuntimeContext Description TODO Date 2019/8/20 14:11 @@ -26,8 +25,16 @@ import lombok.Setter; */ public class RuntimeContext { - @Setter public static String tenantID; + private static String language; + + public static void setTenantID(String tenantID) { + RuntimeContext.tenantID = tenantID; + } + + public static void setLanguage(String language) { + RuntimeContext.language = language; + } public static String getTenantID() { @@ -37,9 +44,6 @@ public class RuntimeContext { return tenantID; } - @Setter - private static String language; - public static String getLanguage() { try { language = CAFContext.current.getLanguage(); diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/logging/MvnStreamConsumer.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/logging/MvnStreamConsumer.java index 3620543..12714a9 100644 --- a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/logging/MvnStreamConsumer.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/logging/MvnStreamConsumer.java @@ -17,8 +17,9 @@ package com.inspur.edp.lcm.metadata.common.logging; import com.inspur.lcm.metadata.logging.LoggerDisruptorQueue; import io.iec.edp.caf.boot.context.CAFContext; -import lombok.extern.slf4j.Slf4j; import org.apache.maven.shared.invoker.InvocationOutputHandler; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Classname MvnStreamConsumer Description 获取日志 Date 2020/3/4 11:32 @@ -26,8 +27,8 @@ import org.apache.maven.shared.invoker.InvocationOutputHandler; * @author zhongchq * @version 1.0 */ -@Slf4j public class MvnStreamConsumer implements InvocationOutputHandler { + private static final Logger log = LoggerFactory.getLogger(MvnStreamConsumer.class); private String exceptionString; diff --git a/model/framework/devtime-core/pom.xml b/model/framework/devtime-core/pom.xml index 6082276..de4c65a 100644 --- a/model/framework/devtime-core/pom.xml +++ b/model/framework/devtime-core/pom.xml @@ -15,6 +15,12 @@ io.iec.edp caf-business-object-api + + + lombok + org.projectlombok + + io.iec.edp diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MavenUtilsCore.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MavenUtilsCore.java index f69739e..00ceb92 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MavenUtilsCore.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MavenUtilsCore.java @@ -23,7 +23,6 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import lombok.extern.slf4j.Slf4j; import org.apache.maven.shared.invoker.DefaultInvocationRequest; import org.apache.maven.shared.invoker.DefaultInvoker; import org.apache.maven.shared.invoker.InvocationRequest; @@ -31,12 +30,15 @@ import org.apache.maven.shared.invoker.InvocationResult; import org.apache.maven.shared.utils.cli.CommandLineException; import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author zhaoleitr */ -@Slf4j public class MavenUtilsCore { + private static final Logger log = LoggerFactory.getLogger(MavenUtilsCore.class); + private String mavenHomePath; private final DefaultInvoker invoker; diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java index 7d2e459..dcbd4aa 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java @@ -96,15 +96,16 @@ import java.util.stream.Collectors; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipInputStream; -import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; import org.codehaus.plexus.util.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author zhaoleitr */ -@Slf4j public class MetadataCoreManager { + private static final Logger log = LoggerFactory.getLogger(MetadataCoreManager.class); private final FileServiceImp fileService = new FileServiceImp(); private final MetadataProjectCoreService metadataProjectCoreService = new MetadataProjectCoreService(); diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataIndexCacheService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataIndexCacheService.java index a977bd6..43d8c69 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataIndexCacheService.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataIndexCacheService.java @@ -32,15 +32,17 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; -import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * 元数据索引服务 * * @author zhaoleitr */ -@Slf4j public class MetadataIndexCacheService { + private static final Logger log = LoggerFactory.getLogger(MetadataIndexCacheService.class); + private static MetadataIndexCacheService singleton = null; private final FileServiceImp fileServiceImp = new FileServiceImp(); diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataServiceImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataServiceImp.java index bc1bd51..d80ff73 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataServiceImp.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataServiceImp.java @@ -36,13 +36,15 @@ import java.io.IOException; import java.nio.file.Paths; import java.util.List; import java.util.Objects; -import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author zhaoleitr */ -@Slf4j public class MetadataServiceImp implements MetadataService { + private static final Logger log = LoggerFactory.getLogger(MetadataServiceImp.class); + private final GspProjectService gspProjectService = new GspProjectServiceImp(); private final MetadataProjectCoreService metadataProjectService = new MetadataProjectCoreService(); private final MetadataCoreManager metadataCoreManager = new MetadataCoreManager(); diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageCoreService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageCoreService.java index 2a8bb8c..42a9dab 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageCoreService.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageCoreService.java @@ -80,7 +80,6 @@ import java.util.stream.Collectors; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipInputStream; -import lombok.extern.slf4j.Slf4j; import org.apache.maven.model.Dependency; import org.apache.maven.model.DeploymentRepository; import org.apache.maven.model.DistributionManagement; @@ -89,6 +88,8 @@ import org.apache.maven.model.Parent; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.model.io.xpp3.MavenXpp3Writer; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -99,8 +100,8 @@ import org.springframework.web.client.RestTemplate; /** * @author zhaoleitr */ -@Slf4j public class PackageCoreService { + private static final Logger log = LoggerFactory.getLogger(PackageCoreService.class); private FileServiceImp fileServiceImp = new FileServiceImp(); private MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RefCommonCoreService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RefCommonCoreService.java index f86bf1d..9ff9be9 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RefCommonCoreService.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RefCommonCoreService.java @@ -26,12 +26,10 @@ import com.inspur.edp.lcm.metadata.core.index.ProjectMetadataCacheService; import java.io.File; import java.util.ArrayList; import java.util.List; -import lombok.extern.slf4j.Slf4j; /** * @author zhaoleitr */ -@Slf4j public class RefCommonCoreService { private final MetadataCoreManager metadataManager = new MetadataCoreManager(); private final MetadataProjectCoreService projectService = new MetadataProjectCoreService(); diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeConfigLoader.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeConfigLoader.java index b49f2c4..337f883 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeConfigLoader.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeConfigLoader.java @@ -25,20 +25,21 @@ import com.inspur.edp.lcm.metadata.common.FileServiceImp; import io.iec.edp.caf.common.environment.EnvironmentUtil; import java.io.IOException; import java.nio.file.Paths; -import lombok.Getter; -import lombok.Setter; public class JitRuntimeConfigLoader { private static final String SECTION_NAME = "JitRuntimeConfigration"; - @Getter - @Setter static JitRuntimeConfigration jitRuntimeConfigration; private static String fileName = "config/platform/common/lcm_gspprojectextend.json"; public JitRuntimeConfigLoader() { } + public static void setJitRuntimeConfigration( + JitRuntimeConfigration jitRuntimeConfigration) { + JitRuntimeConfigLoader.jitRuntimeConfigration = jitRuntimeConfigration; + } + protected JitRuntimeConfigration getJitRuntimeConfigration() { fileName = Paths.get(EnvironmentUtil.getServerRTPath()).resolve(fileName).toString(); diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MavenUtilsImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MavenUtilsImp.java index 78fb424..d7421b0 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MavenUtilsImp.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MavenUtilsImp.java @@ -18,7 +18,6 @@ package com.inspur.edp.lcm.metadata.ref; import com.inspur.edp.lcm.metadata.api.service.MavenUtilsService; import com.inspur.edp.lcm.metadata.core.MavenUtilsCore; import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; -import lombok.extern.slf4j.Slf4j; /** * Classname MavenUtils Description mvn操作工具类 Date 2019/12/9 9:49 @@ -26,7 +25,6 @@ import lombok.extern.slf4j.Slf4j; * @author zhongchq * @version 1.0 */ -@Slf4j public class MavenUtilsImp implements MavenUtilsService { @Override diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MdpkgServiceImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MdpkgServiceImp.java index 425bbad..c25a7f5 100644 --- a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MdpkgServiceImp.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MdpkgServiceImp.java @@ -27,12 +27,10 @@ import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; import io.iec.edp.caf.commons.utils.SpringBeanUtils; import java.io.IOException; import java.util.List; -import lombok.extern.slf4j.Slf4j; /** * 元数据服务 */ -@Slf4j public class MdpkgServiceImp implements MdpkgService { private MetadataProjectService metadataProjectService; diff --git a/model/framework/devtime-webapi/pom.xml b/model/framework/devtime-webapi/pom.xml index 0aaf73f..042cd1e 100644 --- a/model/framework/devtime-webapi/pom.xml +++ b/model/framework/devtime-webapi/pom.xml @@ -15,6 +15,12 @@ io.iec.edp caf-boot-starter-rest-server + + + lombok + org.projectlombok + + diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceCore.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceCore.java index 1ab8798..4b3d6ca 100644 --- a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceCore.java +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceCore.java @@ -27,7 +27,6 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; -import lombok.extern.slf4j.Slf4j; import org.apache.maven.model.Model; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.model.io.xpp3.MavenXpp3Writer; @@ -35,7 +34,6 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import org.dom4j.Document; import org.dom4j.Element; -@Slf4j public class GenerateServiceCore { public void generate(String absolutePath, String mavenPath) throws Exception { final GeneratorManager generatorManager = GeneratorManagerFactory.createGeneratorManager(absolutePath); diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceImp.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceImp.java index fb19618..33e5820 100644 --- a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceImp.java +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceImp.java @@ -27,10 +27,8 @@ import java.nio.file.Paths; import java.util.Arrays; import java.util.List; import java.util.Properties; -import lombok.extern.slf4j.Slf4j; import org.codehaus.plexus.util.StringUtils; -@Slf4j public class GenerateServiceImp implements GenerateService { GenerateServiceCore generateServiceCore = new GenerateServiceCore(); diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManager.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManager.java index d32b9c2..24a6180 100644 --- a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManager.java +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManager.java @@ -47,16 +47,18 @@ import java.io.IOException; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; -import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FileUtils; import org.apache.maven.model.Model; import org.apache.maven.model.Parent; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.model.io.xpp3.MavenXpp3Writer; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -@Slf4j public class GeneratorManager { + private static final Logger log = LoggerFactory.getLogger(GeneratorManager.class); + MetadataProjectCoreService metadataProjectCoreService = new MetadataProjectCoreService(); GspProjectCoreService gspProjectCoreService = new GspProjectCoreService(); MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); diff --git a/model/framework/generator-webapi/pom.xml b/model/framework/generator-webapi/pom.xml index 1153e91..2291d68 100644 --- a/model/framework/generator-webapi/pom.xml +++ b/model/framework/generator-webapi/pom.xml @@ -9,6 +9,8 @@ 4.0.0 ubml-model-framework-generator-webapi ${project.version} + ubml-model-framework-generator-webapi + org.openatom.ubml @@ -18,10 +20,14 @@ io.iec.edp caf-boot-starter-rest-server + + + lombok + org.projectlombok + + - ubml-model-framework-generator-webapi - 8 8 diff --git a/model/framework/generator-webapi/src/main/java/com/inspur/edp/jittojava/webapi/GenerateController.java b/model/framework/generator-webapi/src/main/java/com/inspur/edp/jittojava/webapi/GenerateController.java index a4872eb..2b37ecc 100644 --- a/model/framework/generator-webapi/src/main/java/com/inspur/edp/jittojava/webapi/GenerateController.java +++ b/model/framework/generator-webapi/src/main/java/com/inspur/edp/jittojava/webapi/GenerateController.java @@ -22,7 +22,6 @@ import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; -import lombok.extern.slf4j.Slf4j; /** * @Classname GenerateServiceWebApiImp @@ -31,11 +30,9 @@ import lombok.extern.slf4j.Slf4j; * @Created by liu_bintr * @Version 1.0 */ -@Slf4j @Path("/") @Produces(MediaType.APPLICATION_JSON) public class GenerateController { - GenerateService generateService = SpringBeanUtils.getBean(GenerateService.class); @POST diff --git a/model/framework/metadata-shell/pom.xml b/model/framework/metadata-shell/pom.xml new file mode 100644 index 0000000..bc8d365 --- /dev/null +++ b/model/framework/metadata-shell/pom.xml @@ -0,0 +1,36 @@ + + + + ubml-model-framework + org.openatom.ubml + 0.9.0-SNAPSHOT + + 4.0.0 + ubml-model-framework-metadata-shell ${project.version} + ubml-model-framework-metadata-shell + + + 8 + 8 + + + + + org.springframework.boot + spring-boot-starter + + + org.springframework.shell + spring-shell-starter + + + + org.openatom.ubml + ubml-model-framework-devtime-core + ${project.version} + + + + \ No newline at end of file diff --git a/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/ShellApplication.java b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/ShellApplication.java new file mode 100644 index 0000000..63b98ad --- /dev/null +++ b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/ShellApplication.java @@ -0,0 +1,38 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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; + +import org.jline.utils.AttributedString; +import org.jline.utils.AttributedStyle; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; + +import static com.inspur.edp.lcm.metadata.shell.Utils.SPRING_SHELL_FLAG_NAME; +import static com.inspur.edp.lcm.metadata.shell.Utils.SPRING_SHELL_FLAG_TRUE; + +@SpringBootApplication(scanBasePackages = {"io.iec.edp", "com.inspur"}) +public class ShellApplication { + public static void main(String[] args) { + System.setProperty(SPRING_SHELL_FLAG_NAME, SPRING_SHELL_FLAG_TRUE); + SpringApplication.run(ShellApplication.class, args); + } + + @Bean + public org.springframework.shell.jline.PromptProvider myPromptProvider() { + return () -> new AttributedString("lcm-metadata-shell:>", AttributedStyle.DEFAULT.foreground(AttributedStyle.YELLOW)); + } +} diff --git a/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/MetadataCommand.java b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/MetadataCommand.java new file mode 100644 index 0000000..6ce8eba --- /dev/null +++ b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/MetadataCommand.java @@ -0,0 +1,206 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.shell; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; +import com.inspur.edp.lcm.metadata.core.MavenUtilsCore; +import com.inspur.edp.lcm.metadata.core.MetadataCoreManager; +import com.inspur.edp.lcm.metadata.core.MetadataProjectServiceImp; +import com.inspur.edp.lcm.metadata.core.PackageCoreService; +import com.inspur.edp.lcm.metadata.core.PackageGenerateCoreService; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.apache.maven.model.Dependency; +import org.apache.maven.model.Model; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.apache.maven.model.io.xpp3.MavenXpp3Writer; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.shell.standard.ShellComponent; +import org.springframework.shell.standard.ShellMethod; +import org.springframework.shell.standard.ShellOption; +import org.springframework.util.StringUtils; + +/** + * @author zhongchq + */ +@ShellComponent +public class MetadataCommand { + private static final Logger log = LoggerFactory.getLogger(MetadataCommand.class); + + MetadataProjectService metadataProjectService = new MetadataProjectServiceImp(); + + @Autowired + FileService fileService; + + String gspprojectJson = "gspproject.json"; + String defaultVersion = "0.1.0-SNAPSHOT"; + String code = "code"; + + @ShellMethod(key = "compile", value = "Compile Projects") + public void compile(String path, String mavenPath) { + path = path + File.separator + "java" + File.separator + "code"; + MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + mavenUtilsCore.exeMavenCommand(path, mavenPath, "clean install"); + } + + //version为该工程的版本号。对于解析型,生成型默认的版本号为0.1.0-SNAPSHOT + @ShellMethod(key = "push", value = "Push Metadata.") + public void pushMetadata(String path, String repoId, String mavenPath, + @ShellOption(defaultValue = "0.1.0-SNAPSHOT") String version) { + ManagerUtils.setMavenStoragePath(mavenPath); + final ProcessMode processMode = metadataProjectService.getProcessMode(path); + PackageCoreService packageCoreService = new PackageCoreService(); + switch (processMode.toString()) { + case "interpretation": + packageCoreService.deployMdpkgForInterpretation(path, repoId, version, null, mavenPath); + break; + default: + packageCoreService.deploySnapshotMdVersion(path, repoId, version, false, mavenPath); + } + } + + /*** + * @author zhongchq + * @param path 工程路径 + **/ + @ShellMethod(key = "compileall", value = "Compile All Projects UnderDir") + public void compileAllProjects(String path, String mavenPath) { + List allDirectories = new ArrayList<>(); + List directories = fileService.getAllProjectsDirectories(path, allDirectories, gspprojectJson); + MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + for (String proDir : directories) { + proDir = proDir + File.separator + "java" + File.separator + "code"; + mavenUtilsCore.exeMavenCommand(proDir, mavenPath, "clean install"); + } + } + + @ShellMethod(key = "extract", value = "Extract Package.") + public void extract(String path, String desDir) { + List allDirectories = new ArrayList<>(); + List directories = fileService.getAllProjectsDirectories(path, allDirectories, gspprojectJson); + for (String directory : directories) { + String publishDir = directory + File.separator + "publish"; + if (new File(publishDir).exists()) { + fileService.folderCopy(publishDir, desDir); + } + } + } + + @ShellMethod(key = "restore", value = "Pull Metadata Package.") + public void restore(String path, String mavenPath) { + String packagePathT = Utils.createTempDir(); + try { + PackageCoreService mdPkgService = new PackageCoreService(); + mdPkgService.restore(path, true, mavenPath, packagePathT); + log.info("restore complete"); + } finally { + log.info("clear temp files"); + Utils.delDir(packagePathT); + log.info("clear complete"); + } + } + + @ShellMethod(key = "restoreWithPath", value = "Pull Metadata Package with packagePath.") + public void restore(String path, String mavenPath, String packagePath) { + String packagePathT = ""; + if (StringUtils.isEmpty(packagePath)) { + packagePathT = Utils.createTempDir(); + } + try { + PackageCoreService mdPkgService = new PackageCoreService(); + mdPkgService.restore(path, true, mavenPath, packagePathT); + } finally { + if (StringUtils.isEmpty(packagePath)) { + Utils.delDir(packagePathT); + } + } + } + +// @ShellMethod(key = "generatecode",value = "Generate Code.") +//// public void generateCode(String path) throws Exception { +//// generateService.generate(path); +//// } + + @ShellMethod(key = "packmd", value = "Generate Metadata Package.") + public void generateMdPack(String path) { + path = path + File.separator + "metadata"; +// ManagerUtils.setDevRootPath(devPath); + PackageGenerateCoreService packageGenerateCoreService = new PackageGenerateCoreService(); + packageGenerateCoreService.generatePackage(path); + log.info("元数据打包完成!"); + } + + /** + * @param boPath bo工程所在路径,相对于projects.eg:bf/df + * @throws IOException IO异常 + * @author zhongchq + **/ + @ShellMethod("Update Api Modules Dependencies Version.") + void updateApiDependencies(String boPath) throws IOException { + File projDir = new File(boPath); + List allDirectories = new ArrayList<>(); + List directories = fileService.getAllProjectsDirectories(boPath, allDirectories, gspprojectJson); + for (String dir : directories) { + File file = new File(dir); + String mdprojPath = "metadata" + File.separator + file.getName() + ".mdproj"; + MetadataCoreManager manager = new MetadataCoreManager(); + MetadataProject metadataProjInfo = manager.getMetadataProjInfo(file.getPath() + File.separator + mdprojPath); + List refs = metadataProjInfo.getMavenPackageRefs(); + String apiPath = file.getPath() + "/java/code/api/pom.xml"; + if (!(refs == null)) { + try (FileInputStream fis = new FileInputStream(apiPath)) { + MavenXpp3Reader reader = new MavenXpp3Reader(); + Model model = reader.read(fis); + List dependencies = model.getDependencies(); + dependencies.clear(); + if (refs.size() > 0) { + for (MavenPackageRefs ref : refs) { + Dependency dependency = new Dependency(); + dependency.setGroupId(ref.getGroupId()); + dependency.setArtifactId(ref.getArtifactId()); + if (ref.getVersion().startsWith("m")) { + dependency.setVersion(ref.getVersion().substring(1)); + } else { + dependency.setVersion(ref.getVersion()); + } + dependencies.add(dependency); + } + } + model.setDependencies(dependencies); + MavenXpp3Writer mavenXpp3Writer = new MavenXpp3Writer(); + try (FileOutputStream fileOutputStream = new FileOutputStream(apiPath)) { + mavenXpp3Writer.write(fileOutputStream, model); + } + } catch (IOException | XmlPullParserException e) { + throw new IOException("update apimodules error!", e); + } + } + + } + } +} \ No newline at end of file diff --git a/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/StringCommandRunner.java b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/StringCommandRunner.java new file mode 100644 index 0000000..be7eacd --- /dev/null +++ b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/StringCommandRunner.java @@ -0,0 +1,69 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.shell; + +import java.util.List; +import java.util.PriorityQueue; +import java.util.Queue; +import java.util.stream.Collectors; +import org.jline.reader.Parser; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.context.annotation.Lazy; +import org.springframework.core.annotation.Order; +import org.springframework.core.env.ConfigurableEnvironment; +import org.springframework.shell.Shell; +import org.springframework.shell.jline.InteractiveShellApplicationRunner; + +/** + * @Description: 自定义命令Runner, 启动应用后直接执行多条命令, 执行后结束 + */ +@Order(InteractiveShellApplicationRunner.PRECEDENCE - 50) // order 越小, 越先执行 +public class StringCommandRunner implements ApplicationRunner { + + @Lazy + @Autowired + private Parser parser; + + @Lazy + @Autowired + private Shell shell; + + @Lazy + @Autowired + private ConfigurableEnvironment environment; + + @Override + public void run(ApplicationArguments args) throws Exception { + //过滤掉所有@开头的参数, @开头的参数交给ScriptShellApplicationRunner 处理 + List cmds = args.getNonOptionArgs().stream() + .filter(s -> !s.startsWith("@")) + .collect(Collectors.toList()); + + //如果启动参数中, 命令不为空, 则执行 + if (cmds.size() > 0) { + // 关闭交互式应用: 确保关闭应用后, 直接退出应用, 不停留在交互式窗口中 + InteractiveShellApplicationRunner.disable(environment); + + // 将所有命令存储到队列中 + Queue queue = new PriorityQueue<>(cmds); + + // 执行命令 + shell.run(new StringInputProvider(parser, queue)); + } + } +} \ No newline at end of file diff --git a/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/StringInputProvider.java b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/StringInputProvider.java new file mode 100644 index 0000000..4e4080f --- /dev/null +++ b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/StringInputProvider.java @@ -0,0 +1,50 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.shell; + +import java.util.Queue; +import org.jline.reader.ParsedLine; +import org.jline.reader.Parser; +import org.springframework.shell.Input; +import org.springframework.shell.InputProvider; + +/* + * 读取命令 + */ +public class StringInputProvider implements InputProvider { + + // 存储要执行的所有命令 + private Queue commands; + + private final Parser parser; + + public StringInputProvider(Parser parser, Queue commands) { + this.parser = parser; + this.commands = commands; + } + + @Override + public Input readInput() { + String command = commands.poll(); + if (command == null) { + // return null 时退出应用 + return null; + } else { + ParsedLine parsedLine = parser.parse(command, command.length()); + return new StringParsedLineInput(parsedLine); + } + } +} \ No newline at end of file diff --git a/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/StringParsedLineInput.java b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/StringParsedLineInput.java new file mode 100644 index 0000000..e667814 --- /dev/null +++ b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/StringParsedLineInput.java @@ -0,0 +1,51 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.shell; + +import java.util.List; +import java.util.stream.Collectors; +import org.jline.reader.ParsedLine; +import org.springframework.shell.Input; + +/* + * 自定义行解析, 复制的底层代码: org.springframework.shell.jline.ParsedLineInput + */ +public class StringParsedLineInput implements Input { + + private final ParsedLine parsedLine; + + StringParsedLineInput(ParsedLine parsedLine) { + this.parsedLine = parsedLine; + } + + @Override + public String rawText() { + return parsedLine.line(); + } + + @Override + public List words() { + return sanitizeInput(parsedLine.words()); + } + + static List sanitizeInput(List words) { + words = words.stream() + .map(s -> s.replaceAll("^\\n+|\\n+$", "")) + .map(s -> s.replaceAll("\\n+", " ")) + .collect(Collectors.toList()); + return words; + } +} \ No newline at end of file diff --git a/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/Utils.java b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/Utils.java new file mode 100644 index 0000000..f5c6bc2 --- /dev/null +++ b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/Utils.java @@ -0,0 +1,49 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.shell; + +import java.io.File; + +public class Utils { + public static final String SPRING_SHELL_FLAG_NAME = "spring-shell"; + public static final String SPRING_SHELL_FLAG_TRUE = "1"; + + public static void delDir(String filePath) { + File file = new File(filePath); + if (file.exists()) + delDir(file); + } + + public static void delDir(File file) { + if (file.isDirectory()) { + File zFiles[] = file.listFiles(); + for (File file2 : zFiles) { + delDir(file2); + } + file.delete(); + } else { + file.delete(); + } + } + + public static String createTempDir() { + File file = new File("packages"); + if (file.exists()) + file = new File("packages" + Runtime.getRuntime()); + file.mkdir(); + return file.getPath(); + } +} diff --git a/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/config/ShellConfiguration.java b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/config/ShellConfiguration.java new file mode 100644 index 0000000..0190120 --- /dev/null +++ b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/config/ShellConfiguration.java @@ -0,0 +1,34 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.shell.config; + +import com.inspur.edp.lcm.metadata.shell.StringCommandRunner; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Classname RefConfiguration Description ref配置类 Date 2019/11/28 10:34 + * + * @author zhongchq + * @version 1.0 + */ +@Configuration +public class ShellConfiguration { + @Bean + public StringCommandRunner create() { + return new StringCommandRunner(); + } +} diff --git a/model/framework/metadata-shell/src/main/resources/META-INF/spring.factories b/model/framework/metadata-shell/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000..6c7a393 --- /dev/null +++ b/model/framework/metadata-shell/src/main/resources/META-INF/spring.factories @@ -0,0 +1 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.inspur.edp.lcm.metadata.shell.config.ShellConfiguration \ No newline at end of file diff --git a/model/framework/metadata-shell/src/main/resources/application.yaml b/model/framework/metadata-shell/src/main/resources/application.yaml new file mode 100644 index 0000000..e6724a6 --- /dev/null +++ b/model/framework/metadata-shell/src/main/resources/application.yaml @@ -0,0 +1,8 @@ +application: + version: 0.1.0-SNAPSHOT +logging: + pattern: + console: "%date{yyyy-MM-dd HH:mm:ss.SSS}[%level][%thread]-%msg%n" + level: + root: warn + com.inspur.edp.lcm.metadata.shell.ShellApplication: warn \ No newline at end of file diff --git a/model/framework/metadata-shell/src/main/resources/banner.txt b/model/framework/metadata-shell/src/main/resources/banner.txt new file mode 100644 index 0000000..08bdee9 --- /dev/null +++ b/model/framework/metadata-shell/src/main/resources/banner.txt @@ -0,0 +1,10 @@ +${AnsiColor.BRIGHT_YELLOW} ${AnsiStyle.BOLD} +Welcome to +// .__ ________ .___ ____ ___ ______ +// |__| / _____/ | |\ \/ / \ \ \ \ +// | |/ \ ___ | | \ / \ \ \ \ +// | |\ \_\ \| | / \ ) ) ) ) +// |__| \______ /|___|/___/\ \ / / / / +// ==============\/============\_/ /_/_/_/ + +iGIX Development Kit (${application.version}) \ No newline at end of file diff --git a/model/framework/pom.xml b/model/framework/pom.xml index 48eebed..c7dfa2f 100644 --- a/model/framework/pom.xml +++ b/model/framework/pom.xml @@ -26,11 +26,13 @@ generator-spi generator-core generator-webapi + metadata-shell 2.2.0.RELEASE 1.2.62 + 2.0.1.RELEASE 0.3.7-SNAPSHOT 0.3.2 @@ -63,6 +65,16 @@ fastjson ${fastjson.version} + + org.springframework.boot + spring-boot-starter + ${spring-boot.version} + + + org.springframework.shell + spring-shell-starter + ${spring-shell-starter.version} + io.iec.edp diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRTServiceImp.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRTServiceImp.java index 512e9e1..db382f3 100644 --- a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRTServiceImp.java +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRTServiceImp.java @@ -36,9 +36,7 @@ import io.iec.edp.caf.commons.utils.SpringBeanUtils; import io.iec.edp.caf.rpc.api.service.RpcClient; import java.util.LinkedHashMap; import java.util.List; -import lombok.extern.slf4j.Slf4j; -@Slf4j public class MetadataRTServiceImp implements MetadataRTService { MetadataRtUtils utils = new MetadataRtUtils(); diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/MetadataRTServerServiceImpl.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/MetadataRTServerServiceImpl.java index 749c351..78b0ef1 100644 --- a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/MetadataRTServerServiceImpl.java +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/MetadataRTServerServiceImpl.java @@ -69,14 +69,16 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipInputStream; import javax.annotation.PostConstruct; -import lombok.extern.slf4j.Slf4j; import org.codehaus.plexus.util.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author zhaoleitr */ -@Slf4j public class MetadataRTServerServiceImpl implements MetadataRTServerService { + private static final Logger log = LoggerFactory.getLogger(MetadataRTServerServiceImpl.class); + FileService fileService = new FileServiceImp(); private II18nResourceRTManager i18nResourceRtManager; diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MonitorInitializer.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MonitorInitializer.java index 398d2eb..3e8b330 100644 --- a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MonitorInitializer.java +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MonitorInitializer.java @@ -18,10 +18,12 @@ package com.inspur.edp.lcm.metadata.servermanager.monitor; import com.inspur.edp.lcm.metadata.common.FileServiceImp; import io.iec.edp.caf.common.environment.EnvironmentUtil; import javax.annotation.PostConstruct; -import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -@Slf4j public class MonitorInitializer { + private static final Logger log = LoggerFactory.getLogger(MonitorInitializer.class); + private final String mdpkgSuffix = ".mdpkg"; private final String metatdataPath = "metadata"; diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepositoryImp.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepositoryImp.java index 3e8a7d5..8b41f79 100644 --- a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepositoryImp.java +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepositoryImp.java @@ -36,7 +36,8 @@ import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipInputStream; -import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Classname MetadataPackageRepositoryImp Description TODO Date 2019/8/21 17:04 @@ -44,8 +45,8 @@ import lombok.extern.slf4j.Slf4j; * @author zhongchq * @version 1.0 */ -@Slf4j public class MetadataPackageRepositoryImp implements MetadataPackageRepository { + private static final Logger log = LoggerFactory.getLogger(MetadataPackageRepositoryImp.class); // @Autowired //TODO 依赖注入会是null,此类还未被初始化。 FileService fileService = new FileServiceImp(); diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ConvertUtils.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ConvertUtils.java index b3ebb6f..726d409 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ConvertUtils.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ConvertUtils.java @@ -72,7 +72,6 @@ //import org.openatom.ubml.model.vo.definition.common.mapping.GspVoElementSourceType; //import org.openatom.ubml.model.vo.definition.common.mapping.GspVoObjectMapping; //import org.openatom.ubml.model.vo.definition.common.mapping.GspVoObjectSourceType; -//import lombok.var; // //import java.util.ArrayList; //import java.util.List; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/entity/GspVoExtendInfo.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/entity/GspVoExtendInfo.java index fae9fa8..49a3a33 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/entity/GspVoExtendInfo.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/entity/GspVoExtendInfo.java @@ -20,7 +20,6 @@ import java.util.Date; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; -import lombok.NoArgsConstructor; /** * The Josn Deserializer Of Biz Operation @@ -32,10 +31,12 @@ import lombok.NoArgsConstructor; */ @Entity @Table(name = "GspViewModel") -@NoArgsConstructor @JsonIgnoreProperties(ignoreUnknown = true) public class GspVoExtendInfo { + public GspVoExtendInfo() { + } + public GspVoExtendInfo(String id, String extendInfo, String configId, String createdBy, Date createdOn, String lastChangedBy, Date lastChangedOn) { this.id = id; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionCollectionSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionCollectionSerializer.java index f4dd0e1..e4ddfd5 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionCollectionSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionCollectionSerializer.java @@ -22,7 +22,6 @@ import org.openatom.ubml.model.common.definition.cef.json.SerializerUtils; import org.openatom.ubml.model.vo.definition.action.ViewModelAction; import org.openatom.ubml.model.vo.definition.action.ViewModelActionType; import org.openatom.ubml.model.vo.definition.collection.VMActionCollection; -import lombok.var; /** * The Josn Serializer Of View Model Action Collection * -- Gitee From fe43f1dcdeca779fcd99b86242352ff0180b5144 Mon Sep 17 00:00:00 2001 From: bugu <837948266@qq.com> Date: Tue, 15 Jun 2021 17:41:19 +0800 Subject: [PATCH 53/61] update model/pom.xml. --- model/pom.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/model/pom.xml b/model/pom.xml index 5beef64..506848c 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -48,9 +48,6 @@ ubml-common ${project.version} - - - \ No newline at end of file -- Gitee From 6512674ca971eb8fc33fb7014c9b70d6ab04307a Mon Sep 17 00:00:00 2001 From: Hongfei Sun Date: Thu, 19 May 2022 13:52:03 +0800 Subject: [PATCH 54/61] =?UTF-8?q?=E6=9B=B4=E6=96=B0copyright?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .mvn/wrapper/maven-wrapper.properties | 16 ++++++++++ all/pom.xml | 16 ++++++++++ bom/pom.xml | 16 ++++++++++ common/pom.xml | 16 ++++++++++ model/be/definition/pom.xml | 16 ++++++++++ model/be/pom.xml | 16 ++++++++++ model/common/definition/pom.xml | 16 ++++++++++ model/common/engine/pom.xml | 16 ++++++++++ model/common/generator/pom.xml | 16 ++++++++++ model/common/pom.xml | 16 ++++++++++ model/common/runtime-api/pom.xml | 16 ++++++++++ model/common/runtime-core/pom.xml | 16 ++++++++++ model/common/runtime-repo/pom.xml | 16 ++++++++++ model/common/runtime-spi/pom.xml | 16 ++++++++++ model/externalapi/definition/pom.xml | 16 ++++++++++ model/externalapi/devtime-api/pom.xml | 16 ++++++++++ model/externalapi/devtime-core/pom.xml | 16 ++++++++++ model/externalapi/devtime-spi/pom.xml | 16 ++++++++++ model/externalapi/extension/pom.xml | 16 ++++++++++ model/externalapi/generator/pom.xml | 16 ++++++++++ model/externalapi/pom.xml | 16 ++++++++++ model/externalapi/runtime-api/pom.xml | 16 ++++++++++ model/externalapi/runtime-core/pom.xml | 16 ++++++++++ model/externalapi/runtime-spi/pom.xml | 16 ++++++++++ model/framework/common/pom.xml | 16 ++++++++++ model/framework/devtime-api/pom.xml | 16 ++++++++++ model/framework/devtime-core/pom.xml | 16 ++++++++++ model/framework/devtime-webapi/pom.xml | 16 ++++++++++ model/framework/entity/pom.xml | 16 ++++++++++ model/framework/generator-api/pom.xml | 16 ++++++++++ .../context/common/FileUtilsTest.java | 16 ++++++++++ model/framework/generator-core/pom.xml | 16 ++++++++++ model/framework/generator-spi/pom.xml | 16 ++++++++++ model/framework/generator-webapi/pom.xml | 16 ++++++++++ model/framework/metadata-shell/pom.xml | 16 ++++++++++ model/framework/pom.xml | 16 ++++++++++ model/framework/runtime-api/pom.xml | 16 ++++++++++ model/framework/runtime-core/pom.xml | 16 ++++++++++ model/framework/runtime-spi/pom.xml | 16 ++++++++++ model/pom.xml | 30 +++++++++---------- model/vo/definition/pom.xml | 30 +++++++++---------- .../action/IViewModelParameter.java | 16 ++++++++++ model/vo/pom.xml | 30 +++++++++---------- pom.xml | 30 +++++++++---------- style/ubml_checkstyle.xml | 2 +- style/ubml_codeStyle.xml | 2 +- 46 files changed, 698 insertions(+), 66 deletions(-) diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 43d9d39..e1bbb49 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1,18 @@ +# +# Copyright \u00A9 OpenAtom Foundation. +# +# 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. +# + # distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip distributionUrl=http://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.1/apache-maven-3.6.1-bin.zip \ No newline at end of file diff --git a/all/pom.xml b/all/pom.xml index f616cfe..3888780 100644 --- a/all/pom.xml +++ b/all/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/bom/pom.xml b/bom/pom.xml index c9d5e7e..3af4a08 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/common/pom.xml b/common/pom.xml index a518f0c..451f0e4 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/be/definition/pom.xml b/model/be/definition/pom.xml index ccb7e45..a4faef6 100644 --- a/model/be/definition/pom.xml +++ b/model/be/definition/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/be/pom.xml b/model/be/pom.xml index 9344647..3d1d81a 100644 --- a/model/be/pom.xml +++ b/model/be/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/common/definition/pom.xml b/model/common/definition/pom.xml index e7490d1..08fd4f6 100644 --- a/model/common/definition/pom.xml +++ b/model/common/definition/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/common/engine/pom.xml b/model/common/engine/pom.xml index 90a59f2..6c4922a 100644 --- a/model/common/engine/pom.xml +++ b/model/common/engine/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/common/generator/pom.xml b/model/common/generator/pom.xml index fed417a..9fe7251 100644 --- a/model/common/generator/pom.xml +++ b/model/common/generator/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/common/pom.xml b/model/common/pom.xml index bdabf5a..68bcf0e 100644 --- a/model/common/pom.xml +++ b/model/common/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/common/runtime-api/pom.xml b/model/common/runtime-api/pom.xml index 0574640..5435b86 100644 --- a/model/common/runtime-api/pom.xml +++ b/model/common/runtime-api/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/common/runtime-core/pom.xml b/model/common/runtime-core/pom.xml index f6c913e..ddc7053 100644 --- a/model/common/runtime-core/pom.xml +++ b/model/common/runtime-core/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/common/runtime-repo/pom.xml b/model/common/runtime-repo/pom.xml index c31a4e5..95da5b0 100644 --- a/model/common/runtime-repo/pom.xml +++ b/model/common/runtime-repo/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/common/runtime-spi/pom.xml b/model/common/runtime-spi/pom.xml index 1be9c94..b42cbcd 100644 --- a/model/common/runtime-spi/pom.xml +++ b/model/common/runtime-spi/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/externalapi/definition/pom.xml b/model/externalapi/definition/pom.xml index f1ce094..ff7d987 100644 --- a/model/externalapi/definition/pom.xml +++ b/model/externalapi/definition/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/externalapi/devtime-api/pom.xml b/model/externalapi/devtime-api/pom.xml index 4104175..55a8379 100644 --- a/model/externalapi/devtime-api/pom.xml +++ b/model/externalapi/devtime-api/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/externalapi/devtime-core/pom.xml b/model/externalapi/devtime-core/pom.xml index fa47be1..7c90d35 100644 --- a/model/externalapi/devtime-core/pom.xml +++ b/model/externalapi/devtime-core/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/externalapi/devtime-spi/pom.xml b/model/externalapi/devtime-spi/pom.xml index 6015308..02d73a5 100644 --- a/model/externalapi/devtime-spi/pom.xml +++ b/model/externalapi/devtime-spi/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/externalapi/extension/pom.xml b/model/externalapi/extension/pom.xml index 92c4ca5..b28b7a4 100644 --- a/model/externalapi/extension/pom.xml +++ b/model/externalapi/extension/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/externalapi/generator/pom.xml b/model/externalapi/generator/pom.xml index 95d910a..f8ea781 100644 --- a/model/externalapi/generator/pom.xml +++ b/model/externalapi/generator/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/externalapi/pom.xml b/model/externalapi/pom.xml index fb159ec..2a284b5 100644 --- a/model/externalapi/pom.xml +++ b/model/externalapi/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/externalapi/runtime-api/pom.xml b/model/externalapi/runtime-api/pom.xml index 43b38dd..64c8aff 100644 --- a/model/externalapi/runtime-api/pom.xml +++ b/model/externalapi/runtime-api/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/externalapi/runtime-core/pom.xml b/model/externalapi/runtime-core/pom.xml index a2df916..a1e5330 100644 --- a/model/externalapi/runtime-core/pom.xml +++ b/model/externalapi/runtime-core/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/externalapi/runtime-spi/pom.xml b/model/externalapi/runtime-spi/pom.xml index 21305ec..8aaee40 100644 --- a/model/externalapi/runtime-spi/pom.xml +++ b/model/externalapi/runtime-spi/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/framework/common/pom.xml b/model/framework/common/pom.xml index 06a5538..c7a067d 100644 --- a/model/framework/common/pom.xml +++ b/model/framework/common/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/framework/devtime-api/pom.xml b/model/framework/devtime-api/pom.xml index 44be71b..a04a9ff 100644 --- a/model/framework/devtime-api/pom.xml +++ b/model/framework/devtime-api/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/framework/devtime-core/pom.xml b/model/framework/devtime-core/pom.xml index de4c65a..97bfd18 100644 --- a/model/framework/devtime-core/pom.xml +++ b/model/framework/devtime-core/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/framework/devtime-webapi/pom.xml b/model/framework/devtime-webapi/pom.xml index 042cd1e..1a2c08e 100644 --- a/model/framework/devtime-webapi/pom.xml +++ b/model/framework/devtime-webapi/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/framework/entity/pom.xml b/model/framework/entity/pom.xml index 333aea2..5c82f10 100644 --- a/model/framework/entity/pom.xml +++ b/model/framework/entity/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/framework/generator-api/pom.xml b/model/framework/generator-api/pom.xml index 4ea0623..a75c698 100644 --- a/model/framework/generator-api/pom.xml +++ b/model/framework/generator-api/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/framework/generator-api/src/test/java/com/inspur/edp/jittojava/context/common/FileUtilsTest.java b/model/framework/generator-api/src/test/java/com/inspur/edp/jittojava/context/common/FileUtilsTest.java index 7d6f136..7482fc2 100644 --- a/model/framework/generator-api/src/test/java/com/inspur/edp/jittojava/context/common/FileUtilsTest.java +++ b/model/framework/generator-api/src/test/java/com/inspur/edp/jittojava/context/common/FileUtilsTest.java @@ -1,3 +1,19 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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.jittojava.context.common; //import org.junit.Assert; diff --git a/model/framework/generator-core/pom.xml b/model/framework/generator-core/pom.xml index 6e552f5..5602da5 100644 --- a/model/framework/generator-core/pom.xml +++ b/model/framework/generator-core/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/framework/generator-spi/pom.xml b/model/framework/generator-spi/pom.xml index 88aadab..4fc0ad9 100644 --- a/model/framework/generator-spi/pom.xml +++ b/model/framework/generator-spi/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/framework/generator-webapi/pom.xml b/model/framework/generator-webapi/pom.xml index 2291d68..a2ecef4 100644 --- a/model/framework/generator-webapi/pom.xml +++ b/model/framework/generator-webapi/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/framework/metadata-shell/pom.xml b/model/framework/metadata-shell/pom.xml index bc8d365..e73ded3 100644 --- a/model/framework/metadata-shell/pom.xml +++ b/model/framework/metadata-shell/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/framework/pom.xml b/model/framework/pom.xml index c7dfa2f..5bfa4a3 100644 --- a/model/framework/pom.xml +++ b/model/framework/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/framework/runtime-api/pom.xml b/model/framework/runtime-api/pom.xml index bda1332..86d089a 100644 --- a/model/framework/runtime-api/pom.xml +++ b/model/framework/runtime-api/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/framework/runtime-core/pom.xml b/model/framework/runtime-core/pom.xml index 961705a..9898403 100644 --- a/model/framework/runtime-core/pom.xml +++ b/model/framework/runtime-core/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/framework/runtime-spi/pom.xml b/model/framework/runtime-spi/pom.xml index 34de7a9..4dc10f9 100644 --- a/model/framework/runtime-spi/pom.xml +++ b/model/framework/runtime-spi/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/pom.xml b/model/pom.xml index 506848c..35b9ca1 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -1,21 +1,19 @@ + ~ Copyright © OpenAtom Foundation. + ~ + ~ 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. + --> diff --git a/model/vo/definition/pom.xml b/model/vo/definition/pom.xml index 3850ebf..260b409 100644 --- a/model/vo/definition/pom.xml +++ b/model/vo/definition/pom.xml @@ -1,21 +1,19 @@ + ~ Copyright © OpenAtom Foundation. + ~ + ~ 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. + --> diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameter.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameter.java index 56a6f8a..f3c7eda 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameter.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameter.java @@ -1,3 +1,19 @@ +/* + * Copyright © OpenAtom Foundation. + * + * 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 org.openatom.ubml.model.vo.definition.Interface; package org.openatom.ubml.model.vo.definition.action; diff --git a/model/vo/pom.xml b/model/vo/pom.xml index 214b600..7193864 100644 --- a/model/vo/pom.xml +++ b/model/vo/pom.xml @@ -1,21 +1,19 @@ + ~ Copyright © OpenAtom Foundation. + ~ + ~ 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. + --> + ~ Copyright © OpenAtom Foundation. + ~ + ~ 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. + --> 4.0.0 diff --git a/style/ubml_checkstyle.xml b/style/ubml_checkstyle.xml index 4e24228..9257c18 100644 --- a/style/ubml_checkstyle.xml +++ b/style/ubml_checkstyle.xml @@ -1,6 +1,6 @@