Skip to content

Commit

Permalink
add debuging support
Browse files Browse the repository at this point in the history
  • Loading branch information
idriss.naji committed Jan 15, 2023
1 parent 3f6f674 commit 104af69
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,19 @@ 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()));
}


private Urls convert(BasicConsultingTypeResponseDTOUrls urls) {
if (urls == null) {
return null;
}
return new Urls(urls.getRequiredAidMissingRedirectUrl(),
urls.getRegistrationPostcodeFallbackUrl());
}
Expand All @@ -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())
Expand All @@ -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(
Expand All @@ -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());
}

Expand All @@ -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())
Expand All @@ -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<Option> options = new ArrayList<>();
requiredComponents.getAge().getOptions()
.forEach(optionDTO -> options.add(new Option(optionDTO.getValue(), optionDTO.getLabel())));
Expand All @@ -181,6 +211,9 @@ private RequiredComponents convert(RequiredComponentsDTO requiredComponents) {

private FurtherInformation convert(
BasicConsultingTypeResponseDTOFurtherInformation furtherInformation) {
if (furtherInformation == null) {
return null;
}
return new FurtherInformation(furtherInformation.getLabel(), furtherInformation.getUrl());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ public ConsultingType getConsultingTypeBySlug(String slug) {
*/
public Optional<ConsultingTypeEntity> addConsultingType(final ConsultingType consultingType) {
log.debug("Using tenant unaware repository service to try to add a consulting type");
if (isConsultingTypeWithGivenIdPresent(consultingType)
|| slugIsNotValid(consultingType)) {
if (isConsultingTypeWithGivenIdPresent(consultingType)) {
LogService.logWarning(String
.format("Could not add consulting type. id %s or slug %s is not unique",
consultingType.getId(), consultingType.getSlug()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ private List<ConsultingType> findBySlug(String slug) {
*/
public Optional<ConsultingTypeEntity> addConsultingType(final ConsultingType consultingType) {
log.debug("Using tenant aware repository service to try to add consulting type");
if (isConsultingTypeWithGivenIdPresent(consultingType)
|| isConsultingTypeWithGivenSlugPresent(consultingType)) {
if (isConsultingTypeWithGivenIdPresent(consultingType)) {
LogService.logWarning(String
.format("Could not add consulting type. id %s or slug %s is not unique",
consultingType.getId(), consultingType.getSlug()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
@Configuration
@EnableGlobalMethodSecurity(
prePostEnabled = true)
@EnableWebSecurity
@EnableWebSecurity(debug = true)
public class SecurityConfig extends KeycloakWebSecurityConfigurerAdapter {

@Value("${csrf.cookie.property}")
Expand Down

0 comments on commit 104af69

Please sign in to comment.