You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2026/08/08 21:58:46 UTC
(cayenne) 01/04: ClassGenerationAction cleanup
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git
commit 2c531a123340647f6519824b0bb41b8c7332e815
Author: Andrus Adamchik <an...@objectstyle.com>
AuthorDate: Sat Aug 8 16:56:58 2026 -0400
ClassGenerationAction cleanup
---
.../apache/cayenne/tools/CayenneGeneratorTask.java | 16 ++--
.../apache/cayenne/gen/ClassGenerationAction.java | 101 +++++++++------------
.../cayenne/gen/ClassGenerationActionFactory.java | 2 +-
.../gen/DefaultClassGenerationActionFactory.java | 4 +-
.../gen/mock/TestClassGenerationAction.java | 2 +-
.../apache/cayenne/tools/CayenneGeneratorMojo.java | 20 ++--
.../cgen/InstrumentedClassGenerationAction.java | 8 +-
.../DataMapArtefactsConfigurator.java | 2 +-
.../EmbeddableArtefactsConfigurator.java | 2 +-
.../EntityArtefactsConfigurator.java | 2 +-
.../PreviewClassGenerationFactory.java | 4 +-
.../templateeditor/PreviewGenerationAction.java | 4 +-
.../templateeditor/ArtifactsConfiguratorTest.java | 2 +-
13 files changed, 74 insertions(+), 95 deletions(-)
diff --git a/cayenne-ant/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java b/cayenne-ant/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java
index cc063ab60..831169a53 100644
--- a/cayenne-ant/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java
+++ b/cayenne-ant/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java
@@ -115,21 +115,21 @@ public class CayenneGeneratorTask extends CayenneTask {
Thread.currentThread().setContextClassLoader(CayenneGeneratorTask.class.getClassLoader());
DataMap dataMap = loadAction.getMainDataMap();
- for (ClassGenerationAction generatorAction : createGenerators(dataMap)) {
+ for (ClassGenerationAction action : createActions(dataMap)) {
CayenneGeneratorEntityFilterAction filterEntityAction = new CayenneGeneratorEntityFilterAction();
filterEntityAction.setNameFilter(NamePatternMatcher.build(logger, includeEntitiesPattern, excludeEntitiesPattern));
CayenneGeneratorEmbeddableFilterAction filterEmbeddableAction = new CayenneGeneratorEmbeddableFilterAction();
filterEmbeddableAction.setNameFilter(NamePatternMatcher.build(logger, null, excludeEmbeddablesPattern));
- generatorAction.setLogger(logger);
+ action.setLogger(logger);
if (!hasConfig() && useConfigFromDataMap) {
- generatorAction.prepareArtifacts();
+ action.prepareArtifacts();
} else {
- generatorAction.addEntities(filterEntityAction.getFilteredEntities(dataMap));
- generatorAction.addEmbeddables(filterEmbeddableAction.getFilteredEmbeddables(dataMap));
- generatorAction.addDataMap(dataMap);
+ action.addEntities(filterEntityAction.getFilteredEntities(dataMap));
+ action.addEmbeddables(filterEmbeddableAction.getFilteredEmbeddables(dataMap));
+ action.addDataMap(dataMap);
}
- generatorAction.execute();
+ action.execute();
}
} catch (Exception e) {
throw new BuildException(e);
@@ -138,7 +138,7 @@ public class CayenneGeneratorTask extends CayenneTask {
}
}
- private List<ClassGenerationAction> createGenerators(DataMap dataMap) {
+ private List<ClassGenerationAction> createActions(DataMap dataMap) {
List<ClassGenerationAction> actions = new ArrayList<>();
for (CgenConfiguration configuration : buildConfigurations(dataMap)) {
actions.add(injector.getInstance(ClassGenerationActionFactory.class).createAction(configuration));
diff --git a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
index 450e92a33..20cc26f0e 100644
--- a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
+++ b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
@@ -55,15 +55,11 @@ public class ClassGenerationAction {
private static final String WILDCARD = "*";
private static final String CUSTOM_TEMPLATE_REPO = "customTemplateRepo";
- /**
- * @since 4.1
- */
- protected CgenConfiguration cgenConfiguration;
+ protected CgenConfiguration configuration;
protected Logger logger;
- // runtime ivars
protected Context context;
- protected Map<String, Template> templateCache;
+ protected final Map<String, Template> templateCache;
private ToolsUtilsFactory utilsFactory;
private MetadataUtils metadataUtils;
@@ -79,9 +75,9 @@ public class ClassGenerationAction {
* tools.application.myTool = com.mycompany.MyTool</pre>
* Then the methods in the MyTool class will be available for use in the template like ${myTool.myMethod(arg)}
*/
- public ClassGenerationAction(CgenConfiguration cgenConfig) {
- this.cgenConfiguration = cgenConfig;
- String toolConfigFile = cgenConfig.getExternalToolConfig();
+ public ClassGenerationAction(CgenConfiguration configuration) {
+ this.configuration = configuration;
+ String toolConfigFile = configuration.getExternalToolConfig();
if (System.getProperty("org.apache.velocity.tools") != null || toolConfigFile != null) {
ToolManager manager = new ToolManager(true, true);
@@ -96,10 +92,7 @@ public class ClassGenerationAction {
this.templateCache = new HashMap<>(5);
}
- /**
- * VelocityContext initialization method called once per artifact.
- */
- public void resetContextForArtifact(Artifact artifact) {
+ protected void resetContextForArtifact(Artifact artifact) {
StringUtils stringUtils = StringUtils.getInstance();
String qualifiedClassName = artifact.getQualifiedClassName();
@@ -112,7 +105,7 @@ public class ClassGenerationAction {
String superClassName = SUPERCLASS_PREFIX + stringUtils.stripPackageName(qualifiedClassName);
- String superPackageName = cgenConfiguration.getSuperPkg();
+ String superPackageName = configuration.getSuperPkg();
if (superPackageName == null || superPackageName.isEmpty()) {
superPackageName = packageName + ".auto";
}
@@ -129,8 +122,8 @@ public class ClassGenerationAction {
context.put(Artifact.OBJECT_KEY, artifact.getObject());
context.put(Artifact.STRING_UTILS_KEY, stringUtils);
- context.put(Artifact.CREATE_PROPERTY_NAMES, cgenConfiguration.isCreatePropertyNames());
- context.put(Artifact.CREATE_PK_PROPERTIES, cgenConfiguration.isCreatePKProperties());
+ context.put(Artifact.CREATE_PROPERTY_NAMES, configuration.isCreatePropertyNames());
+ context.put(Artifact.CREATE_PK_PROPERTIES, configuration.isCreatePKProperties());
}
/**
@@ -154,7 +147,7 @@ public class ClassGenerationAction {
public void addEntities(Collection<ObjEntity> entities) {
if (entities != null) {
for (ObjEntity entity : entities) {
- cgenConfiguration.addArtifact(new EntityArtifact(entity));
+ configuration.addArtifact(new EntityArtifact(entity));
}
}
}
@@ -162,7 +155,7 @@ public class ClassGenerationAction {
public void addEmbeddables(Collection<Embeddable> embeddables) {
if (embeddables != null) {
for (Embeddable embeddable : embeddables) {
- cgenConfiguration.addArtifact(new EmbeddableArtifact(embeddable));
+ configuration.addArtifact(new EmbeddableArtifact(embeddable));
}
}
}
@@ -173,13 +166,13 @@ public class ClassGenerationAction {
*/
public void addDataMap(DataMap dataMap) {
// data map should be used only in ArtifactsGenerationMode.ALL
- if (!cgenConfiguration.getArtifactsGenerationMode().equals(ArtifactsGenerationMode.ALL.getLabel())) {
+ if (!configuration.getArtifactsGenerationMode().equals(ArtifactsGenerationMode.ALL.getLabel())) {
return;
}
- Artifact artifact = new DataMapArtifact(cgenConfiguration.getDataMap(), dataMap.getQueryDescriptors());
- if (!cgenConfiguration.getArtifacts().contains(artifact)) {
- cgenConfiguration.addArtifact(artifact);
+ Artifact artifact = new DataMapArtifact(configuration.getDataMap(), dataMap.getQueryDescriptors());
+ if (!configuration.getArtifacts().contains(artifact)) {
+ configuration.addArtifact(artifact);
}
}
@@ -187,14 +180,14 @@ public class ClassGenerationAction {
* @since 4.1
*/
public void prepareArtifacts() {
- cgenConfiguration.getArtifacts().clear();
- addEntities(cgenConfiguration.getEntities().stream()
- .map(entity -> cgenConfiguration.getDataMap().getObjEntity(entity))
+ configuration.getArtifacts().clear();
+ addEntities(configuration.getEntities().stream()
+ .map(entity -> configuration.getDataMap().getObjEntity(entity))
.collect(Collectors.toList()));
- addEmbeddables(cgenConfiguration.getEmbeddables().stream()
- .map(embeddable -> cgenConfiguration.getDataMap().getEmbeddable(embeddable))
+ addEmbeddables(configuration.getEmbeddables().stream()
+ .map(embeddable -> configuration.getDataMap().getEmbeddable(embeddable))
.collect(Collectors.toList()));
- addDataMap(cgenConfiguration.getDataMap());
+ addDataMap(configuration.getDataMap());
}
/**
@@ -205,7 +198,7 @@ public class ClassGenerationAction {
validateAttributes();
try {
- for (Artifact artifact : cgenConfiguration.getArtifacts()) {
+ for (Artifact artifact : configuration.getArtifacts()) {
execute(artifact);
}
} finally {
@@ -221,7 +214,7 @@ public class ClassGenerationAction {
resetContextForArtifact(artifact);
- ArtifactGenerationMode artifactMode = cgenConfiguration.isMakePairs()
+ ArtifactGenerationMode artifactMode = configuration.isMakePairs()
? ArtifactGenerationMode.GENERATION_GAP
: ArtifactGenerationMode.SINGLE_CLASS;
@@ -241,30 +234,27 @@ public class ClassGenerationAction {
initVelocityProperties(props, type);
VelocityEngine velocityEngine = new VelocityEngine();
velocityEngine.init(props);
- return velocityEngine.getTemplate(cgenConfiguration.getTemplateByType(type).getName());
+ return velocityEngine.getTemplate(configuration.getTemplateByType(type).getName());
}
protected void initVelocityProperties(Properties props, TemplateType type) {
- CgenTemplate template = cgenConfiguration.getTemplateByType(type);
+ CgenTemplate template = configuration.getTemplateByType(type);
if (template.isFile()) {
props.put(RuntimeConstants.RESOURCE_LOADERS, "cayenne");
props.put("resource.loader.cayenne.class", ClassGeneratorResourceLoader.class.getName());
props.put("resource.loader.cayenne.cache", "false");
- if(cgenConfiguration.getRootPath() != null) {
- props.put("resource.loader.cayenne.root", cgenConfiguration.getRootPath());
+ if (configuration.getRootPath() != null) {
+ props.put("resource.loader.cayenne.root", configuration.getRootPath());
}
} else {
props.put(RuntimeConstants.RESOURCE_LOADERS, "string");
props.put("resource.loader.string.class", StringResourceLoader.class.getName());
props.put("resource.loader.string.repository.name", CUSTOM_TEMPLATE_REPO);
- putTemplateTextInRepository(template);
- }
- }
- private void putTemplateTextInRepository(CgenTemplate template) {
- StringResourceRepository repo = new StringResourceRepositoryImpl();
- repo.putStringResource(template.getName(), template.getData());
- StringResourceLoader.setRepository(CUSTOM_TEMPLATE_REPO, repo);
+ StringResourceRepository repo = new StringResourceRepositoryImpl();
+ repo.putStringResource(template.getName(), template.getData());
+ StringResourceLoader.setRepository(CUSTOM_TEMPLATE_REPO, repo);
+ }
}
/**
@@ -273,7 +263,7 @@ public class ClassGenerationAction {
* Called internally from "execute".
*/
protected void validateAttributes() {
- Path dir = cgenConfiguration.buildOutputPath();
+ Path dir = configuration.buildOutputPath();
if (dir == null) {
throw new CayenneRuntimeException("Output directory is not set.");
}
@@ -329,10 +319,10 @@ public class ClassGenerationAction {
String packageName = (String) context.get(Artifact.SUPER_PACKAGE_KEY);
String className = (String) context.get(Artifact.SUPER_CLASS_KEY);
- File dir = mkpath(cgenConfiguration.buildOutputPath().toFile(), packageName);
+ File dir = mkpath(configuration.buildOutputPath().toFile(), packageName);
String fileName = StringUtils
.getInstance()
- .replaceWildcardInStringWithString(WILDCARD, cgenConfiguration.getOutputPattern(), className);
+ .replaceWildcardInStringWithString(WILDCARD, configuration.getOutputPattern(), className);
return new File(dir, fileName);
}
@@ -346,17 +336,17 @@ public class ClassGenerationAction {
String packageName = (String) context.get(Artifact.SUB_PACKAGE_KEY);
String className = (String) context.get(Artifact.SUB_CLASS_KEY);
- String filename = StringUtils.getInstance().replaceWildcardInStringWithString(WILDCARD, cgenConfiguration.getOutputPattern(), className);
- File dest = new File(mkpath(cgenConfiguration.buildOutputPath().toFile(), packageName), filename);
+ String filename = StringUtils.getInstance().replaceWildcardInStringWithString(WILDCARD, configuration.getOutputPattern(), className);
+ File dest = new File(mkpath(configuration.buildOutputPath().toFile(), packageName), filename);
if (dest.exists()) {
// no overwrite of subclasses
- if (cgenConfiguration.isMakePairs()) {
+ if (configuration.isMakePairs()) {
return null;
}
// skip if said so
- if (!cgenConfiguration.isOverwrite()) {
+ if (!configuration.isOverwrite()) {
return null;
}
}
@@ -371,7 +361,7 @@ public class ClassGenerationAction {
*/
private File mkpath(File dest, String pkgName) throws Exception {
- if (!cgenConfiguration.isUsePkgPath() || pkgName == null) {
+ if (!configuration.isUsePkgPath() || pkgName == null) {
return dest;
}
@@ -395,8 +385,8 @@ public class ClassGenerationAction {
/**
* @since 4.1
*/
- public CgenConfiguration getCgenConfiguration() {
- return cgenConfiguration;
+ public CgenConfiguration getConfiguration() {
+ return configuration;
}
/**
@@ -407,13 +397,6 @@ public class ClassGenerationAction {
this.context = context;
}
- /**
- * @since 4.1
- */
- public void setCgenConfiguration(CgenConfiguration cgenConfiguration) {
- this.cgenConfiguration = cgenConfiguration;
- }
-
public ToolsUtilsFactory getUtilsFactory() {
return utilsFactory;
}
@@ -459,7 +442,7 @@ public class ClassGenerationAction {
@Override
public void close() throws IOException {
- String encoding = cgenConfiguration.getEncoding();
+ String encoding = configuration.getEncoding();
Charset charset = encoding != null ? Charset.forName(encoding) : Charset.defaultCharset();
byte[] generated = buffer.toString().getBytes(charset);
diff --git a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationActionFactory.java b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationActionFactory.java
index 2bec76c81..9c6f2a07b 100644
--- a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationActionFactory.java
+++ b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationActionFactory.java
@@ -23,5 +23,5 @@ package org.apache.cayenne.gen;
*/
public interface ClassGenerationActionFactory {
- ClassGenerationAction createAction(CgenConfiguration cgenConfiguration);
+ ClassGenerationAction createAction(CgenConfiguration configuration);
}
diff --git a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/DefaultClassGenerationActionFactory.java b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/DefaultClassGenerationActionFactory.java
index c2be6ac3b..b698369ac 100644
--- a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/DefaultClassGenerationActionFactory.java
+++ b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/DefaultClassGenerationActionFactory.java
@@ -33,8 +33,8 @@ public class DefaultClassGenerationActionFactory implements ClassGenerationActio
private MetadataUtils metadataUtils;
@Override
- public ClassGenerationAction createAction(CgenConfiguration cgenConfiguration) {
- ClassGenerationAction classGenerationAction = new ClassGenerationAction(cgenConfiguration);
+ public ClassGenerationAction createAction(CgenConfiguration configuration) {
+ ClassGenerationAction classGenerationAction = new ClassGenerationAction(configuration);
classGenerationAction.setUtilsFactory(utilsFactory);
classGenerationAction.setMetadataUtils(metadataUtils);
return classGenerationAction;
diff --git a/cayenne-cgen/src/test/java/org/apache/cayenne/gen/mock/TestClassGenerationAction.java b/cayenne-cgen/src/test/java/org/apache/cayenne/gen/mock/TestClassGenerationAction.java
index 6907e7594..7ba5c07df 100644
--- a/cayenne-cgen/src/test/java/org/apache/cayenne/gen/mock/TestClassGenerationAction.java
+++ b/cayenne-cgen/src/test/java/org/apache/cayenne/gen/mock/TestClassGenerationAction.java
@@ -30,7 +30,7 @@ public class TestClassGenerationAction extends ClassGenerationAction {
private Collection<StringWriter> writers;
public TestClassGenerationAction(ClassGenerationAction classGenerationAction, Collection<StringWriter> writers){
- super(classGenerationAction.getCgenConfiguration());
+ super(classGenerationAction.getConfiguration());
setUtilsFactory(classGenerationAction.getUtilsFactory());
this.writers = writers;
}
diff --git a/cayenne-maven-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java b/cayenne-maven-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java
index b7a6576cc..2cf447569 100644
--- a/cayenne-maven-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java
+++ b/cayenne-maven-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java
@@ -275,22 +275,22 @@ public class CayenneGeneratorMojo extends AbstractMojo {
try {
loaderAction.setAdditionalDataMapFiles(convertAdditionalDataMaps());
DataMap dataMap = loaderAction.getMainDataMap();
- for (ClassGenerationAction generator : createGenerators(dataMap)) {
+ for (ClassGenerationAction action : createActions(dataMap)) {
CayenneGeneratorEntityFilterAction filterEntityAction = new CayenneGeneratorEntityFilterAction();
filterEntityAction.setNameFilter(NamePatternMatcher.build(logger, includeEntities, excludeEntities));
CayenneGeneratorEmbeddableFilterAction filterEmbeddableAction = new CayenneGeneratorEmbeddableFilterAction();
filterEmbeddableAction.setNameFilter(NamePatternMatcher.build(logger, null, excludeEmbeddables));
- generator.setLogger(logger);
+ action.setLogger(logger);
if (!hasConfig() && useConfigFromDataMap) {
- generator.prepareArtifacts();
+ action.prepareArtifacts();
} else {
- generator.addEntities(filterEntityAction.getFilteredEntities(dataMap));
- generator.addEmbeddables(filterEmbeddableAction.getFilteredEmbeddables(dataMap));
- generator.addDataMap(dataMap);
+ action.addEntities(filterEntityAction.getFilteredEntities(dataMap));
+ action.addEmbeddables(filterEmbeddableAction.getFilteredEmbeddables(dataMap));
+ action.addDataMap(dataMap);
}
- generator.execute();
+ action.execute();
}
} catch (Exception e) {
throw new MojoExecutionException("Error generating classes: ", e);
@@ -323,11 +323,7 @@ public class CayenneGeneratorMojo extends AbstractMojo {
dataMapSuperTemplate != null || createPKProperties != null || externalToolConfig != null;
}
- /**
- * Factory method to create internal class generator. Called from
- * constructor.
- */
- private List<ClassGenerationAction> createGenerators(DataMap dataMap) {
+ private List<ClassGenerationAction> createActions(DataMap dataMap) {
List<ClassGenerationAction> actions = new ArrayList<>();
for (CgenConfiguration configuration : buildConfigurations(dataMap)) {
actions.add(injector.getInstance(ClassGenerationActionFactory.class).createAction(configuration));
diff --git a/cayenne-mcp-server/src/main/java/org/apache/cayenne/mcp/tools/cgen/InstrumentedClassGenerationAction.java b/cayenne-mcp-server/src/main/java/org/apache/cayenne/mcp/tools/cgen/InstrumentedClassGenerationAction.java
index e8c3b9845..572e453b1 100644
--- a/cayenne-mcp-server/src/main/java/org/apache/cayenne/mcp/tools/cgen/InstrumentedClassGenerationAction.java
+++ b/cayenne-mcp-server/src/main/java/org/apache/cayenne/mcp/tools/cgen/InstrumentedClassGenerationAction.java
@@ -44,8 +44,8 @@ class InstrumentedClassGenerationAction extends ClassGenerationAction {
private final List<CgenFileEntry> writtenFiles;
private Artifact currentArtifact;
- public InstrumentedClassGenerationAction(CgenConfiguration cgenConfig) {
- super(cgenConfig);
+ public InstrumentedClassGenerationAction(CgenConfiguration configuration) {
+ super(configuration);
this.writtenFiles = new ArrayList<>();
}
@@ -76,11 +76,11 @@ class InstrumentedClassGenerationAction extends ClassGenerationAction {
* Must be called after {@link #prepareArtifacts()}.
*/
public int countFilesConsidered() {
- ArtifactGenerationMode mode = cgenConfiguration.isMakePairs()
+ ArtifactGenerationMode mode = configuration.isMakePairs()
? ArtifactGenerationMode.GENERATION_GAP
: ArtifactGenerationMode.SINGLE_CLASS;
int count = 0;
- for (Artifact artifact : cgenConfiguration.getArtifacts()) {
+ for (Artifact artifact : configuration.getArtifacts()) {
count += artifact.getTemplateTypes(mode).length;
}
return count;
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ui/project/editor/datamap/cgen/templateeditor/DataMapArtefactsConfigurator.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ui/project/editor/datamap/cgen/templateeditor/DataMapArtefactsConfigurator.java
index f04ad759a..89ca6e107 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ui/project/editor/datamap/cgen/templateeditor/DataMapArtefactsConfigurator.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ui/project/editor/datamap/cgen/templateeditor/DataMapArtefactsConfigurator.java
@@ -29,7 +29,7 @@ public class DataMapArtefactsConfigurator implements ArtefactsConfigurator {
@Override
public void config(ClassGenerationAction action, String artifactName) {
- action.addDataMap(action.getCgenConfiguration().getDataMap());
+ action.addDataMap(action.getConfiguration().getDataMap());
}
@Override
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ui/project/editor/datamap/cgen/templateeditor/EmbeddableArtefactsConfigurator.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ui/project/editor/datamap/cgen/templateeditor/EmbeddableArtefactsConfigurator.java
index 9ba180df8..abaa30b1c 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ui/project/editor/datamap/cgen/templateeditor/EmbeddableArtefactsConfigurator.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ui/project/editor/datamap/cgen/templateeditor/EmbeddableArtefactsConfigurator.java
@@ -44,7 +44,7 @@ public class EmbeddableArtefactsConfigurator implements ArtefactsConfigurator {
}
private Embeddable getSelectedEntity(String artifactName, ClassGenerationAction action) {
- DataMap dataMap = action.getCgenConfiguration().getDataMap();
+ DataMap dataMap = action.getConfiguration().getDataMap();
if (dataMap != null) {
return dataMap.getEmbeddable(artifactName);
}
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ui/project/editor/datamap/cgen/templateeditor/EntityArtefactsConfigurator.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ui/project/editor/datamap/cgen/templateeditor/EntityArtefactsConfigurator.java
index 13d29a8e6..d0d608c77 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ui/project/editor/datamap/cgen/templateeditor/EntityArtefactsConfigurator.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ui/project/editor/datamap/cgen/templateeditor/EntityArtefactsConfigurator.java
@@ -44,7 +44,7 @@ public class EntityArtefactsConfigurator implements ArtefactsConfigurator {
}
private ObjEntity getSelectedEntity(String artifactName, ClassGenerationAction action) {
- DataMap dataMap = action.getCgenConfiguration().getDataMap();
+ DataMap dataMap = action.getConfiguration().getDataMap();
if (dataMap != null) {
return dataMap.getObjEntity(artifactName);
}
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ui/project/editor/datamap/cgen/templateeditor/PreviewClassGenerationFactory.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ui/project/editor/datamap/cgen/templateeditor/PreviewClassGenerationFactory.java
index 8439e89e5..c50210367 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ui/project/editor/datamap/cgen/templateeditor/PreviewClassGenerationFactory.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ui/project/editor/datamap/cgen/templateeditor/PreviewClassGenerationFactory.java
@@ -41,8 +41,8 @@ public class PreviewClassGenerationFactory implements ClassGenerationActionFacto
private StringWriter writer;
@Override
- public ClassGenerationAction createAction(CgenConfiguration cgenConfiguration) {
- PreviewGenerationAction action = new PreviewGenerationAction(cgenConfiguration);
+ public ClassGenerationAction createAction(CgenConfiguration configuration) {
+ PreviewGenerationAction action = new PreviewGenerationAction(configuration);
action.setUtilsFactory(utilsFactory);
action.setMetadataUtils(metadataUtils);
action.setWriter(writer);
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ui/project/editor/datamap/cgen/templateeditor/PreviewGenerationAction.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ui/project/editor/datamap/cgen/templateeditor/PreviewGenerationAction.java
index 3619e7ddc..cf47fc74d 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ui/project/editor/datamap/cgen/templateeditor/PreviewGenerationAction.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ui/project/editor/datamap/cgen/templateeditor/PreviewGenerationAction.java
@@ -34,8 +34,8 @@ public class PreviewGenerationAction extends ClassGenerationAction {
private StringWriter writer;
- public PreviewGenerationAction(CgenConfiguration cgenConfig) {
- super(cgenConfig);
+ public PreviewGenerationAction(CgenConfiguration configuration) {
+ super(configuration);
}
@Override
diff --git a/modeler/cayenne-modeler/src/test/java/org/apache/cayenne/modeler/editor/templateeditor/ArtifactsConfiguratorTest.java b/modeler/cayenne-modeler/src/test/java/org/apache/cayenne/modeler/editor/templateeditor/ArtifactsConfiguratorTest.java
index c95bde807..787114429 100644
--- a/modeler/cayenne-modeler/src/test/java/org/apache/cayenne/modeler/editor/templateeditor/ArtifactsConfiguratorTest.java
+++ b/modeler/cayenne-modeler/src/test/java/org/apache/cayenne/modeler/editor/templateeditor/ArtifactsConfiguratorTest.java
@@ -64,7 +64,7 @@ public class ArtifactsConfiguratorTest {
embeddableArtefactsConfigurator.config(action,"embeddable");
dataMapArtefactsConfigurator.config(action,"queryDescriptor");
- CgenConfiguration configuration = action.getCgenConfiguration();
+ CgenConfiguration configuration = action.getConfiguration();
Field artifactsField = configuration.getClass().getDeclaredField("artifacts");
artifactsField.setAccessible(true);