@@ -131,7 +131,7 @@ public String getName() {
131
131
return name ;
132
132
}
133
133
134
- private List <GenericValue > getTenantList (Property delegatorNameProp ) throws ContainerException {
134
+ private static List <GenericValue > getTenantList (Property delegatorNameProp ) throws ContainerException {
135
135
if (!EntityUtil .isMultiTenantEnabled ()) {
136
136
throw new ContainerException ("Multitenant is disabled, must be enabled in general.properties -> multitenant=Y" );
137
137
}
@@ -148,7 +148,7 @@ private List<GenericValue> getTenantList(Property delegatorNameProp) throws Cont
148
148
}
149
149
}
150
150
151
- private void loadDataForDelegator (Map <String , String > loadDataProps , Configuration configuration ,
151
+ private static void loadDataForDelegator (Map <String , String > loadDataProps , Configuration configuration ,
152
152
Property delegatorNameProp , String overrideDelegator ) throws ContainerException {
153
153
154
154
// prepare command line properties passed by user
@@ -207,7 +207,8 @@ private static boolean isPropertySet(Map<String, String> props, String key) {
207
207
* Gets the default entity-group-name defined in the container definition
208
208
* unless overridden by the user
209
209
*/
210
- private String getEntityGroupNameFromConfig (Configuration cfg , String overrideGroup ) throws ContainerException {
210
+ private static String getEntityGroupNameFromConfig (Configuration cfg , String overrideGroup )
211
+ throws ContainerException {
211
212
if (overrideGroup != null ) {
212
213
return overrideGroup ;
213
214
} else {
@@ -225,15 +226,16 @@ private String getEntityGroupNameFromConfig(Configuration cfg, String overrideGr
225
226
* overridden by the user. This method will create all the tables, keys and
226
227
* indices if missing and hence might take a long time.
227
228
*/
228
- private Delegator getDelegator (Property delegatorNameProp , String overrideDelegator ) throws ContainerException {
229
+ private static Delegator getDelegator (Property delegatorNameProp , String overrideDelegator )
230
+ throws ContainerException {
229
231
if (overrideDelegator != null ) {
230
232
return DelegatorFactory .getDelegator (overrideDelegator );
231
233
} else {
232
234
return getDelegatorFromProp (delegatorNameProp );
233
235
}
234
236
}
235
237
236
- private Delegator getDelegatorFromProp (Property delegatorNameProp ) throws ContainerException {
238
+ private static Delegator getDelegatorFromProp (Property delegatorNameProp ) throws ContainerException {
237
239
if (delegatorNameProp != null && UtilValidate .isNotEmpty (delegatorNameProp .value )) {
238
240
Delegator delegator = DelegatorFactory .getDelegator (delegatorNameProp .value );
239
241
if (delegator != null ) {
@@ -246,32 +248,32 @@ private Delegator getDelegatorFromProp(Property delegatorNameProp) throws Contai
246
248
}
247
249
}
248
250
249
- private Delegator getBaseDelegator (Delegator delegator ) {
251
+ private static Delegator getBaseDelegator (Delegator delegator ) {
250
252
if (delegator .getDelegatorTenantId () != null ) {
251
253
return DelegatorFactory .getDelegator (delegator .getDelegatorBaseName ());
252
254
} else {
253
255
return delegator ;
254
256
}
255
257
}
256
258
257
- private GenericHelperInfo getHelperInfo (Delegator delegator , String entityGroup ) throws ContainerException {
259
+ private static GenericHelperInfo getHelperInfo (Delegator delegator , String entityGroup ) throws ContainerException {
258
260
GenericHelperInfo helperInfo = delegator .getGroupHelperInfo (entityGroup );
259
261
if (helperInfo == null ) {
260
262
throw new ContainerException ("Unable to locate the datasource helper for the group: " + entityGroup );
261
263
}
262
264
return helperInfo ;
263
265
}
264
266
265
- private Map <String , ModelEntity > getModelEntities (Delegator delegator ,
266
- String entityGroup ) throws ContainerException {
267
+ private static Map <String , ModelEntity > getModelEntities (Delegator delegator , String entityGroup )
268
+ throws ContainerException {
267
269
try {
268
270
return delegator .getModelEntityMapByGroup (entityGroup );
269
271
} catch (GenericEntityException e ) {
270
272
throw new ContainerException (e );
271
273
}
272
274
}
273
275
274
- private void createOrUpdateComponentEntities (Delegator baseDelegator ,
276
+ private static void createOrUpdateComponentEntities (Delegator baseDelegator ,
275
277
Collection <ComponentConfig > allComponents ) {
276
278
277
279
for (ComponentConfig config : allComponents ) {
@@ -294,7 +296,7 @@ private void createOrUpdateComponentEntities(Delegator baseDelegator,
294
296
}
295
297
}
296
298
297
- private void dropDbConstraints (DatabaseUtil dbUtil , Map <String , ModelEntity > modelEntities ,
299
+ private static void dropDbConstraints (DatabaseUtil dbUtil , Map <String , ModelEntity > modelEntities ,
298
300
TreeSet <String > modelEntityNames ) {
299
301
300
302
List <String > messages = new ArrayList <>();
@@ -326,7 +328,7 @@ private void dropDbConstraints(DatabaseUtil dbUtil, Map<String, ModelEntity> mod
326
328
logMessageList (messages );
327
329
}
328
330
329
- private void createDbConstraints (DatabaseUtil dbUtil , Map <String , ModelEntity > modelEntities ,
331
+ private static void createDbConstraints (DatabaseUtil dbUtil , Map <String , ModelEntity > modelEntities ,
330
332
TreeSet <String > modelEntityNames ) {
331
333
332
334
List <String > messages = new ArrayList <>();
@@ -358,7 +360,7 @@ private void createDbConstraints(DatabaseUtil dbUtil, Map<String, ModelEntity> m
358
360
logMessageList (messages );
359
361
}
360
362
361
- private void dropPrimaryKeys (DatabaseUtil dbUtil , Map <String , ModelEntity > modelEntities ,
363
+ private static void dropPrimaryKeys (DatabaseUtil dbUtil , Map <String , ModelEntity > modelEntities ,
362
364
TreeSet <String > modelEntityNames ) {
363
365
364
366
List <String > messages = new ArrayList <>();
@@ -374,7 +376,7 @@ private void dropPrimaryKeys(DatabaseUtil dbUtil, Map<String, ModelEntity> model
374
376
logMessageList (messages );
375
377
}
376
378
377
- private void createPrimaryKeys (DatabaseUtil dbUtil , Map <String , ModelEntity > modelEntities ,
379
+ private static void createPrimaryKeys (DatabaseUtil dbUtil , Map <String , ModelEntity > modelEntities ,
378
380
TreeSet <String > modelEntityNames ) {
379
381
380
382
List <String > messages = new ArrayList <>();
@@ -390,7 +392,7 @@ private void createPrimaryKeys(DatabaseUtil dbUtil, Map<String, ModelEntity> mod
390
392
logMessageList (messages );
391
393
}
392
394
393
- private void repairDbColumns (DatabaseUtil dbUtil , Map <String , ModelEntity > modelEntities ) {
395
+ private static void repairDbColumns (DatabaseUtil dbUtil , Map <String , ModelEntity > modelEntities ) {
394
396
List <String > fieldsToRepair = new ArrayList <>();
395
397
List <String > messages = new ArrayList <>();
396
398
dbUtil .checkDb (modelEntities , fieldsToRepair , messages , false , false , false , false );
@@ -401,15 +403,14 @@ private void repairDbColumns(DatabaseUtil dbUtil, Map<String, ModelEntity> model
401
403
logMessageList (messages );
402
404
}
403
405
404
- private void logMessageList (List <String > messages ) {
406
+ private static void logMessageList (List <String > messages ) {
405
407
if (Debug .infoOn ()) {
406
408
messages .forEach (message -> Debug .logInfo (message , module ));
407
409
}
408
410
}
409
411
410
- private void loadData (Delegator delegator , Delegator baseDelegator ,
411
- Collection <ComponentConfig > allComponents ,
412
- GenericHelperInfo helperInfo ,
412
+ private static void loadData (Delegator delegator , Delegator baseDelegator ,
413
+ Collection <ComponentConfig > allComponents , GenericHelperInfo helperInfo ,
413
414
Map <String , String > loadDataProps ) throws ContainerException {
414
415
415
416
// prepare command line properties passed by user
@@ -444,15 +445,15 @@ private void loadData(Delegator delegator, Delegator baseDelegator,
444
445
logDataLoadingResults (infoMessages , errorMessages , totalRowsChanged );
445
446
}
446
447
447
- private int getTransactionTimeout (String timeout ) {
448
+ private static int getTransactionTimeout (String timeout ) {
448
449
try {
449
450
return Integer .parseInt (timeout );
450
451
} catch (Exception e ) {
451
452
return -1 ;
452
453
}
453
454
}
454
455
455
- private List <URL > prepareDataUrls (Delegator delegator , Delegator baseDelegator ,
456
+ private static List <URL > prepareDataUrls (Delegator delegator , Delegator baseDelegator ,
456
457
Collection <ComponentConfig > allComponents , GenericHelperInfo helperInfo ,
457
458
Map <String , String > loadDataProps ) throws ContainerException {
458
459
@@ -499,7 +500,7 @@ private static boolean isDataReadersEnabled(List<String> files, String directory
499
500
return readers != null || (files .isEmpty () && directory == null );
500
501
}
501
502
502
- private List <String > prepareTenantLoadComponents (Delegator delegator , Delegator baseDelegator ,
503
+ private static List <String > prepareTenantLoadComponents (Delegator delegator , Delegator baseDelegator ,
503
504
Collection <ComponentConfig > allComponents , String component ) {
504
505
505
506
List <String > loadComponents = new ArrayList <>();
@@ -529,7 +530,7 @@ private List<String> prepareTenantLoadComponents(Delegator delegator, Delegator
529
530
return loadComponents ;
530
531
}
531
532
532
- private List <URL > retireveDataUrlsFromFileList (List <String > files ) throws ContainerException {
533
+ private static List <URL > retireveDataUrlsFromFileList (List <String > files ) throws ContainerException {
533
534
List <URL > fileUrls = new ArrayList <>();
534
535
for (String file : files ) {
535
536
URL url = UtilURL .fromResource (file );
@@ -542,7 +543,7 @@ private List<URL> retireveDataUrlsFromFileList(List<String> files) throws Contai
542
543
return fileUrls ;
543
544
}
544
545
545
- private List <URL > retrieveDataUrlsFromDirectory (String directory ) {
546
+ private static List <URL > retrieveDataUrlsFromDirectory (String directory ) {
546
547
return Optional .ofNullable (directory )
547
548
.map (dir -> Arrays .asList (new File (dir ).listFiles ()).stream ()
548
549
.filter (file -> file .getName ().toLowerCase (Locale .getDefault ()).endsWith (".xml" ))
@@ -551,7 +552,7 @@ private List<URL> retrieveDataUrlsFromDirectory(String directory) {
551
552
.orElse (new ArrayList <URL >());
552
553
}
553
554
554
- private void logDataLoadingPlan (List <URL > urlList , String delegatorName ) {
555
+ private static void logDataLoadingPlan (List <URL > urlList , String delegatorName ) {
555
556
if (UtilValidate .isNotEmpty (urlList )) {
556
557
Debug .logImportant ("=-=-=-=-=-=-= Doing a data load using delegator '"
557
558
+ delegatorName + "' with the following files:" , module );
@@ -562,7 +563,7 @@ private void logDataLoadingPlan(List<URL> urlList, String delegatorName) {
562
563
}
563
564
}
564
565
565
- private String createDataLoadMessage (URL dataUrl , int rowsChanged , int totalRowsChanged ) {
566
+ private static String createDataLoadMessage (URL dataUrl , int rowsChanged , int totalRowsChanged ) {
566
567
NumberFormat formatter = NumberFormat .getIntegerInstance ();
567
568
formatter .setMinimumIntegerDigits (5 );
568
569
formatter .setGroupingUsed (false );
@@ -571,7 +572,7 @@ private String createDataLoadMessage(URL dataUrl, int rowsChanged, int totalRows
571
572
+ " from " + dataUrl .toExternalForm ();
572
573
}
573
574
574
- private void logDataLoadingResults (List <String > infoMessages ,
575
+ private static void logDataLoadingResults (List <String > infoMessages ,
575
576
List <Object > errorMessages , int totalRowsChanged ) {
576
577
577
578
if (UtilValidate .isNotEmpty (infoMessages )) {
0 commit comments