Skip to content

Commit

Permalink
Cbrelease 4.8.18 (sunbird-cb#171)
Browse files Browse the repository at this point in the history
* 4.8.18 dev v5 (sunbird-cb#146)

* commiting for file uploading and downloading cios logs (sunbird-cb#142)

* commiting for file uploading and downloading cios logs

* commiting for deleting temp file directly in download api.

* "Resolved Security Hotspots by adding proper logging" (sunbird-cb#145)

* "Resolved Security Hotspots by adding proper logging"

* "Resolved bugs raised by SonarQube"

* "Resolved bugs raised by SonarQube"

---------

Co-authored-by: pathiktarento1089 <123535830+pathiktarento1089@users.noreply.github.com>
Co-authored-by: vikrantbipin <118338417+vikrantbipin@users.noreply.github.com>

* 4.8.18 merged (sunbird-cb#148)

* 4.8.17 dev v5 (sunbird-cb#44)

* KB-6678 - if assessment is submitted without selecting any option then same questions are repeating in each attempt (in question weightage)

1. Getting NaN if both correct and incorrect are 0 , So added a check.

* added api for to show V6 competencies (sunbird-cb#40)

* added api for to show V6 competencies

* worked on code review comments

* worked on code review comments

* Update application.properties removed spaces between the values

---------

Co-authored-by: anilkumar <anilkumar.kammlapalli@tarento.com>

---------

Co-authored-by: SaipradeepR <53404427+SaipradeepR@users.noreply.github.com>
Co-authored-by: tarentomaheshvakkund <139739142+tarentomaheshvakkund@users.noreply.github.com>
Co-authored-by: anilkumarkammalapalli <121931293+anilkumarkammalapalli@users.noreply.github.com>
Co-authored-by: anilkumar <anilkumar.kammlapalli@tarento.com>

* public link generation and calling email sending api

* public link generation and calling email sending api (sunbird-cb#112)

* convertToPng code added

* png and email encryption method added (sunbird-cb#114)

* public link generation and calling email sending api

* convertToPng code added

* pull from upstream

* Cbrelease 4.8.17 (sunbird-cb#115)

* public link generation and calling email sending api

* convertToPng code added

* pull from upstream

* svg issue resolved

* svg issue resolved (sunbird-cb#118)

* public link generation and calling email sending api

* convertToPng code added

* pull from upstream

* svg issue resolved

* 4.8.17 report fix (sunbird-cb#107)

* Adding impl for report download (sunbird-cb#101)

* 4.8.17 mdo report fix (sunbird-cb#105)

* Adding impl for report download

* Adding impl for report download

* Adding impl for report download (sunbird-cb#106)

* upload issue resolved

* Cbrelease 4.8.17 (sunbird-cb#119)

* public link generation and calling email sending api

* convertToPng code added

* pull from upstream

* svg issue resolved

* upload issue resolved

* certificateId hardCode removed

* CertificateId hard code removed (sunbird-cb#120)

* public link generation and calling email sending api

* convertToPng code added

* pull from upstream

* svg issue resolved

* upload issue resolved

* certificateId hardCode removed

* producer code added

* producer code added

* MAde the impl changes for pdf generator (sunbird-cb#122)

* Remove unused impl and adding null check (sunbird-cb#123)

* Remove unused impl and update the check (sunbird-cb#124)

* Remove unused impl (sunbird-cb#125)

* Update the property (sunbird-cb#126)

* Adding the impl changes for pdf issue (sunbird-cb#127)

* Added the check for the kafka event process

* Integerating content progress update along with assessment submit API - KAR-788 (sunbird-cb#129) (sunbird-cb#133)

Co-authored-by: sreerag-tarento <sreerag.sajeesh@tarento.com>

* Integerating content progress API with all v4,v5 & v6 version of assessment submit API - KAR-788 (sunbird-cb#135) (sunbird-cb#139)

* Integerating content progress update along with assessment submit API - KAR-788

* Integerating content progress APi with all v4,v5 & v6 version of assessment submit API

Co-authored-by: sreerag-tarento <sreerag.sajeesh@tarento.com>

* Fixed build issues

* Creating v2 API to fetch l1, l2 child from postgres (sunbird-cb#147)

---------

Co-authored-by: Karthikeyan Rajendran <70887864+karthik-tarento@users.noreply.github.com>
Co-authored-by: SaipradeepR <53404427+SaipradeepR@users.noreply.github.com>
Co-authored-by: tarentomaheshvakkund <139739142+tarentomaheshvakkund@users.noreply.github.com>
Co-authored-by: anilkumarkammalapalli <121931293+anilkumarkammalapalli@users.noreply.github.com>
Co-authored-by: anilkumar <anilkumar.kammlapalli@tarento.com>
Co-authored-by: arpithasureshappa <arpitha.sureshappa@tarento.com>
Co-authored-by: Sharath Prasad <sharaths.kashyap@gmail.com>
Co-authored-by: sreerag-tarento <sreerag.sajeesh@tarento.com>
Co-authored-by: karthik-tarento <karthikeyan.rajendran@tarento.com>

* For ticket https://karmayogibharat.atlassian.net/browse/KAR-818 (sunbird-cb#149)

* 4.8.18 merged v1 (sunbird-cb#151)

* 4.8.17 dev v5 (sunbird-cb#44)

* KB-6678 - if assessment is submitted without selecting any option then same questions are repeating in each attempt (in question weightage)

1. Getting NaN if both correct and incorrect are 0 , So added a check.

* added api for to show V6 competencies (sunbird-cb#40)

* added api for to show V6 competencies

* worked on code review comments

* worked on code review comments

* Update application.properties removed spaces between the values

---------

Co-authored-by: anilkumar <anilkumar.kammlapalli@tarento.com>

---------

Co-authored-by: SaipradeepR <53404427+SaipradeepR@users.noreply.github.com>
Co-authored-by: tarentomaheshvakkund <139739142+tarentomaheshvakkund@users.noreply.github.com>
Co-authored-by: anilkumarkammalapalli <121931293+anilkumarkammalapalli@users.noreply.github.com>
Co-authored-by: anilkumar <anilkumar.kammlapalli@tarento.com>

* public link generation and calling email sending api

* public link generation and calling email sending api (sunbird-cb#112)

* convertToPng code added

* png and email encryption method added (sunbird-cb#114)

* public link generation and calling email sending api

* convertToPng code added

* pull from upstream

* Cbrelease 4.8.17 (sunbird-cb#115)

* public link generation and calling email sending api

* convertToPng code added

* pull from upstream

* svg issue resolved

* svg issue resolved (sunbird-cb#118)

* public link generation and calling email sending api

* convertToPng code added

* pull from upstream

* svg issue resolved

* 4.8.17 report fix (sunbird-cb#107)

* Adding impl for report download (sunbird-cb#101)

* 4.8.17 mdo report fix (sunbird-cb#105)

* Adding impl for report download

* Adding impl for report download

* Adding impl for report download (sunbird-cb#106)

* upload issue resolved

* Cbrelease 4.8.17 (sunbird-cb#119)

* public link generation and calling email sending api

* convertToPng code added

* pull from upstream

* svg issue resolved

* upload issue resolved

* certificateId hardCode removed

* CertificateId hard code removed (sunbird-cb#120)

* public link generation and calling email sending api

* convertToPng code added

* pull from upstream

* svg issue resolved

* upload issue resolved

* certificateId hardCode removed

* producer code added

* producer code added

* MAde the impl changes for pdf generator (sunbird-cb#122)

* Remove unused impl and adding null check (sunbird-cb#123)

* Remove unused impl and update the check (sunbird-cb#124)

* Remove unused impl (sunbird-cb#125)

* Update the property (sunbird-cb#126)

* Adding the impl changes for pdf issue (sunbird-cb#127)

* Added the check for the kafka event process

* Integerating content progress update along with assessment submit API - KAR-788 (sunbird-cb#129) (sunbird-cb#133)

Co-authored-by: sreerag-tarento <sreerag.sajeesh@tarento.com>

* Integerating content progress API with all v4,v5 & v6 version of assessment submit API - KAR-788 (sunbird-cb#135) (sunbird-cb#139)

* Integerating content progress update along with assessment submit API - KAR-788

* Integerating content progress APi with all v4,v5 & v6 version of assessment submit API

Co-authored-by: sreerag-tarento <sreerag.sajeesh@tarento.com>

* Fixed build issues

* Creating v2 API to fetch l1, l2 child from postgres (sunbird-cb#147)

* Adding the check for childrenId's (sunbird-cb#150)

---------

Co-authored-by: Karthikeyan Rajendran <70887864+karthik-tarento@users.noreply.github.com>
Co-authored-by: SaipradeepR <53404427+SaipradeepR@users.noreply.github.com>
Co-authored-by: tarentomaheshvakkund <139739142+tarentomaheshvakkund@users.noreply.github.com>
Co-authored-by: anilkumarkammalapalli <121931293+anilkumarkammalapalli@users.noreply.github.com>
Co-authored-by: anilkumar <anilkumar.kammlapalli@tarento.com>
Co-authored-by: arpithasureshappa <arpitha.sureshappa@tarento.com>
Co-authored-by: Sharath Prasad <sharaths.kashyap@gmail.com>
Co-authored-by: sreerag-tarento <sreerag.sajeesh@tarento.com>
Co-authored-by: karthik-tarento <karthikeyan.rajendran@tarento.com>

* 4.8.18 fix bulk upload (sunbird-cb#153)

* Doing the impl changes for User Bulk Upload csv Impl

* Doing the impl changes for User Bulk Upload csv Impl

* Update HallOfFameServiceImpl.java

Added "XS" to National Learning Week

* 4.8.18 dev (sunbird-cb#155)

* "Public User Event Bulk Onboard Feature" (sunbird-cb#152)

* "Public user event bulk onboard - Bug Fix" (sunbird-cb#154)

* "Public user event bulk onboard - Bug Fix"

* Review changes

---------

Co-authored-by: vikrantbipin <118338417+vikrantbipin@users.noreply.github.com>
Co-authored-by: sreerag-tarento <sreerag.sajeesh@tarento.com>

* Added default status,progress and comletion percentage for public event bulk onboard (sunbird-cb#156)

* "Public User Event Bulk Onboard Feature"

* "Public User Event Bulk Onboard Feature-bug fix"

* "Added default status,progress and comletion percentage for public event bulk onboard"

* "Added default status,progress and comletion percentage for public event bulk onboard"

* PublicUserEventBulkOnboard: Added claim event karma points, fixed bugs and enhanced code (sunbird-cb#157)

* "Public User Event Bulk Onboard Feature"

* "Public User Event Bulk Onboard Feature-bug fix"

* "Added default status,progress and comletion percentage for public event bulk onboard"

* "Added default status,progress and comletion percentage for public event bulk onboard"

* "PublicUserEventBulkOnboard:Added claim event karma points, fixed bugs and enhanced code"

* "Commented karma points event triggering because  Karma points are generated inside event-cert generator flink job"

* Claim karma point event and corrected ets time (sunbird-cb#158)

* "Public User Event Bulk Onboard Feature"

* "Public User Event Bulk Onboard Feature-bug fix"

* "Added default status,progress and comletion percentage for public event bulk onboard"

* "Added default status,progress and comletion percentage for public event bulk onboard"

* "PublicUserEventBulkOnboard:Added claim event karma points, fixed bugs and enhanced code"

* "Commented karma points event triggering because  Karma points are generated inside event-cert generator flink job"

* "Claim karma point event and corrected ets time"

* LearnerLeaderBoard API returning empty when no data instead of not-found (sunbird-cb#159)

* added lrc_progressdetails for offline event enrolment (sunbird-cb#160)

* "Public User Event Bulk Onboard Feature"

* "Public User Event Bulk Onboard Feature-bug fix"

* "Added default status,progress and comletion percentage for public event bulk onboard"

* "Added default status,progress and comletion percentage for public event bulk onboard"

* "PublicUserEventBulkOnboard:Added claim event karma points, fixed bugs and enhanced code"

* "Commented karma points event triggering because  Karma points are generated inside event-cert generator flink job"

* "Claim karma point event and corrected ets time"

* "added lrc_progressdetails"

* Fixed class cast exception for event duration (sunbird-cb#162)

* "Public User Event Bulk Onboard Feature"

* "Public User Event Bulk Onboard Feature-bug fix"

* "Added default status,progress and comletion percentage for public event bulk onboard"

* "Added default status,progress and comletion percentage for public event bulk onboard"

* "PublicUserEventBulkOnboard:Added claim event karma points, fixed bugs and enhanced code"

* "Commented karma points event triggering because  Karma points are generated inside event-cert generator flink job"

* "Claim karma point event and corrected ets time"

* "added lrc_progressdetails"

* "Fixed class cast exception for event duration"

* Corrected karma point event format (sunbird-cb#163)

* "Public User Event Bulk Onboard Feature"

* "Public User Event Bulk Onboard Feature-bug fix"

* "Added default status,progress and comletion percentage for public event bulk onboard"

* "Added default status,progress and comletion percentage for public event bulk onboard"

* "PublicUserEventBulkOnboard:Added claim event karma points, fixed bugs and enhanced code"

* "Commented karma points event triggering because  Karma points are generated inside event-cert generator flink job"

* "Claim karma point event and corrected ets time"

* "added lrc_progressdetails"

* "Fixed class cast exception for event duration"

* "Corrected karma point event format"

* Added validation for invalid event details (sunbird-cb#165)

* "Public User Event Bulk Onboard Feature"

* "Public User Event Bulk Onboard Feature-bug fix"

* "Added default status,progress and comletion percentage for public event bulk onboard"

* "Added default status,progress and comletion percentage for public event bulk onboard"

* "PublicUserEventBulkOnboard:Added claim event karma points, fixed bugs and enhanced code"

* "Commented karma points event triggering because  Karma points are generated inside event-cert generator flink job"

* "Claim karma point event and corrected ets time"

* "added lrc_progressdetails"

* "Fixed class cast exception for event duration"

* "Corrected karma point event format"

* "Added validation for invalid event details"

* Added condition to update the existing enrollment and trigger the kafka event (sunbird-cb#166)

* "Public User Event Bulk Onboard Feature"

* "Public User Event Bulk Onboard Feature-bug fix"

* "Added default status,progress and comletion percentage for public event bulk onboard"

* "Added default status,progress and comletion percentage for public event bulk onboard"

* "PublicUserEventBulkOnboard:Added claim event karma points, fixed bugs and enhanced code"

* "Commented karma points event triggering because  Karma points are generated inside event-cert generator flink job"

* "Claim karma point event and corrected ets time"

* "added lrc_progressdetails"

* "Fixed class cast exception for event duration"

* "Corrected karma point event format"

* "Added validation for invalid event details"

* "Added condition to update the enrollment and trigger the kafka event"

* 4.8.18 dev v8 (sunbird-cb#169)

* Events to be generated based on the data recieved in CSV File. (sunbird-cb#161)

* LearnerLeaderBoard API returning empty when no data instead of not-found

* Events to be generated based on the data recieved in CSV File.

1. If the user have consumed the event more than 180 seconds we need to generate the event  for karma points and certificate generation.
2. Input would be csv file.

---------

Co-authored-by: karthik-tarento <karthikeyan.rajendran@tarento.com>

* worked on user event consumption (sunbird-cb#164)

* worked on user event consumption

* worked on code review comments

---------

Co-authored-by: anilkumar <anilkumar.kammlapalli@tarento.com>

* removed date from csv (sunbird-cb#168)

Co-authored-by: anilkumar <anilkumar.kammlapalli@tarento.com>

---------

Co-authored-by: tarentomaheshvakkund <139739142+tarentomaheshvakkund@users.noreply.github.com>
Co-authored-by: anilkumarkammalapalli <121931293+anilkumarkammalapalli@users.noreply.github.com>
Co-authored-by: anilkumar <anilkumar.kammlapalli@tarento.com>

* Added comments for user event enrolment updates

* User event enrolment: fixed typo in event message

* Fix for updating completedOn column value

* Created new APIs to fetch status of offline event bulkonboard and download the processed csv file (sunbird-cb#170)

* "Public User Event Bulk Onboard Feature"

* "Public User Event Bulk Onboard Feature-bug fix"

* "Added default status,progress and comletion percentage for public event bulk onboard"

* "Added default status,progress and comletion percentage for public event bulk onboard"

* "PublicUserEventBulkOnboard:Added claim event karma points, fixed bugs and enhanced code"

* "Commented karma points event triggering because  Karma points are generated inside event-cert generator flink job"

* "Claim karma point event and corrected ets time"

* "added lrc_progressdetails"

* "Fixed class cast exception for event duration"

* "Corrected karma point event format"

* "Added validation for invalid event details"

* "Added condition to update the enrollment and trigger the kafka event"

* "Created new APIs to fetch status of offline event bulkonboard and download the processed csv file"

* Updated logic for event cert generation script

* Handling invalid records

* Reading event duration from event_batch table

* Added max_size while updating record

* Handling completed user event enrolment in script

* Added condition to skip status 0

* Added parsing for edge cases

* Added API to update event enrolment status value

* Updated code to check issueCertificates

* Updated code to check issueCertificates

* Updated code to check issueCertificates

---------

Co-authored-by: Karthikeyan Rajendran <70887864+karthik-tarento@users.noreply.github.com>
Co-authored-by: pathiktarento1089 <123535830+pathiktarento1089@users.noreply.github.com>
Co-authored-by: vikrantbipin <118338417+vikrantbipin@users.noreply.github.com>
Co-authored-by: SaipradeepR <53404427+SaipradeepR@users.noreply.github.com>
Co-authored-by: tarentomaheshvakkund <139739142+tarentomaheshvakkund@users.noreply.github.com>
Co-authored-by: anilkumarkammalapalli <121931293+anilkumarkammalapalli@users.noreply.github.com>
Co-authored-by: anilkumar <anilkumar.kammlapalli@tarento.com>
Co-authored-by: arpithasureshappa <arpitha.sureshappa@tarento.com>
Co-authored-by: Sharath Prasad <sharaths.kashyap@gmail.com>
Co-authored-by: sreerag-tarento <sreerag.sajeesh@tarento.com>
Co-authored-by: karthik-tarento <karthikeyan.rajendran@tarento.com>
Co-authored-by: sureshece16 <80331286+sureshece16@users.noreply.github.com>
  • Loading branch information
13 people authored Oct 28, 2024
1 parent cdc7629 commit fdf23ee
Show file tree
Hide file tree
Showing 34 changed files with 1,732 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class CassandraPropertyReader {

private final Properties properties = new Properties();
private static final String file = "cassandratablecolumn.properties";
private static CassandraPropertyReader cassandraPropertyReader = null;
private static volatile CassandraPropertyReader cassandraPropertyReader = null;

/** private default constructor
* @throws IOException */
Expand All @@ -30,21 +30,20 @@ private CassandraPropertyReader() throws IOException {
}
}

public static CassandraPropertyReader getInstance() {
if (null == cassandraPropertyReader) {
synchronized (CassandraPropertyReader.class) {
if (null == cassandraPropertyReader) {
try {
cassandraPropertyReader = new CassandraPropertyReader();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
public static CassandraPropertyReader getInstance() {
if (null == cassandraPropertyReader) {
synchronized (CassandraPropertyReader.class) {
if (null == cassandraPropertyReader) {
try {
cassandraPropertyReader = new CassandraPropertyReader();
} catch (IOException e) {
throw new RuntimeException("Error initializing CassandraPropertyReader", e);
}
}
}
}
}
}
return cassandraPropertyReader;
}
}
return cassandraPropertyReader;
}

/**
* Method to read value from resource file .
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public SBApiResponse publishCbPlan(SunbirdApiRequest request, String userOrgId,
endDate = dateFormat.parse(String.valueOf(
cbPlanDtoMap.getOrDefault(Constants.END_DATE, publishCbPlan.get(Constants.END_DATE))));
} catch (ParseException e) {
e.printStackTrace(); // Handle the exception appropriately
logger.error("Failed to parse the end date: " + e.getMessage(), e);
}
cbPlan.put(Constants.END_DATE, endDate);
cbPlan.put(Constants.DRAFT_DATA, null);
Expand Down
82 changes: 77 additions & 5 deletions src/main/java/org/sunbird/common/util/CbExtServerProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,27 @@ public String getPublicAssessmentCloudCertificateFolderName() {
@Value("${questionSet.publish}")
private String questionSetPublish;

@Value("${cios.logs.cloud.folder.name}")
private String ciosFileLogsCloudFolderName;

@Value("${public.user.event.bulk.onboard.topic}")
private String publicUserEventBulkOnboardTopic;

@Value("${public.user.event.bulk.onboard.container.name}")
private String eventBulkOnboardContainerName;

@Value("${user.issue.certificate.for.event.topic}")
private String userIssueCertificateForEventTopic;

@Value("${user.event.enrolment.table}")
private String userEventEnrolmentTable;

@Value("${public.user.event.bulkonboard.table}")
private String publicUserEventBulkOnboardTable;

@Value("${user.event.karma.point.topic}")
private String userEventKarmaPointTopic;

public String getCiosCloudIconFolderName() {
return ciosCloudIconFolderName;
}
Expand Down Expand Up @@ -1904,7 +1925,7 @@ public String[] getSbEsHostList() {
}

public void setSbEsHostList(String sbEsHost) {
this.sbEsHostList = sbEsHostList;
this.sbEsHostList = sbEsHost;
}

public String getSbEsUser() {
Expand Down Expand Up @@ -2523,10 +2544,6 @@ public String getEhrmsDetailUrl() {
return ehrmsDetailUrl;
}

public void setEhrmsDetailUrl(SBApiResponse response) {
this.ehrmsDetailUrl = ehrmsDetailUrl;
}

public void setEhrmsDetailUrl(String ehrmsDetailUrl) {
this.ehrmsDetailUrl = ehrmsDetailUrl;
}
Expand Down Expand Up @@ -3158,4 +3175,59 @@ public void setCqfAssessmentPostPublishTopic(String cqfAssessmentPostPublishTopi
this.cqfAssessmentPostPublishTopic = cqfAssessmentPostPublishTopic;
}

public String getCiosFileLogsCloudFolderName() {
return ciosFileLogsCloudFolderName;
}

public void setCiosFileLogsCloudFolderName(String ciosFileLogsCloudFolderName) {
this.ciosFileLogsCloudFolderName = ciosFileLogsCloudFolderName;
}

public String getEventBulkOnboardContainerName() {
return eventBulkOnboardContainerName;
}

public void setEventBulkOnboardContainerName(String eventBulkOnboardContainerName) {
this.eventBulkOnboardContainerName = eventBulkOnboardContainerName;
}

public String getPublicUserEventBulkOnboardTopic() {
return publicUserEventBulkOnboardTopic;
}

public void setPublicUserEventBulkOnboardTopic(String publicUserEventBulkOnboardTopic) {
this.publicUserEventBulkOnboardTopic = publicUserEventBulkOnboardTopic;
}

public String getUserIssueCertificateForEventTopic() {
return userIssueCertificateForEventTopic;
}

public void setUserIssueCertificateForEventTopic(String userIssueCertificateForEventTopic) {
this.userIssueCertificateForEventTopic = userIssueCertificateForEventTopic;
}

public String getUserEventEnrolmentTable() {
return userEventEnrolmentTable;
}

public void setUserEventEnrolmentTable(String userEventEnrolmentTable) {
this.userEventEnrolmentTable = userEventEnrolmentTable;
}

public String getPublicUserEventBulkOnboardTable() {
return publicUserEventBulkOnboardTable;
}

public void setPublicUserEventBulkOnboardTable(String publicUserEventBulkOnboardTable) {
this.publicUserEventBulkOnboardTable = publicUserEventBulkOnboardTable;
}

public String getUserEventKarmaPointTopic() {
return userEventKarmaPointTopic;
}

public void setUserEventKarmaPointTopic(String userEventKarmaPointTopic) {
this.userEventKarmaPointTopic = userEventKarmaPointTopic;
}
}
13 changes: 13 additions & 0 deletions src/main/java/org/sunbird/common/util/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,19 @@ public class Constants {
public static final String NOT_APPLICABLE = "Not Applicable";
public static final String CURRENT_PAGE = "currentPage";
public static final String FILTER = "filter";
public static final String API_ORG_V2_LIST = "api.org.v2.list";
public static final String PUBLIC_USER_EVENT_BULKONBOARD = "api.public.user.event.bulkonboard";
public static final String EVENT_ID = "eventId";
public static final String ENROLLED_DATE_KEY_LOWER = "enrolled_date";
public static final String DATE_TIME = "dateTime";
public static final String EVENT_BATCH_TABLE_NAME = "event_batch";
public static final String COMPLETED_ON ="completedOn";
public static final String START_DATE_COLUMN = "start_date";
public static final String END_DATE_COLUMN = "end_date";
public static final String BATCH_ATTRIBUTES_COLUMN="batch_attributes";
public static final String USER_EVENT_CONSUMPTION = "api.user.event.consumption";
public static final String LRC_PROGRESS_DETAILS_COLUMN="lrc_progressdetails";
public static final String API_USER_EVENT_BULK_ONBOARD_STATUS = "api.user.event.bulk.onboard.status";

private Constants() {
throw new IllegalStateException("Utility class");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/sunbird/common/util/ProjectUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public static Boolean validateDate(String dateString){
Date date = dateFormat.parse(dateString);
return date.after(pastDate) && (date.before(todaysDate) || date.equals(todaysDate));
} catch (ParseException e) {
e.printStackTrace();
logger.error("Invalid date format: " + dateString + " Exception: ", e);
}
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/sunbird/core/cipher/SecretKeySpec.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void postConstruct() {
}

public String getAlgorithm() {
return Constants.CIPHER_ALGORITHM;
return algorithm;
}

public String getFormat() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.HttpServerErrorException;
import org.springframework.web.client.RestTemplate;
import org.sunbird.cache.RedisCacheMgr;
import org.sunbird.cassandra.utils.CassandraOperation;
Expand Down Expand Up @@ -85,8 +86,16 @@ public SBApiResponse fetchEhrmsProfileDetail(String userId, String authToken) {
String ehrmsAuthPassword = serverConfig.getEhrmsAuthPassword();
String jwtToken = redisCacheMgr.getCache(Constants.EHRMS_USER_TOKEN);
if (StringUtils.isEmpty(jwtToken)) {
jwtToken = fetchJwtToken(ehrmsAuthUrl, ehrmsAuthUsername, ehrmsAuthPassword).replace("\"", "");
redisCacheMgr.putCache(Constants.EHRMS_USER_TOKEN, jwtToken, serverConfig.getRedisEhrmsTokenTimeOut());
jwtToken = fetchJwtToken(ehrmsAuthUrl, ehrmsAuthUsername, ehrmsAuthPassword);
if (StringUtils.isNotEmpty(jwtToken)) {
// Removing unwanted quotes and storing the token in cache
jwtToken = jwtToken.replace("\"", "");
redisCacheMgr.putCache(Constants.EHRMS_USER_TOKEN, jwtToken, serverConfig.getRedisEhrmsTokenTimeOut());
} else {
// Logging and handling null or empty token case
logger.error("Failed to fetch JWT token. The token returned is null or empty.");
throw new RuntimeException("Failed to fetch JWT token.");
}
}
Map<String, Object> fetchEhrmsUserDetails = fetchEhrmsUserDetails(serverConfig.getEhrmsDetailUrl(), externalSystemId, jwtToken);
response.setResult(fetchEhrmsUserDetails);
Expand All @@ -112,8 +121,18 @@ private String fetchJwtToken(String ehrmsAuthUrl, String ehrmsAuthUsername, Stri
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity entity = new HttpEntity(body, headers);
ResponseEntity<String> response = restTemplate.exchange(ehrmsAuthUrl, HttpMethod.POST, entity, String.class);
return response.getBody();
try {
logger.info("Attempting to fetch JWT token from {}", ehrmsAuthUrl);
ResponseEntity<String> response = restTemplate.exchange(ehrmsAuthUrl, HttpMethod.POST, entity, String.class);
logger.info("Successfully fetched JWT token. Status code: {}", response.getStatusCode());
return response.getBody();
} catch (HttpClientErrorException | HttpServerErrorException e) {
logger.error("HTTP error while fetching JWT token. Status code: {}, Error message: {}", e.getStatusCode(), e.getResponseBodyAsString(), e);
throw e;
} catch (Exception e) {
logger.error("Unexpected error while fetching JWT token.", e);
throw e;
}
}

private Map<String, Object> fetchEhrmsUserDetails(String ehrmsAuthUrl, String externalSystemId, String jwtToken) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.sunbird.halloffame.service;

import org.apache.commons.collections.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -86,7 +87,8 @@ public SBApiResponse learnerLeaderBoard(String rootOrgId, String authToken) {
);

if (userRowNum == null || userRowNum.isEmpty()) {
setNotFoundResponse(response, Constants.USER_ID_DOESNT_EXIST);
response.put(Constants.RESULT, ListUtils.EMPTY_LIST);
response.put(Constants.COUNT, 0);
return response;
}

Expand All @@ -104,6 +106,7 @@ public SBApiResponse learnerLeaderBoard(String rootOrgId, String authToken) {
);

response.put(Constants.RESULT, result);
response.put(Constants.COUNT, result == null ? 0 : result.size());
return response;

} catch (Exception e) {
Expand Down Expand Up @@ -181,7 +184,7 @@ public SBApiResponse getUserLeaderBoard(String authToken) {
public SBApiResponse getMdoLeaderBoard() {
SBApiResponse response = ProjectUtil.createDefaultResponse(Constants.API_HALL_OF_FAME_MDO_LEADERBOARD);
Map<String, Object> propertyMap = new HashMap<>();
propertyMap.put(Constants.SIZE, Arrays.asList("S", "M", "L", "XL"));
propertyMap.put(Constants.SIZE, Arrays.asList("XS","S", "M", "L", "XL"));
try {
List<Map<String, Object>> mdoLeaderBoard = cassandraOperation.getRecordsByPropertiesWithoutFiltering(
Constants.KEYSPACE_SUNBIRD, Constants.NLW_MDO_LEADERBOARD, propertyMap, null);
Expand Down Expand Up @@ -209,12 +212,6 @@ private void setBadRequestResponse(SBApiResponse response, String errMsg) {
response.setResponseCode(HttpStatus.BAD_REQUEST);
}

private void setNotFoundResponse(SBApiResponse response, String errMsg) {
response.getParams().setStatus(Constants.FAILED);
response.getParams().setErrmsg(errMsg);
response.setResponseCode(HttpStatus.NOT_FOUND);
}

private void setInternalServerErrorResponse(SBApiResponse response) {
response.getParams().setStatus(Constants.FAILED);
response.setResponseCode(HttpStatus.INTERNAL_SERVER_ERROR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,9 @@ public LocalDate[] populateDate(){
local[1] = endDate;
return local;
}

public static double roundToTwoDecimals(double value) {
BigDecimal bd = new BigDecimal(value);
bd = bd.setScale(2, RoundingMode.HALF_UP);
return bd.doubleValue();
return BigDecimal.valueOf(value).setScale(2, RoundingMode.HALF_UP).doubleValue();
}

public SBApiResponse readInsightsForOrganisation(Map<String, Object> requestBody, String userId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public Date fetchLimitDate() {
try {
return dateFormat.parse(dateString);
} catch (ParseException e) {
e.printStackTrace();
logger.error("Failed to parse the date: " + dateString, e);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.sunbird.nlw.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.sunbird.common.model.SBApiResponse;
import org.sunbird.nlw.service.PublicUserEventBulkonboardService;

import java.io.IOException;

@RestController
public class PublicUserEventBulkonboardController {

@Autowired
PublicUserEventBulkonboardService nlwService;

@PostMapping("/user/event/bulkOnboard")
public ResponseEntity<?> processEventUsersForCertificate(@RequestParam(value = "file", required = true) MultipartFile multipartFile, @RequestParam(value = "eventId", required = true) String eventId, @RequestParam(value = "batchId", required = true) String batchId) throws IOException {
SBApiResponse uploadResponse = nlwService.bulkOnboard(multipartFile, eventId, batchId);
return new ResponseEntity<>(uploadResponse, uploadResponse.getResponseCode());

}
@GetMapping("/user/event/bulkonboard/status/{eventId}")
public ResponseEntity<?> getUserEventBulkOnboardDetails(@PathVariable("eventId") String eventId) {
SBApiResponse response = nlwService.getUserEventBulkOnboardDetails(eventId);
return new ResponseEntity<>(response, response.getResponseCode());
}

@GetMapping("/user/event/bulkonboard/download/{fileName}")
public ResponseEntity<?> downloadFile(@PathVariable("fileName") String fileName) {
return nlwService.downloadFile(fileName);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.sunbird.nlw.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.sunbird.common.model.SBApiResponse;
import org.sunbird.nlw.service.UserEventPostConsumptionService;

import java.io.IOException;

@RestController
public class UserEventPostConsumptionController {

@Autowired
UserEventPostConsumptionService nlwService;

@PostMapping("/user/event/postConsumption")
public ResponseEntity<?> processEventUsersForCertificateAndKarmaPoints(@RequestParam(value = "file", required = true) MultipartFile multipartFile) throws IOException {
SBApiResponse uploadResponse = nlwService.processEventUsersForCertificateAndKarmaPoints(multipartFile);
return new ResponseEntity<>(uploadResponse, uploadResponse.getResponseCode());
}

@PostMapping("/user/event/postConsumption/updateStatus")
public ResponseEntity<?> processEventUsersForStatus(@RequestParam(value = "file", required = true) MultipartFile multipartFile) throws IOException {
SBApiResponse uploadResponse = nlwService.processEventUsersForStatus(multipartFile);
return new ResponseEntity<>(uploadResponse, uploadResponse.getResponseCode());
}
}
Loading

0 comments on commit fdf23ee

Please sign in to comment.