Skip to content

Commit 8921267

Browse files
Enhanced and refactored bunch of generators and all related files and their testcases
1 parent 1ca8d8d commit 8921267

File tree

47 files changed

+848
-913
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+848
-913
lines changed

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

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,52 +6,36 @@
66
package com.magento.idea.magento2plugin.actions.generation.data;
77

88
public class DataModelData {
9-
private final String namespace;
9+
1010
private final String name;
11+
private final String interfaceName;
1112
private final String moduleName;
12-
private final String fqn;
13-
private final String interfaceFQN;
1413
private final String properties;
1514
private final boolean withInterface;
1615

1716
/**
1817
* Constructor.
1918
*
20-
* @param namespace String
2119
* @param name String
20+
* @param interfaceName String
2221
* @param moduleName String
23-
* @param fqn String
24-
* @param interfaceFQN String
2522
* @param properties String
2623
* @param hasInterface boolean
2724
*/
2825
public DataModelData(
29-
final String namespace,
3026
final String name,
27+
final String interfaceName,
3128
final String moduleName,
32-
final String fqn,
33-
final String interfaceFQN,
3429
final String properties,
3530
final boolean hasInterface
3631
) {
37-
this.namespace = namespace;
3832
this.name = name;
33+
this.interfaceName = interfaceName;
3934
this.moduleName = moduleName;
40-
this.fqn = fqn;
41-
this.interfaceFQN = interfaceFQN;
4235
this.properties = properties;
4336
this.withInterface = hasInterface;
4437
}
4538

46-
/**
47-
* Get Namespace.
48-
*
49-
* @return String
50-
*/
51-
public String getNamespace() {
52-
return namespace;
53-
}
54-
5539
/**
5640
* Get Name.
5741
*
@@ -62,30 +46,21 @@ public String getName() {
6246
}
6347

6448
/**
65-
* Get module name.
49+
* Get interface name.
6650
*
6751
* @return String
6852
*/
69-
public String getModuleName() {
70-
return moduleName;
53+
public String getInterfaceName() {
54+
return interfaceName;
7155
}
7256

7357
/**
74-
* Get FQN.
75-
*
76-
* @return String
77-
*/
78-
public String getFQN() {
79-
return fqn;
80-
}
81-
82-
/**
83-
* Get Interface FQN.
58+
* Get module name.
8459
*
8560
* @return String
8661
*/
87-
public String getInterfaceFQN() {
88-
return interfaceFQN;
62+
public String getModuleName() {
63+
return moduleName;
8964
}
9065

9166
/**

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

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,54 @@
55

66
package com.magento.idea.magento2plugin.actions.generation.data;
77

8+
import org.jetbrains.annotations.NotNull;
9+
810
public class DataModelInterfaceData {
9-
private final String namespace;
11+
1012
private final String name;
1113
private final String moduleName;
12-
private final String fqn;
1314
private final String properties;
1415

1516
/**
16-
* Constructor.
17+
* Data model interface constructor.
18+
*
19+
* @param name String
20+
* @param moduleName String
21+
* @param properties String
1722
*/
1823
public DataModelInterfaceData(
19-
final String namespace,
20-
final String name,
21-
final String moduleName,
22-
final String fqn,
23-
final String properties
24+
final @NotNull String name,
25+
final @NotNull String moduleName,
26+
final @NotNull String properties
2427
) {
25-
this.namespace = namespace;
2628
this.name = name;
2729
this.moduleName = moduleName;
28-
this.fqn = fqn;
2930
this.properties = properties;
3031
}
3132

32-
public String getNamespace() {
33-
return namespace;
34-
}
35-
33+
/**
34+
* Get data model interface name.
35+
*
36+
* @return String
37+
*/
3638
public String getName() {
3739
return name;
3840
}
3941

42+
/**
43+
* Get module name.
44+
*
45+
* @return String
46+
*/
4047
public String getModuleName() {
4148
return moduleName;
4249
}
4350

44-
public String getFQN() {
45-
return fqn;
46-
}
47-
51+
/**
52+
* Get properties.
53+
*
54+
* @return String
55+
*/
4856
public String getProperties() {
4957
return properties;
5058
}

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

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,38 @@
88
import org.jetbrains.annotations.NotNull;
99

1010
public class EntityDataMapperData {
11+
1112
private final String moduleName;
1213
private final String entityName;
13-
private final String namespace;
14-
private final String classFqn;
15-
private final String modelClassFqn;
16-
private final String dataModelClassFqn;
14+
private final String modelName;
15+
private final String dtoName;
16+
private final String dtoInterfaceName;
17+
private final boolean isDtoWithInterface;
1718

1819
/**
1920
* Magento entity data mapper data constructor.
2021
*
2122
* @param moduleName String
2223
* @param entityName String
23-
* @param namespace String
24-
* @param modelClassFqn String
25-
* @param dataModelClassFqn String
24+
* @param modelName String
25+
* @param dtoName String
26+
* @param dtoInterfaceName String
27+
* @param isDtoWithInterface boolean
2628
*/
2729
public EntityDataMapperData(
2830
final @NotNull String moduleName,
2931
final @NotNull String entityName,
30-
final @NotNull String namespace,
31-
final @NotNull String classFqn,
32-
final @NotNull String modelClassFqn,
33-
final @NotNull String dataModelClassFqn
32+
final @NotNull String modelName,
33+
final @NotNull String dtoName,
34+
final @NotNull String dtoInterfaceName,
35+
final boolean isDtoWithInterface
3436
) {
3537
this.moduleName = moduleName;
3638
this.entityName = entityName;
37-
this.namespace = namespace;
38-
this.classFqn = classFqn;
39-
this.modelClassFqn = modelClassFqn;
40-
this.dataModelClassFqn = dataModelClassFqn;
39+
this.modelName = modelName;
40+
this.dtoName = dtoName;
41+
this.dtoInterfaceName = dtoInterfaceName;
42+
this.isDtoWithInterface = isDtoWithInterface;
4143
}
4244

4345
/**
@@ -59,38 +61,38 @@ public String getEntityName() {
5961
}
6062

6163
/**
62-
* Get namespace.
64+
* Get model name.
6365
*
6466
* @return String
6567
*/
66-
public String getNamespace() {
67-
return namespace;
68+
public String getModelName() {
69+
return modelName;
6870
}
6971

7072
/**
71-
* Get class fqn.
73+
* Get DTO name.
7274
*
7375
* @return String
7476
*/
75-
public String getClassFqn() {
76-
return classFqn;
77+
public String getDtoName() {
78+
return dtoName;
7779
}
7880

7981
/**
80-
* Get model class fqn.
82+
* Get DTO interface name.
8183
*
8284
* @return String
8385
*/
84-
public String getModelClassFqn() {
85-
return modelClassFqn;
86+
public String getDtoInterfaceName() {
87+
return dtoInterfaceName;
8688
}
8789

8890
/**
89-
* Get data model class fqn.
91+
* Check if DTO has interface.
9092
*
91-
* @return String
93+
* @return boolean
9294
*/
93-
public String getDataModelClassFqn() {
94-
return dataModelClassFqn;
95+
public boolean isDtoWithInterface() {
96+
return isDtoWithInterface;
9597
}
9698
}

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

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,30 @@
88
import org.jetbrains.annotations.NotNull;
99

1010
public class GetListQueryModelData {
11+
1112
private final String moduleName;
1213
private final String entityName;
13-
private final String collectionType;
14-
private final String collectionTypeFactory;
15-
private final String entityDataMapperType;
14+
private final String modelName;
15+
private final String collectionName;
1616

1717
/**
1818
* Query Model DTO Constructor.
1919
*
2020
* @param moduleName String
2121
* @param entityName String
22-
* @param collectionType String
23-
* @param entityDataMapperType String
22+
* @param modelName String
23+
* @param collectionName String
2424
*/
2525
public GetListQueryModelData(
2626
final @NotNull String moduleName,
2727
final @NotNull String entityName,
28-
final @NotNull String collectionType,
29-
final @NotNull String entityDataMapperType
28+
final @NotNull String modelName,
29+
final @NotNull String collectionName
3030
) {
3131
this.moduleName = moduleName;
3232
this.entityName = entityName;
33-
this.collectionType = collectionType;
34-
this.collectionTypeFactory = collectionType.concat("Factory");
35-
this.entityDataMapperType = entityDataMapperType;
33+
this.modelName = modelName;
34+
this.collectionName = collectionName;
3635
}
3736

3837
/**
@@ -54,29 +53,20 @@ public String getEntityName() {
5453
}
5554

5655
/**
57-
* Get entity collection type.
58-
*
59-
* @return String
60-
*/
61-
public String getCollectionType() {
62-
return collectionType;
63-
}
64-
65-
/**
66-
* Get entity collection type factory.
56+
* Get model name.
6757
*
6858
* @return String
6959
*/
70-
public String getCollectionTypeFactory() {
71-
return collectionTypeFactory;
60+
public String getModelName() {
61+
return modelName;
7262
}
7363

7464
/**
75-
* Get entity data mapper type.
65+
* Get entity collection name.
7666
*
7767
* @return String
7868
*/
79-
public String getEntityDataMapperType() {
80-
return entityDataMapperType;
69+
public String getCollectionName() {
70+
return collectionName;
8171
}
8272
}

0 commit comments

Comments
 (0)