diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..0683c8c2a98c82e5e603fb3dd5855330632127e0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +.idea +.idea/** +.metadata +.settings +.project +.version.properties +filter.properties +logs.zip +/**/target +target +tmp +*.class +*.iml +*.swp +*.log +*.jar +.factorypath +build-target +out/ \ No newline at end of file diff --git a/common-entity-variable-generator/pom.xml b/common-entity-variable-generator/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..00ee8d58a442ba85f40bdf96a7e74b27d0030d95 --- /dev/null +++ b/common-entity-variable-generator/pom.xml @@ -0,0 +1,83 @@ + + + + + 4.0.0 + + business-entity-generator1 + com.inspur.edp + 0.1.0-SNAPSHOT + + cef-variable-dtgenerator + common-entity-variable-generator + + + + com.fasterxml.jackson.core + jackson-databind + 2.7.4 + + + org.springframework + spring-core + 5.1.8.RELEASE + + + org.springframework + spring-context + 5.1.8.RELEASE + compile + + + com.inspur.edp + caf-generator + 0.1.4 + + + com.inspur.edp + cef-designtime-api + 0.1.7 + + + com.inspur.edp + cef-designtime-generator + 0.2.2-SNAPSHOT + + + com.inspur.edp + cef-variable-core + 0.1.7 + + + com.inspur.edp + cef-api + 0.2.46 + + + com.inspur.edp + cef-spi + 0.2.46 + + + com.inspur.edp + lcm-metadata-api + 0.1.23 + + + diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/VariableGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/VariableGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..68519d03bf2ee33f47763f308bc5608153f7e9b2 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/VariableGenerator.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.cef.variable.dtgenerator; + + +import com.inspur.edp.caf.generator.module.ModuleGenerator; +import com.inspur.edp.cef.designtime.api.variable.CommonVariableEntity; +import com.inspur.edp.cef.entity.dependenceTemp.DataValidator; +import com.inspur.edp.cef.generator.apiGenerator.CefApiGenerator; +import com.inspur.edp.cef.generator.configGenerator.CefConfigGenerator; +import com.inspur.edp.cef.generator.coreGenerator.base.CefCoreGenerator; +import com.inspur.edp.cef.generator.entityGenerator.BaseEntityGenerator; +import com.inspur.edp.cef.generator.overall.CefGenerator; +import com.inspur.edp.cef.generator.overall.CefGeneratorContext; +import com.inspur.edp.cef.generator.overall.ICefGeneratorContext; +import com.inspur.edp.cef.variable.dtgenerator.api.VariableApiGenerator; +import com.inspur.edp.cef.variable.dtgenerator.core.VariableCoreGenerator; +import com.inspur.edp.cef.variable.dtgenerator.entity.VariableEntityGenerator; +import com.inspur.edp.jittojava.context.JitContext; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; + +public class VariableGenerator extends CefGenerator +{ + private CommonVariableEntity variableEntity; + + private ICefGeneratorContext privateCefGeneratorContext; + protected final ICefGeneratorContext getCefGeneratorContext() + { + return privateCefGeneratorContext; + } + public VariableGenerator(String path, CommonVariableEntity variableEntity, ICefGeneratorContext refProjContext, boolean pre, JitContext metadataJitContext) + { + super(path, refProjContext.getMetadata(), pre, null, metadataJitContext); + DataValidator.checkForNullReference(refProjContext, "refProjContext"); + DataValidator.checkForNullReference(refProjContext.getMetadata(), "refProjContext.Metadata"); + DataValidator.checkForNullReference(variableEntity, "variableEntity"); + DataValidator.checkForNullReference(metadataJitContext, "metadataJitContext"); + this.variableEntity = variableEntity; + privateCefGeneratorContext = refProjContext; + } + + public VariableGenerator(String path, CommonVariableEntity variableEntity, ICefGeneratorContext refProjContext + , GspMetadata metadata, CefGeneratorContext refGenCtx, ModuleGenerator refGenerator, JitContext metadataJITContext) + { + super(path, metadata, refGenCtx, refGenerator, metadataJITContext); + DataValidator.checkForNullReference(refProjContext, "refProjContext"); + DataValidator.checkForNullReference(refProjContext.getMetadata(), "refProjContext.Metadata"); + DataValidator.checkForNullReference(variableEntity, "variableEntity"); + DataValidator.checkForNullReference(metadataJITContext, "metadataJitContext"); + this.variableEntity = variableEntity; + privateCefGeneratorContext = refProjContext; + } + + public VariableGeneratorContext getVariableGeneratorContext(){return (VariableGeneratorContext)super.getContext();} + + @Override + protected final CefGeneratorContext createCefGeneratorContext() + { + VariableGeneratorContext rez = CreateVarGeneratorContext(); + rez.setCefGeneratorContext(getCefGeneratorContext()); + return rez; + } + + protected VariableGeneratorContext CreateVarGeneratorContext() + { + VariableGeneratorContext ctx = new VariableGeneratorContext(variableEntity); + if (preGenerating) + { + ctx.setRefProjectGenerator(super.getMetadataJITContext().getApiModuleGenerator()); + } + else + { + ctx.setRefProjectGenerator(super.getMetadataJITContext().getCoreModuleGenerator()); + } + return ctx; + } + + ///#endregion + @Override + protected CefApiGenerator createApiGenerator() + { + return new VariableApiGenerator(getVariableGeneratorContext()); + } + + @Override + protected CefCoreGenerator createCoreGenerator() + { + return new VariableCoreGenerator(getVariableGeneratorContext()); + } + + @Override + protected BaseEntityGenerator createEntityGenerator() + { + return new VariableEntityGenerator(getVariableGeneratorContext()); + } + + + ///#region 编译执行完之后要执行的逻辑 + @Override + protected void afterGenerate() + { + super.afterGenerate(); + //var configGen = new VarConfigGenerator(Context); + //configGen.Generate(); + //Context.config = configGen.config; + } + + ///#endregion + + + public boolean isHasRepository() { + return false; + } + + @Override + protected boolean getHasRepository() { + return false; + } + + @Override + protected CefConfigGenerator createConfigGenerator(){return null;} +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/VariableGeneratorContext.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/VariableGeneratorContext.java new file mode 100644 index 0000000000000000000000000000000000000000..40d22477cb45130a6e70b1cce8c675b6ef4068e4 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/VariableGeneratorContext.java @@ -0,0 +1,74 @@ +/* + * Copyright © OpenAtom Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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.cef.variable.dtgenerator; + + +import com.inspur.edp.cef.designtime.api.IGspCommonDataType; +import com.inspur.edp.cef.designtime.api.variable.CommonVariableEntity; +import com.inspur.edp.cef.entity.dependenceTemp.DataValidator; +import com.inspur.edp.cef.generator.overall.CefGeneratorContext; +import com.inspur.edp.cef.generator.overall.ICefGeneratorContext; +import com.inspur.edp.cef.variable.dtgenerator.core.VariableCoreGenCtx; + +public class VariableGeneratorContext extends CefGeneratorContext { + + private CommonVariableEntity variableEntity; + + public VariableGeneratorContext(CommonVariableEntity variableEntity) { + this.variableEntity = variableEntity; + } + + public CommonVariableEntity getCommonVariableEntity() { + return variableEntity; + } + + private ICefGeneratorContext privateCefGeneratorContext; + + public final ICefGeneratorContext getCefGeneratorContext() { + return privateCefGeneratorContext; + } + + public final void setCefGeneratorContext(ICefGeneratorContext value) { + privateCefGeneratorContext = value; + } + + @Override + public IGspCommonDataType getCommonDataType() { + return getCommonVariableEntity();// VariableEntity; + } + + @Override + public String getDataTypeNamespace() { + throw new RuntimeException("变量不能持久化"); + } + + @Override + public String getGeneratePath() { + return ""; + } + + public final String getCustomActionType(String mdId, String assemblyName, String className) { + DataValidator.checkForEmptyString(assemblyName, "assemblyName"); + DataValidator.checkForEmptyString(className, "className"); + return className; + } + + @Override + public VariableCoreGenCtx getCefCoreGenCtx() { + return (VariableCoreGenCtx) super.getCefCoreGenCtx(); + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/ApiHelper.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/ApiHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..d92fcc87e44a431b1ab0250e5cff4fb88ff060a0 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/ApiHelper.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.cef.variable.dtgenerator.api; + + +import com.inspur.edp.cef.designtime.api.IGspCommonDataType; + +/** + 获取自定义动作,实体中作的类名称。接口 + +*/ +public class ApiHelper +{ + public static String GetEntityAllInterfaceClassName(IGspCommonDataType variableEntity) + { + final String nameTemplate = "I%1$sentity"; + return String.format(nameTemplate, variableEntity.getCode()); + } + + public static String GetEntityInterfaceClassName(IGspCommonDataType variableEntity) + { + String nameTemplate = "I%1$sInnerEntity"; + return String.format(nameTemplate, variableEntity.getCode()); + } + + public static String GetMgrInterfaceClassName(IGspCommonDataType variableEntity) + { + final String itemNameTemplate = "I%1$sVaribaleManager"; + return String.format(itemNameTemplate, variableEntity.getCode()); + } + + public static String GetMgrAllInterfaceClassName(IGspCommonDataType variableEntity) + { + final String itemNameTemplate = "I%1$sService"; + return String.format(itemNameTemplate, variableEntity.getCode()); + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/VariableApiGenContext.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/VariableApiGenContext.java new file mode 100644 index 0000000000000000000000000000000000000000..1e8d0b1e5af20da21940f9254c25aace59d4c9a2 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/VariableApiGenContext.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.cef.variable.dtgenerator.api; + + +import com.inspur.edp.cef.generator.apiGenerator.CefApiGeneratorContext; +import com.inspur.edp.cef.variable.dtgenerator.VariableGeneratorContext; + +public class VariableApiGenContext extends CefApiGeneratorContext +{ + public VariableApiGenContext(VariableGeneratorContext variableGenContext) + { + super(variableGenContext); + + } + public VariableGeneratorContext getVariableGenCtx(){return (VariableGeneratorContext)super.getCefGenContext();} + + //基类上的defaultNamespace在DoGenerate时才赋值太晚了类生成器取不到 + private String privateNamespace; + public final String getNamespace() + { + return privateNamespace; + } + public final void setNamespace(String value) + { + privateNamespace = value; + } + + @Override + public String getPackageName() { + return getNamespace(); + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/VariableApiGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/VariableApiGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..2f44093904d1a85ecdf4e2157807e1975517b0f8 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/VariableApiGenerator.java @@ -0,0 +1,101 @@ +/* + * Copyright © OpenAtom Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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.cef.variable.dtgenerator.api; + + +import com.inspur.edp.caf.generator.BaseGenerator; +import com.inspur.edp.cef.generator.apiGenerator.CefApiGenerator; +import com.inspur.edp.cef.generator.apiGenerator.CefApiGeneratorContext; +import com.inspur.edp.cef.generator.apiGenerator.dataType.mgrAllInterface.MgrAllInterfaceGenerator; +import com.inspur.edp.cef.generator.apiGenerator.dataType.mgrInterface.MgrInterfaceGenerator; +import com.inspur.edp.cef.generator.apiGenerator.dataType.mgrInterface.resourceInfo.ModelInfoBaseGenerator; +import com.inspur.edp.cef.variable.dtgenerator.VariableGeneratorContext; +import com.inspur.edp.cef.variable.dtgenerator.api.mginterface.VariableMgrInterfaceGenerator; +import com.inspur.edp.cef.variable.dtgenerator.api.mginterface.resinfo.VarModelInfoGenerator; +import com.inspur.edp.cef.variable.dtgenerator.api.mgrallinterface.VariableMgrAllInterfaceGenerator; +import com.inspur.edp.cef.variable.dtgenerator.api.variableinterface.VariableAllInterfaceGenerator; +import com.inspur.edp.cef.variable.dtgenerator.api.variableinterface.VariableInterfaceGenerator; + +public class VariableApiGenerator extends CefApiGenerator +{ + protected VariableGeneratorContext variableGenContext; + public VariableApiGenerator(VariableGeneratorContext variableGenContext) + { + super(variableGenContext); + this.variableGenContext = variableGenContext; + } + + private VariableApiGenContext getVariableApiGenContext(){return (VariableApiGenContext)super.getContext();} + + @Override + protected CefApiGeneratorContext createCefApiGenContext() + { + VariableApiGenContext variableApiGenContext= new VariableApiGenContext(variableGenContext); + variableApiGenContext.setNamespace(variableGenContext.getCommonVariableEntity().getGeneratedApiAssemblyInfo().getDefaultNamespace()); + return variableApiGenContext; + } + + @Override + protected MgrAllInterfaceGenerator getMgrAllInterfaceGenerator() + { + return new VariableMgrAllInterfaceGenerator(getVariableApiGenContext()); + } + + @Override + protected MgrInterfaceGenerator getMgrInterfaceGenerator() { + return new VariableMgrInterfaceGenerator(getVariableApiGenContext()); + } + + @Override + protected ModelInfoBaseGenerator createModelInfoGenerator() { + return new VarModelInfoGenerator(getVariableApiGenContext(), getVariableApiGenContext().getVariableGenCtx().getCommonVariableEntity()); + } + + @Override + protected String getPackageName() { + return getVariableApiGenContext().getNamespace(); + } + + @Override + protected void beforeGenerate() + { + getVariableApiGenContext().setNamespace(variableGenContext.getCommonVariableEntity().getGeneratedApiAssemblyInfo().getDefaultNamespace()); + super.beforeGenerate(); + + //Context.SetIsRef(true); + //Context.SetRefProjectGen(variableGenContext.CefGeneratorContext.ApiGenContext); + } + + @Override + protected java.util.ArrayList getExtendChildGenerators() + { + //C# TO JAVA CONVERTER TODO TASK: There is no equivalent to implicit typing in Java: + java.util.ArrayList childs = super.getExtendChildGenerators(); + if (childs == null) + { + childs = new java.util.ArrayList(); + } + childs.add(new VariableInterfaceGenerator(getVariableApiGenContext())); + childs.add(new VariableAllInterfaceGenerator(getVariableApiGenContext())); + return childs; +} + @Override + protected void doInitialize() + { + super.doInitialize(); + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/mginterface/VariableMgrInerfaceGenCtx.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/mginterface/VariableMgrInerfaceGenCtx.java new file mode 100644 index 0000000000000000000000000000000000000000..7a8fa42ad52d762b33f473a64704810b27486d87 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/mginterface/VariableMgrInerfaceGenCtx.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.cef.variable.dtgenerator.api.mginterface; + + +import com.inspur.edp.cef.generator.apiGenerator.dataType.mgrInterface.MgrInterfaceGeneratorContext; +import com.inspur.edp.cef.variable.dtgenerator.api.VariableApiGenContext; + +public class VariableMgrInerfaceGenCtx extends MgrInterfaceGeneratorContext +{ + public VariableMgrInerfaceGenCtx(VariableApiGenContext apiGenContext) + { + super(apiGenContext); + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/mginterface/VariableMgrInterfaceGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/mginterface/VariableMgrInterfaceGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..36bce35df28988b25a660480d1e293660873b0d7 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/mginterface/VariableMgrInterfaceGenerator.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.cef.variable.dtgenerator.api.mginterface; + +import com.inspur.edp.cef.generator.apiGenerator.dataType.mgrInterface.MgrInterfaceGenerator; +import com.inspur.edp.cef.generator.apiGenerator.dataType.mgrInterface.MgrInterfaceGeneratorContext; +import com.inspur.edp.cef.generator.apiGenerator.dataType.mgrInterface.resourceInfo.ModelInfoBaseGenerator; +import com.inspur.edp.cef.variable.dtgenerator.api.ApiHelper; +import com.inspur.edp.cef.variable.dtgenerator.api.VariableApiGenContext; +import com.inspur.edp.cef.variable.dtgenerator.api.mginterface.resinfo.VarModelInfoGenerator; + +public class VariableMgrInterfaceGenerator extends MgrInterfaceGenerator { + + private VariableApiGenContext apiGenContext; + + public VariableMgrInterfaceGenerator(VariableApiGenContext apiGenContext) { + super(apiGenContext); + this.apiGenContext = apiGenContext; + } + + @Override + protected MgrInterfaceGeneratorContext createMgrInterfaceGenContext() { + return new VariableMgrInerfaceGenCtx(apiGenContext); + } + + @Override + protected String getName() { + return ApiHelper + .GetMgrInterfaceClassName(apiGenContext.getVariableGenCtx().getCommonVariableEntity()); + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/mginterface/resinfo/VarModelInfoCtorGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/mginterface/resinfo/VarModelInfoCtorGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..f559f818a0fefe9adeca43f10987a362b938eb6a --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/mginterface/resinfo/VarModelInfoCtorGenerator.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.cef.variable.dtgenerator.api.mginterface.resinfo; + +import com.inspur.edp.caf.generator.utils.ExpressionUtils; +import com.inspur.edp.cef.generator.apiGenerator.CefApiGeneratorContext; +import com.inspur.edp.cef.generator.apiGenerator.dataType.mgrInterface.MgrInterfaceGeneratorContext; +import com.inspur.edp.cef.generator.apiGenerator.dataType.mgrInterface.resourceInfo.ModelInfoCtorGenerator; +import org.eclipse.jdt.core.dom.Block; +import org.eclipse.jdt.core.dom.SuperConstructorInvocation; + +public class VarModelInfoCtorGenerator extends ModelInfoCtorGenerator { + + private final String className; + private final String currentSu; + private final String metadataId; + private final String rootNodeCode; + private final String displayKey; + private final CefApiGeneratorContext parentContext; + + public VarModelInfoCtorGenerator(String className, String currentSu, String metadataId, + String rootNodeCode, String displayKey, + CefApiGeneratorContext parentContext) { + super(className, currentSu, metadataId, rootNodeCode, displayKey, parentContext); + this.className = className; + this.currentSu = currentSu; + this.metadataId = metadataId; + this.rootNodeCode = rootNodeCode; + this.displayKey = displayKey; + this.parentContext = parentContext; + } + + @Override + protected Block buildMethodBody() { + Block block=ast.newBlock(); + SuperConstructorInvocation superConstructorInvocation= ast.newSuperConstructorInvocation(); + superConstructorInvocation.arguments().add(ExpressionUtils.getStringLiteral(ast, currentSu)); + superConstructorInvocation.arguments().add(ExpressionUtils.getStringLiteral(ast, metadataId)); + superConstructorInvocation.arguments().add(ExpressionUtils.getStringLiteral(ast, rootNodeCode)); + superConstructorInvocation.arguments().add(ExpressionUtils.getStringLiteral(ast, displayKey)); + block.statements().add(superConstructorInvocation); + return block; + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/mginterface/resinfo/VarModelInfoGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/mginterface/resinfo/VarModelInfoGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..740217b9fb779900ac91622c56592c452d6480bf --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/mginterface/resinfo/VarModelInfoGenerator.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.cef.variable.dtgenerator.api.mginterface.resinfo; + +import com.inspur.edp.caf.generator.method.ClassMethodGenerator; +import com.inspur.edp.cef.designtime.api.variable.CommonVariableEntity; +import com.inspur.edp.cef.generator.apiGenerator.CefApiGeneratorContext; +import com.inspur.edp.cef.generator.apiGenerator.dataType.mgrInterface.MgrInterfaceGeneratorContext; +import com.inspur.edp.cef.generator.apiGenerator.dataType.mgrInterface.resourceInfo.ModelInfoBaseGenerator; +import com.inspur.edp.cef.generator.apiGenerator.dataType.mgrInterface.resourceInfo.ModelInfoCtorGenerator; +import com.inspur.edp.cef.variable.core.manager.VarMgrResInfoImpl; +import java.util.ArrayList; + +public class VarModelInfoGenerator extends ModelInfoBaseGenerator { + + private CefApiGeneratorContext privateParentContext; + private final CommonVariableEntity unifiedDataTypeDef; + + public VarModelInfoGenerator( + CefApiGeneratorContext parentContext, CommonVariableEntity unifiedDataTypeDef) { + super(parentContext); + this.privateParentContext = parentContext; + this.unifiedDataTypeDef = unifiedDataTypeDef; + } + + @Override + protected String getModelCode() { + return unifiedDataTypeDef.getCode(); + } + + @Override + protected String getModelDisplayValueKey() { + return unifiedDataTypeDef.getI18nResourceInfoPrefix() + ".Name"; + } + + @Override + protected String getModelRootNodeCode() { + return unifiedDataTypeDef.getCode(); + } + + @Override + protected Class getParentClassType() { + return VarMgrResInfoImpl.class; + } + + @Override + protected ModelInfoCtorGenerator getModelInfoCtorGenerator() { + return new VarModelInfoCtorGenerator(getName(), getMetaCurrentSU(), getMetaResourceMetaId(), + getModelRootNodeCode(), getModelDisplayValueKey(), privateParentContext); + } + + @Override + protected ArrayList createMethodGenerators() { + ArrayList list = super.createMethodGenerators(); + if (list == null) { + list = new ArrayList<>(); + } + list.add( + new VarModelInfoGetResourceGenerator(getName(), getMetaCurrentSU(), getMetaResourceMetaId(), + getModelRootNodeCode(), getModelDisplayValueKey(), privateParentContext)); + return list; + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/mginterface/resinfo/VarModelInfoGetResourceGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/mginterface/resinfo/VarModelInfoGetResourceGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..f5ecf9d49cd002f34d1442b65ad2b37cbe28a7e1 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/mginterface/resinfo/VarModelInfoGetResourceGenerator.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.cef.variable.dtgenerator.api.mginterface.resinfo; + +import com.inspur.edp.caf.generator.baseInfo.ParameterInfo; +import com.inspur.edp.caf.generator.baseInfo.TypeInfo; +import com.inspur.edp.caf.generator.method.ClassMethodGenerator; +import com.inspur.edp.cef.gencommon.MediateType; +import com.inspur.edp.cef.generator.apiGenerator.CefApiGeneratorContext; +import com.inspur.edp.cef.generator.apiGenerator.dataType.mgrInterface.MgrInterfaceGeneratorContext; +import com.inspur.edp.cef.spi.entity.resourceInfo.builinImpls.CefValueObjResInfo; +import java.util.ArrayList; +import org.eclipse.jdt.core.dom.Block; +import org.eclipse.jdt.core.dom.ClassInstanceCreation; +import org.eclipse.jdt.core.dom.Modifier.ModifierKeyword; +import org.eclipse.jdt.core.dom.ReturnStatement; + +public class VarModelInfoGetResourceGenerator extends ClassMethodGenerator { + + private final String className; + private final String currentSu; + private final String metadataId; + private final String rootNodeCode; + private final String displayKey; + private final CefApiGeneratorContext parentContext; + + public VarModelInfoGetResourceGenerator(String className, String currentSu, String metadataId, + String rootNodeCode, String displayKey, CefApiGeneratorContext parentContext) { + this.className = className; + this.currentSu = currentSu; + this.metadataId = metadataId; + this.rootNodeCode = rootNodeCode; + this.displayKey = displayKey; + this.parentContext = parentContext; + } + + @Override + protected Block buildMethodBody() { + Block block = ast.newBlock(); + ReturnStatement returnStatement = ast.newReturnStatement(); + for (MediateType entityType : parentContext.getCefGenContext() + .getEntityResourceInfos().values()) { + String typeName = entityType.getFullName(); + TypeInfo type = new TypeInfo(typeName); + type.setUseFullName(true); + ClassInstanceCreation creation = ast.newClassInstanceCreation(); + creation.setType(type.getType(ast, parentContext)); + returnStatement.setExpression(creation); + } + + block.statements().add(returnStatement); + return block; + } + + @Override + protected String getMethodName() { + return "getResourceInfo"; + } + + @Override + protected TypeInfo getReturnType() { + return new TypeInfo(CefValueObjResInfo.class); + } + + @Override + protected ArrayList getAccessModifiers() { + ArrayList modifierKeywords = new ArrayList<>(); + modifierKeywords.add(ModifierKeyword.PROTECTED_KEYWORD); + return modifierKeywords; + } + + @Override + protected boolean getIsOverride() { + return true; + } + + @Override + protected ArrayList getParameterCollection() { + return null; + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/mgrallinterface/VariableMgrAllInterfaceGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/mgrallinterface/VariableMgrAllInterfaceGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..d7bda02423fb517dd81b2a20930f52b7de3bb4ba --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/mgrallinterface/VariableMgrAllInterfaceGenerator.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.cef.variable.dtgenerator.api.mgrallinterface; + +import com.inspur.edp.cef.generator.apiGenerator.dataType.mgrAllInterface.MgrAllInterfaceGenerator; +import com.inspur.edp.cef.variable.dtgenerator.api.ApiHelper; +import com.inspur.edp.cef.variable.dtgenerator.api.VariableApiGenContext; + +/** + 自定义动作和实体动作混合接口,Gen + +*/ +public class VariableMgrAllInterfaceGenerator extends MgrAllInterfaceGenerator +{ + private VariableApiGenContext variableApiGenContext; + public VariableMgrAllInterfaceGenerator(VariableApiGenContext variableGenContext) + { + super(variableGenContext); + this.variableApiGenContext = variableGenContext; + } + /** + 获取ClassName, + + @return + */ + @Override + protected String getName() + { + return ApiHelper.GetMgrAllInterfaceClassName(variableApiGenContext.getVariableGenCtx().getCommonVariableEntity()); + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/mgrallinterface/VariableMgrInerfaceGenCtx.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/mgrallinterface/VariableMgrInerfaceGenCtx.java new file mode 100644 index 0000000000000000000000000000000000000000..372e96f26f3be0dfea78bab19420331d7adb370c --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/mgrallinterface/VariableMgrInerfaceGenCtx.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.cef.variable.dtgenerator.api.mgrallinterface; + +import com.inspur.edp.cef.generator.apiGenerator.dataType.mgrInterface.MgrInterfaceGeneratorContext; +import com.inspur.edp.cef.variable.dtgenerator.api.VariableApiGenContext; + +public class VariableMgrInerfaceGenCtx extends MgrInterfaceGeneratorContext +{ + public VariableMgrInerfaceGenCtx(VariableApiGenContext apiGenContext) + { + super(apiGenContext); + + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/variableinterface/VariableAllInterfaceGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/variableinterface/VariableAllInterfaceGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..1ac48a370555987685dd56757b2c523c07be6e40 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/variableinterface/VariableAllInterfaceGenerator.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.cef.variable.dtgenerator.api.variableinterface; + +import com.inspur.edp.cef.generator.apiGenerator.dataType.entityAllInterface.DataTypeAllInterfaceGenerator; +import com.inspur.edp.cef.variable.dtgenerator.api.VariableApiGenContext; + +public class VariableAllInterfaceGenerator extends DataTypeAllInterfaceGenerator +{ + private VariableApiGenContext apiGenContext; + + public VariableAllInterfaceGenerator(VariableApiGenContext apiGenContext) + { + super(apiGenContext, apiGenContext.getVariableGenCtx().getCommonVariableEntity()); + this.apiGenContext = apiGenContext; + } + + @Override + protected String getName() + { + return "I"+apiGenContext.getVariableGenCtx().getCommonVariableEntity().getCode()+"AllEntityInterface"; + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/variableinterface/VariableInterfaceGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/variableinterface/VariableInterfaceGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..d475281e50635f413c16e0211273a89493c6d350 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/variableinterface/VariableInterfaceGenerator.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.cef.variable.dtgenerator.api.variableinterface; + + +import com.inspur.edp.cef.generator.apiGenerator.dataType.entityInterface.DataTypeInterfaceGenerator; +import com.inspur.edp.cef.generator.apiGenerator.dataType.entityInterface.resourceInfo.DataTypeResourceInfoGenerator; +import com.inspur.edp.cef.variable.dtgenerator.api.VariableApiGenContext; + +public class VariableInterfaceGenerator extends DataTypeInterfaceGenerator { + + private VariableApiGenContext apiGenContext; + + public VariableInterfaceGenerator(VariableApiGenContext apiGenContext) { + super(apiGenContext, apiGenContext.getVariableGenCtx().getCommonVariableEntity()); + this.apiGenContext = apiGenContext; + } + + @Override + protected String getName() { + return "I" + apiGenContext.getVariableGenCtx().getCommonVariableEntity().getCode() + "entity"; + } + + @Override + protected DataTypeResourceInfoGenerator createResourceInfoGenerator() { + return new VariableResourceInfoGenerator(getContext(), + apiGenContext.getVariableGenCtx().getCommonVariableEntity()); + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/variableinterface/VariableResInfoCtorGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/variableinterface/VariableResInfoCtorGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..4c369d85542952133269bbc8dcf954e6a3e1c440 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/variableinterface/VariableResInfoCtorGenerator.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 com.inspur.edp.cef.variable.dtgenerator.api.variableinterface; + +import com.inspur.edp.caf.generator.baseInfo.ParameterInfo; +import com.inspur.edp.caf.generator.baseInfo.TypeInfo; +import com.inspur.edp.caf.generator.method.ClassMethodGenerator; +import com.inspur.edp.caf.generator.utils.ExpressionUtils; +import com.inspur.edp.cef.designtime.api.IGspCommonDataType; +import com.inspur.edp.cef.designtime.api.variable.CommonVariableEntity; +import com.inspur.edp.cef.generator.apiGenerator.dataType.entityInterface.resourceInfo.ResourceInfoCtorGenerator; +import com.inspur.edp.cef.spi.entity.resourceInfo.builinImpls.CefModelResInfoImpl; +import java.util.ArrayList; +import org.eclipse.jdt.core.dom.Block; +import org.eclipse.jdt.core.dom.Modifier.ModifierKeyword; +import org.eclipse.jdt.core.dom.SuperConstructorInvocation; + +public class VariableResInfoCtorGenerator extends ClassMethodGenerator { + + private final CommonVariableEntity dataType; + private final String className; + + public VariableResInfoCtorGenerator(String className, CommonVariableEntity dataType) { + this.className = className; + this.dataType = dataType; + } + + @Override + protected final TypeInfo getReturnType() { + return null; + } + + @Override + protected final String getMethodName() { + return this.className; + } + + @Override + protected final ArrayList getAccessModifiers() { + ArrayList list = new ArrayList(); + list.add(ModifierKeyword.PUBLIC_KEYWORD); + return list; + } + + @Override + protected ArrayList getParameterCollection() { + return null; + } + + @Override + protected final boolean buildIsConstructor() { + return true; + } + + @Override + protected final Block buildMethodBody() { + Block block = this.ast.newBlock(); + SuperConstructorInvocation superConstructorInvocation = this.ast.newSuperConstructorInvocation(); + superConstructorInvocation.arguments().add(ExpressionUtils.getStringLiteral(this.ast, this.dataType.getCode())); + superConstructorInvocation.arguments().add(ExpressionUtils.getStringLiteral(this.ast, this.dataType.getI18nResourceInfoPrefix())); + block.statements().add(superConstructorInvocation); + return block; + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/variableinterface/VariableResourceInfoGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/variableinterface/VariableResourceInfoGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..1df25d5d83be45ce2f984acd7adac0e6ef102001 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/api/variableinterface/VariableResourceInfoGenerator.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.cef.variable.dtgenerator.api.variableinterface; + +import com.inspur.edp.caf.generator.baseInfo.TypeInfo; +import com.inspur.edp.caf.generator.method.ClassMethodGenerator; +import com.inspur.edp.cef.designtime.api.variable.CommonVariableEntity; +import com.inspur.edp.cef.generator.apiGenerator.dataType.entityInterface.DataTypeInterfaceGeneratorContext; +import com.inspur.edp.cef.generator.apiGenerator.dataType.entityInterface.resourceInfo.DataTypeResourceInfoGenerator; +import com.inspur.edp.cef.spi.entity.resourceInfo.builinImpls.CefValueObjResInfo; + +public class VariableResourceInfoGenerator extends DataTypeResourceInfoGenerator { + + public VariableResourceInfoGenerator(DataTypeInterfaceGeneratorContext parentContext, + CommonVariableEntity dataType) { + super(parentContext, dataType); + } + + @Override + protected TypeInfo getParentClass() { + return new TypeInfo(CefValueObjResInfo.class); + } + + @Override + protected ClassMethodGenerator getCtorGenerator(String className) { + return new VariableResInfoCtorGenerator(className, (CommonVariableEntity) dataType); + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/config/VarConfigGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/config/VarConfigGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..fcbd0c6a9c978bc1a28ab7941dbe5644ada24439 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/config/VarConfigGenerator.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.cef.variable.dtgenerator.config; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.inspur.edp.cef.entity.config.MgrConfig; +import com.inspur.edp.cef.variable.dtgenerator.VariableGeneratorContext; +import org.springframework.core.serializer.Serializer; + +public class VarConfigGenerator +{ + private VariableGeneratorContext parentContext; + + public VarConfigGenerator(VariableGeneratorContext parentContext, String apiAssemblyName, String coreAssemblyName) + { + this.parentContext = parentContext; + this.privateApiAssemblyName = apiAssemblyName; + this.privateCoreAssemblyName = coreAssemblyName; + } + + + + public final String GetMgrConfigString() + { + MgrConfig tempVar = new MgrConfig(); + tempVar.setAllInterfaceAssembly(getApiAssemblyName()); + tempVar.setAssembly(getApiAssemblyName()); + tempVar.setAllInterfaceClassName(parentContext.getMgrAllInterfaceType().getFullName()); + tempVar.setClass(parentContext.getMgrInterfaceType().getFullName()); + tempVar.setImpAssembly(getCoreAssemblyName()); + tempVar.setImpClass(parentContext.getMgrImplType().getFullName()); + MgrConfig config = tempVar; + ObjectMapper mapper = new ObjectMapper(); + SimpleModule module = new SimpleModule(); + mapper.registerModule(module); + try { + return (mapper.writeValueAsString(config)); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + } + + private String privateApiAssemblyName; + private String getApiAssemblyName() + { + return privateApiAssemblyName; + } + + private String privateCoreAssemblyName; + private String getCoreAssemblyName() + { + return privateCoreAssemblyName; + } + + //public void Generate() + //{ + // config = new MgrConfig + // { + // AllInterfaceAssembly = parentContext.MgrAllInterfaceType.Assembly.FullName, + // Assembly = parentContext.MgrInterfaceType.Assembly.FullName, + // AllInterfaceClassName = parentContext.MgrAllInterfaceType.FullName, + // Class = parentContext.MgrInterfaceType.FullName, + // ImpAssembly = parentContext.MgrAssemblyName, + // ImpClass = parentContext.MgrImplType.FullName + // }; + //} + //public void ConfigToStr() + //{ + // Generate(); + // parentContext.VarConfigAttrStr=Serializer.JsonSerialize(config); + //} +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/VariableCoreGenCtx.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/VariableCoreGenCtx.java new file mode 100644 index 0000000000000000000000000000000000000000..5785843dab8e36f0a222b90143e285c4f6647a73 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/VariableCoreGenCtx.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.cef.variable.dtgenerator.core; + +import com.inspur.edp.cef.gencommon.MediateType; +import com.inspur.edp.cef.generator.coreGenerator.base.CefCoreGeneratorContext; +import com.inspur.edp.cef.generator.overall.CefGeneratorContext; +import com.inspur.edp.cef.variable.dtgenerator.VariableGeneratorContext; + +public class VariableCoreGenCtx extends CefCoreGeneratorContext + { + public VariableCoreGenCtx(VariableGeneratorContext parentGenContext) + { + super(parentGenContext); + } + + public VariableGeneratorContext getVariableGeneratorContext(){return (VariableGeneratorContext)super.getCefGenContext();} + + @Override + public String getVersionControlPropertyName() { + return null; + } + + @Override + public VariableGeneratorContext getCefGenContext() { + return (VariableGeneratorContext) super.getCefGenContext(); + } + + private MediateType variableMgrType; + + public MediateType getVariableMgrType() { + return variableMgrType; + } + + public void setVariableMgrType(MediateType variableMgrType) { + this.variableMgrType = variableMgrType; + } + + } diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/VariableCoreGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/VariableCoreGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..96596b66dc2e82f3f2b375ddc2b7940b88517fe3 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/VariableCoreGenerator.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.cef.variable.dtgenerator.core; + + +import com.inspur.edp.cef.generator.coreGenerator.base.CefCoreGenerator; +import com.inspur.edp.cef.generator.coreGenerator.base.CefCoreGeneratorContext; +import com.inspur.edp.cef.generator.coreGenerator.base.mgrGenerator.ManagerGenerator; +import com.inspur.edp.cef.generator.coreGenerator.entityGenerator.CommonModelCoreGeneratorContext; +import com.inspur.edp.cef.variable.dtgenerator.VariableGeneratorContext; +import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.manager.VarManagerGenerator; + +public class VariableCoreGenerator extends CefCoreGenerator +{ + private VariableGeneratorContext context; +// private MetadataJitContext metadataJitContext; + + public VariableCoreGenerator(VariableGeneratorContext context) + { + super(context); + this.context = context; +// this.metadataJitContext = metadataJitContext; + } + + private VariableCoreGenCtx getVariableCoreGenCtx(){return (VariableCoreGenCtx)super.getContext();} + + @Override + protected CefCoreGeneratorContext createCoreGenContext() + { + VariableCoreGenCtx ctx = new VariableCoreGenCtx(context); + ctx.setNamespace( context.getCommonVariableEntity().getGeneratedCoreAssemblyInfo().getDefaultNamespace()); + return ctx; + } + + @Override + protected String getPackageName() { + return getVariableCoreGenCtx().getPackageName(); + } + + @Override + protected ManagerGenerator createMgrImplGenerator() { + return new VarManagerGenerator(getVariableCoreGenCtx()); + } + + @Override + protected boolean getHasRepository() { + return false; +} +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/datatypeimpl/VariableDataTypeImplGenCtx.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/datatypeimpl/VariableDataTypeImplGenCtx.java new file mode 100644 index 0000000000000000000000000000000000000000..09c15a627ddf43917d67350a763bebbc7d74c423 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/datatypeimpl/VariableDataTypeImplGenCtx.java @@ -0,0 +1,14 @@ +//package com.inspur.edp.cef.variable.dtgenerator.core.datatypeimpl; +// +// +//import com.inspur.edp.cef.generator.coreGenerator.base.entityGenerator.CefDataTypeImplGeneratorContext; +//import com.inspur.edp.cef.variable.dtgenerator.core.VariableCoreGenCtx; +// +//public class VariableDataTypeImplGenCtx extends CefDataTypeImplGeneratorContext +//{ +// public VariableDataTypeImplGenCtx(VariableCoreGenCtx coreGenContext) +// { +// super(coreGenContext, coreGenContext.getVariableGeneratorContext().getCommonVariableEntity()); +// } +// +//} \ No newline at end of file diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/datatypeimpl/VariableDataTypeImplGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/datatypeimpl/VariableDataTypeImplGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..f0f56fe9fb101fd22dbb009b68aca45fa25ec76f --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/datatypeimpl/VariableDataTypeImplGenerator.java @@ -0,0 +1,70 @@ +//package com.inspur.edp.cef.variable.dtgenerator.core.datatypeimpl; +// +// +//import com.inspur.edp.cef.gencommon.MediateType; +//import com.inspur.edp.cef.generator.coreGenerator.base.entityGenerator.CefDataTypeImplGeneratorContext; +//import com.inspur.edp.cef.generator.coreGenerator.base.entityGenerator.determinations.DataTypeDtmsGenerator; +//import com.inspur.edp.cef.generator.coreGenerator.base.entityGenerator.validations.DataTypeValidationsGenerator; +//import com.inspur.edp.cef.generator.coreGenerator.valueObjectGenerator.entityGenerator.ValueObjDataTypeImplGenerator; +//import com.inspur.edp.cef.variable.dtgenerator.core.VariableCoreGenCtx; +//import com.inspur.edp.cef.variable.dtgenerator.core.datatypeimpl.dtms.VariableDtmsGenerator; +// +//public class VariableDataTypeImplGenerator extends ValueObjDataTypeImplGenerator +//{ +// +// private VariableCoreGenCtx variableCoreGenCtx; +// +// public VariableDataTypeImplGenerator(VariableCoreGenCtx context) +// { +// super(context, context.getVariableGeneratorContext().getCommonVariableEntity()); +// this.variableCoreGenCtx = context; +// variableCoreGenCtx.setRootEntityImplType( new MediateType(getNameSpace(), getName())); +// } +////C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing via the 'new' keyword: +////ORIGINAL LINE: private new VariableDataTypeImplGenCtx Context => (VariableDataTypeImplGenCtx)super.Context; +// private VariableDataTypeImplGenCtx getVariableDataTypeImplGenCtx(){return (VariableDataTypeImplGenCtx)super.getContext();} +// +// @Override +// protected CefDataTypeImplGeneratorContext createImplGenContext() +// { +// return new VariableDataTypeImplGenCtx(variableCoreGenCtx); +// } +// +// @Override +// protected boolean getHasDetermination() { +// return true; +// } +// +// @Override +// protected boolean getHasValidation() { +// return false; +// } +// +// @Override +// protected DataTypeDtmsGenerator getDtmGenerator() +// { +// return new VariableDtmsGenerator(getVariableDataTypeImplGenCtx()); +// } +// /** +// 参数校验生成 +// +// @return +// */ +// @Override +// protected DataTypeValidationsGenerator getValGenerator() +// { +// return null; +// } +// +// @Override +// protected String getName() +// { +// return variableCoreGenCtx.getVariableGeneratorContext().getCommonVariableEntity().getCode()+"entity"; +// } +// +// +// protected String getNameSpace() +// { +// return variableCoreGenCtx.getVariableGeneratorContext().getCommonVariableEntity().getGeneratedCoreAssemblyInfo().getDefaultNamespace(); +// } +//} \ No newline at end of file diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/mgrimpl/VaribaleMgrImplGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/mgrimpl/VaribaleMgrImplGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..281a9815d543688ee3fc514b3e50e29ba47a9a21 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/mgrimpl/VaribaleMgrImplGenerator.java @@ -0,0 +1,29 @@ +//package com.inspur.edp.cef.variable.dtgenerator.core.mgrimpl; +// +// +//import com.inspur.edp.caf.generator.method.ClassMethodGenerator; +//import com.inspur.edp.cef.generator.coreGenerator.valueObjectGenerator.mgrGenerator.ValueObjMgrImplGenerator; +//import com.inspur.edp.cef.variable.dtgenerator.core.VariableCoreGenCtx; +// +//public class VaribaleMgrImplGenerator extends ValueObjMgrImplGenerator +//{ +// private VariableCoreGenCtx coreGenContext; +// public VaribaleMgrImplGenerator(VariableCoreGenCtx coreGenContext) +// { +// super(coreGenContext); +// this.coreGenContext = coreGenContext; +// +// } +// +// @Override +// protected java.util.ArrayList getMgrActionGenerators() +// { +// return new java.util.ArrayList(); +// } +// +// @Override +// protected String getName() +// { +// return "VariableManager"; +// } +//} \ No newline at end of file diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/VarGenerateContext.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/VarGenerateContext.java new file mode 100644 index 0000000000000000000000000000000000000000..1973bcc11d0e469f42c42bc2c4084c53206a684e --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/VarGenerateContext.java @@ -0,0 +1,63 @@ +//package com.inspur.edp.cef.variable.rtgenerator; +// +// +//import com.inspur.edp.cef.entity.config.CefConfig; +//import com.inspur.edp.cef.gencommon.MediateType; +//import com.inspur.edp.cef.rtgenerator.CefGenerateContext; +//import com.inspur.edp.cef.rtgenerator.common.CefMgrTypeInfo; +// +//public class VarGenerateContext extends CefGenerateContext +//{ +// protected VarGenerateContext(java.util.ArrayList mgrTypes, CefMgrTypeInfo parentTypeInfo, CefConfig cefConfig, CefMgrTypeInfo currentTypeInfo) +// { +// super(mgrTypes, parentTypeInfo, cefConfig, currentTypeInfo); +// } +// +// private boolean privateIsEntityData=false; +// @Override +// public boolean getIsEntityData(){return privateIsEntityData;} +// @Override +// public void setIsEntityData(boolean value){privateIsEntityData=value;} +// +// @Override +// protected java.lang.Class getEntityRepositoryFactory() +// { +// try { +// return Class.forName("com.inspur.edp.udt.rtgenerator.common.UdtRepositoryFactory"); +// } catch (ClassNotFoundException e) { +// e.printStackTrace(); +// throw new RuntimeException(e); +// } +// } +// +// @Override +// protected java.lang.Class getNestedManagerFactory() { +// try { +// return Class.forName("com.inspur.edp.udt.rtgenerator.udtfactory.UdtFactory"); +// } catch (ClassNotFoundException e) { +// e.printStackTrace(); +// throw new RuntimeException(e); +// } +// } +// +// @Override +// protected java.lang.Class getNestedRepositoryFactory() +// { +// try { +// return Class.forName("com.inspur.edp.udt.rtgenerator.common.UdtRepositoryFactory"); +// } catch (ClassNotFoundException e) { +// e.printStackTrace(); +// throw new RuntimeException(e); +// } +// } +// +// private MediateType privateVariableMgrType; +// public final MediateType getVariableMgrType() +// { +// return privateVariableMgrType; +// } +// public final void setVariableMgrType(MediateType value) +// { +// privateVariableMgrType = value; +// } +//} \ No newline at end of file diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/VariableCompileUnit.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/VariableCompileUnit.java new file mode 100644 index 0000000000000000000000000000000000000000..8bbd873982e18feaaac3bc0d5d4a2f2f2eef1a07 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/VariableCompileUnit.java @@ -0,0 +1,26 @@ +//package com.inspur.edp.cef.variable.rtgenerator; +// +//import com.inspur.edp.cef.rtgenerator.CefGenerateContext; +//import com.inspur.edp.cef.rtgenerator.CefRootCompileUnitGenerator; +//import com.inspur.edp.cef.rtgenerator.managergen.ManagerGenerator; +//import com.inspur.edp.cef.variable.rtgenerator.manager.VarManagerGenerator; +// +//public class VariableCompileUnit extends CefRootCompileUnitGenerator { +// private VarGenerateContext cefGenerateContext; +// +// public VariableCompileUnit(VarGenerateContext cefGenerateContext) { +// super(cefGenerateContext); +// this.cefGenerateContext = cefGenerateContext; +// } +// +// @Override +// protected ManagerGenerator createManagerGenerator() { +// return new VarManagerGenerator(cefGenerateContext); +// } +// +// @Override +// protected String getPackageName() { +// return cefGenerateContext.getCefConfig().getDefaultNamespace(); +// } +// +//} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/VariableGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/VariableGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..2c7f3d4e78e9960a42f9381e4a5798696bc656f4 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/VariableGenerator.java @@ -0,0 +1,74 @@ +//package com.inspur.edp.cef.variable.rtgenerator; +// +//import com.inspur.edp.cef.entity.config.CefConfig; +//import com.inspur.edp.cef.entity.config.MgrConfig; +//import com.inspur.edp.cef.rtgenerator.CefGenerateContext; +//import com.inspur.edp.cef.rtgenerator.CefGenerator; +//import com.inspur.edp.cef.rtgenerator.CefRootCompileUnitGenerator; +//import com.inspur.edp.cef.rtgenerator.common.CefMgrTypeInfo; +//import com.inspur.edp.cef.rtgenerator.common.CompileContext; +//import com.inspur.edp.cef.rtgenerator.managergen.ManagerGenerator; +//import com.inspur.edp.cef.variable.gencommon.VariableConfig; +//import com.inspur.edp.cef.variable.rtgenerator.manager.VarManagerGenerator; +// +//public class VariableGenerator extends CefGenerator +//{ +// private CompileContext compileContext; +//// private ProjectGeneratorContext parentContext; +// +// public VariableGenerator(java.util.ArrayList mgrConfigs, CefMgrTypeInfo parentTypeInfo, VariableConfig cefConfig,String generatedPath, CompileContext compileContext) +// { +// super(mgrConfigs, parentTypeInfo, cefConfig,generatedPath,compileContext); +//// this.parentContext = parentContext; +// this.compileContext = compileContext; +// } +// +////C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing via the 'new' keyword: +////ORIGINAL LINE: protected new VarGenerateContext Context => (VarGenerateContext)super.Context; +// protected VarGenerateContext getVarGenerateContext(){return (VarGenerateContext)super.getContext();} +// +// @Override +// protected final CefGenerateContext createCefGenerateContext(java.util.ArrayList mgrTypes, CefMgrTypeInfo parentTypeInfo +// , com.inspur.edp.cef.entity.config.CefConfig cefConfig, CefMgrTypeInfo currentTypeInfo) +// { +// VarGenerateContext rez = CreateVarGenCtx(mgrTypes, parentTypeInfo, cefConfig, currentTypeInfo); +// +// return rez; +// } +// +// @Override +// protected CefRootCompileUnitGenerator createRootCompileUnitGenerator() { +// return new VariableCompileUnit(getVarGenerateContext()); +// } +// +// @Override +// protected void beforeInitialize() +// { +// super.beforeInitialize(); +//// Context.SetIsRef(true); +//// Context.SetRefProjectGen(parentContext); +// } +// +// protected VarGenerateContext CreateVarGenCtx(java.util.ArrayList mgrTypes, CefMgrTypeInfo parentTypeInfo, CefConfig cefConfig, CefMgrTypeInfo currentTypeInfo) +// { +// return new VarGenerateContext(mgrTypes, parentTypeInfo, cefConfig, currentTypeInfo); +// } +// +//// @Override +//// protected ManagerGenerator createManagerGenerator() {return new VarManagerGenerator(getVarGenerateContext());} +// +// +// @Override +// protected void afterGenerate() +// { +// } +// +// public final void SetAfterGenerate() +// { +// super.afterGenerate(); +// } +// +// //protected override void AddExtendChildGenerators(List childGenerators) +// //{ +// //} +//} \ No newline at end of file diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/VarEntityGenCtx.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/VarEntityGenCtx.java new file mode 100644 index 0000000000000000000000000000000000000000..22166689914c2df4b4051f6df49036cb2468a577 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/VarEntityGenCtx.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.cef.variable.dtgenerator.core.rtgenerator.entity; + +import com.inspur.edp.cef.generator.coreGenerator.base.entitygen.EntityGeneratorContext; +import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.manager.VarMgrGenContext; + +public class VarEntityGenCtx extends EntityGeneratorContext +{ + private VarMgrGenContext mgrGenCtx; + public VarEntityGenCtx(VarMgrGenContext mgrGenCtx) + { + super(); + this.mgrGenCtx = mgrGenCtx; + } + + public VarMgrGenContext getMgrGenCtx(){ + return mgrGenCtx; + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/VarEntityGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/VarEntityGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..f186e8d59b2494d19c813be058d9903278468433 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/VarEntityGenerator.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.cef.variable.dtgenerator.core.rtgenerator.entity; + + +import com.inspur.edp.cef.generator.coreGenerator.base.entitygen.DataTypeImpGenerator; +import com.inspur.edp.cef.generator.coreGenerator.base.entitygen.EntityGenerator; +import com.inspur.edp.cef.generator.coreGenerator.base.entitygen.EntityGeneratorContext; +import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.manager.VarMgrGenContext; + +public class VarEntityGenerator extends EntityGenerator +{ + private VarMgrGenContext mgrGenCtx; + public VarEntityGenerator(VarMgrGenContext mgrGenCtx) + { + super(mgrGenCtx.getVarGenerateContext(),mgrGenCtx.getVarGenerateContext().getVariableGeneratorContext().getCommonDataType()); + this.mgrGenCtx = mgrGenCtx; + } + +//C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing via the 'new' keyword: +//ORIGINAL LINE: private new VarEntityGenCtx Context => (VarEntityGenCtx)super.Context; + private VarEntityGenCtx getVarEntityGenContext(){return (VarEntityGenCtx)super.getContext();} + + @Override + protected EntityGeneratorContext createEntityGeneratorContext() + { + return new VarEntityGenCtx(mgrGenCtx); + } + + @Override + protected DataTypeImpGenerator getEntityImplGenerator() + { + return new VarImplGenerator(getVarEntityGenContext(), node); + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/VarImplGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/VarImplGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..2307c56c497b230ae80422775ea7d8cffb2ee3c7 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/VarImplGenerator.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.cef.variable.dtgenerator.core.rtgenerator.entity; + + +import com.inspur.edp.caf.generator.BaseGenerator; +import com.inspur.edp.caf.generator.baseInfo.TypeInfo; +import com.inspur.edp.caf.generator.field.FieldGenerator; +import com.inspur.edp.caf.generator.method.ClassMethodGenerator; +import com.inspur.edp.cef.designtime.api.IGspCommonDataType; +import com.inspur.edp.cef.designtime.api.variable.CommonVariableEntity; +import com.inspur.edp.cef.gencommon.MediateType; +import com.inspur.edp.cef.generator.coreGenerator.base.entitygen.EntityDataImplGenerator; +import com.inspur.edp.cef.generator.coreGenerator.base.entitygen.ValueObjectImplGenerator; +import com.inspur.edp.cef.generator.overall.GeneratorUtil; +import com.inspur.edp.cef.variable.api.variable.IVariable; +import com.inspur.edp.cef.variable.core.variable.AbstractVariable; +import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.entity.cacheinfo.GetCacheInfoFieldGenerator; +import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.entity.cacheinfo.GetCacheInfoMethodGenerator; +import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.entity.data.VarDataImplGenerator; +import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.entity.dtm.VarCreateAfterModifyDtmAssMethodGenerator; +import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.entity.method.VarCtorGenerator; +import java.util.ArrayList; + +public class VarImplGenerator extends ValueObjectImplGenerator +{ + private VarEntityGenCtx entityGenCtx; + public VarImplGenerator(VarEntityGenCtx entityGenCtx, IGspCommonDataType node) + { + super(entityGenCtx, node); + this.entityGenCtx = entityGenCtx; + entityGenCtx.getProjContext().setRootEntityImplType(new MediateType(null, getName())); + } + + @Override + protected void addValueExtendParentInterfaces(ArrayList arrayList) { + arrayList.add(new TypeInfo(IVariable.class)); + addImport(IVariable.class.getTypeName()); + } + + @Override + protected Class getParentClass() { + return AbstractVariable.class; + } + + @Override + protected String getName() { + return dataType.getCode()+"entity"; + } + + @Override + protected ClassMethodGenerator getCreateAfterCreateDtmAssMethodGenerator(){return null;} + @Override + protected ClassMethodGenerator getCreateAfterModifyDtmAssMethodGenerator() + { + return new VarCreateAfterModifyDtmAssMethodGenerator(getDataTypeImplContext(),getDataTypeImpContext().getNodeCode()); + } + + @Override + protected ClassMethodGenerator getCreateAfterModifyValAssMethodGenerator(){return null;} + @Override + protected ClassMethodGenerator getCreateBeforeSaveDtmAssMethodGenerator(){return null;} + @Override + protected ClassMethodGenerator getCreateBeforeSaveValAssMethodGenerator(){return null;} + + @Override + protected EntityDataImplGenerator getDataGenerator(MediateType baseType) + { + return new VarDataImplGenerator(entityGenCtx, dataType.getCode(), baseType); + } + @Override + protected ClassMethodGenerator getConstructorGenerator(String typeName, String dataName) + { + return new VarCtorGenerator(typeName, dataName); + } + + @Override + protected FieldGenerator getDataTypeCacheInfoFieldGenerator() { + return new GetCacheInfoFieldGenerator(); + } + + @Override + protected ClassMethodGenerator getDataTypeCacheInfoMethodGenerator() { + return new GetCacheInfoMethodGenerator(); + } + + @Override + protected ArrayList createClassExtendChildGenrators() { + ArrayList baseExtendGens = super.createClassExtendChildGenrators(); + if (baseExtendGens == null) { + baseExtendGens = new ArrayList(); + } +// baseExtendGens.add(new VariableDtmsGenerator(getDataTypeImplContext())); +// baseExtendGens.add(new VariableValidationGenerator(getDataTypeImplContext())); + return baseExtendGens; + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/cacheinfo/GetCacheInfoFieldGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/cacheinfo/GetCacheInfoFieldGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..303f760e969ed9fe305b26959409b03b40f993f2 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/cacheinfo/GetCacheInfoFieldGenerator.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.cef.variable.dtgenerator.core.rtgenerator.entity.cacheinfo; + +import com.inspur.edp.caf.generator.baseInfo.TypeInfo; +import com.inspur.edp.cef.generator.coreGenerator.base.entitygen.field.DataTypeCacheInfoFieldGenerator; +import org.eclipse.jdt.core.dom.ClassInstanceCreation; +import org.eclipse.jdt.core.dom.Expression; +import com.inspur.edp.cef.variable.core.variable.builtinimpls.VariableEntityCacheInfo; + +public class GetCacheInfoFieldGenerator extends DataTypeCacheInfoFieldGenerator { + + public GetCacheInfoFieldGenerator() { + } + + @Override + protected TypeInfo getFieldType() { + TypeInfo result = new TypeInfo(VariableEntityCacheInfo.class); +// result.setArray(true); + return result; + } + + @Override + protected Expression buildGetMethodBody() { + ClassInstanceCreation result = ast.newClassInstanceCreation(); + addImport(VariableEntityCacheInfo.class.getTypeName()); + result.setType(new TypeInfo(VariableEntityCacheInfo.class).getType(ast)); + return result; + } +} + diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/cacheinfo/GetCacheInfoMethodGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/cacheinfo/GetCacheInfoMethodGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..b64ac0dd6d80e0a5479b0344f85def7c512d314f --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/cacheinfo/GetCacheInfoMethodGenerator.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.cef.variable.dtgenerator.core.rtgenerator.entity.cacheinfo; + +import com.inspur.edp.caf.generator.baseInfo.TypeInfo; +import com.inspur.edp.cef.generator.coreGenerator.base.entitygen.method.GetDataTypeCacheInfoMethodGenerator; +import org.eclipse.jdt.core.dom.Block; +import org.eclipse.jdt.core.dom.ReturnStatement; +import com.inspur.edp.cef.variable.core.variable.builtinimpls.VariableEntityCacheInfo; + +public class GetCacheInfoMethodGenerator extends GetDataTypeCacheInfoMethodGenerator { + + @Override + protected Block buildMethodBody() { + Block block = ast.newBlock(); + ReturnStatement returnStatement = ast.newReturnStatement(); + returnStatement.setExpression(ast.newSimpleName("_befStaticCacheInfo")); + block.statements().add(returnStatement); + return block; + } + + @Override + protected String getMethodName() { + return "getVariableCacheInfo"; + } + + @Override + protected TypeInfo getReturnType() { + return new TypeInfo(VariableEntityCacheInfo.class); + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/data/SessionDataPropGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/data/SessionDataPropGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..22c7d67b5106ebfe49042f732d87c810ecc5261d --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/data/SessionDataPropGenerator.java @@ -0,0 +1,66 @@ +//package com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.entity.data; +// +//import com.inspur.edp.cef.gencommon.ReflectionUtils; +//import com.inspur.edp.cef.generator.common.MediatePropertyInfo; +//import com.inspur.edp.cef.generator.coreGenerator.base.entitygen.property.BaseTypePropGenerator; +//import com.inspur.edp.cef.variable.api.attr.SessionVarAttribute; +//import com.inspur.edp.cef.variable.core.data.DataUtil; +//import org.eclipse.jdt.core.dom.Block; +//import org.eclipse.jdt.core.dom.MethodInvocation; +//import org.eclipse.jdt.core.dom.ReturnStatement; +//import org.eclipse.jdt.core.dom.StringLiteral; +// +////来自session的变量, 根据20190216讨论, 直接从session上取值赋值, 不支持回滚 +//public class SessionDataPropGenerator extends BaseTypePropGenerator +//{ +// private String sessionKey; +// +// public SessionDataPropGenerator(MediatePropertyInfo propertyInfo, String propertyFieldName) +// { +// super(propertyInfo,propertyFieldName); +// } +// +// @Override +// protected void beforeInitialize() +// { +// super.beforeInitialize(); +// SessionVarAttribute attr = (SessionVarAttribute) ReflectionUtils.getMethodAnnotation(getPropertyInfo().getPropertyMethod(),SessionVarAttribute.class); +// sessionKey = attr.sessionKey(); +// } +// +// @Override +// protected Block buildGetMethodBody() { +// Block block=ast.newBlock(); +// ReturnStatement returnStatement=ast.newReturnStatement(); +// MethodInvocation methodInvocation=ast.newMethodInvocation(); +// addImport(DataUtil.class.getTypeName()); +// methodInvocation.setExpression(ast.newSimpleName("DataUtil")); +// methodInvocation.setName(ast.newSimpleName("getSesssionValue")); +// StringLiteral stringLiteral=ast.newStringLiteral(); +// stringLiteral.setLiteralValue(sessionKey); +// methodInvocation.arguments().add(stringLiteral); +// returnStatement.setExpression(methodInvocation); +// +// block.statements().add(returnStatement); +// return block; +// } +// +// @Override +// protected Block buildSetMethodBody() { +// Block block=ast.newBlock(); +// ReturnStatement returnStatement=ast.newReturnStatement(); +// MethodInvocation methodInvocation=ast.newMethodInvocation(); +// addImport(DataUtil.class.getTypeName()); +// methodInvocation.setExpression(ast.newSimpleName("DataUtil")); +// methodInvocation.setName(ast.newSimpleName("setSessionValue")); +// StringLiteral stringLiteral=ast.newStringLiteral(); +// stringLiteral.setLiteralValue(sessionKey); +// methodInvocation.arguments().add(stringLiteral); +// methodInvocation.arguments().add(ast.newSimpleName("value")); +// returnStatement.setExpression(methodInvocation); +// +// block.statements().add(returnStatement); +// return block; +// } +// +//} \ No newline at end of file diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/data/VarDataImplGenCtx.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/data/VarDataImplGenCtx.java new file mode 100644 index 0000000000000000000000000000000000000000..8380708bb46e34c033d6c8402e71d72a387d59e7 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/data/VarDataImplGenCtx.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.cef.variable.dtgenerator.core.rtgenerator.entity.data; + + +import com.inspur.edp.caf.generator.item.ClassGeneratorContext; +import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.entity.VarEntityGenCtx; + +public class VarDataImplGenCtx extends ClassGeneratorContext +{ + private VarEntityGenCtx entityGenCtx; + public VarDataImplGenCtx(VarEntityGenCtx entityGenCtx) + { + this.entityGenCtx = entityGenCtx; + } + + public VarEntityGenCtx getEntityGenCtx (){return entityGenCtx;} +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/data/VarDataImplGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/data/VarDataImplGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..7433faf5dece8ee20273efdabb38092ca923402f --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/data/VarDataImplGenerator.java @@ -0,0 +1,82 @@ +/* + * Copyright © OpenAtom Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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.cef.variable.dtgenerator.core.rtgenerator.entity.data; + +import com.inspur.edp.caf.generator.BaseGenerator; +import com.inspur.edp.caf.generator.baseInfo.TypeInfo; +import com.inspur.edp.caf.generator.item.ClassGeneratorContext; +import com.inspur.edp.cef.entity.entity.IValueObjData; +import com.inspur.edp.cef.gencommon.MediateType; +import com.inspur.edp.cef.generator.coreGenerator.base.accessorgen.ReadOnlyNestedAcsGenerator; +import com.inspur.edp.cef.generator.coreGenerator.base.entitygen.EntityDataImplGenerator; +import com.inspur.edp.cef.generator.coreGenerator.base.entitygen.EntityGeneratorContext; +import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.entity.VarEntityGenCtx; +import com.inspur.edp.das.commonmodel.IGspCommonObject; +import java.util.ArrayList; + +public class VarDataImplGenerator extends EntityDataImplGenerator { + + private VarEntityGenCtx entityGenCtx; + + public VarDataImplGenerator(VarEntityGenCtx entityGenCtx, String nodeCode, + MediateType targetInterfaceType) { + super(entityGenCtx, nodeCode, targetInterfaceType); + this.entityGenCtx = entityGenCtx; + } + + @Override + protected ClassGeneratorContext createClassInfoContext() { + return new VarDataImplGenCtx(entityGenCtx); + } + + @Override + protected EntityDataImplGenerator getDataChildsGenerator( + EntityGeneratorContext entityGeneratorContext, IGspCommonObject iGspCommonObject) { + throw new UnsupportedOperationException("变量不支持子表"); + } + + @Override + protected java.util.ArrayList createClassExtendChildGenrators() { + java.util.ArrayList list = super.createClassExtendChildGenrators(); + if (list == null) { + list = new java.util.ArrayList(); + } + list.add(new VariableAcsGenerator(entityGenCtx, + entityGenCtx.getNode(), TargetInterfaceType)); + list.add( + new ReadOnlyNestedAcsGenerator(entityGenCtx, entityGenCtx.getNode(), TargetInterfaceType)); + return list; + } + + @Override + public String getName() { + return entityGenCtx.getMgrGenCtx().getVarGenerateContext().getCefGenContext() + .getCommonVariableEntity().getCode().concat("Data"); + } + + @Override + public boolean isValueObject() { + return true; + } + + @Override + protected void addExtendParentInterfaces(ArrayList parents) { + super.addExtendParentInterfaces(parents); + parents.add(new TypeInfo(IValueObjData.class)); + addImport(IValueObjData.class.getTypeName()); + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/data/VariableAcsGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/data/VariableAcsGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..b65776097ee9a8b3d286ef395ca704b7e3f64faf --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/data/VariableAcsGenerator.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.cef.variable.dtgenerator.core.rtgenerator.entity.data; + +import com.inspur.edp.cef.designtime.api.IGspCommonDataType; +import com.inspur.edp.cef.gencommon.MediateType; +import com.inspur.edp.cef.generator.coreGenerator.base.accessorgen.NestedAcsGenerator; +import com.inspur.edp.cef.generator.coreGenerator.base.entitygen.EntityGeneratorContext; + +public class VariableAcsGenerator extends NestedAcsGenerator +{ + public VariableAcsGenerator(EntityGeneratorContext parContext, IGspCommonDataType node, MediateType targetInterfaceType) + { + super(parContext,node, node.getCode(), targetInterfaceType); + } + + //protected override void AddAcsExtendMethod(List methodGens) + //{ + // base.AddAcsExtendMethod(methodGens); + // methodGens.Add(new CopySelfGenerator()); + //} + + ////public virtual ICefData CopySelf() => InnerData?.CopySelf(); + //public class CopySelfGenerator : ClassMethodGenerator + //{ + // protected override BlockSyntax BuildMethodBody() => + // SyntaxFactory.Block( + // SyntaxFactory.SingletonList( + // SyntaxFactory.ReturnStatement( + // SyntaxFactory.IdentifierName("InnerData")))); + + // protected override List GetAccessModifiers() => + // new List { MethodAccessModifier.Public, MethodAccessModifier.Override }; + + // protected override string GetMethodName() => "CopySelf"; + + // protected override List GetParameterCollection() => + // new List(); + + // protected override Type GetReturnType() => typeof(ICefData); + //} +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/dtm/VarAfterModifyDtmGen.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/dtm/VarAfterModifyDtmGen.java new file mode 100644 index 0000000000000000000000000000000000000000..7ec21d1bb3cbb00179d556e29ef574cfc70392be --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/dtm/VarAfterModifyDtmGen.java @@ -0,0 +1,32 @@ +//package com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.entity.dtm; +// +// +//import com.inspur.edp.cef.rtgenerator.entitygen.determination.AfterModifyDtmGen; +//import com.inspur.edp.cef.rtgenerator.entitygen.determination.method.GetChangesetDtmGenerator; +//import com.inspur.edp.cef.rtgenerator.entitygen.determination.method.GetDeterminationContextGenerator; +//import com.inspur.edp.cef.variable.rtgenerator.entity.VarEntityGenCtx; +// +//public class VarAfterModifyDtmGen extends AfterModifyDtmGen +//{ +// public VarAfterModifyDtmGen(VarEntityGenCtx entityContext) +// { +// super(entityContext, "RootNode"); +// } +// +// @Override +// protected boolean getIsValueObject() { +// return true; +// } +// +// @Override +// public GetChangesetDtmGenerator changesetMethodGen() +// { +// return new VarGetChangesetDtmGenerator(); +// } +// +// @Override +// protected GetDeterminationContextGenerator getDeterminationContextGen() +// { +// return new VarGetDeterminationContextGenerator(); +// } +//} \ No newline at end of file diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/dtm/VarCreateAfterModifyDtmAssMethodGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/dtm/VarCreateAfterModifyDtmAssMethodGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..b7ab149d5585aee580779092f7fdcff218b06cbf --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/dtm/VarCreateAfterModifyDtmAssMethodGenerator.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.cef.variable.dtgenerator.core.rtgenerator.entity.dtm; + + +import com.inspur.edp.caf.generator.baseInfo.TypeInfo; +import com.inspur.edp.cef.designtime.api.operation.CommonDetermination; +import com.inspur.edp.cef.generator.coreGenerator.base.entitygen.DataTypeImpContext; +import com.inspur.edp.cef.generator.coreGenerator.base.entitygen.createdtmassmethod.ValueObjCreateAfterModifyDtmAsseMethodGenerator; +import com.inspur.edp.cef.variable.core.determination.builtinimpls.VarAfterModifyDtmAssembler; +import com.inspur.edp.cef.variable.core.determination.builtinimpls.adaptors.VarAftModifyDtmAdaptor; +import java.util.List; +import javax.ws.rs.NotSupportedException; + +public class VarCreateAfterModifyDtmAssMethodGenerator extends + ValueObjCreateAfterModifyDtmAsseMethodGenerator { + + public VarCreateAfterModifyDtmAssMethodGenerator(DataTypeImpContext dataTypeImpContext, + String nodeCode) { + super(dataTypeImpContext, nodeCode); + } + + @Override + protected TypeInfo getNewAdaptor_TypeParam() { + return new TypeInfo(VarAftModifyDtmAdaptor.class); + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/dtm/VarGetChangesetDtmGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/dtm/VarGetChangesetDtmGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..f012a076d80ee243fd71a65a2099c9c2fdbb14a1 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/dtm/VarGetChangesetDtmGenerator.java @@ -0,0 +1,21 @@ +//package com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.entity.dtm; +// +// +//import com.inspur.edp.cef.rtgenerator.entitygen.determination.method.GetChangesetDtmGenerator; +//import org.eclipse.jdt.core.dom.Block; +//import org.eclipse.jdt.core.dom.ClassInstanceCreation; +//import org.eclipse.jdt.core.dom.ThrowStatement; +// +//public class VarGetChangesetDtmGenerator extends GetChangesetDtmGenerator +//{ +// @Override +// protected Block buildMethodBody() { +// Block block=ast.newBlock(); +// ThrowStatement throwStatement =ast.newThrowStatement(); +// ClassInstanceCreation classInstanceCreation= ast.newClassInstanceCreation(); +// classInstanceCreation.setType(ast.newSimpleType(ast.newName(UnsupportedOperationException.class.getTypeName()))); +// throwStatement.setExpression(classInstanceCreation); +// block.statements().add(throwStatement); +// return block; +// } +//} \ No newline at end of file diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/dtm/VarGetDeterminationContextGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/dtm/VarGetDeterminationContextGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..1f188b6deb5901ea89d6269ee89e964ee391426d --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/dtm/VarGetDeterminationContextGenerator.java @@ -0,0 +1,51 @@ +//package com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.entity.dtm; +// +// +//import com.inspur.edp.caf.generator.baseInfo.ParameterInfo; +//import com.inspur.edp.caf.generator.baseInfo.TypeInfo; +//import com.inspur.edp.cef.api.dataType.valueObj.ICefValueObjContext; +//import com.inspur.edp.cef.rtgenerator.entitygen.determination.method.GetDeterminationContextGenerator; +//import com.inspur.edp.cef.variable.core.determination.VarDeterminationContext; +//import org.eclipse.jdt.core.dom.Block; +//import org.eclipse.jdt.core.dom.CastExpression; +//import org.eclipse.jdt.core.dom.ClassInstanceCreation; +//import org.eclipse.jdt.core.dom.ReturnStatement; +// +//import java.util.ArrayList; +// +//public class VarGetDeterminationContextGenerator extends GetDeterminationContextGenerator +//{ +// @Override +// protected ArrayList getParameterCollection() { +// ArrayList list=new ArrayList(); +// ParameterInfo parameterInfo=new ParameterInfo(); +// parameterInfo.setParamType(new TypeInfo(ICefValueObjContext.class)); +// parameterInfo.setParamName("data"); +// list.add(parameterInfo); +// +// return list; +// } +// +// @Override +// protected Class getContextParType() { +// return ICefValueObjContext.class; +// } +// +// @Override +// protected Block buildMethodBody() { +// Block block=ast.newBlock(); +// ReturnStatement returnStatement=ast.newReturnStatement(); +// ClassInstanceCreation classInstanceCreation=ast.newClassInstanceCreation(); +// classInstanceCreation.setType(ast.newSimpleType(ast.newName(VarDeterminationContext.class.getTypeName()))); +// +// CastExpression castExpression=ast.newCastExpression(); +// castExpression.setType(ast.newSimpleType(ast.newName(ICefValueObjContext.class.getTypeName()))); +// castExpression.setExpression(ast.newSimpleName("data")); +// +// classInstanceCreation.arguments().add(castExpression); +// returnStatement.setExpression(classInstanceCreation); +// block.statements().add(returnStatement); +// +// return block; +// } +//} \ No newline at end of file diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/method/VarCtorGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/method/VarCtorGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..9a1e2639957c8c103aa412d97366f7d0d7165ed0 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/entity/method/VarCtorGenerator.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.cef.variable.dtgenerator.core.rtgenerator.entity.method; + + +import com.inspur.edp.caf.generator.baseInfo.ParameterInfo; +import com.inspur.edp.caf.generator.baseInfo.TypeInfo; +import com.inspur.edp.cef.generator.coreGenerator.base.entitygen.method.DataTypeCtorGenerator; +import com.inspur.edp.cef.variable.api.variable.IVariableContext; +import java.util.ArrayList; +import org.eclipse.jdt.core.dom.Block; +import org.eclipse.jdt.core.dom.SuperConstructorInvocation; + +public class VarCtorGenerator extends DataTypeCtorGenerator +{ + public VarCtorGenerator(String className, String dataName) + { + super(className, dataName); + } + + @Override + protected ArrayList getParameterCollection() { + ArrayList list=new ArrayList(); + ParameterInfo parameterInfo=new ParameterInfo(); + parameterInfo.setParamType(new TypeInfo(IVariableContext.class)); + parameterInfo.setParamName("context"); + list.add(parameterInfo); + + return list; + } + + @Override + protected Block buildMethodBody() { + Block block=ast.newBlock(); + SuperConstructorInvocation superConstructorInvocation=ast.newSuperConstructorInvocation(); + superConstructorInvocation.arguments().add(ast.newSimpleName("context")); + block.statements().add(superConstructorInvocation); + return block; + } + +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/CreateAbstractUdtGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/CreateAbstractUdtGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..fbfc938a4e5a6b507d6bf2673faf67f24a1c93af --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/CreateAbstractUdtGenerator.java @@ -0,0 +1,94 @@ +/* + * Copyright © OpenAtom Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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.cef.variable.dtgenerator.core.rtgenerator.manager; + +import com.inspur.edp.caf.generator.baseInfo.ParameterInfo; +import com.inspur.edp.caf.generator.baseInfo.TypeInfo; +import com.inspur.edp.caf.generator.method.ClassMethodGenerator; +import com.inspur.edp.cef.variable.api.variable.IVariableContext; +import com.inspur.edp.cef.variable.core.variable.AbstractVariable; +import java.util.ArrayList; +import java.util.Arrays; +import org.eclipse.jdt.core.dom.Block; +import org.eclipse.jdt.core.dom.ClassInstanceCreation; +import org.eclipse.jdt.core.dom.Modifier; +import org.eclipse.jdt.core.dom.ReturnStatement; + +// +// * public override AbstractVariable CreateVariable(IVariableContext ctx) +// +// public override AbstractUdt CreateAbstractUdt(IUdtContext ctx) +// { +// return new XXXX(ctx); +// } +// +public class CreateAbstractUdtGenerator extends ClassMethodGenerator +{ + private VarMgrGenContext mgrGenCtx; + + public CreateAbstractUdtGenerator( + VarMgrGenContext mgrGenCtx) + { + this.mgrGenCtx = mgrGenCtx; + } + + @Override + protected boolean getIsOverride() { + return true; + } + + @Override + protected ArrayList getAccessModifiers() { + return new ArrayList<>(Arrays.asList(new Modifier.ModifierKeyword[]{Modifier.ModifierKeyword.PUBLIC_KEYWORD})); + } + + @Override + protected String getMethodName(){return "createVariable";} + + private static final String ctxParaName = "ctx"; + + @Override + protected ArrayList getParameterCollection() { + ArrayList list=new ArrayList(); + ParameterInfo parameterInfo=new ParameterInfo(); + parameterInfo.setParamType(new TypeInfo(IVariableContext.class)); + parameterInfo.setParamName(ctxParaName); + list.add(parameterInfo); + + return list; + } + + @Override + protected TypeInfo getReturnType() { + return new TypeInfo(AbstractVariable.class); + } + + @Override + protected Block buildMethodBody() { + Block block=ast.newBlock(); + ReturnStatement returnStatement=ast.newReturnStatement(); + ClassInstanceCreation classInstanceCreation=ast.newClassInstanceCreation(); + classInstanceCreation.setType(ast.newSimpleType(ast.newName( + mgrGenCtx.getProjContext().getEntityMediateTypes().get( + mgrGenCtx.getVarGenerateContext().getCefGenContext().getCommonVariableEntity() + .getCode()).getFullName()))); + classInstanceCreation.arguments().add(ast.newSimpleName(ctxParaName)); + returnStatement.setExpression(classInstanceCreation); + block.statements().add(returnStatement); + return block; + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/MgrImplGenCtx.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/MgrImplGenCtx.java new file mode 100644 index 0000000000000000000000000000000000000000..acc92561ad9ac3a5d7401ebff6f9db11faf819c3 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/MgrImplGenCtx.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.cef.variable.dtgenerator.core.rtgenerator.manager; + + +import com.inspur.edp.cef.generator.coreGenerator.base.mgrGenerator.MgrImplCtx; + +public class MgrImplGenCtx extends MgrImplCtx +{ + public MgrImplGenCtx(VarMgrGenContext mgrGenCtx) + { + super(mgrGenCtx); + privateMgrGenCtx = mgrGenCtx; + } + + private VarMgrGenContext privateMgrGenCtx; + public final VarMgrGenContext getMgrGenCtx() + { + return privateMgrGenCtx; + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/VarManagerGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/VarManagerGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..12c191057f547880132c49af4087d3dd4124c2bf --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/VarManagerGenerator.java @@ -0,0 +1,82 @@ +/* + * Copyright © OpenAtom Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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.cef.variable.dtgenerator.core.rtgenerator.manager; + + +import com.inspur.edp.caf.generator.BaseGenerator; +import com.inspur.edp.caf.generator.composite.CompositeGeneratorContext; +import com.inspur.edp.cef.generator.coreGenerator.base.accessorcreatorgen.AccessorCreatorGenerator; +import com.inspur.edp.cef.generator.coreGenerator.base.entitygen.EntityGenerator; +import com.inspur.edp.cef.generator.coreGenerator.base.mgrGenerator.DataManagerImplGenerator; +import com.inspur.edp.cef.generator.coreGenerator.base.mgrGenerator.ManagerGenerator; +import com.inspur.edp.cef.generator.coreGenerator.base.serializer.changeser.valueobject.ValueObjChangeSerGenerator; +import com.inspur.edp.cef.variable.dtgenerator.core.VariableCoreGenCtx; +import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.entity.VarEntityGenerator; +import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.manager.acccessorcreator.VarAccessorCreatorGenerator; +import java.util.ArrayList; + +public class VarManagerGenerator extends ManagerGenerator { + + private VariableCoreGenCtx varGenCtx; + + public VarManagerGenerator(VariableCoreGenCtx parentContext) { + super(parentContext); + this.varGenCtx = parentContext; + } + + protected VarMgrGenContext getVarMgrGenContext() { + return (VarMgrGenContext) super.getContext(); + } + + @Override + protected AccessorCreatorGenerator createAccessorCreatorImplGenerator() { + return new VarAccessorCreatorGenerator(getVarMgrGenContext()); + } + + @Override + protected final CompositeGeneratorContext createCompositeContext() { + return CreateVarMgrGenCtx(); + } + + @Override + protected VarMgrGenContext getContext(){return (VarMgrGenContext) super.getContext();} + + protected VarMgrGenContext CreateVarMgrGenCtx() { + return new VarMgrGenContext(varGenCtx); + } + + @Override + protected EntityGenerator createEntityGenerator() { + return new VarEntityGenerator( getContext()); + } + + @Override + protected final DataManagerImplGenerator createMgrImplGenerator() { + return createVarMgrImplGenerator(); + } + + protected VarManagerImplGenerator createVarMgrImplGenerator() { + return new VarManagerImplGenerator(getContext()); + } + + @Override + protected void addExtendCompositeItemGenerators( + ArrayList compositeItemGenerators) { + super.addExtendCompositeItemGenerators(compositeItemGenerators); + compositeItemGenerators.add(new ValueObjChangeSerGenerator(getVarMgrGenContext())); + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/VarManagerImplGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/VarManagerImplGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..89df7e3eff7f2f579ac75ac9234a1952a93df472 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/VarManagerImplGenerator.java @@ -0,0 +1,82 @@ +/* + * Copyright © OpenAtom Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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.cef.variable.dtgenerator.core.rtgenerator.manager; + + +import com.inspur.edp.caf.generator.item.ClassGeneratorContext; +import com.inspur.edp.caf.generator.method.ClassMethodGenerator; +import com.inspur.edp.cef.gencommon.MediateType; +import com.inspur.edp.cef.generator.coreGenerator.base.mgrGenerator.ValueObjManagerGenerator; +import com.inspur.edp.cef.generator.coreGenerator.base.mgrGenerator.method.ValueObjGetRepositoryMethodGenerator; +import com.inspur.edp.cef.variable.core.manager.AbstractVariableManager; +import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.manager.repository.VarRepositoryPropertyGenerator; +import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.manager.serialize.GetChangeDeserGenerator; +import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.manager.serialize.GetChangeSerializerGenerator; +import java.util.List; + +public class VarManagerImplGenerator extends ValueObjManagerGenerator +{ + private VarMgrGenContext mgrGenCtx; + public VarManagerImplGenerator(VarMgrGenContext mgrGenCtx) + { + super(mgrGenCtx); + this.mgrGenCtx = mgrGenCtx; + } + + @Override + protected void doInitialize() + { + super.doInitialize(); + mgrGenCtx.getVarGenerateContext().setVariableMgrType(new MediateType(mgrGenCtx.getVarGenerateContext().getNameSpace(), getName())); + } + + @Override + protected String getName() { + return mgrGenCtx.getVarGenerateContext().getCefGenContext().getCommonVariableEntity().getCode() + "Manager"; + } + + @Override + protected Class getImplParentClassType() { + return AbstractVariableManager.class; + } + + @Override + protected List getMgrActionGenerators() { + return null; + } + + @Override + protected ClassGeneratorContext createClassInfoContext() + { + return new MgrImplGenCtx(mgrGenCtx); + } + + @Override + protected void addExtendMethodGenerator(java.util.ArrayList generators) + { + super.addExtendMethodGenerator(generators); + generators.add(new CreateAbstractUdtGenerator(mgrGenCtx)); + generators.add(new GetChangeSerializerGenerator(mgrGenCtx)); + generators.add(new GetChangeDeserGenerator(mgrGenCtx)); + } + + @Override + protected ValueObjGetRepositoryMethodGenerator createValueObjRepoPropertyGenerator() + { + return new VarRepositoryPropertyGenerator(mgrGenCtx.getVarGenerateContext()); + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/VarMgrGenContext.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/VarMgrGenContext.java new file mode 100644 index 0000000000000000000000000000000000000000..b76d71f0b6ac755980db5565cc8218e94cca426d --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/VarMgrGenContext.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 com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.manager; + + +import com.inspur.edp.cef.generator.coreGenerator.base.mgrGenerator.ManagerGeneratorContext; +import com.inspur.edp.cef.variable.dtgenerator.core.VariableCoreGenCtx; + +public class VarMgrGenContext extends ManagerGeneratorContext +{ + public VarMgrGenContext(VariableCoreGenCtx varGenCtx) + { + super(varGenCtx); + } + + public VariableCoreGenCtx getVarGenerateContext(){return (VariableCoreGenCtx)super.getProjContext();} +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/acccessorcreator/VarAccessorCreatorGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/acccessorcreator/VarAccessorCreatorGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..ada47735561ff1826fbfc24a497aa5eaef65beb6 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/acccessorcreator/VarAccessorCreatorGenerator.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.cef.variable.dtgenerator.core.rtgenerator.manager.acccessorcreator; + + +import com.inspur.edp.caf.generator.item.ClassGeneratorContext; +import com.inspur.edp.cef.generator.coreGenerator.base.accessorcreatorgen.AccessorCreatorGenerator; +import com.inspur.edp.cef.generator.coreGenerator.base.accessorcreatorgen.method.CreateAccessorGenerator; +import com.inspur.edp.cef.generator.coreGenerator.base.accessorcreatorgen.method.CreateReadonlyAccessorGenerator; +import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.manager.VarMgrGenContext; +import java.util.ArrayList; +import java.util.Arrays; +import org.eclipse.jdt.core.dom.Modifier; + +public class VarAccessorCreatorGenerator extends AccessorCreatorGenerator +{ + private VarMgrGenContext parContext; + public VarAccessorCreatorGenerator(VarMgrGenContext parContext) + { + super(parContext); + this.parContext = parContext; + } + + @Override + protected ClassGeneratorContext createClassInfoContext() + { + return new ClassGeneratorContext(); + } + + @Override + protected ArrayList getAccessModifier() { + return new ArrayList<>(Arrays.asList(new Modifier.ModifierKeyword[]{Modifier.ModifierKeyword.PUBLIC_KEYWORD})); + } + + @Override + protected String getName() { + return this.ParentContext.getProjContext().getCefGenContext().getCommonDataType().getCode() + "AccessorCreator"; + } + + @Override + protected CreateAccessorGenerator getCreateAccessorGenerator() + { + return new VarCreateAccessorGenerator(parContext); + } + + @Override + protected CreateReadonlyAccessorGenerator getCreateReadonlyAccessorGenerator() + { + return new VarCreateReadonlyAccessorGenerator(parContext); + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/acccessorcreator/VarCreateAccessorGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/acccessorcreator/VarCreateAccessorGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..e696f1d91f0e85d03383fe7675cbbad9fedaf293 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/acccessorcreator/VarCreateAccessorGenerator.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.cef.variable.dtgenerator.core.rtgenerator.manager.acccessorcreator; + +import com.inspur.edp.cef.generator.coreGenerator.base.accessorcreatorgen.method.CreateAccessorGenerator; +import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.manager.VarMgrGenContext; +import org.eclipse.jdt.core.dom.Block; +import org.eclipse.jdt.core.dom.CastExpression; +import org.eclipse.jdt.core.dom.ClassInstanceCreation; +import org.eclipse.jdt.core.dom.ReturnStatement; + +public class VarCreateAccessorGenerator extends CreateAccessorGenerator +{ + private VarMgrGenContext mgrGenCtx; + + public VarCreateAccessorGenerator(VarMgrGenContext mgrGenCtx) + { + this.mgrGenCtx = mgrGenCtx; + } + + @Override + protected Block buildMethodBody() { + Block block= ast.newBlock(); + ReturnStatement returnStatement=ast.newReturnStatement(); + ClassInstanceCreation classInstanceCreation=ast.newClassInstanceCreation(); + String rootCode = mgrGenCtx.getVarGenerateContext().getCefGenContext().getCommonVariableEntity().getCode(); + classInstanceCreation.setType(ast.newSimpleType(ast.newName(mgrGenCtx.getProjContext().getAccessorMediateTypes().get(rootCode).getFullName()))); + + CastExpression castExpression=ast.newCastExpression(); + castExpression.setType(ast.newSimpleType(ast.newName(mgrGenCtx.getProjContext().getCefGenContext().getRootDataInterfaceType().getFullName()))); + castExpression.setExpression(ast.newSimpleName(ParName_Data)); + classInstanceCreation.arguments().add(castExpression); + + returnStatement.setExpression(classInstanceCreation); + block.statements().add(returnStatement); + return block; + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/acccessorcreator/VarCreateReadonlyAccessorGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/acccessorcreator/VarCreateReadonlyAccessorGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..9fc188fcffe48916cdc99821fb1e931931b63d35 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/acccessorcreator/VarCreateReadonlyAccessorGenerator.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.cef.variable.dtgenerator.core.rtgenerator.manager.acccessorcreator; + +import com.inspur.edp.cef.generator.coreGenerator.base.accessorcreatorgen.method.CreateReadonlyAccessorGenerator; +import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.manager.VarMgrGenContext; +import org.eclipse.jdt.core.dom.Block; +import org.eclipse.jdt.core.dom.CastExpression; +import org.eclipse.jdt.core.dom.ClassInstanceCreation; +import org.eclipse.jdt.core.dom.ReturnStatement; + +public class VarCreateReadonlyAccessorGenerator extends CreateReadonlyAccessorGenerator +{ + private VarMgrGenContext mgrGenCtx; + + public VarCreateReadonlyAccessorGenerator(VarMgrGenContext mgrGenCtx) + { + this.mgrGenCtx = mgrGenCtx; + } + + @Override + protected Block buildMethodBody() { + Block block=ast.newBlock(); + ReturnStatement returnStatement=ast.newReturnStatement(); + ClassInstanceCreation classInstanceCreation=ast.newClassInstanceCreation(); + String rootCode = mgrGenCtx.getVarGenerateContext().getCefGenContext().getCommonVariableEntity().getCode(); + classInstanceCreation.setType(ast.newSimpleType(ast.newName(mgrGenCtx.getProjContext().getReadonlyAccessorMediateTypes().get(rootCode).getFullName()))); + + CastExpression castExpression=ast.newCastExpression(); + castExpression.setType(ast.newSimpleType(ast.newName(mgrGenCtx.getProjContext().getCefGenContext().getRootDataInterfaceType().getFullName()))); + castExpression.setExpression(ast.newSimpleName(ParName_Data)); + classInstanceCreation.arguments().add(castExpression); + returnStatement.setExpression(classInstanceCreation); + + block.statements().add(returnStatement); + + return block; + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/repository/VarRepositoryPropertyGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/repository/VarRepositoryPropertyGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..1c779c70019f9dda451715e3067761d4d25fb74d --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/repository/VarRepositoryPropertyGenerator.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.cef.variable.dtgenerator.core.rtgenerator.manager.repository; + + +import com.inspur.edp.cef.generator.coreGenerator.base.mgrGenerator.method.ValueObjGetRepositoryMethodGenerator; +import com.inspur.edp.cef.variable.dtgenerator.core.VariableCoreGenCtx; +import org.eclipse.jdt.core.dom.Block; +import org.eclipse.jdt.core.dom.ClassInstanceCreation; +import org.eclipse.jdt.core.dom.ThrowStatement; + +public class VarRepositoryPropertyGenerator extends ValueObjGetRepositoryMethodGenerator +{ + private VariableCoreGenCtx cefGenCtx; + + public VarRepositoryPropertyGenerator(VariableCoreGenCtx cefGenCtx) + { + super(cefGenCtx); + this.cefGenCtx = cefGenCtx; + } + + @Override + protected Block buildMethodBody() { + Block block=ast.newBlock(); + ThrowStatement throwStatement=ast.newThrowStatement(); + ClassInstanceCreation classInstanceCreation=ast.newClassInstanceCreation(); + + block.statements().add(throwStatement); + return block; + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/serialize/GetChangeDeserGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/serialize/GetChangeDeserGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..405356dc31f7351409a504d94f904e6bd2116099 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/serialize/GetChangeDeserGenerator.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.cef.variable.dtgenerator.core.rtgenerator.manager.serialize; + +import com.inspur.edp.caf.generator.baseInfo.ParameterInfo; +import com.inspur.edp.caf.generator.baseInfo.TypeInfo; +import com.inspur.edp.caf.generator.method.ClassMethodGenerator; +import com.inspur.edp.cef.spi.jsonser.abstractcefchange.AbstractCefChangeJsonDeserializer; +import com.inspur.edp.cef.spi.jsonser.abstractcefchange.AbstractCefChangeSerializer; +import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.manager.VarMgrGenContext; +import java.util.ArrayList; +import org.eclipse.jdt.core.dom.Block; +import org.eclipse.jdt.core.dom.ClassInstanceCreation; +import org.eclipse.jdt.core.dom.Modifier; +import org.eclipse.jdt.core.dom.Modifier.ModifierKeyword; +import org.eclipse.jdt.core.dom.ReturnStatement; + +public class GetChangeDeserGenerator extends ClassMethodGenerator { + + private VarMgrGenContext mgrGenCtx; + + public GetChangeDeserGenerator(VarMgrGenContext mgrGenCtx) + { + this.mgrGenCtx = mgrGenCtx; + } + @Override + protected Block buildMethodBody() { + String entityImplName = mgrGenCtx.getChangeSerContext().getDeserializerClassName(); + Block block = ast.newBlock(); + ReturnStatement returnStatement = ast.newReturnStatement(); + ClassInstanceCreation classInstanceCreation = ast.newClassInstanceCreation(); + classInstanceCreation.setType(ast.newSimpleType(ast.newName(entityImplName))); + returnStatement.setExpression(classInstanceCreation); + block.statements().add(returnStatement); + return block; + } + @Override + protected String getMethodName() { + return "getChangeDeserializer"; + } + + @Override + protected TypeInfo getReturnType() { + return new TypeInfo(AbstractCefChangeJsonDeserializer.class); + } + + @Override + protected java.util.ArrayList getAccessModifiers() { + return new java.util.ArrayList(java.util.Arrays + .asList(new Modifier.ModifierKeyword[]{Modifier.ModifierKeyword.PROTECTED_KEYWORD})); + } + + @Override + protected boolean getIsOverride() { + return true; + } + + + @Override + protected ArrayList getParameterCollection() { + return null; + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/serialize/GetChangeSerializerGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/serialize/GetChangeSerializerGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..49f0462e406f2e5988b781dd35d0b19316dc0ce6 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/core/rtgenerator/manager/serialize/GetChangeSerializerGenerator.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.cef.variable.dtgenerator.core.rtgenerator.manager.serialize; + +import com.inspur.edp.caf.generator.baseInfo.ParameterInfo; +import com.inspur.edp.caf.generator.baseInfo.TypeInfo; +import com.inspur.edp.caf.generator.method.ClassMethodGenerator; +import com.inspur.edp.cef.spi.jsonser.abstractcefchange.AbstractCefChangeSerializer; +import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.manager.VarMgrGenContext; +import java.util.ArrayList; +import org.eclipse.jdt.core.dom.Block; +import org.eclipse.jdt.core.dom.ClassInstanceCreation; +import org.eclipse.jdt.core.dom.Modifier; +import org.eclipse.jdt.core.dom.ReturnStatement; + +public class GetChangeSerializerGenerator extends ClassMethodGenerator { + + private VarMgrGenContext mgrGenCtx; + + public GetChangeSerializerGenerator(VarMgrGenContext mgrGenCtx) { + this.mgrGenCtx = mgrGenCtx; + } + + @Override + protected Block buildMethodBody() { + String entityImplName = mgrGenCtx.getChangeSerContext().getClassName(); + Block block = ast.newBlock(); + ReturnStatement returnStatement = ast.newReturnStatement(); + ClassInstanceCreation classInstanceCreation = ast.newClassInstanceCreation(); + classInstanceCreation.setType(ast.newSimpleType(ast.newName(entityImplName))); + returnStatement.setExpression(classInstanceCreation); + block.statements().add(returnStatement); + return block; + } + + @Override + protected String getMethodName() { + return "getChangeSerializer"; + } + + @Override + protected TypeInfo getReturnType() { + return new TypeInfo(AbstractCefChangeSerializer.class); + } + + @Override + protected java.util.ArrayList getAccessModifiers() { + return new java.util.ArrayList(java.util.Arrays + .asList(new Modifier.ModifierKeyword[]{Modifier.ModifierKeyword.PROTECTED_KEYWORD})); + } + + @Override + protected boolean getIsOverride() { + return true; + } + + + @Override + protected ArrayList getParameterCollection() { + return null; + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/entity/VarEntityGenContext.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/entity/VarEntityGenContext.java new file mode 100644 index 0000000000000000000000000000000000000000..1adea7e17434716e469b0076f6a0c78c27fa9517 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/entity/VarEntityGenContext.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.cef.variable.dtgenerator.entity; + + +import com.inspur.edp.cef.generator.entityGenerator.valueObject.ValueObjEntityGeneratorContext; +import com.inspur.edp.cef.variable.dtgenerator.VariableGeneratorContext; + +public class VarEntityGenContext extends ValueObjEntityGeneratorContext +{ + public VarEntityGenContext(VariableGeneratorContext parentGenContext) + { + super(parentGenContext); + + } + public VariableGeneratorContext variableGeneratorContext(){return (VariableGeneratorContext)super.getCefGenContext();} + private String privateNamespace; + public final String getNamespace() + { + return privateNamespace; + } + public final void setNamespace(String value) + { + privateNamespace = value; + } + + @Override + public String getPackageName() { + return getNamespace(); + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/entity/VariableEntityGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/entity/VariableEntityGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..934315904de54e44f29d4474bed529295c17d2e6 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/entity/VariableEntityGenerator.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.cef.variable.dtgenerator.entity; + + +import com.inspur.edp.cef.generator.entityGenerator.base.DataTypeGenerator; +import com.inspur.edp.cef.generator.entityGenerator.valueObject.ValueObjEntityGenerator; +import com.inspur.edp.cef.generator.entityGenerator.valueObject.ValueObjEntityGeneratorContext; +import com.inspur.edp.cef.variable.dtgenerator.VariableGeneratorContext; + +public class VariableEntityGenerator extends ValueObjEntityGenerator +{ + public VariableEntityGenerator(VariableGeneratorContext cefGenContext) + { + super(cefGenContext); + } + + private VariableGeneratorContext getVariableGeneratorContext() {return (VariableGeneratorContext)super.getCefGenContext();} + + private VarEntityGenContext getVarEntityGenContext(){return (VarEntityGenContext)super.getContext();} + + @Override + protected ValueObjEntityGeneratorContext createValueObjGeneratorContext() + {return new VarEntityGenContext(getVariableGeneratorContext());} + + @Override + protected void doInitialize() + { + super.doInitialize(); + } + @Override + protected void beforeInitialize() + { + getVarEntityGenContext().setNamespace(getVariableGeneratorContext().getCommonVariableEntity().getGeneratedEntityAssemblyInfo().getDefaultNamespace()); + super.beforeInitialize(); + } + + @Override + protected String getPackageName() { + return getVarEntityGenContext().getNamespace(); + } + + @Override + protected DataTypeGenerator getDataTypeGenerator() + { + return new VariableNodeGenerator(getVarEntityGenContext()); + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/entity/VariableNodeGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/entity/VariableNodeGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..4bc66a5b03cca5856f901b13350c24a2047ef5ea --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/entity/VariableNodeGenerator.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.cef.variable.dtgenerator.entity; + +import com.inspur.edp.cef.generator.entityGenerator.base.dataTypeData.DataTypeDataGenerator; +import com.inspur.edp.cef.generator.entityGenerator.valueObject.ValueObjectGenerator; +import com.inspur.edp.cef.generator.entityGenerator.valueObject.ValueObjectGeneratorContext; +import com.inspur.edp.cef.variable.dtgenerator.entity.data.VariableDataGenerator; + +public class VariableNodeGenerator extends ValueObjectGenerator +{ + private VarEntityGenContext getVarEntityGenContext(){return (VarEntityGenContext)super.entityGenContext;} + + public VariableNodeGenerator(VarEntityGenContext context) + { + super(context.variableGeneratorContext().getCommonDataType(),context); + + } +//C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing via the 'new' keyword: +//ORIGINAL LINE: private new VariableNodeGeneratorContext Context => (VariableNodeGeneratorContext)super.Context; + private VariableNodeGeneratorContext getVariableNodeGeneratorContext(){return (VariableNodeGeneratorContext)super.getContext();} + @Override + protected DataTypeDataGenerator getDataGenerator() + { + return new VariableDataGenerator(this.getVariableNodeGeneratorContext()); + } + + @Override + protected ValueObjectGeneratorContext getValueObjGenContext() + { + return new VariableNodeGeneratorContext(getVarEntityGenContext()); + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/entity/VariableNodeGeneratorContext.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/entity/VariableNodeGeneratorContext.java new file mode 100644 index 0000000000000000000000000000000000000000..ee0764c7492a52e2a9680ef06fad12d346bf8176 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/entity/VariableNodeGeneratorContext.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.cef.variable.dtgenerator.entity; + +import com.inspur.edp.cef.generator.entityGenerator.valueObject.ValueObjectGeneratorContext; + +public class VariableNodeGeneratorContext extends ValueObjectGeneratorContext +{ + public VariableNodeGeneratorContext(VarEntityGenContext varEntityGenContext) + { + super(varEntityGenContext.variableGeneratorContext().getCommonDataType(),varEntityGenContext); + + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/entity/data/VariableDataGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/entity/data/VariableDataGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..b49aec4a6a8a1aadb06499334ef8918d7260fc8c --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/entity/data/VariableDataGenerator.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.cef.variable.dtgenerator.entity.data; + + +import com.inspur.edp.caf.generator.baseInfo.TypeInfo; +import com.inspur.edp.cef.gencommon.MediateType; +import com.inspur.edp.cef.generator.entityGenerator.base.dataTypeData.DataTypeDataGenerator; +import com.inspur.edp.cef.variable.api.data.IVariableData; +import com.inspur.edp.cef.variable.dtgenerator.entity.VariableNodeGeneratorContext; + +import java.util.ArrayList; + +public class VariableDataGenerator extends DataTypeDataGenerator +{ + private VariableNodeGeneratorContext nodeGenContext; + + public VariableDataGenerator(VariableNodeGeneratorContext nodeGenContext) + { + super(nodeGenContext, nodeGenContext.getDataType()); + this.nodeGenContext = nodeGenContext; + nodeGenContext.getEntityGenContext().setRootNodeType ( new MediateType(nodeGenContext.getEntityGenContext().getDefaultPackageName(), getName())); + nodeGenContext.getEntityGenContext().setRootNodeCode(nodeGenContext.getDataType().getCode()); + + } + + //protected override string GetName() + //{ + // return $"I{(nodeGenContext.EntityGenContext as VarEntityGenContext).variableGeneratorContext.VariableEntity.Code}entity"; + //} + + @Override + protected java.util.ArrayList addParentInterfaces() + { +//C# TO JAVA CONVERTER TODO TASK: There is no equivalent to implicit typing in Java: + ArrayList list = super.addParentInterfaces(); + if (list == null) + { + list = new java.util.ArrayList(); + } + list.add(new TypeInfo(IVariableData.class)); + return list; + } + +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/CompCodeNames.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/CompCodeNames.java new file mode 100644 index 0000000000000000000000000000000000000000..c52d3569d217d49ce80fc34ba821c53b9d75d3a9 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/CompCodeNames.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.cef.variable.dtgenerator.vardtmGenerate; + +public class CompCodeNames +{ + public static String KeywordUsing = "using"; + public static String KeywordNameSpace = "namespace"; + public static String KeywordPublic = "public"; + public static String KeywordProtected = "protected"; + public static String KeywordInternal = "internal"; + public static String KeywordPrivate = "private"; + public static String KeywordClass = "class"; + public static String KeywordOverride = "override"; + public static String KeywordVoid = "void"; + + + ///#region 变量 + //VariableDtm + public static String UDTDeterminationNameSpaceSuffix = "Determination"; + + public static String AbstractDeterminationClassName = "AbstractDetermination"; + public static String VariableDeterminationNameSpaceSuffix = "Determination"; + + public static String DeterminationSpiNameSpace = "Inspur.Gsp.Variable.Spi"; + public static String DeterminationApiNameSpace = "Inspur.Gsp.Variable.api"; + public static String DeterminationChangeset = "Inspur.Gsp.Cef.entity.Changeset"; + public static String UDTDtmCmpExtendName = ".udtDtmCmp"; + public static final String UDTDtmComponent = "UDTDtmComponent"; + public static String UDTDtmControllerName = "DtmController"; + + ///#endregion +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/JavaCompCodeNames.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/JavaCompCodeNames.java new file mode 100644 index 0000000000000000000000000000000000000000..1eb77778107a770b5eec7002ad2c68c19026a7f7 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/JavaCompCodeNames.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.cef.variable.dtgenerator.vardtmGenerate; + +public class JavaCompCodeNames { + + public static String KeywordUsing = "using"; + public static String KeywordNameSpace = "namespace"; + public static String KeywordPublic = "public"; + public static String KeywordProtected = "protected"; + public static String KeywordInternal = "internal"; + public static String KeywordPrivate = "private"; + public static String KeywordClass = "class"; + public static String KeywordOverride = "Override"; + public static String KeywordVoid = "void"; + public static String KeywordPackage = "package"; + public static String KeywordImport = "import"; + public static String KeywordExtend = "extends"; + public static String KeywordReturn = "return"; + + ///#region import + public static String KeywordIDeterminationContext = "com.inspur.edp.bef.api.action.determination.IDeterminationContext"; + public static String KeywordAbstractDetermination = "com.inspur.edp.cef.variable.spi.determination.AbstractVariableDetermination"; + public static String KeywordIChangeDetail = "com.inspur.edp.cef.entity.changeset.IChangeDetail"; + public static String KeywordIVarDeterminationContext = "com.inspur.edp.cef.variable.api.determination.IVarDeterminationContext"; + public static String KeywordISvcDeterminationVariable = "com.inspur.gs.gsp.caf.svc.svcdetermination.entity.Variable.ISvcDeterminationVariable"; + public static String IEntityDataNameSpace = "com.inspur.edp.cef.entity.entity.IEntityData"; + public static String ICefDataNameSpace = "com.inspur.edp.cef.entity.entity.ICefData"; + + ///#endregion + + + ///#region 变量 + //VariableDtm + public static String UDTDeterminationNameSpaceSuffix = "Determination"; + + public static String AbstractDeterminationClassName = "AbstractVariableDetermination"; + //public static string AbstractDeterminationClassName = "AbstractVarableDetermination"; + public static String VariableDeterminationNameSpaceSuffix = "vardeterminations"; + + + public static String DeterminationSpiNameSpace = "Inspur.Gsp.Variable.Spi"; + public static String DeterminationApiNameSpace = "Inspur.Gsp.Variable.Api"; + public static String DeterminationChangeset = "Inspur.Gsp.Cef.Entity.Changeset"; + public static String UDTDtmCmpExtendName = ".udtDtmCmp"; + public static final String UDTDtmComponent = "UDTDtmComponent"; + public static String UDTDtmControllerName = "DtmController"; + public static String DeterminationName = "Vardeterminations"; + public static String IEntityData = "IEntityData"; + public static String ICefData = "ICefData"; +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/cmpgenerators/CommonDtmGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/cmpgenerators/CommonDtmGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..32d079e78be6cd0822795211d660d570317f7d0b --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/cmpgenerators/CommonDtmGenerator.java @@ -0,0 +1,100 @@ +/* + * Copyright © OpenAtom Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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.cef.variable.dtgenerator.vardtmGenerate.cmpgenerators; + + +import com.inspur.edp.bef.component.base.GspComponent; +import com.inspur.edp.bef.component.base.ReturnValue; +import com.inspur.edp.bef.component.detailcmpentity.udtdetermination.UDTDtmComponent; +import com.inspur.edp.cef.designtime.api.operation.CommonDetermination; +import com.inspur.edp.cef.designtime.api.operation.CommonOperation; +import com.inspur.edp.cef.generator.DotNetToJavaStringHelper; +import com.inspur.edp.cef.variable.dtgenerator.vardtmGenerate.JavaCompCodeNames; + +public class CommonDtmGenerator extends CommonOperationComponentGenerator +{ + public static CommonDtmGenerator getInstance(){return new CommonDtmGenerator();} + private CommonDtmGenerator() + { + } + + @Override + protected GspComponent BuildComponent() + { + return new UDTDtmComponent(); + } + + @Override + protected void EvaluateComponentInfo(GspComponent component, CommonOperation operation, GspComponent originalComponent) + { + this.originalComponent = originalComponent; + // 基本信息(没有参数信息) + EvaluateComponentBasicInfo((UDTDtmComponent)component, (CommonDetermination)operation); + + // 返回值信息 + ((UDTDtmComponent)((component instanceof UDTDtmComponent) ? component : null)).getUdtDtmMethod().setReturnValue(new ReturnValue()); + } + private void EvaluateComponentBasicInfo(UDTDtmComponent component, CommonDetermination determination) + { + if (!DotNetToJavaStringHelper.isNullOrEmpty(determination.getComponentId())) + { + component.setComponentID( determination.getComponentId()); + } + component.setComponentCode( determination.getCode()); + component.setComponentName(determination.getName()); + component.setComponentDescription( determination.getDescription()); + component.getUdtDtmMethod().setAssembly (this.assemblyName); + + String suffix=String.format("%1$s%2$s%3$s",this.model.getCode(),".", JavaCompCodeNames.DeterminationName); + String packageName=JavaModuleImportPackage(this.nameSpace); + packageName=String.format("%1$s%2$s",packageName,suffix.toLowerCase()); + if (this.originalComponent!= null) + { + component.getUdtDtmMethod().setDotnetClassName(originalComponent.getMethod().getClassName()); + component.getMethod().setClassName(JavaModuleClassName(originalComponent.getMethod().getDotnetClassName(),packageName)); + } + else + { + String classNameSuffix = varEntityCode+determination.getCode(); + component.getUdtDtmMethod().setDotnetClassName(ComponentClassNameGenerator.GenerateUDTDtmComponentClassName(this.nameSpace, classNameSuffix)); + component.getMethod().setClassName(JavaModuleClassName(component.getUdtDtmMethod().getDotnetClassName(),packageName)); + } + } + protected String JavaModuleClassName(String classNamestr, String packageNameStr) + { + String connections = ""; + if (!(classNamestr==null || "".equals(classNamestr))) + { + connections = classNamestr.substring(classNamestr.lastIndexOf(".")); + connections = String.format("%1$s%2$s",packageNameStr, connections); + } + + return (connections); + } + protected String JavaModuleImportPackage(String packageName) + { + String[] strArray = packageName.split("[.]",-1); + String str = "com."; + int i; + + for (i = 0; i < strArray.length; i++) + { + str += strArray[i].toLowerCase() + "."; + } + return str; + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/cmpgenerators/CommonOperationComponentGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/cmpgenerators/CommonOperationComponentGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..488447a82e5f886c79619b1e7ce6bbfc09be7e46 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/cmpgenerators/CommonOperationComponentGenerator.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 com.inspur.edp.cef.variable.dtgenerator.vardtmGenerate.cmpgenerators; + +import com.inspur.edp.bef.component.base.GspComponent; +import com.inspur.edp.cef.designtime.api.operation.CommonOperation; +import com.inspur.edp.cef.generator.DotNetToJavaStringHelper; +import com.inspur.edp.cef.variable.dtgenerator.vardtmGenerate.CompCodeNames; +import com.inspur.edp.cef.variable.dtgenerator.vardtmGenerate.JavaCompCodeNames; +import com.inspur.edp.das.commonmodel.entity.GspCommonModel; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.service.MetadataService; +import com.inspur.edp.lcm.metadata.api.service.RefCommonService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import io.iec.edp.caf.runtime.config.BeanUtil; +import org.springframework.util.StringUtils; + +/** + CommonOperation构件生成器基类 + +*/ +public abstract class CommonOperationComponentGenerator +{ + /** + UDTDef编号 + + */ + protected String varEntityCode; + /** + UDTDef程序集名称 + + */ + protected String assemblyName; + protected String nameSpace; + /** + 原始构件 + + */ + protected GspComponent originalComponent; + protected String bizObjectID; + protected GspCommonModel model; + /** + 生成构件元数据 + + @param operation UDT操作 + @param path 生成指定路径 + @param varEntityCode UDT编号 + @param assemblyName UDT程序集名称 + */ + @Deprecated + public String GenerateComponent(GspCommonModel model,CommonOperation operation, String path, String varEntityCode, String assemblyName, String defaultNamespace, String bizObjectID) + { + this.varEntityCode = varEntityCode; + this.assemblyName = assemblyName; + this.nameSpace = defaultNamespace; + this.bizObjectID = bizObjectID; + this.model=model; + if (DotNetToJavaStringHelper.isNullOrEmpty(operation.getComponentId())) { + GspMetadata component = createComponent(operation, path); + //4、建立Action与元数据之间的关联关系 + operation.setComponentId(((GspComponent)component.getContent()).getComponentID()); + //操作的ComponentName用来记录生成的构件元数据的名称 + operation.setComponentName(component.getHeader().getCode()); + return operation.getCode(); + } + else + { + ModifyComponent(operation, path); + } + return null; + } + /** + 新建构件 + + @param operation + @param path + */ + private GspMetadata createComponent(CommonOperation operation, String path) { + //1、构建实体 + GspComponent component = BuildComponent(); + //2、赋值 + EvaluateComponentInfo(component, operation, null); + //3、生成构件 + return EstablishComponent(component, path); + } + + public GspMetadata createComponent(GspCommonModel model, CommonOperation operation, String path, + String varEntityCode, String assemblyName, String defaultNamespace, String bizObjectID) { + if(!StringUtils.isEmpty(operation.getComponentId())) { + throw new RuntimeException(operation.getCode()+"构件上已存在构件"); + } + this.varEntityCode = varEntityCode; + this.assemblyName = assemblyName; + this.nameSpace = defaultNamespace; + this.bizObjectID = bizObjectID; + this.model=model; + return createComponent(operation, path); + } + /** + 构造构件实体类 + + @return + 构件实体类 + + + */ + protected abstract GspComponent BuildComponent(); + /** + 为构件赋值 + + @param component 构件实体信息 + @param operation 动作信息 + */ + protected abstract void EvaluateComponentInfo(GspComponent component, CommonOperation operation, GspComponent originalComponent); + /** + 生成构件实体对应的构件元数据 + + @param component 构件实体 + @param path 生成构件元数据指定路径 + @return + 生成的构件元数据名称 + + + */ + private GspMetadata EstablishComponent(GspComponent component, String path) + { + return DtmMetadataExchangeUtil.getInstance().establishGspMetadata(component, path, this.varEntityCode, this.bizObjectID); + } + + private RefCommonService refCommonService; + private RefCommonService getRefCommonService(){ + if(refCommonService == null){ + refCommonService=SpringBeanUtils.getBean(RefCommonService.class); +// refCommonService = BeanUtil.getAppCtx().getBean(RefCommonService.class); + } + return refCommonService; + } + /** + 修改构件 + + @param operation + @param path + */ + private void ModifyComponent(CommonOperation operation, String path) + { + //1、构建实体 + GspComponent component = BuildComponent(); + String fullPath = ""; + + MetadataService metadataService = SpringBeanUtils.getBean(MetadataService.class); + // 带针对不同类型构件的扩展名的文件全名 + String metadataFileNameWithExtendName = operation.getComponentName()+ JavaCompCodeNames.UDTDtmCmpExtendName; + if (!metadataService.isMetadataExist(path, metadataFileNameWithExtendName)) + { + throw new RuntimeException("构件元数据" + metadataFileNameWithExtendName + "不存在!"); + } + fullPath = path + "\\" + metadataFileNameWithExtendName; + GspComponent originalComponent = GetOriginalComponent(path, metadataFileNameWithExtendName); + //2、赋值 + EvaluateComponentInfo(component, operation, originalComponent); + //4、修改更新构件元数据 + DtmMetadataExchangeUtil.getInstance().UpdateGSPMetadata(component, fullPath, this.varEntityCode, this.bizObjectID); + } + /** + 获取修改元数据之前的元数据信息 + + @param path + @param metadataFileNameWithSuffix + @return + */ + private GspComponent GetOriginalComponent(String path, String metadataFileNameWithSuffix) + { + MetadataService metadataService = SpringBeanUtils.getBean(MetadataService.class); + GspMetadata metadata = metadataService.loadMetadata(metadataFileNameWithSuffix, path); + GspComponent originalComponent = (GspComponent)((metadata.getContent() instanceof GspComponent) ? metadata.getContent() : null); + return originalComponent; + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/cmpgenerators/ComponentClassNameGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/cmpgenerators/ComponentClassNameGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..16f591480e0ba9536903f54f10a5aa8afdfc7d72 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/cmpgenerators/ComponentClassNameGenerator.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.cef.variable.dtgenerator.vardtmGenerate.cmpgenerators; + +import com.inspur.edp.cef.variable.dtgenerator.vardtmGenerate.CompCodeNames; +import com.inspur.edp.cef.variable.dtgenerator.vardtmGenerate.JavaCompCodeNames; + +public class ComponentClassNameGenerator +{ + private static final String classNameFormat = "%1$s.%2$s.%3$s%4$s"; + + public static String GenerateUDTDtmComponentClassName(String assembly, String compCode) + { + return String.format(classNameFormat, assembly, JavaCompCodeNames.UDTDeterminationNameSpaceSuffix, compCode, "VODtm"); + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/cmpgenerators/DtmMetadataExchangeUtil.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/cmpgenerators/DtmMetadataExchangeUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..804f2cb904c4c4fe117d8547c3dec88d6030c02c --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/cmpgenerators/DtmMetadataExchangeUtil.java @@ -0,0 +1,351 @@ +/* + * Copyright © OpenAtom Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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.cef.variable.dtgenerator.vardtmGenerate.cmpgenerators; + +import com.inspur.edp.bef.component.base.GspComponent; +import com.inspur.edp.cef.variable.dtgenerator.vardtmGenerate.CompCodeNames; +import com.inspur.edp.cef.variable.dtgenerator.vardtmGenerate.JavaCompCodeNames; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +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.service.FileService; +import com.inspur.edp.lcm.metadata.api.service.MetadataService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import org.springframework.boot.SpringBootExceptionReporter; + +/** + 与元数据交互的工具 + +*/ +public class DtmMetadataExchangeUtil +{ + public static DtmMetadataExchangeUtil getInstance(){return new DtmMetadataExchangeUtil();} + private DtmMetadataExchangeUtil() + { + } + /** + 业务实体编号 + + */ + private String privateBizEntityCode; + private String getBizEntityCode() + { + return privateBizEntityCode; + } + private void setBizEntityCode(String value) + { + privateBizEntityCode = value; + } + /** + 元数据存放路径 + + */ + private String privateMetadataPath; + private String getMetadataPath() + { + return privateMetadataPath; + } + private void setMetadataPath(String value) + { + privateMetadataPath = value; + } + /** + 元数据名称 + + */ + private String privateComponentName; + private String getComponentName() + { + return privateComponentName; + } + private void setComponentName(String value) + { + privateComponentName = value; + } + /** + 是否是新建元数据 + + */ + private boolean privateIsNewMetadata; + private boolean getIsNewMetadata() + { + return privateIsNewMetadata; + } + private void setIsNewMetadata(boolean value) + { + privateIsNewMetadata = value; + } + private String privateBizObjectID; + private String getBizObjectID() + { + return privateBizObjectID; + } + private void setBizObjectID(String value) + { + privateBizObjectID = value; + } + /** + 创建构件元数据,返回构件元数据ID + + @param component 构件实体 + @param path 生成构件元数据的路径 + @param bizEntityCode 业务实体编号 + @return + 生成的构件元数据名称 + + + */ + @Deprecated + public final String EstablishGSPMetdadata(GspComponent component, String path, String bizEntityCode, String bizObjectID) { + return establishGspMetadata(component, path, bizEntityCode, bizObjectID).getHeader().getCode(); + } + + public final GspMetadata establishGspMetadata(GspComponent component, String path, String bizEntityCode, + String bizObjectID) { + this.setIsNewMetadata(true); + this.setBizEntityCode(bizEntityCode); + this.setMetadataPath(path); + this.setBizObjectID(bizObjectID); + //1、构建元数据实体 + GspMetadata metadata = BuildGSPMetadataEntity(component); + //2、生成构件元数据 + GenerateGSPMetadata(metadata); + return metadata; + } + + /** + 更新构件元数据 + + @param component 构件实体 + @param fullPath 要修改的构件元数据完整路径 + */ + public final void UpdateGSPMetadata(GspComponent component, String fullPath, String bizEntityCode, String bizObjectID) + { + FileService service=SpringBeanUtils.getBean(FileService.class); + this.setIsNewMetadata(false); + this.setBizEntityCode(bizEntityCode); + this.setBizObjectID(bizObjectID); + this.setMetadataPath(service.getDirectoryName(fullPath)); + this.setComponentName(service.getFileNameWithoutExtension(fullPath)); + //1、构建元数据实体 + GspMetadata metadata = BuildGSPMetadataEntity(component); + UpdateComponentMetadata(metadata, fullPath); + } + + + ///#region 构建构件元数据实体 + /** + 创建GSPMetadata实体 + + @param component 构件实体 + @return GSPMetadata实体 + */ + private GspMetadata BuildGSPMetadataEntity(GspComponent component) + { + GspMetadata metadata = CreateMetadataEntity(); + + EvaluateMetadataHeader(component, metadata); + EvaluateMetadataContent(component, metadata); + return metadata; + } + + /** + 创建元数据实例 + + @return + 实例化的元数据 + + + */ + private GspMetadata CreateMetadataEntity() + { + GspMetadata tempVar = new GspMetadata(); + tempVar.setHeader(new MetadataHeader()); + tempVar.setRefs(new java.util.ArrayList()); + GspMetadata metadata = tempVar; + return metadata; + } + /** + 为元数据的Header属性赋值 + + @param component 构件实体 + @param metadata 元数据实体 + */ + private void EvaluateMetadataHeader(GspComponent component, GspMetadata metadata) + { + if (checkNull(metadata.getHeader().getNameSpace())) + { + metadata.getHeader().setNameSpace("Inspur.Gsp.ViewModel"); + } + +//C# TO JAVA CONVERTER TODO TASK: The following line could not be converted: + metadata.getHeader().setCode(GenerateComponentMetadataName(component,this.getMetadataPath())); + metadata.getHeader().setName(GenerateComponentMetadataName(component, this.getMetadataPath())); + metadata.getHeader().setFileName(this.getComponentName() + GetCmpMetadataExtendNameByCompType(component.getComponentType())); + metadata.getHeader().setType(GetCmpMetadataTypeByCompType(component.getComponentType())); + + if (!checkNull(getBizObjectID())) + { + metadata.getHeader().setBizobjectID(getBizObjectID()); + } + + if (checkNull(metadata.getHeader().getId()) && checkNull(component.getComponentID())) //新建构件元数据时,需要初始化后获取ID + { + MetadataService metadataService = SpringBeanUtils.getBean(MetadataService.class); + //初始化元数据,为了获取元数据ID + metadata = metadataService.initializeMetadataEntity(metadata); + component.setComponentID(metadata.getHeader().getId()); + } + else if (checkNull(metadata.getHeader().getId()) && !checkNull(component.getComponentID())) //修改构件元数据时,需要为元数据的ID赋值 + { + metadata.getHeader().setId(component.getComponentID()); + } + } + /** + 为元数据的Content属性赋值 + + @param component 构件实体 + @param metadata 元数据实体 + */ + private void EvaluateMetadataContent(GspComponent component, GspMetadata metadata) + { + metadata.setContent(component); + } + + ///#region 根据元数据类型获取相应信息 + /** + 获取构件元数据拼接后缀名 + + @param componentType 构件类型 + @return + */ + private String GetCmpMetadataExtendSuffixByCompType(String componentType) + { + //switch (componentType) + //{ + // case ComponentConstantElement.UDTDtmComponent: + return JavaCompCodeNames.UDTDtmControllerName; + // default: + // throw new System.Exception("未知构件类型"); + //} + } + /** + 获取构件元数据扩展名 + + @param componentType 构件类型 + @return + */ + private String GetCmpMetadataExtendNameByCompType(String componentType) + { + //switch (componentType) + //{ + // case ComponentConstantElement.UDTDtmComponent: + return JavaCompCodeNames.UDTDtmCmpExtendName; + // default: + // throw new System.Exception("未知构件类型"); + //} + } + /** + 获取构件元数据类型 + + @param componentType 构件类型 + @return + */ + private String GetCmpMetadataTypeByCompType(String componentType) + { + //switch (componentType) + //{ + // case ComponentConstantElement.UDTDtmComponent: + return JavaCompCodeNames.UDTDtmComponent; + // default: + // throw new System.Exception("未知构件类型"); + //} + } + + ///#endregion + + ///#endregion + + /** + 生成构件元数据 + + @param metadata 元数据 + @param + @return + 生成的构件元数据 + + + */ + private String GenerateGSPMetadata(GspMetadata metadata) + { + + MetadataService metadataService = SpringBeanUtils.getBean(MetadataService.class); + + metadata.setRelativePath(this.getMetadataPath()); + //创建元数据 + metadataService.createMetadata(this.getMetadataPath(), metadata); + return metadata.getHeader().getCode(); + } + + private void UpdateComponentMetadata(GspMetadata metadata, String fullPath) + { + MetadataService metadataService = SpringBeanUtils.getBean(MetadataService.class); + metadataService.saveMetadata(metadata, fullPath); + } + /** + 生成当前路径下唯一的元数据名称 + + @param component 构件实体 + @param path 生成的元数据存放路径 + @return 唯一的要生成的元数据名称 + */ + private String GenerateComponentMetadataName(GspComponent component, String path) + { + //构件元数据命名规则 + String metadataFileName = this.getBizEntityCode() + component.getComponentCode() + GetCmpMetadataExtendSuffixByCompType(component.getComponentType()); + // 若为新增元数据操作,则需要检查路径下是否有重名元数据;若为修改元数据操作,则无需操作 + if (this.getIsNewMetadata()) + { + String orgMetadataFileName = metadataFileName; + String metadataFileNameWithSuffix = metadataFileName + GetCmpMetadataExtendNameByCompType(component.getComponentType()); + int index = 0; + MetadataService metadataService = SpringBeanUtils.getBean(MetadataService.class); + while (metadataService.isMetadataExist(path, metadataFileNameWithSuffix)) + { + //(同一个Be元数据中,若有重名,则自动增加后缀) + metadataFileName = orgMetadataFileName + ++index; + metadataFileNameWithSuffix = metadataFileName + GetCmpMetadataExtendNameByCompType(component.getComponentType()); + } + this.setComponentName(metadataFileName); + } + + return metadataFileName; + } + private boolean checkNull(Object propValue) { + if (propValue == null) { + return true; + } + if (propValue.getClass().isAssignableFrom(String.class)) { + String stringValue = (String) propValue; + if (stringValue == null || stringValue.isEmpty()) { + return true; + } + } + + return false; + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/generatecmpcode/BaseCommonCompCodeGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/generatecmpcode/BaseCommonCompCodeGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..a7fbd9a246352c1f3b335ed1a38594b4c7dfbd32 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/generatecmpcode/BaseCommonCompCodeGenerator.java @@ -0,0 +1,238 @@ +//package com.inspur.edp.cef.variable.dtgenerator.vardtmGenerate.generatecmpcode; +// +// +//import com.inspur.edp.cef.designtime.api.operation.CommonOperation; +// +//public abstract class BaseCommonCompCodeGenerator implements IBaseCompCodeGen +//{ +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#region 字段 +// private String entityNamespace; +// private String apiNamespace; +// private IRefCommonService lcmDtService; +// private IRefCommonService LcmDtService => (lcmDtService != null) ? lcmDtService : (lcmDtService = ServiceManager.GetService()); +// +// protected CommonOperation Operation; +// protected String NameSpace; +// protected String EntityClassName; +// +// protected abstract String getBaseClassName(); +// private String privatePath; +// public final String getPath() +// { +// return privatePath; +// } +// public final void setPath(String value) +// { +// privatePath = value; +// } +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#endregion +// +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#region 构造函数 +// protected BaseCommonCompCodeGenerator(CommonVariableEntity udtDef, CommonOperation operation, String nameSpace, String path) +// { +// setPath(path); +// Operation = operation; +// NameSpace = GetNameSpace(nameSpace); +// EntityClassName = udtDef.GetGeneratedEntityClassInfo().ClassName; +// entityNamespace = udtDef.GetGeneratedEntityClassInfo().ClassNamespace; +// apiNamespace = udtDef.GetGeneratedApiAssemblyInfo().DefaultNamespace; +// } +// +// private String GetNameSpace(String baseNameSpace) +// { +// String nameSpace = "%1$s.{1}"; +// return String.format(nameSpace, baseNameSpace, GetNameSpaceSuffix()); +// } +// +// protected abstract String GetNameSpaceSuffix(); +// /** +// 获取当前构件名称 +// +// @return +// */ +// public final String GetCompName() +// { +// if (DotNetToJavaStringHelper.isNullOrEmpty(Operation.ComponentId)) +// { +// return GetInitializeCompName(); +// } +// GspMetadata metadata = LcmDtService.GetRefMetadata(Operation.ComponentId); +// if (metadata == null) +// { +// throw new RuntimeException("没有生成构件,无法继续生成代码"); +// } +// +// IMetadataContent content = metadata.Content; +// String fullClassName = ""; +// if (content instanceof GspComponent) +// { +// GspComponent component = (GspComponent)((metadata.Content instanceof GspComponent) ? metadata.Content : null); +// fullClassName = component.GetMethod().ClassName; +// } +// else +// { +// throw new RuntimeException("当前元数据不属于构件元数据"); +// } +// +// String[] sections = fullClassName.split("[.]", -1); +// return sections[sections.length - 1]; +// } +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#endregion +// +// /** +// 是否执行GenerateCommon() +// +// */ +// boolean getIsCommonGenerate() +// +// public final String GenerateExecute() +// { +// StringBuilder result = new StringBuilder(); +// +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#region using +// GenerateUsing(result); +// result.append("\n"); +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#endregion +// +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#region NameSpaceStart命名空间开始 +// +// result.append(CompCodeNames.KeywordNameSpace).Append(" ").AppendLine(NameSpace); +// result.AppendLine("{"); +// +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#endregion +// +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#region ClassStart +// +// result.append(GetIndentationStr()).Append(CompCodeNames.KeywordPublic).Append(" ").Append(CompCodeNames.KeywordClass).Append(" ").Append(GetCompName()).Append(" : ").AppendLine(getBaseClassName()); +// result.append(GetIndentationStr()).AppendLine("{"); +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#endregion +// +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#region Field +// +// GenerateField(result); +// result.append("\n"); +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#endregion +// +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#region Constructor +// +// GenerateConstructor(result); +// result.append("\n"); +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#endregion +// +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#region ExecuteMethod +// +// result.append(GetDoubleIndentationStr()).Append(CompCodeNames.KeywordProtected).Append(" ").Append(CompCodeNames.KeywordOverride).Append(" ").Append(CompCodeNames.KeywordVoid).Append(" ").AppendLine("Execute()"); +// result.append(GetDoubleIndentationStr()).AppendLine("{"); +// result.append(GetDoubleIndentationStr()).AppendLine("}"); +// +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#endregion +// +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#region ExtendMethod +// +// GenerateExtendMethod(result); +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#endregion +// +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#region ClassEnd +// result.append(GetIndentationStr()).AppendLine("}"); +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#endregion +// +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#region NameSpaceEnd 命名空间结束 +// result.AppendLine("}"); +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#endregion +// +// return result.toString(); +// } +// +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#region 生成方法 +// /** +// 生成Using代码 +// +// @param result +// */ +// private void GenerateUsing(StringBuilder result) +// { +// result.append(GetUsingStr(entityNamespace)); +// result.append(GetUsingStr(apiNamespace)); +// GenerateExtendUsing(result); +// } +// protected abstract void GenerateExtendUsing(StringBuilder result); +// protected abstract void GenerateConstructor(StringBuilder result); +// protected void GenerateExtendMethod(StringBuilder result) +// { +// +// } +// protected void GenerateField(StringBuilder result) +// { +// +// } +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#endregion +// +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#region 通用方法 +// +// protected final String GetUsingStr(String value) +// { +// return new StringBuilder(CompCodeNames.KeywordUsing).Append(" ").Append(value).AppendLine(";").toString(); +// } +// +// protected final String GetNewline() +// { +// return "\r\n"; +// } +// /** +// 缩进 +// +// @return +// */ +// protected final String GetIndentationStr() +// { +// return "\t"; +// } +// /** +// 双缩进 +// +// @return +// */ +// protected final String GetDoubleIndentationStr() +// { +// return "\t\t"; +// } +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#endregion +// +// protected abstract String GetInitializeCompName(); +// +// /** +// 2019.3新加,不需要兼容 +// +// @return +// */ +// public final String GenerateCommon() +// { +// return ""; +// } +//} \ No newline at end of file diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/generatecmpcode/CommonDeterminationGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/generatecmpcode/CommonDeterminationGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..cbfb9b9c56ae66aab740500b35b2f6d8ff5e9be1 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/generatecmpcode/CommonDeterminationGenerator.java @@ -0,0 +1,59 @@ +//package com.inspur.edp.cef.variable.dtgenerator.vardtmGenerate.generatecmpcode; +// +//public class CommonDeterminationGenerator extends BaseCommonCompCodeGenerator +//{ +// @Override +// protected String BaseClassName => CompCodeNames.AbstractDeterminationClassName; +// +// public CommonDeterminationGenerator(CommonVariableEntity cdtDef, CommonOperation operation, String nameSpace, String path) +// { +// super(cdtDef, operation, nameSpace, path); +// } +// +// @Override +// protected String GetNameSpaceSuffix() +// { +// return CompCodeNames.VariableDeterminationNameSpaceSuffix; +// } +// +// @Override +// protected void GenerateExtendUsing(StringBuilder result) +// { +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#region using +// result.append(GetUsingStr(CompCodeNames.DeterminationSpiNameSpace)); +// result.append(GetUsingStr(CompCodeNames.DeterminationApiNameSpace)); +// result.append(GetUsingStr(CompCodeNames.DeterminationChangeset)); +////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: +// ///#endregion +// } +// +// @Override +// protected void GenerateConstructor(StringBuilder result) +// { +// result.append(GetDoubleIndentationStr()).Append(CompCodeNames.KeywordPublic).Append(" ").Append(GetCompName()).AppendLine("(IVarDeterminationContext context, IChangeDetail change) : base(context, change)"); +// result.append(GetDoubleIndentationStr()).AppendLine("{"); +// result.append(GetDoubleIndentationStr()).AppendLine("}"); +// } +// +// @Override +// protected void GenerateExtendMethod(StringBuilder result) +// { +// result.append(GetDoubleIndentationStr()).Append(CompCodeNames.KeywordPrivate).Append(" ").Append(EntityClassName).AppendLine(" GetData() "); +// result.append(GetDoubleIndentationStr()).AppendLine("{"); +// +// result.append(GetDoubleIndentationStr()).Append(GetIndentationStr()).Append("return base.Context.data as ").Append(EntityClassName).AppendLine(" ;"); +// +// result.append(GetDoubleIndentationStr()).AppendLine("}"); +// } +// /** +// 获取构件名称 +// +// @return +// */ +// @Override +// protected String GetInitializeCompName() +// { +// return String.Concat(Operation.Code, "Determination"); +// } +//} \ No newline at end of file diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/generatecmpcode/IBaseCompCodeGen.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/generatecmpcode/IBaseCompCodeGen.java new file mode 100644 index 0000000000000000000000000000000000000000..e03b6facd32e1432a739ad48bc7b0873ee67192c --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/generatecmpcode/IBaseCompCodeGen.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.cef.variable.dtgenerator.vardtmGenerate.generatecmpcode; + +public interface IBaseCompCodeGen +{ + boolean getIsCommonGenerate(); + + /** + 获取构件名 + + @return + */ + String GetCompName(); + + /** + 仅Excute() + + @return + */ + String GenerateExecute(); + + /** + 全量生成 + + @return + */ + String GenerateCommon(); + +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/javageneratecmpcode/JavaBaseCommonCompCodeGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/javageneratecmpcode/JavaBaseCommonCompCodeGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..638a2d3934488e378405df839c4ceebb44133e0f --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/javageneratecmpcode/JavaBaseCommonCompCodeGenerator.java @@ -0,0 +1,298 @@ +/* + * Copyright © OpenAtom Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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.cef.variable.dtgenerator.vardtmGenerate.javageneratecmpcode; + +import com.google.common.util.concurrent.ServiceManager; +import com.inspur.edp.bef.component.base.GspComponent; +import com.inspur.edp.cef.designtime.api.operation.CommonOperation; +import com.inspur.edp.cef.variable.dtgenerator.vardtmGenerate.JavaCompCodeNames; +import com.inspur.edp.das.commonmodel.entity.GspCommonModel; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; +import com.inspur.edp.lcm.metadata.api.service.RefCommonService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import javax.swing.Spring; + +public abstract class JavaBaseCommonCompCodeGenerator implements JavaIBaseCompCodeGen{ + ///#region 字段 + private String entityNamespace; + private String apiNamespace; + private RefCommonService lcmDtService; + + protected CommonOperation operation; + protected String nameSpace; + protected String BeName; + protected String entityClassName; + //解析型标志 + + protected boolean isInterpretation; + + protected abstract String getBaseClassName(); + private String privatePath; + public final String getPath() + { + return privatePath; + } + public final void setPath(String value) + { + privatePath = value; + } + + ///#endregion + + private RefCommonService getLcmDtService(){ + if(lcmDtService==null) + lcmDtService = SpringBeanUtils.getBean(RefCommonService.class); + return lcmDtService; +} + ///#region 构造函数 + protected JavaBaseCommonCompCodeGenerator(GspCommonModel gspCommonModel, CommonOperation operation, String nameSpace, String path) + { + setPath(path); + this.operation = operation; + this.nameSpace = GetNameSpace(nameSpace, gspCommonModel.getCode()); + this.entityClassName = gspCommonModel.getVariables().getGeneratedEntityClassInfo().getClassName(); + //目的是兼容生成variable的文件夹名称误写成Variable + this.entityNamespace = gspCommonModel.getVariables().getGeneratedEntityClassInfo().getClassNamespace(); + this.apiNamespace = gspCommonModel.getVariables().getGeneratedApiAssemblyInfo().getDefaultNamespace(); + // 解析型 + this.isInterpretation= SpringBeanUtils.getBean(MetadataProjectService.class).isInterpretation(path); + } + + private String GetNameSpace(String baseNameSpace, String beName) + { + String nameSpace = "%1$s.%2$s.%3$s"; + return String.format(nameSpace, baseNameSpace, beName, GetNameSpaceSuffix()); + } + + + protected abstract String GetNameSpaceSuffix(); + /** + 获取当前构件名称 + + @return + */ + public final String getCompName() + { + if (checkNull(operation.getComponentId())) + { + return GetInitializeCompName(); + } + GspMetadata metadata = getLcmDtService().getRefMetadata(operation.getComponentId()); + if (metadata == null) + { + throw new RuntimeException("没有生成构件,无法继续生成代码"); + } + + IMetadataContent content = metadata.getContent(); + String fullClassName = ""; + if (content instanceof GspComponent) + { + GspComponent component = (GspComponent)((metadata.getContent() instanceof GspComponent) ? metadata.getContent() : null); + fullClassName = component.getMethod().getClassName(); + } + else + { + throw new RuntimeException("当前元数据不属于构件元数据"); + } + + String[] sections = fullClassName.split("[.]", -1); + return sections[sections.length - 1]; + } + + ///#endregion + + /** + 是否执行GenerateCommon() + + */ + public boolean getIsCommonGenerate(){return false;} + + public final String generateExecute() + { + StringBuilder result = new StringBuilder(); + ///#region package + nameSpace = ConvertJavaImportPackage(nameSpace); + result.append(JavaCompCodeNames.KeywordPackage).append(" ").append(nameSpace).append(";").append(getNewline()); + + ///#endregion + ///#region import + GenerateImport(result); + result.append(getNewline()); + + ///#endregion + ///#region ClassStart + result.append(JavaCompCodeNames.KeywordPublic).append(" ").append(JavaCompCodeNames.KeywordClass).append(" ").append(getCompName()).append(" ").append(JavaCompCodeNames.KeywordExtend).append(" ").append(getBaseClassName()).append(getNewline()); + result.append("{").append(getNewline()); + + ///#endregion + ///#region Field + JavaGenerateField(result); + result.append(getNewline()); + + ///#endregion + ///#region Constructor + + JavaGenerateConstructor(result); + result.append(getNewline()); + + ///#endregion + ///#region execute + + result.append(GetIndentationStr()).append("@").append(JavaCompCodeNames.KeywordOverride).append(getNewline()); + result.append(GetIndentationStr()).append(JavaCompCodeNames.KeywordPublic).append(" ").append(" ").append(JavaCompCodeNames.KeywordVoid).append(" ").append("execute() "); + + result.append(GetIndentationStr()).append("{").append(getNewline()); + result.append(GetIndentationStr()).append("} ").append(getNewline()); + + ///#endregion + ///#region ExtendMethod + + JavaGenerateExtendMethod(result); + + ///#endregion + ///#region ClassEnd + result.append("}").append(getNewline()); + ///#endregion + + ///#region NameSpaceEnd 命名空间结束 + //result.appendLine("}"); + ///#endregion + return result.toString(); + } + ///#region 生成方法 + + protected abstract void GenerateExtendUsing(StringBuilder result); + protected abstract void JavaGenerateConstructor(StringBuilder result); + protected void JavaGenerateExtendMethod(StringBuilder result) + { + } + protected void JavaGenerateField(StringBuilder result) + { + } + private String ConvertJavaImportPackage(String readPropertyValue_string) + { + String[] strArray = readPropertyValue_string.split("[.]", -1); + String str = "com."; + int i; + + for (i = 0; i < strArray.length - 1; i++) + { + str += strArray[i].toLowerCase() + "."; + } + str += strArray[i].toLowerCase(); + return str; + } + + private String ConvertJavaImportPackageCompatibilityMode(String readPropertyValue_string) + { + String[] strArray = readPropertyValue_string.split("[.]", -1); + String str = "com."; + int i; + + for (i = 0; i < strArray.length - 2; i++) + { + str += strArray[i].toLowerCase() + "."; + } + str += strArray[i].toLowerCase(); + str = String.format("%1$s%2$s%3$s", str, ".", strArray[strArray.length - 1]); + return str; + } + private void GenerateImport(StringBuilder result) + { + if (!this.isInterpretation) + { + //此处不调用ConvertJavaImportPackageCompatibilityMode方法,entityNamespace已经java包名 + entityNamespace = String.format("%1$s%2$s",entityNamespace, ".*"); + result.append(GetImportStr(entityNamespace)); + apiNamespace = String.format("%1$s%2$s",apiNamespace, ".*"); + result.append(GetImportStr(apiNamespace)); + } + + result.append(GetImportStr(JavaCompCodeNames.KeywordIDeterminationContext)); + result.append(GetImportStr(JavaCompCodeNames.KeywordAbstractDetermination)); + result.append(GetImportStr(JavaCompCodeNames.KeywordIChangeDetail)); + result.append(GetImportStr(JavaCompCodeNames.KeywordIVarDeterminationContext)); + result.append(GetImportStr(JavaCompCodeNames.ICefDataNameSpace)); + //JavaGenerateExtendUsing(result); + } + + ///#endregion + + ///#region 通用方法 + protected final String GetImportStr(String value) + { + return new StringBuilder(JavaCompCodeNames.KeywordImport).append(" ").append(value).append(";").append(getNewline()).toString(); + } + protected final String GetUsingStr(String value) + { + return new StringBuilder(JavaCompCodeNames.KeywordUsing).append(" ").append(value).append(";").append(getNewline()).toString(); + } + + protected final String getNewline() + { + return "\r\n"; + } + /** + 缩进 + + @return + */ + protected final String GetIndentationStr() + { + return "\t"; + } + /** + 双缩进 + + @return + */ + protected final String GetDoubleIndentationStr() + { + return "\t\t"; + } + + ///#endregion + + protected abstract String GetInitializeCompName(); + + /** + 2019.3新加,不需要兼容 + + @return + */ + public final String generateCommon() + { + return ""; + } + + public boolean checkNull(Object propValue) { + if (propValue == null) { + return true; + } + + if (propValue.getClass().isAssignableFrom(String.class)) { + String stringValue = (String) propValue; + if (stringValue == null || stringValue.isEmpty()) { + return true; + } + } + + return false; + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/javageneratecmpcode/JavaCommonDeterminationGenerator.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/javageneratecmpcode/JavaCommonDeterminationGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..dd68dfda81208712b408e921b3f1c63ddfff5d36 --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/javageneratecmpcode/JavaCommonDeterminationGenerator.java @@ -0,0 +1,101 @@ +/* + * Copyright © OpenAtom Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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.cef.variable.dtgenerator.vardtmGenerate.javageneratecmpcode; + +import com.inspur.edp.cef.designtime.api.operation.CommonOperation; +import com.inspur.edp.cef.variable.dtgenerator.vardtmGenerate.JavaCompCodeNames; +import com.inspur.edp.das.commonmodel.entity.GspCommonModel; + +public class JavaCommonDeterminationGenerator extends JavaBaseCommonCompCodeGenerator { + @Override + protected String getBaseClassName(){ + return JavaCompCodeNames.AbstractDeterminationClassName; + } + protected com.inspur.edp.das.commonmodel.entity.GspCommonModel GspCommonModel; + + public JavaCommonDeterminationGenerator(GspCommonModel GspCommonModel, CommonOperation operation, String nameSpace, String path) + { + super(GspCommonModel, operation, nameSpace, path); + this.GspCommonModel = GspCommonModel; + } + + @Override + protected String GetNameSpaceSuffix() + { + return JavaCompCodeNames.VariableDeterminationNameSpaceSuffix; + } + + @Override + protected void GenerateExtendUsing(StringBuilder result) + { + + ///#region using + result.append(GetUsingStr(JavaCompCodeNames.DeterminationSpiNameSpace)); + result.append(GetUsingStr(JavaCompCodeNames.DeterminationApiNameSpace)); + result.append(GetUsingStr(JavaCompCodeNames.DeterminationChangeset)); + + ///#endregion + } + + @Override + protected void JavaGenerateConstructor(StringBuilder result) + { + result.append(GetIndentationStr()).append(JavaCompCodeNames.KeywordPublic).append(" ").append(getCompName()).append("(IVarDeterminationContext context, IChangeDetail change)").append("{").append(getNewline()); + result.append(GetDoubleIndentationStr()).append("super((IVarDeterminationContext) context, change);").append(getNewline() ); + result.append(GetIndentationStr()).append("}").append(getNewline()); + } + + @Override + protected void JavaGenerateExtendMethod(StringBuilder result) + { + if (this.isInterpretation) + { + JavaGenerateInterpretationVarExtendMethod(result); + } + else + { + JavaGenerateVarExtendMethod(result); + } + } + + protected final void JavaGenerateVarExtendMethod(StringBuilder result) + { + result.append(GetIndentationStr()).append(JavaCompCodeNames.KeywordPrivate).append(" ").append(GspCommonModel.getVariables().getGeneratedEntityClassInfo().getClassName()).append(" getData() ").append("{").append(getNewline()); + + result.append(GetDoubleIndentationStr()).append(JavaCompCodeNames.KeywordReturn).append(" ").append("(").append(GspCommonModel.getVariables().getGeneratedEntityClassInfo().getClassName()).append(")").append("getContext().getData()").append(" ;").append(getNewline()); + result.append(GetIndentationStr()).append("}").append(getNewline()); + } + + protected final void JavaGenerateInterpretationVarExtendMethod(StringBuilder result) + { + result.append(GetIndentationStr()).append(JavaCompCodeNames.KeywordPrivate).append(" ").append(JavaCompCodeNames.ICefData).append(" getData() ").append("{").append(getNewline()); + + result.append(GetDoubleIndentationStr()).append(JavaCompCodeNames.KeywordReturn).append(" ").append("(").append(JavaCompCodeNames.ICefData).append(")").append("getContext().getData()").append(" ;").append(getNewline()); + result.append(GetIndentationStr()).append("}").append(getNewline()); + } + + /** + 获取构件名称 + + @return + */ + @Override + protected String GetInitializeCompName() + { + return String.format(operation.getCode(), "Determination"); + } +} diff --git a/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/javageneratecmpcode/JavaIBaseCompCodeGen.java b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/javageneratecmpcode/JavaIBaseCompCodeGen.java new file mode 100644 index 0000000000000000000000000000000000000000..e632a3d70c0efc32ed24a6ca31d08891d9863a6c --- /dev/null +++ b/common-entity-variable-generator/src/main/java/com/inspur/edp/cef/variable/dtgenerator/vardtmGenerate/javageneratecmpcode/JavaIBaseCompCodeGen.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.cef.variable.dtgenerator.vardtmGenerate.javageneratecmpcode; + +public interface JavaIBaseCompCodeGen +{ + boolean getIsCommonGenerate(); + + /** + 获取构件名 + + @return + */ + String getCompName(); + + /** + 仅Excute() + + @return + */ + String generateExecute(); + + /** + 全量生成 + + @return + */ + String generateCommon(); + +} diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..855e12923f012ec154e183f8dbadd9f0a0816fc5 --- /dev/null +++ b/pom.xml @@ -0,0 +1,58 @@ + + + + + 4.0.0 + + com.inspur.edp.bef + business-entity-generator1 + 0.1.0-SNAPSHOT + pom + + business-entity-generator + common-entity-generator + unified-datatype-generator + common-entity-variable-generator + + + 0.1.1 + 0.2.75 + 0.2.43 + + + + + + io.iec.edp + caf-database-object-api + ${database.object.api.version} + + + com.inspur.edp + lcm-database-object-api + ${database.object.api.version} + + + io.iec.edp + caf-boot-commons-autoconfigure + 0.2.9 + + + + diff --git a/style/ubml_checkstyle.xml b/style/ubml_checkstyle.xml new file mode 100644 index 0000000000000000000000000000000000000000..c63db71a8e40c72f0b8494de97f6534f4c48a659 --- /dev/null +++ b/style/ubml_checkstyle.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/unified-datatype-generator/pom.xml b/unified-datatype-generator/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..81249b6d61f1a26f4462851eae3b4dbb333c4f8d --- /dev/null +++ b/unified-datatype-generator/pom.xml @@ -0,0 +1,126 @@ + + + + + + business-entity-generator1 + com.inspur.edp + 0.2.1-SNAPSHOT + + 4.0.0 + + unified-datatype-generator + + + com.inspur.edp + lcm-metadata-api + 0.1.0-SNAPSHOT + + + org.springframework + spring-beans + 5.1.8.RELEASE + compile + + + org.springframework + spring-context + 5.1.8.RELEASE + + + com.fasterxml.jackson.core + jackson-databind + 2.10.0.pr1 + + + com.inspur.edp + bef-component + 0.2.0 + + + com.inspur.edp + caf-generator + 0.1.4 + compile + + + com.inspur.edp + cef-designtime-generator + 0.2.3 + compile + + + com.inspur.edp + udt-api + 0.1.25-SNAPSHOT + + + com.inspur.edp + cef-designtime-generator + 0.2.2-SNAPSHOT + + + com.inspur.edp + cef-designtime-api + 0.2.18 + + + com.inspur.edp + udt-designtime-api + 0.1.5 + + + com.inspur.edp + udt-spi + 0.1.26 + + + com.inspur.edp + metadata-to-java-spi + 0.1.0-SNAPSHOT + + + com.inspur.edp + cef-gencommon + 0.1.0 + + + com.inspur.edp + cef-repository + 0.2.60 + + + com.inspur.edp + cef-api + 0.2.60 + + + com.inspur.edp + bef-builtincomponents + 0.2.12 + + + com.inspur.edp + cef-entity + 0.2.60 + + + + + diff --git a/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/api/entityinterface/complexudt/ComplexUdtAssoInfoGenerator.java b/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/api/entityinterface/complexudt/ComplexUdtAssoInfoGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..8064afecd1e96d63560ca0bc4942e115a72683c9 --- /dev/null +++ b/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/api/entityinterface/complexudt/ComplexUdtAssoInfoGenerator.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.udt.generator.api.entityinterface.complexudt; + + +import com.inspur.edp.cef.designtime.api.element.GspAssociation; +import com.inspur.edp.cef.generator.apiGenerator.dataType.entityInterface.propertyInfo.DataTypPropInfoGenCtx; +import com.inspur.edp.udt.designtime.api.entity.element.UdtElement; +import com.inspur.edp.udt.generator.api.entityinterface.valueobjinfo.propinfo.UdtAssoInfoGenerator; +import com.inspur.edp.udt.generator.api.entityinterface.valueobjinfo.propinfo.UdtRefPropInfoGenerator; + +public class ComplexUdtAssoInfoGenerator extends UdtAssoInfoGenerator +{ + public ComplexUdtAssoInfoGenerator(DataTypPropInfoGenCtx parentContext, GspAssociation asso) + { + super(parentContext, asso); + } + + @Override + protected UdtRefPropInfoGenerator CreateUdtPropInfoGenerator(UdtElement field) + { + return new ComplexUdtRefPropGenerator(super.getContext(), field); + } +} diff --git a/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/api/entityinterface/complexudt/ComplexUdtInfoGenerator.java b/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/api/entityinterface/complexudt/ComplexUdtInfoGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..fd0cc9a780a0d9f74e6565b29f35dd45c958de91 --- /dev/null +++ b/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/api/entityinterface/complexudt/ComplexUdtInfoGenerator.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.udt.generator.api.entityinterface.complexudt; + + +import com.inspur.edp.cef.generator.apiGenerator.dataType.entityInterface.DataTypeInterfaceGeneratorContext; +import com.inspur.edp.udt.designtime.api.entity.ComplexDataTypeDef; +import com.inspur.edp.udt.designtime.api.entity.element.UdtElement; +import com.inspur.edp.udt.generator.api.entityinterface.valueobjinfo.ValueObjInfoGenerator; +import com.inspur.edp.udt.generator.api.entityinterface.valueobjinfo.propinfo.UdtPropInfoGenerator; +import com.inspur.edp.udt.spi.ValuObjInfo.ComplexUdt.ComplexUdtInfo; + +public class ComplexUdtInfoGenerator extends ValueObjInfoGenerator +{ + private ComplexDataTypeDef cUdt; + public ComplexUdtInfoGenerator(DataTypeInterfaceGeneratorContext parentContext) + { + super(parentContext); + cUdt = (ComplexDataTypeDef)parentContext.getDataType(); + } + + @Override + protected void beforeInitialize() + { + super.beforeInitialize(); + //Java版临时注释:国际化。 +// CefResourceExtractContext context = new CefResourceExtractContext(cUdt.getAssemblyName(), new I18nResourceItemCollection()); +// ComplexUdtReourceExtractor extractor = new ComplexUdtReourceExtractor(cUdt, context); +// extractor.Extract(); + } + + @Override + protected java.lang.Class getValueObjInfoParentClassType() + { + return ComplexUdtInfo.class; + } + + @Override + protected UdtPropInfoGenerator CreateUdtPropInfoGeneraotor(UdtElement field) + { + return new ComplexUdtPropInfoGenerator(getContext(), field); + } +} diff --git a/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/api/entityinterface/complexudt/ComplexUdtPropInfoGenerator.java b/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/api/entityinterface/complexudt/ComplexUdtPropInfoGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..ba156378260e8346107ca854706c05c86c309e54 --- /dev/null +++ b/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/api/entityinterface/complexudt/ComplexUdtPropInfoGenerator.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.udt.generator.api.entityinterface.complexudt; + +import com.inspur.edp.cef.designtime.api.element.GspAssociation; +import com.inspur.edp.cef.generator.apiGenerator.dataType.entityInterface.dataTypeInfo.DataTypeInfoGeneratorContext; +import com.inspur.edp.udt.designtime.api.entity.element.UdtElement; +import com.inspur.edp.udt.generator.api.entityinterface.valueobjinfo.propinfo.UdtAssoInfoGenerator; +import com.inspur.edp.udt.generator.api.entityinterface.valueobjinfo.propinfo.UdtPropInfoGenerator; +import com.inspur.edp.udt.spi.ValuObjInfo.ComplexUdt.ComplexUdtPropInfo; + +public class ComplexUdtPropInfoGenerator extends UdtPropInfoGenerator +{ + public ComplexUdtPropInfoGenerator(DataTypeInfoGeneratorContext parentContext, UdtElement field) + { + super(parentContext, field); + } + @Override + protected java.lang.Class getUdtPropInfoParentClassType() + { + return ComplexUdtPropInfo.class; + } + + @Override + protected UdtAssoInfoGenerator getUdtAssoInfoGenerator(GspAssociation asso) + { + return new ComplexUdtAssoInfoGenerator(getContext(), asso); + } +} diff --git a/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/api/entityinterface/complexudt/ComplexUdtRefPropGenerator.java b/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/api/entityinterface/complexudt/ComplexUdtRefPropGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..f65341cf2fa70736c2def63812b06f7254b573c4 --- /dev/null +++ b/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/api/entityinterface/complexudt/ComplexUdtRefPropGenerator.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.udt.generator.api.entityinterface.complexudt; + +import com.inspur.edp.cef.generator.apiGenerator.dataType.entityInterface.assoInfo.AssociaitionInfoGenCtx; +import com.inspur.edp.udt.designtime.api.entity.element.UdtElement; +import com.inspur.edp.udt.generator.api.entityinterface.valueobjinfo.propinfo.UdtRefPropInfoGenerator; +import com.inspur.edp.udt.spi.ValuObjInfo.ComplexUdt.ComplexUdtRefPropInfo; + +public class ComplexUdtRefPropGenerator extends UdtRefPropInfoGenerator +{ + public ComplexUdtRefPropGenerator(AssociaitionInfoGenCtx parentContext, UdtElement field) + { + super(parentContext, field); + } + @Override + protected java.lang.Class GetUdtRefPropInfoParentClassType() + { + return ComplexUdtRefPropInfo.class; + } +} diff --git a/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/core/rtgenerator/manager/CreateAbstractUdtGenerator.java b/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/core/rtgenerator/manager/CreateAbstractUdtGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..825b9d08f201bd6064d30bcd9e2fb0f4b538f411 --- /dev/null +++ b/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/core/rtgenerator/manager/CreateAbstractUdtGenerator.java @@ -0,0 +1,82 @@ +/* + * Copyright © OpenAtom Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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.udt.generator.core.rtgenerator.manager; + + +import com.inspur.edp.caf.generator.baseInfo.ParameterInfo; +import com.inspur.edp.caf.generator.baseInfo.TypeInfo; +import com.inspur.edp.caf.generator.method.ClassMethodGenerator; +import com.inspur.edp.udt.api.Udt.IUdtContext; +import com.inspur.edp.udt.core.Udt.AbstractUdt; +import org.eclipse.jdt.core.dom.Block; +import org.eclipse.jdt.core.dom.ClassInstanceCreation; +import org.eclipse.jdt.core.dom.Modifier; +import org.eclipse.jdt.core.dom.ReturnStatement; + +import java.util.ArrayList; + +// +// public override AbstractUdt CreateAbstractUdt(IUdtContext ctx) +// { +// return new XXXX(ctx); +// } +// +public class CreateAbstractUdtGenerator extends ClassMethodGenerator +{ + private UdtMgrGenCtx mgrGenCtx; + + public CreateAbstractUdtGenerator(UdtMgrGenCtx mgrGenCtx) + { + this.mgrGenCtx = mgrGenCtx; + } + private String ctxParaName = "ctx"; + @Override + protected ArrayList getAccessModifiers() { + return new java.util.ArrayList(java.util.Arrays.asList(new Modifier.ModifierKeyword[]{Modifier.ModifierKeyword.PUBLIC_KEYWORD})); + } + + @Override + protected String getMethodName(){return "createAbstractUdt";} + + @Override + protected ArrayList getParameterCollection() { + ArrayList list =new ArrayList<>(); + ParameterInfo p=new ParameterInfo(); + p.setParamName(ctxParaName); + p.setParamType(new TypeInfo(IUdtContext.class)); + list.add(p); + return list; + } + + @Override + protected TypeInfo getReturnType() { + return new TypeInfo(AbstractUdt.class); + } + + @Override + protected Block buildMethodBody() { + Block block=ast.newBlock(); + ReturnStatement returnStatement=ast.newReturnStatement(); + ClassInstanceCreation classInstanceCreation=ast.newClassInstanceCreation(); + classInstanceCreation.setType(ast.newSimpleType(ast.newName(mgrGenCtx.getProjContext().getEntityMediateTypes().get(mgrGenCtx.getCoreGenCtx().getUdtGenContext().getUdt().getCode()).getFullName()))); + classInstanceCreation.arguments().add(ast.newSimpleName(ctxParaName)); + returnStatement.setExpression(classInstanceCreation); + + block.statements().add(returnStatement); + return block; + } +} diff --git a/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/core/rtgenerator/manager/CreateDataConverterGenerator.java b/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/core/rtgenerator/manager/CreateDataConverterGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..752a82c3d8994ee228408f1d595b1e13500512a7 --- /dev/null +++ b/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/core/rtgenerator/manager/CreateDataConverterGenerator.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.udt.generator.core.rtgenerator.manager; + +import com.fasterxml.jackson.databind.JsonSerializer; +import com.inspur.edp.caf.generator.baseInfo.ParameterInfo; +import com.inspur.edp.caf.generator.baseInfo.TypeInfo; +import com.inspur.edp.caf.generator.method.ClassMethodGenerator; +import com.inspur.edp.cef.entity.entity.ICefData; +import org.eclipse.jdt.core.dom.Block; +import org.eclipse.jdt.core.dom.ClassInstanceCreation; +import org.eclipse.jdt.core.dom.Modifier; +import org.eclipse.jdt.core.dom.ReturnStatement; + +import java.util.ArrayList; + +// +// protected override JsonConverter GetDataConverter(); +// { +// return new XXXX(ctx); +// } +// +public class CreateDataConverterGenerator extends ClassMethodGenerator +{ + private MgrImplGenCtx mgrGenCtx; + + public CreateDataConverterGenerator(MgrImplGenCtx mgrGenCtx) + { + this.mgrGenCtx = mgrGenCtx; + } + + + @Override + protected final java.util.ArrayList getAccessModifiers() { + return new java.util.ArrayList(java.util.Arrays.asList(new Modifier.ModifierKeyword[]{Modifier.ModifierKeyword.PROTECTED_KEYWORD})); + } + + @Override + protected boolean getIsOverride() { + return true; + } + + //C# TO JAVA CONVERTER TODO TASK: Lambda expressions and anonymous methods are not converted by C# to Java Converter: + @Override + protected String getMethodName(){return "getDataSerializer";} + + @Override + protected ArrayList getParameterCollection() { + return null; + } + + //C# TO JAVA CONVERTER TODO TASK: Lambda expressions and anonymous methods are not converted by C# to Java Converter: + @Override + protected TypeInfo getReturnType() { + + TypeInfo typeInfo= new TypeInfo(JsonSerializer.class); + typeInfo.setIsParameterizedType(true); + typeInfo.getArguments().add(new TypeInfo(ICefData.class)); + return typeInfo; + } + + @Override + protected Block buildMethodBody() { + Block block=ast.newBlock(); + ReturnStatement returnStatement=ast.newReturnStatement(); + ClassInstanceCreation classInstanceCreation=ast.newClassInstanceCreation(); + classInstanceCreation.setType(ast.newSimpleType(ast.newName(mgrGenCtx.getDataConverterType().getClassName()))); + + returnStatement.setExpression(classInstanceCreation); + block.statements().add(returnStatement); + + return block; + } +} diff --git a/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/core/rtgenerator/manager/dataconverter/GetChangeSerializerGenerator.java b/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/core/rtgenerator/manager/dataconverter/GetChangeSerializerGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..9bcda42bccff3dc97c9cd440fc2ab4f51a020049 --- /dev/null +++ b/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/core/rtgenerator/manager/dataconverter/GetChangeSerializerGenerator.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.udt.generator.core.rtgenerator.manager.dataconverter; + +import com.inspur.edp.caf.generator.baseInfo.ParameterInfo; +import com.inspur.edp.caf.generator.baseInfo.TypeInfo; +import com.inspur.edp.caf.generator.method.ClassMethodGenerator; +import com.inspur.edp.cef.spi.jsonser.abstractcefchange.AbstractCefChangeSerializer; +import com.inspur.edp.udt.generator.core.rtgenerator.manager.UdtMgrGenCtx; +import java.util.ArrayList; +import org.eclipse.jdt.core.dom.Block; +import org.eclipse.jdt.core.dom.ClassInstanceCreation; +import org.eclipse.jdt.core.dom.Modifier; +import org.eclipse.jdt.core.dom.Modifier.ModifierKeyword; +import org.eclipse.jdt.core.dom.ReturnStatement; + +public class GetChangeSerializerGenerator extends ClassMethodGenerator { + + private UdtMgrGenCtx mgrGenCtx; + + public GetChangeSerializerGenerator(UdtMgrGenCtx mgrGenCtx) + { + this.mgrGenCtx = mgrGenCtx; + } + @Override + protected Block buildMethodBody() { + String entityImplName = mgrGenCtx.getChangeSerContext().getClassName(); + Block block = ast.newBlock(); + ReturnStatement returnStatement = ast.newReturnStatement(); + ClassInstanceCreation classInstanceCreation = ast.newClassInstanceCreation(); + classInstanceCreation.setType(ast.newSimpleType(ast.newName(entityImplName))); + returnStatement.setExpression(classInstanceCreation); + block.statements().add(returnStatement); + return block; + } + @Override + protected String getMethodName() { + return "getChangeSerializer"; + } + + @Override + protected TypeInfo getReturnType() { + return new TypeInfo(AbstractCefChangeSerializer.class); + } + + @Override + protected java.util.ArrayList getAccessModifiers() { + return new java.util.ArrayList(java.util.Arrays + .asList(new Modifier.ModifierKeyword[]{Modifier.ModifierKeyword.PROTECTED_KEYWORD})); + } + + @Override + protected boolean getIsOverride() { + return true; + } + + + @Override + protected ArrayList getParameterCollection() { + return null; + } +} diff --git a/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/repository/assembler/method/ComplexUdtInitColumnGenerator.java b/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/repository/assembler/method/ComplexUdtInitColumnGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..b30fafab5be162ba4d994f7e7f05e8c386fffeb8 --- /dev/null +++ b/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/repository/assembler/method/ComplexUdtInitColumnGenerator.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.udt.generator.repository.assembler.method; + +import com.inspur.edp.caf.generator.baseInfo.TypeInfo; +import com.inspur.edp.cef.designtime.api.IFieldCollection; +import com.inspur.edp.cef.designtime.api.element.GspElementDataType; +import com.inspur.edp.cef.designtime.api.element.GspElementObjectType; +import com.inspur.edp.cef.designtime.api.util.Guid; +import com.inspur.edp.cef.generator.repository.valueObject.ValueObjectAssemblerGenCtx; +import com.inspur.edp.cef.generator.repository.valueObject.methods.ValueObjInitColumnMethodGenerator; +import com.inspur.edp.udt.designtime.api.entity.ComplexDataTypeDef; +import com.inspur.edp.udt.designtime.api.entity.dbInfo.ColumnMapType; +import com.inspur.edp.udt.designtime.api.entity.element.ElementCollection; +import com.inspur.edp.udt.designtime.api.entity.element.UdtElement; +import com.inspur.edp.udt.designtime.api.entity.property.PropertyCollection; +import com.inspur.edp.udt.generator.UdtGeneratorContext; + +import static com.inspur.edp.udt.designtime.api.entity.dbInfo.ColumnMapType.*; + +public class ComplexUdtInitColumnGenerator extends ValueObjInitColumnMethodGenerator +{ + private ValueObjectAssemblerGenCtx parentContext; + private ComplexDataTypeDef dataType; + + public ComplexUdtInitColumnGenerator(ValueObjectAssemblerGenCtx parentContext, ComplexDataTypeDef dataType) + { + super(parentContext, dataType); + this.parentContext = parentContext; + this.dataType = dataType; + } + + @Override + protected IFieldCollection getElements() + { + switch (dataType.getDbInfo().getMappingType()) + { + case SingleColumn: + PropertyCollection properties = new PropertyCollection(); + dataType.initProperties(properties); + ElementCollection tempVar = new ElementCollection(); + UdtElement udtElement=new UdtElement(properties); + udtElement.setID(Guid.newGuid().toString()); + udtElement.setCode(dataType.getCode()); + udtElement.setName(dataType.getName()); + udtElement.setLabelID(dataType.getCode()); + udtElement.setObjectType(GspElementObjectType.None); + udtElement.setMDataType(GspElementDataType.String); + tempVar.add(udtElement); + return tempVar; + case MultiColumns: + return dataType.getContainElements(); + default: + throw new UnsupportedOperationException(); + } + } + + @Override + protected TypeInfo getProcessType(String columnName) { + String className = columnName + "PersistanceValueReader"; + TypeInfo type = new TypeInfo(className); + type.setTypePackageName(((UdtGeneratorContext)parentContext.getRepoGenCtx().getCefGenCtx()).getUdt().getApiNamespace().getDefaultNamespace()); + return type; + } +} diff --git a/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/repository/assembler/property/ColumnMapTypePropGenerator.java b/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/repository/assembler/property/ColumnMapTypePropGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..029424c7068b4605d558dd6168ab4769ae55cf0c --- /dev/null +++ b/unified-datatype-generator/src/main/java/com/inspur/edp/udt/generator/repository/assembler/property/ColumnMapTypePropGenerator.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.udt.generator.repository.assembler.property; + +import com.inspur.edp.caf.generator.baseInfo.TypeInfo; +import com.inspur.edp.caf.generator.property.ClassPropertyGenerator; +import com.inspur.edp.cef.repository.assembler.nesteddatatype.NestedDataColumnMapType; +import com.inspur.edp.udt.designtime.api.entity.ComplexDataTypeDef; +import com.inspur.edp.udt.designtime.api.entity.SimpleDataTypeDef; +import com.inspur.edp.udt.designtime.api.entity.UnifiedDataTypeDef; +import com.inspur.edp.udt.designtime.api.entity.dbInfo.ColumnMapType; +import org.eclipse.jdt.core.dom.Block; +import org.eclipse.jdt.core.dom.Modifier; +import org.eclipse.jdt.core.dom.QualifiedName; +import org.eclipse.jdt.core.dom.ReturnStatement; + +import java.util.ArrayList; + +public class ColumnMapTypePropGenerator extends ClassPropertyGenerator +{ + private UnifiedDataTypeDef udt; + public ColumnMapTypePropGenerator(UnifiedDataTypeDef udt) + { + this.udt = udt; + } + + @Override + protected TypeInfo getPropertyType() { + return new TypeInfo(NestedDataColumnMapType.class); + } + + @Override + protected String getFieldName() { + return null; + } + + @Override + protected String getPropertyName() + { + return "ColumnMapType"; + } + + @Override + protected ArrayList getGetterAccessModifier() { + ArrayList list =new ArrayList(); + list.add(Modifier.ModifierKeyword.PUBLIC_KEYWORD); + return list; + } + + @Override + protected ArrayList getSetterAccessModifier() { + ArrayList list =new ArrayList(); + list.add(Modifier.ModifierKeyword.PUBLIC_KEYWORD); + return list; + } + + @Override + protected boolean isGetterOverride() { + return true; + } + + @Override + protected boolean isSetterOverride() { + return true; + } + + @Override + protected Block buildGetMethodBody() { + Block block=ast.newBlock(); + ReturnStatement returnStatement=ast.newReturnStatement(); + + QualifiedName qualifiedName=ast.newQualifiedName( + ast.newName(NestedDataColumnMapType.class.getTypeName()), + ast.newSimpleName(GetNestedDataColumnMapType().toString())); + returnStatement.setExpression(qualifiedName); + block.statements().add(returnStatement); + return block; + } + + private NestedDataColumnMapType GetNestedDataColumnMapType() + { + if (this.udt instanceof SimpleDataTypeDef) + { + return NestedDataColumnMapType.MultiColumns; + } + else if (this.udt instanceof ComplexDataTypeDef) + { + return ((ComplexDataTypeDef)udt).getDbInfo().getMappingType()==ColumnMapType.MultiColumns ? NestedDataColumnMapType.MultiColumns : NestedDataColumnMapType.SingleColumn; + } + throw new RuntimeException("'"+udt.getName()+"'无对应的Udt类型"+udt.getUdtType()+"。"); + } + +//C# TO JAVA CONVERTER TODO TASK: Lambda expressions and anonymous methods are not converted by C# to Java Converter: + @Override + protected boolean hasSetMethod(){return false;} +}