/* Ċ Ġ* Ġ( C ) ĠCopyright ĠIBM ĠDe ut sch land ĠGmbH Ġ 2 0 2 1 Ċ Ġ* Ġ( C ) ĠCopyright ĠIBM ĠCorp . Ġ 2 0 2 1 Ċ Ġ*/ Ċ Ċ package Ġde . r ki . cov pass . sdk . cert Ċ Ċ import Ġde . r ki . cov pass . sdk . cert . models . D GC Entry Ċ import Ġde . r ki . cov pass . sdk . cert . models . Recovery Ċ import Ġde . r ki . cov pass . sdk . cert . models . Test Ċ import Ġde . r ki . cov pass . sdk . cert . models . V acc ination Ċ import Ġde . r ki . cov pass . sdk . utils . is Ol der Than Ċ import Ġjava . lang . RuntimeException Ċ Ċ public Ġconst Ġval ĠRULE _ VR _ DE _ 0 0 1 : ĠString Ġ= Ġ" VR _ DE _ 0 0 1 " Ċ public Ġconst Ġval ĠRULE _ VR _ DE _ 0 0 2 : ĠString Ġ= Ġ" VR _ DE _ 0 0 2 " Ċ public Ġconst Ġval ĠRULE _ VR _ DE _ 0 0 3 : ĠString Ġ= Ġ" VR _ DE _ 0 0 3 " Ċ public Ġconst Ġval ĠRULE _ VR _ DE _ 0 0 4 : ĠString Ġ= Ġ" VR _ DE _ 0 0 4 " Ċ public Ġconst Ġval ĠRULE _ TR _ DE _ 0 0 1 : ĠString Ġ= Ġ" TR _ DE _ 0 0 1 " Ċ public Ġconst Ġval ĠRULE _ TR _ DE _ 0 0 2 : ĠString Ġ= Ġ" TR _ DE _ 0 0 2 " Ċ public Ġconst Ġval ĠRULE _ TR _ DE _ 0 0 3 : ĠString Ġ= Ġ" TR _ DE _ 0 0 3 " Ċ public Ġconst Ġval ĠRULE _ TR _ DE _ 0 0 4 : ĠString Ġ= Ġ" TR _ DE _ 0 0 4 " Ċ public Ġconst Ġval ĠRULE _ RR _ DE _ 0 0 1 : ĠString Ġ= Ġ" RR _ DE _ 0 0 1 " Ċ public Ġconst Ġval ĠRULE _ RR _ DE _ 0 0 2 : ĠString Ġ= Ġ" RR _ DE _ 0 0 2 " Ċ Ċ /** Ċ Ġ* ĠAssert s Ġthat Ġthe Ġger man Ġvalidation Ġrule Ġset Ġfor Ġthe Ġgiven Ġ[ D GC Entry ] Ġis Ġnot Ġvi olated . Ċ Ġ* Ċ Ġ* Ġ@ throws ĠValidation Rule Violation Exception , Ġif Ġsome Ġof Ġthe Ġvalidation Ġrules Ġis Ġvi olated . Ċ Ġ* Ċ Ġ* ĠTODO ĠThis Ġwill Ġbe Ġreplaced Ġlater Ġon Ġby Ġthe ĠEU Ġrule Ġset . Ċ Ġ* ĠTODO ĠThis Ġwill Ġalso Ġbe Ġused Ġlater Ġon Ġin ĠC ov Pass Ġ( currently Ġonly Ġused Ġin ĠC ov Pass Check ). Ċ Ġ*/ Ċ public Ġfun Ġassert Ger man Validation Rule Set ( d gc Entry : ĠD GC Entry ) Ġ{ ĊĠĠĠ Ġwhen Ġ( d gc Entry ) Ġ{ ĊĠĠĠĠĠĠĠ Ġis ĠV acc ination Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert V acc ination Rules ( d gc Entry ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġis ĠTest Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert Test Rules ( d gc Entry ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġis ĠRecovery Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert Recovery Rules ( d gc Entry ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ Ċ private Ġfun Ġassert V acc ination Rules ( v acc ination : ĠV acc ination ) Ġ{ ĊĠĠĠ Ġassert Rule Vr De 0 0 1 ( v acc ination ) ĊĠĠĠ Ġassert Rule Vr De 0 0 2 ( v acc ination ) ĊĠĠĠ Ġassert Rule Vr De 0 0 3 ( v acc ination ) ĊĠĠĠ Ġassert Rule Vr De 0 0 4 ( v acc ination ) Ċ } Ċ Ċ private Ġfun Ġassert Test Rules ( test : ĠTest ) Ġ{ ĊĠĠĠ Ġassert Rule Tr De 0 0 1 ( test ) ĊĠĠĠ Ġassert Rule Tr De 0 0 2 ( test ) ĊĠĠĠ Ġassert Rule Tr De 0 0 3 ( test ) ĊĠĠĠ Ġassert Rule Tr De 0 0 4 ( test ) Ċ } Ċ Ċ private Ġfun Ġassert Recovery Rules ( recovery : ĠRecovery ) Ġ{ ĊĠĠĠ Ġassert Rule Rr De 0 0 1 ( recovery ) ĊĠĠĠ Ġassert Rule Rr De 0 0 2 ( recovery ) Ċ } Ċ Ċ private Ġfun Ġassert Rule Vr De 0 0 1 ( v acc ination : ĠV acc ination ) Ġ{ ĊĠĠĠ Ġassert Validation Success ( v acc ination . dose Number Ġ== Ġv acc ination . total Serial Do ses , ĠRULE _ VR _ DE _ 0 0 1 ) Ċ } Ċ Ċ private Ġfun Ġassert Rule Vr De 0 0 2 ( v acc ination : ĠV acc ination ) Ġ{ ĊĠĠĠ Ġassert Validation Success ( ĊĠĠĠĠĠĠĠ Ġv acc ination . product Ġin ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠV acc ination . PRODUCT _ COM IR NAT Y , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠV acc ination . PRODUCT _ J AN SS EN , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠV acc ination . PRODUCT _ MO DER NA , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠV acc ination . PRODUCT _ V AX ZE V RI A ĊĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠ ĠRULE _ VR _ DE _ 0 0 2 ĊĠĠĠ Ġ) Ċ } Ċ Ċ private Ġfun Ġassert Rule Vr De 0 0 3 ( v acc ination : ĠV acc ination ) Ġ{ ĊĠĠĠ Ġassert Validation Success ( v acc ination . occ urrence ?. is Ol der Than ( days Ġ= Ġ 1 4 ) Ġ== Ġtrue , ĠRULE _ VR _ DE _ 0 0 3 ) Ċ } Ċ Ċ private Ġfun Ġassert Rule Vr De 0 0 4 ( v acc ination : ĠV acc ination ) Ġ{ ĊĠĠĠ Ġassert Validation Success ( v acc ination . occ urrence ?. is Ol der Than ( days Ġ= Ġ 3 6 5 ) Ġ== Ġfalse , ĠRULE _ VR _ DE _ 0 0 4 ) Ċ } Ċ Ċ private Ġfun Ġassert Rule Tr De 0 0 1 ( test : ĠTest ) Ġ{ ĊĠĠĠ Ġassert Validation Success ( test . test Type Ġin ĠlistOf ( Test . PC R _ TEST , ĠTest . ANT IG EN _ TEST ), ĠRULE _ TR _ DE _ 0 0 1 ) Ċ } Ċ Ċ private Ġfun Ġassert Rule Tr De 0 0 2 ( test : ĠTest ) Ġ{ ĊĠĠĠ Ġassert Validation Success ( ĊĠĠĠĠĠĠĠ Ġtest . test Type Ġ!= ĠTest . ANT IG EN _ TEST Ġ|| ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtest . sample Collection ?. is Ol der Than ( Test . ANT IG EN _ TEST _ EXPI RY _ TIME _ HOUR S ) Ġ== Ġfalse , ĊĠĠĠĠĠĠĠ ĠRULE _ TR _ DE _ 0 0 2 ĊĠĠĠ Ġ) Ċ } Ċ Ċ private Ġfun Ġassert Rule Tr De 0 0 3 ( test : ĠTest ) Ġ{ ĊĠĠĠ Ġassert Validation Success ( ĊĠĠĠĠĠĠĠ Ġtest . test Type Ġ!= ĠTest . PC R _ TEST Ġ|| ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtest . sample Collection ?. is Ol der Than ( Test . PC R _ TEST _ EXPI RY _ TIME _ HOUR S ) Ġ== Ġfalse , ĊĠĠĠĠĠĠĠ ĠRULE _ TR _ DE _ 0 0 3 ĊĠĠĠ Ġ) Ċ } Ċ Ċ private Ġfun Ġassert Rule Tr De 0 0 4 ( test : ĠTest ) Ġ{ ĊĠĠĠ Ġassert Validation Success ( test . test Result Ġ== ĠTest . NEGATIVE _ RESULT , ĠRULE _ TR _ DE _ 0 0 4 ) Ċ } Ċ Ċ private Ġfun Ġassert Rule Rr De 0 0 1 ( recovery : ĠRecovery ) Ġ{ ĊĠĠĠ Ġassert Validation Success ( recovery . first Result ?. is Ol der Than ( 2 7 ) Ġ== Ġtrue , ĠRULE _ RR _ DE _ 0 0 1 ) Ċ } Ċ Ċ private Ġfun Ġassert Rule Rr De 0 0 2 ( recovery : ĠRecovery ) Ġ{ ĊĠĠĠ Ġassert Validation Success ( recovery . first Result ?. is Ol der Than ( 1 8 0 ) Ġ== Ġfalse , ĠRULE _ RR _ DE _ 0 0 2 ) Ċ } Ċ Ċ private Ġfun Ġassert Validation Success ( success : ĠBoolean , Ġrule Identifier : ĠString ) Ġ{ ĊĠĠĠ Ġif Ġ(! success ) Ġthrow ĠValidation Rule Violation Exception ( rule Identifier ) Ċ } Ċ Ċ /** Ċ Ġ* ĠThis Ġexception Ġis Ġthrown Ġwhen Ġa Ġvalidation Ġrule Ġis Ġvi olated . Ċ Ġ* Ċ Ġ* Ġ@ param Ġrule Identifier ĠFor Ġidentifying Ġthe Ġrule , Ġe . g . ĠRR _ DE _ 0 0 2 Ċ Ġ*/ Ċ public Ġclass ĠValidation Rule Violation Exception ( public Ġval Ġrule Identifier : ĠString ) Ġ: ĊĠĠĠ ĠRuntimeException (" Violation Ġof Ġvalidation Ġrule Ġ$ rule Identifier ") Ċ