diff --git a/src/main/java/de/caritas/cob/consultingtypeservice/api/consultingtypes/ConsultingTypeConverter.java b/src/main/java/de/caritas/cob/consultingtypeservice/api/consultingtypes/ConsultingTypeConverter.java index 0a5335e9..d2bc4578 100644 --- a/src/main/java/de/caritas/cob/consultingtypeservice/api/consultingtypes/ConsultingTypeConverter.java +++ b/src/main/java/de/caritas/cob/consultingtypeservice/api/consultingtypes/ConsultingTypeConverter.java @@ -96,6 +96,9 @@ public ConsultingType convert(final ConsultingTypeDTO consultingTypeDTO) { } private WelcomeScreen convert(WelcomeScreenDTO welcomeScreen) { + if (welcomeScreen == null) { + return null; + } return new WelcomeScreen() .withAnonymous(new Anonymous(welcomeScreen.getAnonymous().getTitle(), welcomeScreen.getAnonymous().getText())); @@ -103,6 +106,9 @@ private WelcomeScreen convert(WelcomeScreenDTO welcomeScreen) { private Urls convert(BasicConsultingTypeResponseDTOUrls urls) { + if (urls == null) { + return null; + } return new Urls(urls.getRequiredAidMissingRedirectUrl(), urls.getRegistrationPostcodeFallbackUrl()); } @@ -117,6 +123,9 @@ private Titles convert(BasicConsultingTypeResponseDTOTitles titles) { } private Registration convert(BasicConsultingTypeResponseDTORegistration registration) { + if (registration == null) { + return null; + } return new Registration() .withAutoSelectAgency(registration.getAutoSelectAgency()) .withAutoSelectPostcode(registration.getAutoSelectPostcode()) @@ -127,6 +136,9 @@ private Registration convert(BasicConsultingTypeResponseDTORegistration registra } private Notifications convert(ConsultingTypeDTONotifications notifications) { + if (notifications == null) { + return null; + } return new Notifications() .withTeamSessions( new TeamSessions().withNewMessage( @@ -135,6 +147,9 @@ private Notifications convert(ConsultingTypeDTONotifications notifications) { } private Roles convert(RolesDTO roles) { + if (roles == null) { + return null; + } return new Roles(roles.getConsultant().getRoleNames()); } @@ -145,6 +160,9 @@ private Monitoring convert(ConsultingTypeDTOMonitoring monitoring) { private SessionDataInitializing convert( ConsultingTypeDTOSessionDataInitializing sessionDataInitializing) { + if (sessionDataInitializing == null) { + return null; + } return new SessionDataInitializing() .withAddictiveDrugs(sessionDataInitializing.getAddictiveDrugs()) .withAge(sessionDataInitializing.getAge()) @@ -154,20 +172,32 @@ private SessionDataInitializing convert( } private WelcomeMessage convert(ConsultingTypeDTOWelcomeMessage welcomeMessage) { + if (welcomeMessage == null) { + return null; + } return new WelcomeMessage(welcomeMessage.getSendWelcomeMessage(), welcomeMessage.getWelcomeMessageText()); } private GroupChat convert(BasicConsultingTypeResponseDTOGroupChat groupChat) { + if (groupChat == null) { + return null; + } return new GroupChat(groupChat.getIsGroupChat(), groupChat.getGroupChatRules()); } private WhiteSpot convert(ConsultingTypeDTOWhiteSpot whiteSpot) { + if (whiteSpot == null) { + return null; + } return new WhiteSpot(whiteSpot.getWhiteSpotAgencyAssigned(), whiteSpot.getWhiteSpotAgencyId()); } private RequiredComponents convert(RequiredComponentsDTO requiredComponents) { + if (requiredComponents == null) { + return null; + } List