27
27
import org .hibernate .SessionFactory ;
28
28
import org .hibernate .criterion .CriteriaSpecification ;
29
29
import org .hibernate .criterion .Disjunction ;
30
- import org .hibernate .criterion .Expression ;
31
30
import org .hibernate .criterion .MatchMode ;
32
31
import org .hibernate .criterion .Order ;
33
32
import org .hibernate .criterion .Restrictions ;
@@ -410,7 +409,7 @@ public List<PersonAttributeType> getAllPersonAttributeTypes(boolean includeRetir
410
409
Criteria criteria = sessionFactory .getCurrentSession ().createCriteria (PersonAttributeType .class , "r" );
411
410
412
411
if (!includeRetired ) {
413
- criteria .add (Expression .eq ("retired" , false ));
412
+ criteria .add (Restrictions .eq ("retired" , false ));
414
413
}
415
414
416
415
criteria .addOrder (Order .asc ("sortWeight" ));
@@ -429,16 +428,16 @@ public List<PersonAttributeType> getPersonAttributeTypes(String exactName, Strin
429
428
Criteria criteria = sessionFactory .getCurrentSession ().createCriteria (PersonAttributeType .class , "r" );
430
429
431
430
if (exactName != null )
432
- criteria .add (Expression .eq ("name" , exactName ));
431
+ criteria .add (Restrictions .eq ("name" , exactName ));
433
432
434
433
if (format != null )
435
- criteria .add (Expression .eq ("format" , format ));
434
+ criteria .add (Restrictions .eq ("format" , format ));
436
435
437
436
if (foreignKey != null )
438
- criteria .add (Expression .eq ("foreignKey" , foreignKey ));
437
+ criteria .add (Restrictions .eq ("foreignKey" , foreignKey ));
439
438
440
439
if (searchable != null )
441
- criteria .add (Expression .eq ("searchable" , searchable ));
440
+ criteria .add (Restrictions .eq ("searchable" , searchable ));
442
441
443
442
return criteria .list ();
444
443
}
@@ -463,7 +462,7 @@ public List<Relationship> getAllRelationships(boolean includeVoided) throws DAOE
463
462
Criteria criteria = sessionFactory .getCurrentSession ().createCriteria (Relationship .class , "r" );
464
463
465
464
if (!includeVoided ) {
466
- criteria .add (Expression .eq ("voided" , false ));
465
+ criteria .add (Restrictions .eq ("voided" , false ));
467
466
}
468
467
469
468
return criteria .list ();
@@ -480,13 +479,13 @@ public List<Relationship> getRelationships(Person fromPerson, Person toPerson, R
480
479
Criteria criteria = sessionFactory .getCurrentSession ().createCriteria (Relationship .class , "r" );
481
480
482
481
if (fromPerson != null )
483
- criteria .add (Expression .eq ("personA" , fromPerson ));
482
+ criteria .add (Restrictions .eq ("personA" , fromPerson ));
484
483
if (toPerson != null )
485
- criteria .add (Expression .eq ("personB" , toPerson ));
484
+ criteria .add (Restrictions .eq ("personB" , toPerson ));
486
485
if (relType != null )
487
- criteria .add (Expression .eq ("relationshipType" , relType ));
486
+ criteria .add (Restrictions .eq ("relationshipType" , relType ));
488
487
489
- criteria .add (Expression .eq ("voided" , false ));
488
+ criteria .add (Restrictions .eq ("voided" , false ));
490
489
491
490
return criteria .list ();
492
491
}
@@ -503,27 +502,28 @@ public List<Relationship> getRelationships(Person fromPerson, Person toPerson, R
503
502
Criteria criteria = sessionFactory .getCurrentSession ().createCriteria (Relationship .class , "r" );
504
503
505
504
if (fromPerson != null )
506
- criteria .add (Expression .eq ("personA" , fromPerson ));
505
+ criteria .add (Restrictions .eq ("personA" , fromPerson ));
507
506
if (toPerson != null )
508
- criteria .add (Expression .eq ("personB" , toPerson ));
507
+ criteria .add (Restrictions .eq ("personB" , toPerson ));
509
508
if (relType != null )
510
- criteria .add (Expression .eq ("relationshipType" , relType ));
509
+ criteria .add (Restrictions .eq ("relationshipType" , relType ));
511
510
if (startEffectiveDate != null ) {
512
511
criteria .add (Restrictions .disjunction ().add (
513
- Restrictions .and (Expression .le ("startDate" , startEffectiveDate ), Expression
514
- . ge ( "endDate" , startEffectiveDate ))).add (
515
- Restrictions .and (Expression .le ("startDate" , startEffectiveDate ), Restrictions .isNull ("endDate" ))).add (
516
- Restrictions .and (Restrictions .isNull ("startDate" ), Expression .ge ("endDate" , startEffectiveDate ))).add (
512
+ Restrictions .and (Restrictions .le ("startDate" , startEffectiveDate ), Restrictions . ge ( "endDate" ,
513
+ startEffectiveDate ))).add (
514
+ Restrictions .and (Restrictions .le ("startDate" , startEffectiveDate ), Restrictions .isNull ("endDate" ))).add (
515
+ Restrictions .and (Restrictions .isNull ("startDate" ), Restrictions .ge ("endDate" , startEffectiveDate ))).add (
517
516
Restrictions .and (Restrictions .isNull ("startDate" ), Restrictions .isNull ("endDate" ))));
518
517
}
519
518
if (endEffectiveDate != null ) {
520
519
criteria .add (Restrictions .disjunction ().add (
521
- Restrictions .and (Expression .le ("startDate" , endEffectiveDate ), Expression .ge ("endDate" , endEffectiveDate )))
522
- .add (Restrictions .and (Expression .le ("startDate" , endEffectiveDate ), Restrictions .isNull ("endDate" )))
523
- .add (Restrictions .and (Restrictions .isNull ("startDate" ), Expression .ge ("endDate" , endEffectiveDate )))
524
- .add (Restrictions .and (Restrictions .isNull ("startDate" ), Restrictions .isNull ("endDate" ))));
520
+ Restrictions .and (Restrictions .le ("startDate" , endEffectiveDate ), Restrictions
521
+ .ge ("endDate" , endEffectiveDate ))).add (
522
+ Restrictions .and (Restrictions .le ("startDate" , endEffectiveDate ), Restrictions .isNull ("endDate" ))).add (
523
+ Restrictions .and (Restrictions .isNull ("startDate" ), Restrictions .ge ("endDate" , endEffectiveDate ))).add (
524
+ Restrictions .and (Restrictions .isNull ("startDate" ), Restrictions .isNull ("endDate" ))));
525
525
}
526
- criteria .add (Expression .eq ("voided" , false ));
526
+ criteria .add (Restrictions .eq ("voided" , false ));
527
527
528
528
return criteria .list ();
529
529
}
@@ -552,7 +552,7 @@ public List<RelationshipType> getRelationshipTypes(String relationshipTypeName,
552
552
new StringType ()));
553
553
554
554
if (preferred != null )
555
- criteria .add (Expression .eq ("preferred" , preferred ));
555
+ criteria .add (Restrictions .eq ("preferred" , preferred ));
556
556
557
557
return criteria .list ();
558
558
}
@@ -779,8 +779,8 @@ public List<RelationshipType> getAllRelationshipTypes(boolean includeRetired) {
779
779
Criteria criteria = sessionFactory .getCurrentSession ().createCriteria (RelationshipType .class );
780
780
criteria .addOrder (Order .asc ("weight" ));
781
781
782
- if (includeRetired == false ) {
783
- criteria .add (Expression .eq ("retired" , false ));
782
+ if (! includeRetired ) {
783
+ criteria .add (Restrictions .eq ("retired" , false ));
784
784
}
785
785
786
786
return criteria .list ();
0 commit comments