18
18
import org .springframework .lang .Nullable ;
19
19
import org .springframework .util .Assert ;
20
20
21
+ import ca .gov .dtsstn .passport .api .config .properties .FeatureFlagsProperties ;
21
22
import ca .gov .dtsstn .passport .api .service .SourceCodeService ;
22
23
import ca .gov .dtsstn .passport .api .service .StatusCodeService ;
23
24
import ca .gov .dtsstn .passport .api .service .domain .PassportStatus ;
38
39
@ Mapper (componentModel = "spring" )
39
40
public abstract class CertificateApplicationModelMapper {
40
41
42
+ @ Autowired
43
+ private FeatureFlagsProperties featureFlagsProperties ;
44
+
41
45
@ Autowired
42
46
protected SourceCodeService sourceCodeService ;
43
47
@@ -162,6 +166,8 @@ protected String findApplicationRegisterSid(@Nullable Iterable<CertificateApplic
162
166
protected List <CertificateApplicationIdentificationModel > getCertificateApplicationIdentifications (@ Nullable PassportStatus passportStatus ) {
163
167
if (passportStatus == null ) { return null ; }
164
168
169
+ boolean displayManifest = !isStatusManifestHidden (passportStatus );
170
+
165
171
final CertificateApplicationIdentificationModel applicationRegisterSid = Optional .ofNullable (passportStatus .getApplicationRegisterSid ())
166
172
.map (xxx -> ImmutableCertificateApplicationIdentificationModel .builder ()
167
173
.identificationCategoryText (CertificateApplicationIdentificationModel .APPLICATION_REGISTER_SID_CATEGORY_TEXT )
@@ -177,15 +183,27 @@ protected List<CertificateApplicationIdentificationModel> getCertificateApplicat
177
183
.orElse (null );
178
184
179
185
final CertificateApplicationIdentificationModel manifestNumber = Optional .ofNullable (passportStatus .getManifestNumber ())
180
- .map (xxx -> ImmutableCertificateApplicationIdentificationModel .builder ()
181
- .identificationCategoryText (CertificateApplicationIdentificationModel .MANIFEST_NUMBER_CATEGORY_TEXT )
182
- .identificationId (passportStatus .getManifestNumber ())
183
- .build ())
184
- .orElse (null );
186
+ .filter (xxx -> displayManifest )
187
+ .map (xxx -> ImmutableCertificateApplicationIdentificationModel .builder ()
188
+ .identificationCategoryText (CertificateApplicationIdentificationModel .MANIFEST_NUMBER_CATEGORY_TEXT )
189
+ .identificationId (passportStatus .getManifestNumber ())
190
+ .build ())
191
+ .orElse (null );
185
192
186
193
return Stream .of (applicationRegisterSid , fileNumber , manifestNumber ).filter (Objects ::nonNull ).toList ();
187
194
}
188
195
196
+ private boolean isStatusManifestHidden (@ Nullable PassportStatus passportStatus ) {
197
+ return Optional .ofNullable (passportStatus )
198
+ .map (PassportStatus ::getStatusCodeId )
199
+ .flatMap (statusCodeService ::read )
200
+ .map (StatusCode ::getCode )
201
+ .map (code -> {
202
+ return featureFlagsProperties .getHiddenManifests ().contains (code );
203
+ })
204
+ .orElse (false );
205
+ }
206
+
189
207
@ Nullable
190
208
@ Named ("getPersonGivenNames" )
191
209
protected List <String > getPersonGivenNames (@ Nullable PassportStatus passportStatus ) {
0 commit comments