Skip to content

Commit 4202bbf

Browse files
Code refactoring after CR
1 parent d5b00de commit 4202bbf

9 files changed

+40
-43
lines changed

src/com/magento/idea/magento2plugin/actions/generation/data/DeleteEntityControllerFileData.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class DeleteEntityControllerFileData {
1313
private final String moduleName;
1414
private final String acl;
1515
private final String entityId;
16-
private final boolean deleteCommandHasInterface;
16+
private final boolean hasDeleteCommandInterface;
1717

1818
/**
1919
* Controller Delete file constructor.
@@ -22,19 +22,20 @@ public class DeleteEntityControllerFileData {
2222
* @param moduleName String
2323
* @param acl String
2424
* @param entityId String
25+
* @param hasDeleteCommandInterface boolean
2526
*/
2627
public DeleteEntityControllerFileData(
2728
final @NotNull String entityName,
2829
final @NotNull String moduleName,
2930
final @NotNull String acl,
3031
final @NotNull String entityId,
31-
final boolean isDeleteCommandHasInterface
32+
final boolean hasDeleteCommandInterface
3233
) {
3334
this.entityName = entityName;
3435
this.moduleName = moduleName;
3536
this.acl = acl;
3637
this.entityId = entityId;
37-
this.deleteCommandHasInterface = isDeleteCommandHasInterface;
38+
this.hasDeleteCommandInterface = hasDeleteCommandInterface;
3839
}
3940

4041
/**
@@ -78,7 +79,7 @@ public String getEntityId() {
7879
*
7980
* @return boolean
8081
*/
81-
public boolean isDeleteCommandHasInterface() {
82-
return deleteCommandHasInterface;
82+
public boolean isHasDeleteCommandInterface() {
83+
return hasDeleteCommandInterface;
8384
}
8485
}

src/com/magento/idea/magento2plugin/actions/generation/data/EntityDataMapperData.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class EntityDataMapperData {
1515
private final String modelName;
1616
private final String dtoName;
1717
private final String dtoInterfaceName;
18-
private final boolean dtoWithInterface;
18+
private final boolean hasDtoInterface;
1919

2020
/**
2121
* Magento entity data mapper data constructor.
@@ -25,22 +25,22 @@ public class EntityDataMapperData {
2525
* @param modelName String
2626
* @param dtoName String
2727
* @param dtoInterfaceName String
28-
* @param isDtoWithInterface boolean
28+
* @param hasDtoInterface boolean
2929
*/
3030
public EntityDataMapperData(
3131
final @NotNull String moduleName,
3232
final @NotNull String entityName,
3333
final @NotNull String modelName,
3434
final @NotNull String dtoName,
3535
final @NotNull String dtoInterfaceName,
36-
final boolean isDtoWithInterface
36+
final boolean hasDtoInterface
3737
) {
3838
this.moduleName = moduleName;
3939
this.entityName = entityName;
4040
this.modelName = modelName;
4141
this.dtoName = dtoName;
4242
this.dtoInterfaceName = dtoInterfaceName;
43-
this.dtoWithInterface = isDtoWithInterface;
43+
this.hasDtoInterface = hasDtoInterface;
4444
}
4545

4646
/**
@@ -93,7 +93,7 @@ public String getDtoInterfaceName() {
9393
*
9494
* @return boolean
9595
*/
96-
public boolean isDtoWithInterface() {
97-
return dtoWithInterface;
96+
public boolean isHasDtoInterface() {
97+
return hasDtoInterface;
9898
}
9999
}

src/com/magento/idea/magento2plugin/actions/generation/data/SaveEntityControllerFileData.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public class SaveEntityControllerFileData {
1515
private final String entityId;
1616
private final String dtoName;
1717
private final String dtoInterfaceName;
18-
private final boolean dtoWithInterface;
19-
private final boolean saveCommandHasInterface;
18+
private final boolean hasDtoInterface;
19+
private final boolean hasSaveCommandInterface;
2020

2121
/**
2222
* Controller save file constructor.
@@ -27,8 +27,8 @@ public class SaveEntityControllerFileData {
2727
* @param entityId String
2828
* @param dtoName String
2929
* @param dtoInterfaceName String
30-
* @param isDtoWithInterface boolean
31-
* @param isSaveCommandHasInterface boolean
30+
* @param hasDtoInterface boolean
31+
* @param hasSaveCommandInterface boolean
3232
*/
3333
public SaveEntityControllerFileData(
3434
final @NotNull String entityName,
@@ -37,17 +37,17 @@ public SaveEntityControllerFileData(
3737
final @NotNull String entityId,
3838
final @NotNull String dtoName,
3939
final @NotNull String dtoInterfaceName,
40-
final boolean isDtoWithInterface,
41-
final boolean isSaveCommandHasInterface
40+
final boolean hasDtoInterface,
41+
final boolean hasSaveCommandInterface
4242
) {
4343
this.entityName = entityName;
4444
this.moduleName = moduleName;
4545
this.acl = acl;
4646
this.entityId = entityId;
4747
this.dtoName = dtoName;
4848
this.dtoInterfaceName = dtoInterfaceName;
49-
this.dtoWithInterface = isDtoWithInterface;
50-
this.saveCommandHasInterface = isSaveCommandHasInterface;
49+
this.hasDtoInterface = hasDtoInterface;
50+
this.hasSaveCommandInterface = hasSaveCommandInterface;
5151
}
5252

5353
/**
@@ -109,16 +109,16 @@ public String getDtoInterfaceName() {
109109
*
110110
* @return boolean
111111
*/
112-
public boolean isDtoWithInterface() {
113-
return dtoWithInterface;
112+
public boolean isHasDtoInterface() {
113+
return hasDtoInterface;
114114
}
115115

116116
/**
117117
* Check if save command has interface.
118118
*
119119
* @return boolean
120120
*/
121-
public boolean isSaveCommandHasInterface() {
122-
return saveCommandHasInterface;
121+
public boolean isHasSaveCommandInterface() {
122+
return hasSaveCommandInterface;
123123
}
124124
}

src/com/magento/idea/magento2plugin/actions/generation/data/UiComponentDataProviderData.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class UiComponentDataProviderData {
1111
private final String path;
1212
private final String entityName;
1313
private final String entityIdFieldName;
14-
private final boolean queryHasInterface;
14+
private final boolean hasQueryInterface;
1515

1616
/**
1717
* UiComponentGridDataProviderData constructor.
@@ -33,20 +33,20 @@ public UiComponentDataProviderData(
3333
* @param path String
3434
* @param entityName String
3535
* @param entityIdFieldName String
36-
* @param isQueryHasInterface boolean
36+
* @param hasQueryInterface boolean
3737
*/
3838
public UiComponentDataProviderData(
3939
final String name,
4040
final String path,
4141
final String entityName,
4242
final String entityIdFieldName,
43-
final boolean isQueryHasInterface
43+
final boolean hasQueryInterface
4444
) {
4545
this.name = name;
4646
this.path = path;
4747
this.entityName = entityName;
4848
this.entityIdFieldName = entityIdFieldName;
49-
this.queryHasInterface = isQueryHasInterface;
49+
this.hasQueryInterface = hasQueryInterface;
5050
}
5151

5252
/**
@@ -90,7 +90,7 @@ public String getEntityIdFieldName() {
9090
*
9191
* @return boolean
9292
*/
93-
public boolean isQueryHasInterface() {
94-
return queryHasInterface;
93+
public boolean isHasQueryInterface() {
94+
return hasQueryInterface;
9595
}
9696
}

src/com/magento/idea/magento2plugin/actions/generation/generator/DeleteEntityControllerFileGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ protected void fillAttributes(final @NotNull Properties attributes) {
7272
new DeleteEntityByIdCommandFile(
7373
data.getModuleName(),
7474
data.getEntityName(),
75-
data.isDeleteCommandHasInterface()
75+
data.isHasDeleteCommandInterface()
7676
).getClassFqn()
7777
)
7878
.append("CONTEXT", BackendModuleType.CONTEXT.getType())

src/com/magento/idea/magento2plugin/actions/generation/generator/EntityDataMapperGenerator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ protected AbstractPhpFile initFile() {
6262
@Override
6363
protected void fillAttributes(final @NotNull Properties attributes) {
6464
final ModelFile modelFile = new ModelFile(data.getModuleName(), data.getModelName());
65-
final DataModelFile dtoFile = new DataModelFile(data.getDtoName(), data.getModuleName());
65+
final DataModelFile dtoFile = new DataModelFile(data.getModuleName(), data.getDtoName());
6666
final DataModelInterfaceFile dtoInterfaceFile =
6767
new DataModelInterfaceFile(data.getModuleName(), data.getDtoInterfaceName());
6868
String dtoType;
6969

70-
if (data.isDtoWithInterface()) {
70+
if (data.isHasDtoInterface()) {
7171
dtoType = dtoInterfaceFile.getClassFqn();
7272
} else {
7373
dtoType = dtoFile.getClassFqn();

src/com/magento/idea/magento2plugin/actions/generation/generator/SaveEntityControllerFileGenerator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected AbstractPhpFile initFile() {
6565
protected void fillAttributes(final @NotNull Properties attributes) {
6666
String dtoType;
6767

68-
if (data.isDtoWithInterface()) {
68+
if (data.isHasDtoInterface()) {
6969
final DataModelInterfaceFile dataModelInterfaceFile =
7070
new DataModelInterfaceFile(data.getModuleName(), data.getDtoInterfaceName());
7171
dtoType = dataModelInterfaceFile.getClassFqn();
@@ -90,7 +90,7 @@ protected void fillAttributes(final @NotNull Properties attributes) {
9090
new SaveEntityCommandFile(
9191
data.getModuleName(),
9292
data.getEntityName(),
93-
data.isSaveCommandHasInterface()
93+
data.isHasSaveCommandInterface()
9494
).getClassFqn()
9595
)
9696
.append("DATA_OBJECT", FrameworkLibraryType.DATA_OBJECT.getType())

src/com/magento/idea/magento2plugin/actions/generation/generator/UiComponentDataProviderGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ protected void fillAttributes(final @NotNull Properties attributes) {
8181
new GetListQueryFile(
8282
moduleName,
8383
data.getEntityName(),
84-
data.isQueryHasInterface()
84+
data.isHasQueryInterface()
8585
).getClassFqn()
8686
)
8787
.append("REPORTING_TYPE", FrameworkLibraryType.REPORTING.getType())

src/com/magento/idea/magento2plugin/actions/generation/generator/pool/provider/NewEntityGeneratorsProviderUtil.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,11 @@ public static void initializeGenerators(
138138
)
139139
.addNext(
140140
EntityDataMapperGeneratorHandler.class,
141-
new EntityDataMapperDtoConverter(context, dialogData),
142-
dialogData::hasAdminUiComponents
141+
new EntityDataMapperDtoConverter(context, dialogData)
143142
)
144143
.addNext(
145144
GetListQueryGeneratorHandler.class,
146-
new GetListQueryDtoConverter(context, dialogData),
147-
dialogData::hasAdminUiComponents
145+
new GetListQueryDtoConverter(context, dialogData)
148146
)
149147
.addNext(
150148
DataProviderGeneratorHandler.class,
@@ -173,13 +171,11 @@ public static void initializeGenerators(
173171
)
174172
.addNext(
175173
SaveCommandGeneratorHandler.class,
176-
new SaveEntityCommandDtoConverter(context, dialogData),
177-
dialogData::hasAdminUiComponents
174+
new SaveEntityCommandDtoConverter(context, dialogData)
178175
)
179176
.addNext(
180177
DeleteByIdCommandGeneratorHandler.class,
181-
new DeleteEntityByIdCommandDtoConverter(context, dialogData),
182-
dialogData::hasAdminUiComponents
178+
new DeleteEntityByIdCommandDtoConverter(context, dialogData)
183179
)
184180
.addNext(
185181
FormSaveControllerGeneratorHandler.class,

0 commit comments

Comments
 (0)