2
2
3
3
import static pro .taskana .common .api .BaseQuery .toLowerCopy ;
4
4
5
- import java .sql .SQLException ;
6
5
import java .util .ArrayList ;
7
6
import java .util .List ;
8
7
import org .apache .ibatis .session .RowBounds ;
12
11
import pro .taskana .common .api .TimeInterval ;
13
12
import pro .taskana .common .api .exceptions .InvalidArgumentException ;
14
13
import pro .taskana .common .api .exceptions .SystemException ;
14
+ import pro .taskana .common .internal .InternalTaskanaEngine ;
15
15
import pro .taskana .simplehistory .impl .classification .ClassificationHistoryQuery ;
16
16
import pro .taskana .simplehistory .impl .classification .ClassificationHistoryQueryColumnName ;
17
17
import pro .taskana .spi .history .api .events .classification .ClassificationHistoryEvent ;
@@ -33,7 +33,7 @@ public class ClassificationHistoryQueryImpl implements ClassificationHistoryQuer
33
33
private static final String SQL_EXCEPTION_MESSAGE =
34
34
"Method openConnection() could not open a connection to the database." ;
35
35
36
- private final TaskanaHistoryEngineImpl taskanaHistoryEngine ;
36
+ private final InternalTaskanaEngine internalTaskanaEngine ;
37
37
38
38
private final List <String > orderBy = new ArrayList <>();
39
39
private final List <String > orderColumns = new ArrayList <>();
@@ -82,8 +82,8 @@ public class ClassificationHistoryQueryImpl implements ClassificationHistoryQuer
82
82
private String [] custom7Like ;
83
83
private String [] custom8Like ;
84
84
85
- public ClassificationHistoryQueryImpl (TaskanaHistoryEngineImpl internalTaskanaHistoryEngine ) {
86
- this .taskanaHistoryEngine = internalTaskanaHistoryEngine ;
85
+ public ClassificationHistoryQueryImpl (InternalTaskanaEngine internalTaskanaEngine ) {
86
+ this .internalTaskanaEngine = internalTaskanaEngine ;
87
87
}
88
88
89
89
@ Override
@@ -415,32 +415,26 @@ public ClassificationHistoryQuery orderByCustomAttribute(int num, SortDirection
415
415
416
416
@ Override
417
417
public List <ClassificationHistoryEvent > list () {
418
- List <ClassificationHistoryEvent > result = new ArrayList <>() ;
418
+ List <ClassificationHistoryEvent > result ;
419
419
try {
420
- taskanaHistoryEngine .openConnection ();
421
- result = taskanaHistoryEngine .getSqlSession ().selectList (LINK_TO_MAPPER , this );
422
- return result ;
423
- } catch (SQLException e ) {
424
- LOGGER .error (SQL_EXCEPTION_MESSAGE , e .getCause ());
420
+ internalTaskanaEngine .openConnection ();
421
+ result = internalTaskanaEngine .getSqlSession ().selectList (LINK_TO_MAPPER , this );
425
422
return result ;
426
423
} finally {
427
- taskanaHistoryEngine .returnConnection ();
424
+ internalTaskanaEngine .returnConnection ();
428
425
}
429
426
}
430
427
431
428
@ Override
432
429
public List <ClassificationHistoryEvent > list (int offset , int limit ) {
433
430
List <ClassificationHistoryEvent > result = new ArrayList <>();
434
431
try {
435
- taskanaHistoryEngine .openConnection ();
432
+ internalTaskanaEngine .openConnection ();
436
433
RowBounds rowBounds = new RowBounds (offset , limit );
437
- result = taskanaHistoryEngine .getSqlSession ().selectList (LINK_TO_MAPPER , this , rowBounds );
438
- return result ;
439
- } catch (SQLException e ) {
440
- LOGGER .error (SQL_EXCEPTION_MESSAGE , e .getCause ());
434
+ result = internalTaskanaEngine .getSqlSession ().selectList (LINK_TO_MAPPER , this , rowBounds );
441
435
return result ;
442
436
} finally {
443
- taskanaHistoryEngine .returnConnection ();
437
+ internalTaskanaEngine .returnConnection ();
444
438
}
445
439
}
446
440
@@ -454,17 +448,14 @@ public List<String> listValues(
454
448
this .addOrderCriteria (columnName .toString (), sortDirection );
455
449
456
450
try {
457
- taskanaHistoryEngine .openConnection ();
458
- result = taskanaHistoryEngine .getSqlSession ().selectList (LINK_TO_VALUE_MAPPER , this );
459
- return result ;
460
- } catch (SQLException e ) {
461
- LOGGER .error (SQL_EXCEPTION_MESSAGE , e .getCause ());
451
+ internalTaskanaEngine .openConnection ();
452
+ result = internalTaskanaEngine .getSqlSession ().selectList (LINK_TO_VALUE_MAPPER , this );
462
453
return result ;
463
454
} finally {
464
455
this .orderBy .addAll (cacheOrderBy );
465
456
this .columnName = null ;
466
457
this .orderColumns .remove (orderColumns .size () - 1 );
467
- taskanaHistoryEngine .returnConnection ();
458
+ internalTaskanaEngine .returnConnection ();
468
459
}
469
460
}
470
461
@@ -473,30 +464,24 @@ public ClassificationHistoryEvent single() {
473
464
ClassificationHistoryEvent result = null ;
474
465
try {
475
466
476
- taskanaHistoryEngine .openConnection ();
477
- result = taskanaHistoryEngine .getSqlSession ().selectOne (LINK_TO_MAPPER , this );
467
+ internalTaskanaEngine .openConnection ();
468
+ result = internalTaskanaEngine .getSqlSession ().selectOne (LINK_TO_MAPPER , this );
478
469
479
- return result ;
480
- } catch (SQLException e ) {
481
- LOGGER .error (SQL_EXCEPTION_MESSAGE , e .getCause ());
482
470
return result ;
483
471
} finally {
484
- taskanaHistoryEngine .returnConnection ();
472
+ internalTaskanaEngine .returnConnection ();
485
473
}
486
474
}
487
475
488
476
@ Override
489
477
public long count () {
490
478
Long rowCount = null ;
491
479
try {
492
- taskanaHistoryEngine .openConnection ();
493
- rowCount = taskanaHistoryEngine .getSqlSession ().selectOne (LINK_TO_COUNTER , this );
480
+ internalTaskanaEngine .openConnection ();
481
+ rowCount = internalTaskanaEngine .getSqlSession ().selectOne (LINK_TO_COUNTER , this );
494
482
return (rowCount == null ) ? 0L : rowCount ;
495
- } catch (SQLException e ) {
496
- LOGGER .error (SQL_EXCEPTION_MESSAGE , e .getCause ());
497
- return -1 ;
498
483
} finally {
499
- taskanaHistoryEngine .returnConnection ();
484
+ internalTaskanaEngine .returnConnection ();
500
485
}
501
486
}
502
487
0 commit comments