9797import com .iemr .admin .repository .rolemaster .M_UserservicerolemappingForRoleProviderAdminRepo ;
9898import com .iemr .admin .service .user .EncryptUserPassword ;
9999import com .iemr .admin .utils .CookieUtil ;
100+ import com .iemr .admin .utils .RestTemplateUtil ;
100101import com .iemr .admin .utils .config .ConfigProperties ;
101102import com .iemr .admin .utils .exception .IEMRException ;
102103import com .iemr .admin .utils .http .HttpUtils ;
@@ -462,17 +463,11 @@ private void updateSupervisorRoleInCTI(List<M_UserServiceRoleMapping2> resList1,
462463 private Set <String > getCTICampaignRoles (String campaignName , String authToken ) throws JsonMappingException , JsonProcessingException {
463464 RestTemplate restTemplate = new RestTemplate ();
464465 ObjectMapper objectMapper = new ObjectMapper ();
465- HttpServletRequest requestHeader = ((ServletRequestAttributes ) RequestContextHolder .getRequestAttributes ())
466- .getRequest ();
467- String jwtTokenFromCookie = cookieUtil .getJwtTokenFromCookie (requestHeader );
468466 Set <String > resultSet = new HashSet <String >();
469- MultiValueMap <String , String > headers = new LinkedMultiValueMap <String , String >();
470- headers .add ("Content-Type" , "application/json" );
471- headers .add ("AUTHORIZATION" , authToken );
472- headers .add ("Jwttoken" , jwtTokenFromCookie );
467+ HttpEntity <Object > request = RestTemplateUtil .createRequestEntity (campaignName , authToken );
473468 String url = configProperties .getPropertyByName ("common-url" ) + configProperties .getPropertyByName ("create-feedback" );
474- HttpEntity < Object > request1 = new HttpEntity < Object >( campaignName , headers );
475- ResponseEntity <String > responseStr = restTemplate .exchange (url , HttpMethod .POST , request1 , String .class );
469+
470+ ResponseEntity <String > responseStr = restTemplate .exchange (url , HttpMethod .POST , request , String .class );
476471 OutputResponse response = objectMapper .readValue (responseStr .getBody (), OutputResponse .class );
477472 if (response .isSuccess ()) {
478473 JSONObject obj = new JSONObject (response .getData ());
@@ -481,9 +476,6 @@ private Set<String> getCTICampaignRoles(String campaignName, String authToken) t
481476 resultSet .add (roles .getString (roleIndex ));
482477 }
483478 }
484- // JSONObject request = new JSONObject();
485- // request.put("campaign", campaignName);
486-
487479 return resultSet ;
488480 }
489481
0 commit comments