1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package fr.paris.lutece.plugins.pluginwizard.service.generator;
35
36 import fr.paris.lutece.plugins.pluginwizard.business.ConfigurationKey;
37 import fr.paris.lutece.plugins.pluginwizard.business.ConfigurationKeyHome;
38 import fr.paris.lutece.plugins.pluginwizard.business.model.PluginModel;
39 import fr.paris.lutece.portal.service.datastore.DatastoreService;
40 import fr.paris.lutece.util.ReferenceList;
41
42 import java.util.Collection;
43 import java.util.HashMap;
44 import java.util.Map;
45
46
47
48
49
50 public class PomGenerator extends AbstractFileGenerator
51 {
52
53 private static final String KEY_PREFIX = "plugin-wizard.site_property.";
54
55 private String _strModelVersion;
56 private String _strGlobalPomVersion;
57 private String _strDependencyCoreVersion;
58 private String _strDependencyRestVersion;
59
60
61
62
63 @Override
64 public Map generate( PluginModel pm, String generationSchemeName )
65 {
66 HashMap map = new HashMap( );
67 map.put( getFilePath( pm ), getCode( pm, generationSchemeName ) );
68
69 return map;
70 }
71
72
73
74
75 @Override
76 protected String getCode( PluginModel pm, String generationSchemeName )
77 {
78 Map<String, Object> model = new HashMap<>( );
79 Collection<ConfigurationKey> listKeys = ConfigurationKeyHome.getConfigurationKeysList( );
80
81
82 for ( ConfigurationKey key : listKeys )
83 {
84 model.put( key.getKeyDescription( ).trim( ), key.getKeyValue( ) );
85 }
86
87 model.put( MARK_KOTLIN, isKotlin( ) );
88 model.put( Markers.MARK_PLUGIN, pm );
89 model.put( Markers.MARK_GLOBAL_POM_VERSION, getGlobalPomVersion( ) );
90 model.put( Markers.MARK_CORE_VERSION, getDependencyCoreVersion( ) );
91 model.put( Markers.MARK_DEPENDECY_REST_VERSION, getDependencyRestVersion( ) );
92 model.put( Markers.MARK_POM_MODEL_VERSION, getModelVersion( ) );
93
94 return build( model );
95 }
96
97
98
99
100 @Override
101 protected String getFilename( PluginModel pm )
102 {
103 return "pom.xml";
104 }
105
106
107
108
109 @Override
110 public String getPath( )
111 {
112 return "";
113 }
114
115
116
117
118
119
120 public String getModelVersion( )
121 {
122 return _strModelVersion;
123 }
124
125
126
127
128
129
130 public void setModelVersion( String strModelVersion )
131 {
132 this._strModelVersion = strModelVersion;
133 }
134
135
136
137
138
139
140 public String getGlobalPomVersion( )
141 {
142 return _strGlobalPomVersion;
143 }
144
145
146
147
148
149
150 public void setGlobalPomVersion( String strVersion )
151 {
152 this._strGlobalPomVersion = strVersion;
153 }
154
155
156
157
158
159
160 public String getDependencyCoreVersion( )
161 {
162 return _strDependencyCoreVersion;
163 }
164
165
166
167
168
169
170 public void setDependencyCoreVersion( String strDependencyCoreVersion )
171 {
172 this._strDependencyCoreVersion = strDependencyCoreVersion;
173 }
174
175
176
177
178
179
180 public String getDependencyRestVersion( )
181 {
182 return _strDependencyRestVersion;
183 }
184
185
186
187
188
189
190 public void setDependencyRestVersion( String strDependencyRestVersion )
191 {
192 this._strDependencyRestVersion = strDependencyRestVersion;
193 }
194 }