Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 3.9.0 copy #1

Open
wants to merge 116 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
1f8293c
CustomLog : course actor common
neha0305verma Feb 22, 2021
9510884
CustomLog : course and textbook actor
neha0305verma Feb 22, 2021
83b4c77
custom log : project logger removed
neha0305verma Feb 22, 2021
99911ce
CustomLog : projectlogger removed
neha0305verma Feb 22, 2021
4f6797a
CustomLog changes
neha0305verma Feb 23, 2021
5bc7800
CustomLog : request context env added
neha0305verma Feb 23, 2021
8a9e602
SB-23089 : UserAPI changes
neha0305verma Feb 25, 2021
8158ef7
CustomLog : name changed
neha0305verma Feb 25, 2021
26b9f18
SB-23089 : UserAPI TestCase
neha0305verma Feb 25, 2021
a290c19
SB-23089 : review changes
neha0305verma Feb 26, 2021
9489992
Merge branch 'release-3.8.0' of https://github.com/project-sunbird/su…
neha0305verma Feb 26, 2021
04ea7c0
CustomLog : testcase fix
neha0305verma Feb 26, 2021
9477ebe
CustomLog : testcase fix
neha0305verma Feb 26, 2021
8d5603e
CustomLog : env value added
neha0305verma Feb 26, 2021
2e24129
Custom-log : requestcontext
neha0305verma Feb 26, 2021
7aacdf1
SB-23089 : review changes
neha0305verma Mar 1, 2021
4cc79a4
SB-23089 : test coverage
neha0305verma Mar 1, 2021
69baaf0
Custom-Log : testcase fix
neha0305verma Mar 1, 2021
00abeb6
Custom-Log: Testcases fixed
neha0305verma Mar 1, 2021
0d2d72b
SB-23089 : review changes
neha0305verma Mar 1, 2021
afdc7de
SB-23089 : review changes
neha0305verma Mar 1, 2021
d31df81
CustomLog
neha0305verma Mar 1, 2021
9ae5e02
CustomLog
neha0305verma Mar 1, 2021
915412a
SB-23089 : testcase
neha0305verma Mar 1, 2021
69abe80
SB-23089 : testcase
neha0305verma Mar 1, 2021
2bb4292
SB-23089 : user read api
neha0305verma Mar 2, 2021
20f2be5
SB-23089 : log added
neha0305verma Mar 2, 2021
08a340d
SB-23089 : log added
neha0305verma Mar 2, 2021
7a73551
SB-23089 : review changes
neha0305verma Mar 2, 2021
12b6b4e
Merge pull request #332 from neha0305verma/user-api
Mar 2, 2021
1549533
SB-23089 : authToken added
neha0305verma Mar 3, 2021
f97c525
Merge pull request #334 from neha0305verma/user-api
Mar 3, 2021
67ab494
Private Batch : add and remove user apis deprecated
neha0305verma Mar 4, 2021
ab6c8fe
Merge branch 'release-3.8.0' of https://github.com/project-sunbird/su…
neha0305verma Mar 4, 2021
f8cc4c8
Private Batch : Testcase removed
neha0305verma Mar 4, 2021
daaf18c
JsonUtil
neha0305verma Mar 5, 2021
a08e858
Testcase fix
neha0305verma Mar 8, 2021
8d6e3f8
Merge pull request #335 from neha0305verma/invite-only
Mar 8, 2021
1c3e05b
Merge branch 'release-3.8.0' of https://github.com/project-sunbird/su…
neha0305verma Mar 9, 2021
3ca8d68
Custom-Log : testcase fix
neha0305verma Mar 9, 2021
569c993
Merge pull request #327 from neha0305verma/custom-log
Mar 11, 2021
56f66f4
Issue #SB-23493 feat: Enrolment sync API changes
Mar 11, 2021
5c3eda2
Merge branch 'release-3.8.0' of https://github.com/project-sunbird/su…
Mar 11, 2021
0863233
Issue #SB-23493 feat: Updated pom to include jacoco results for service
Mar 12, 2021
b2c34e9
Issue #SB-23493 feat: Updated pom to include jacoco results for service
Mar 12, 2021
d5d4e65
Issue #SB-23493 feat: Updated pom to include jacoco results for service
Mar 12, 2021
6e135b2
Issue #SB-23493 feat: Updated pom to include jacoco results for service
Mar 12, 2021
cbeac43
Issue #SB-23493 feat: Review changes
Mar 12, 2021
2f861bf
Issue #SB-23493 feat: Updated pom to include jacoco results for service
Mar 12, 2021
602ed56
Issue #SB-23493 feat: Updated pom to include jacoco results for service
Mar 12, 2021
25ae0d8
Issue #SB-23493 feat: Updated pom to include jacoco results for service
Mar 12, 2021
a875c14
Issue #SB-23493 feat: Updated pom to include jacoco results for service
Mar 12, 2021
c4ad3f4
Merge pull request #336 from PradyumnaNagendra/release-3.8.0
maheshkumargangula Mar 15, 2021
18b2f28
Issue #SB-23493 feat: Enrolment sync API changes
Mar 15, 2021
d923f0b
Issue #SB-23493 feat: Test case fix
Mar 15, 2021
806b14f
Merge pull request #337 from PradyumnaNagendra/release-3.8.0
Mar 15, 2021
43c1fbb
SB-22541 : CourseBatch date changes
neha0305verma Mar 16, 2021
2046647
Issue #SB-23662 fix: Configuration update to point to private user read
Mar 17, 2021
75bf270
Merge pull request #339 from PradyumnaNagendra/release-3.8.0
Mar 17, 2021
c8db2ae
SB-22541 : updateBatch changes
neha0305verma Mar 18, 2021
1ed566e
SB-22541 : user content consumption done
neha0305verma Mar 19, 2021
63c3d21
SB-22541 : Page management and page section date changes
neha0305verma Mar 23, 2021
cf84e36
Issue #000 feat: EnrolmentList removed activity_agg read
Mar 23, 2021
b69f32e
SB-22541 : Testcase fix
neha0305verma Mar 23, 2021
71741ed
Merge branch 'release-3.8.0' of https://github.com/project-sunbird/su…
neha0305verma Mar 23, 2021
50b8727
SB-22541 : testcase fix
neha0305verma Mar 23, 2021
72c133b
SB-22541 : Testcase fix
neha0305verma Mar 24, 2021
91987f0
Issue #SB-23493 feat: Updated ConsumptionActor to handle 0.15% sync i…
Mar 24, 2021
0b75e59
Merge pull request #340 from PradyumnaNagendra/enrolment-list-changes
maheshkumargangula Mar 24, 2021
c6e659b
SB-22541 : Testcase fix
neha0305verma Mar 24, 2021
96b8abb
Issue #SB-23777 fix: Update course batch issue fix
Mar 25, 2021
ace278e
Merge pull request #341 from PradyumnaNagendra/release-3.8.0
maheshkumargangula Mar 25, 2021
ee72b79
Github jira integration
Apr 6, 2021
ed8e0e5
Github jira integration
Apr 6, 2021
d210e7f
Github jira integration
Apr 6, 2021
909bcd6
Issue #000 fix: CourseBatch creation status issue fix
Apr 7, 2021
93a7f2d
Issue #000 fix: CourseBatch creation status issue fix
Apr 7, 2021
ce7fdc6
Merge pull request #345 from PradyumnaNagendra/release-3.8.0
Apr 7, 2021
f82e565
Merge branch 'release-3.8.0' into release-3.9.0
Apr 8, 2021
0639bd0
Merge pull request #344 from PradyumnaNagendra/release-3.9.0
maheshkumargangula Apr 9, 2021
2b2a931
Merge branch 'release-3.9.0' of https://github.com/project-sunbird/su…
neha0305verma Apr 12, 2021
bdcca7d
Issue #SC-2218 feat: Scores in group aggregates
Apr 14, 2021
baf70a5
Revert "Merge pull request #345 from PradyumnaNagendra/release-3.8.0"
Apr 16, 2021
4f9b2c1
Issue #SB-24096 fix: CourseBatch status issue
Apr 16, 2021
f603e9e
Issue #SB-24096 fix: Fixed test case
Apr 16, 2021
263f82b
Issue #SB-24096 fix: Fixed test case
Apr 16, 2021
e1813d8
Merge pull request #353 from PradyumnaNagendra/release-3.8.0
Apr 16, 2021
b98c3e2
Issue #SB-24096 fix: CourseBatch status issue
Apr 16, 2021
cfd0ebc
Merge pull request #354 from PradyumnaNagendra/release-3.8.0
Apr 16, 2021
17cb55a
SB-22541 : Added new date columns
neha0305verma Apr 19, 2021
dd7bd64
Merge branch 'release-3.8.0' into release-3.9.0
Apr 19, 2021
5b4201d
SB-22541 : content consumption new date column changes
neha0305verma Apr 19, 2021
7189d8f
Merge branch 'release-3.8.0' of https://github.com/project-sunbird/su…
neha0305verma Apr 19, 2021
953ba78
SB-22541 : testcase fix
neha0305verma Apr 19, 2021
78127af
SB-22541 : String values coverted into date for enddate and enrolment…
neha0305verma Apr 19, 2021
591f4c7
Merge branch 'release-3.9.0' into SC-2218
Apr 20, 2021
2edc8f5
Issue #SC-2218 feat: Scores in group aggregates
Apr 21, 2021
256808a
Merge pull request #356 from PradyumnaNagendra/SC-2218
Apr 21, 2021
0f3c427
SB-22541 : courseBatch end of day added
neha0305verma Apr 21, 2021
f3f77d0
Merge branch 'release-3.9.0' of https://github.com/project-sunbird/su…
neha0305verma Apr 21, 2021
fe408a6
SB-22541 : courseBatch endDate and enrollmentEndDate changes
neha0305verma Apr 21, 2021
b4adc90
Fixed read api
amit-kumaryadav Apr 21, 2021
0bc6f03
SB-22541 : testcase fix
neha0305verma Apr 22, 2021
aabdcf0
SB-22541 : Review Changes
neha0305verma Apr 27, 2021
d26a2fa
Merge pull request #338 from neha0305verma/date
Apr 27, 2021
f91941b
Merge branch 'release-3.9.0' into release-3.9.0
amit-kumaryadav Apr 27, 2021
28dad34
SB-22541 : Page changes for created date
neha0305verma Apr 27, 2021
02575c4
SB-22541 : Review changes
neha0305verma Apr 27, 2021
b6180d3
SB-22541 : Testcase fix
neha0305verma Apr 27, 2021
35b1be3
Merge pull request #358 from neha0305verma/date
Apr 27, 2021
c32d0ad
SB-22541 : Fix for content state timezone
neha0305verma Apr 28, 2021
062b73c
Merge pull request #359 from neha0305verma/date
Apr 28, 2021
baeed04
SB-22541 : oldEndDate and enrollmentEndDate added in 24 hrs format
neha0305verma Apr 28, 2021
7140e0f
Merge pull request #360 from neha0305verma/date
Apr 28, 2021
b4caefb
Merge branch 'release-3.9.0' into release-3.9.0
amit-kumaryadav May 3, 2021
0b112c5
Course Batch URL issue fixed
amit-kumaryadav May 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ jobs:
- run:
name: sonar
command: |
srcBranch=$(curl -s https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER | jq .head.ref -r)
tarBranch=$(curl -s https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER | jq .base.ref -r)
mvn verify -DskipTests=true sonar:sonar -Dsonar.projectKey=project-sunbird_sunbird-course-service -Dsonar.organization=project-sunbird -Dsonar.host.url=https://sonarcloud.io -Dsonar.pullrequest.branch=$srcbranch -Dsonar.pullrequest.key=$CIRCLE_PR_NUMBER -Dsonar.pullrequest.base=$tarbranch -Dsonar.scala.coverage.reportPaths=/home/circleci/project/course-mw/enrolment-actor/target/scoverage.xml,/home/circleci/project/course-mw/sunbird-util/cache-utils/target/scoverage.xml -Dsonar.scanner.force-deprecated-java-version-grace-period=true
JAVA_REPORT_PATHS=`find /home/circleci/project -iname jacoco.xml | awk 'BEGIN { RS = "" ; FS = "\n"; OFS = ","}{$1=$1; print $0}'`
mvn verify -DskipTests=true sonar:sonar -Dsonar.projectKey=project-sunbird_sunbird-course-service -Dsonar.organization=project-sunbird -Dsonar.host.url=https://sonarcloud.io -Dsonar.pullrequest.branch=$srcbranch -Dsonar.pullrequest.key=$CIRCLE_PR_NUMBER -Dsonar.pullrequest.base=$tarbranch -Dsonar.scala.coverage.reportPaths=/home/circleci/project/course-mw/enrolment-actor/target/scoverage.xml,/home/circleci/project/course-mw/sunbird-util/cache-utils/target/scoverage.xml -Dsonar.coverage.jacoco.xmlReportPaths=${JAVA_REPORT_PATHS}

workflows:
version: 2.1
Expand Down
32 changes: 32 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

### Type of change

Please choose appropriate options.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

### How Has This Been Tested?

Please describe the tests that you ran to verify your changes in the below checkboxes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

- [ ] Ran Test A
- [ ] Ran Test B

**Test Configuration**:
* Software versions: Java-11, play2-2.7.2, scala-2.11, redis-5.0.3
* Hardware versions: 2 CPU/ 4GB RAM

### Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
16 changes: 16 additions & 0 deletions .github/workflows/jira-description-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: jira-description-action
on:
pull_request_target:
types: [opened, labeled]
jobs:
add-jira-description:
runs-on: ubuntu-latest
steps:
- uses: project-sunbird/[email protected]
name: jira-description-action
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
jira-token: ${{ secrets.JIRA_TOKEN }}
jira-base-url: ${{ secrets.JIRA_BASE_URL }}
fail-when-jira-issue-not-found: ${{ secrets.FAIL_WHEN_JIRA_ISSUE_NOT_FOUND }}
use: both
23 changes: 15 additions & 8 deletions course-mw/course-actors-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@
<logback.version>1.0.7</logback.version>
</properties>
<dependencies>
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>6.6</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
Expand Down Expand Up @@ -68,11 +78,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-testkit_2.11</artifactId>
Expand Down Expand Up @@ -168,9 +173,11 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
<configuration>
<argLine>
--illegal-access=warn
</argLine>
<!-- <skipTests>true</skipTests> -->
<includes>
<include>**/*Spec.java</include>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import akka.actor.UntypedAbstractActor;
import org.sunbird.common.exception.ProjectCommonException;
import org.sunbird.common.models.response.Response;
import org.sunbird.common.models.response.ResponseParams;
import org.sunbird.common.models.util.LoggerUtil;
import org.sunbird.common.request.Request;
import org.sunbird.common.responsecode.ResponseCode;
Expand Down Expand Up @@ -51,4 +52,16 @@ public Response successResponse() {
response.put("response", "SUCCESS");
return response;
}

public Response clientError(String message) {
Response response = new Response();
response.setResponseCode(ResponseCode.CLIENT_ERROR);
ResponseParams params = new ResponseParams();
params.setStatus(ResponseParams.StatusType.FAILED.name());
params.setErr(ResponseCode.invalidRequestData.getErrorCode());
params.setErrmsg(ResponseCode.invalidRequestData.getErrorMessage());
response.setParams(params);
response.put("response", message);
return response;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private boolean insertDataToElastic(
logger.info(requestContext, "BackgroundJobManager:insertDataToElastic: type = " + type + " identifier = " + identifier);
Future<String> responseF = esService.save(requestContext, type, identifier, data);
String response = (String) ElasticSearchHelper.getResponseFromFuture(responseF);
logger.debug(requestContext, "ES save response for identifier :" + identifier + " : ", response);
logger.debug(requestContext, "ES save response for identifier :" + identifier, null, new HashMap<String, Object>() {{put("response", response);}});
if (!StringUtils.isBlank(response)) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.apache.commons.lang3.StringUtils;
import org.sunbird.actor.base.BaseActor;
import org.sunbird.cassandra.CassandraOperation;
import org.sunbird.common.CassandraUtil;
import org.sunbird.common.ElasticSearchHelper;
import org.sunbird.common.cacheloader.PageCacheLoaderService;
import org.sunbird.common.exception.ProjectCommonException;
Expand All @@ -25,6 +26,7 @@
import org.sunbird.common.request.Request;
import org.sunbird.common.request.RequestContext;
import org.sunbird.common.responsecode.ResponseCode;
import org.sunbird.common.util.JsonUtil;
import org.sunbird.dto.SearchDTO;
import org.sunbird.helper.ServiceFactory;
import org.sunbird.learner.util.ContentSearchUtil;
Expand All @@ -37,8 +39,11 @@
import scala.concurrent.Promise;

import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand All @@ -47,6 +52,7 @@
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.TimeZone;

import static org.sunbird.common.models.util.JsonKey.ID;

Expand All @@ -67,10 +73,15 @@ public class PageManagementActor extends BaseActor {
private static final String DYNAMIC_FILTERS = "dynamicFilters";
private static List<String> userProfilePropList = Arrays.asList("board");
private LoggerUtil logger = new LoggerUtil(PageManagementActor.class);
private static final SimpleDateFormat DATE_FORMAT = ProjectUtil.getDateFormatter();

static {
DATE_FORMAT.setTimeZone(
TimeZone.getTimeZone(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_TIMEZONE)));
}
@Override
public void onReceive(Request request) throws Throwable {
Util.initializeContext(request, TelemetryEnvKey.PAGE);
Util.initializeContext(request, TelemetryEnvKey.PAGE, this.getClass().getName());

if(request.getOperation().equalsIgnoreCase(ActorOperations.GET_DIAL_PAGE_DATA.getValue())) {
getDIALPageData(request);
Expand Down Expand Up @@ -114,7 +125,7 @@ private void getAllSections(RequestContext requestContext) {
}

@SuppressWarnings("unchecked")
private void getSection(Request actorMessage) {
private void getSection(Request actorMessage) throws Exception {
Response response = null;
Map<String, Object> req = actorMessage.getRequest();
String sectionId = (String) req.get(JsonKey.ID);
Expand All @@ -132,7 +143,7 @@ private void getSection(Request actorMessage) {
Map<String, Object> map = result.get(0);
removeUnwantedData(map, "");
Response section = new Response();
section.put(JsonKey.SECTION, response.get(JsonKey.RESPONSE));
section.put(JsonKey.SECTION, JsonUtil.convertWithDateFormat(response.get(JsonKey.RESPONSE), Map.class, DATE_FORMAT));
PageCacheLoaderService.putDataIntoCache(
ActorOperations.GET_SECTION.getValue(), sectionId, response.get(JsonKey.RESPONSE));
sender().tell(section, self());
Expand All @@ -142,7 +153,7 @@ private void getSection(Request actorMessage) {
}
} else {
response = new Response();
response.put(JsonKey.SECTION, sectionMap);
response.put(JsonKey.SECTION, JsonUtil.convertWithDateFormat(sectionMap, Map.class, DATE_FORMAT));
}
sender().tell(response, self());
}
Expand Down Expand Up @@ -171,7 +182,22 @@ private void updatePageSection(Request actorMessage) {
logger.error(actorMessage.getRequestContext(), "Exception occurred while processing display " + e.getMessage(), e);
}
}
sectionMap.put(JsonKey.UPDATED_DATE, ProjectUtil.getFormattedDate());
sectionMap.put(JsonKey.UPDATED_DATE, ProjectUtil.getTimeStamp());
sectionMap = CassandraUtil.changeCassandraColumnMapping(sectionMap);

if (!StringUtils.isBlank((String) sectionMap.get(JsonKey.ID))) {
Map<String, Object> map = new HashMap<>();
map.put(JsonKey.ID, (String) sectionMap.get(JsonKey.ID));
Response res =
cassandraOperation.getRecordsByProperties(
actorMessage.getRequestContext(), sectionDbInfo.getKeySpace(), sectionDbInfo.getTableName(), map);
if (!((List<Map<String, Object>>) res.get(JsonKey.RESPONSE)).isEmpty()) {
Map<String, Object> pageSection = ((List<Map<String, Object>>) res.get(JsonKey.RESPONSE)).get(0);
pageSection.put(JsonKey.CREATED_DATE, createdDateCheck(pageSection));
}
}

sectionMap = CassandraUtil.changeCassandraColumnMapping(sectionMap);
Response response =
cassandraOperation.updateRecord(
actorMessage.getRequestContext(), sectionDbInfo.getKeySpace(), sectionDbInfo.getTableName(), sectionMap);
Expand Down Expand Up @@ -215,7 +241,8 @@ private void createPageSection(Request actorMessage) {
}
sectionMap.put(JsonKey.ID, uniqueId);
sectionMap.put(JsonKey.STATUS, ProjectUtil.Status.ACTIVE.getValue());
sectionMap.put(JsonKey.CREATED_DATE, ProjectUtil.getFormattedDate());
sectionMap.put(JsonKey.CREATED_DATE, ProjectUtil.getTimeStamp());
sectionMap = CassandraUtil.changeCassandraColumnMapping(sectionMap);
Response response =
cassandraOperation.insertRecord(
actorMessage.getRequestContext(), sectionDbInfo.getKeySpace(), sectionDbInfo.getTableName(), sectionMap);
Expand Down Expand Up @@ -442,6 +469,7 @@ private void updatePage(Request actorMessage) {
actorMessage.getRequestContext(), pageDbInfo.getKeySpace(), pageDbInfo.getTableName(), map);
if (!((List<Map<String, Object>>) res.get(JsonKey.RESPONSE)).isEmpty()) {
Map<String, Object> page = ((List<Map<String, Object>>) res.get(JsonKey.RESPONSE)).get(0);
pageMap.put(JsonKey.CREATED_DATE, createdDateCheck(page));
if (!(((String) page.get(JsonKey.ID)).equals(pageMap.get(JsonKey.ID)))) {
ProjectCommonException exception =
new ProjectCommonException(
Expand All @@ -453,7 +481,7 @@ private void updatePage(Request actorMessage) {
}
}
}
pageMap.put(JsonKey.UPDATED_DATE, ProjectUtil.getFormattedDate());
pageMap.put(JsonKey.UPDATED_DATE, ProjectUtil.getTimeStamp());
if (null != pageMap.get(JsonKey.PORTAL_MAP)) {
try {
pageMap.put(JsonKey.PORTAL_MAP, mapper.writeValueAsString(pageMap.get(JsonKey.PORTAL_MAP)));
Expand All @@ -468,6 +496,7 @@ private void updatePage(Request actorMessage) {
logger.error(actorMessage.getRequestContext(), "Exception occurred while updating app map data " + e.getMessage(), e);
}
}
pageMap = CassandraUtil.changeCassandraColumnMapping(pageMap);
Response response =
cassandraOperation.updateRecord(
actorMessage.getRequestContext(), pageDbInfo.getKeySpace(), pageDbInfo.getTableName(), pageMap);
Expand Down Expand Up @@ -516,7 +545,7 @@ private void createPage(Request actorMessage) {
}
}
pageMap.put(JsonKey.ID, uniqueId);
pageMap.put(JsonKey.CREATED_DATE, ProjectUtil.getFormattedDate());
pageMap.put(JsonKey.CREATED_DATE, ProjectUtil.getTimeStamp());
if (null != pageMap.get(JsonKey.PORTAL_MAP)) {
try {
pageMap.put(JsonKey.PORTAL_MAP, mapper.writeValueAsString(pageMap.get(JsonKey.PORTAL_MAP)));
Expand All @@ -531,6 +560,7 @@ private void createPage(Request actorMessage) {
logger.error(actorMessage.getRequestContext(), "createPage: " + e.getMessage(), e);
}
}
pageMap = CassandraUtil.changeCassandraColumnMapping(pageMap);
Response response =
cassandraOperation.insertRecord(
actorMessage.getRequestContext(), pageDbInfo.getKeySpace(), pageDbInfo.getTableName(), pageMap);
Expand Down Expand Up @@ -932,4 +962,16 @@ private List<String> getStringListFromObj(Object obj) {
return Arrays.asList((String)obj);
}
}

// Remove this implementation after deprecating text date columns
private Date createdDateCheck(Map<String, Object> page) {
try {
if (page.containsKey(JsonKey.CREATED_DATE) && page.get(JsonKey.CREATED_DATE) == null) {
return DATE_FORMAT.parse((String) page.get(JsonKey.OLD_CREATED_DATE));
}
} catch (ParseException e) {
logger.error(null, "PageManagementActor:createdDateCheck: Exception occurred with error message = " + e.getMessage(), e);
}
return (Date) page.get(JsonKey.CREATED_DATE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public String getValue() {

@Override
public void onReceive(Request request) throws Throwable {
Util.initializeContext(request, TelemetryEnvKey.USER);
Util.initializeContext(request, TelemetryEnvKey.USER, this.getClass().getName());

String requestedOperation = request.getOperation();
switch (requestedOperation) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class CourseBatchCertificateActor extends BaseActor {

@Override
public void onReceive(Request request) throws Throwable {
Util.initializeContext(request, TelemetryEnvKey.USER);
Util.initializeContext(request, TelemetryEnvKey.USER, this.getClass().getName());

String requestedOperation = request.getOperation();
switch (requestedOperation) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public class CourseManagementActor extends BaseActor {

@Override
public void onReceive(Request request) throws Throwable {
Util.initializeContext(request, TelemetryEnvKey.COURSE_CREATE);
Util.initializeContext(request, TelemetryEnvKey.COURSE_CREATE, this.getClass().getName());

String requestedOperation = request.getOperation();
switch (requestedOperation) {
case "createCourse":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import org.sunbird.cassandra.CassandraOperation;
import org.sunbird.common.CassandraUtil;
import org.sunbird.common.exception.ProjectCommonException;
import org.sunbird.common.models.response.Response;
import org.sunbird.common.models.util.CassandraPropertyReader;
import org.sunbird.common.models.util.JsonKey;
import org.sunbird.common.request.RequestContext;
import org.sunbird.common.responsecode.ResponseCode;
Expand All @@ -19,12 +23,14 @@
public class CourseBatchDaoImpl implements CourseBatchDao {
private CassandraOperation cassandraOperation = ServiceFactory.getInstance();
private Util.DbInfo courseBatchDb = Util.dbInfoMap.get(JsonKey.COURSE_BATCH_DB);

private static final CassandraPropertyReader propertiesCache =
CassandraPropertyReader.getInstance();
private ObjectMapper mapper = new ObjectMapper();

@Override
public Response create(RequestContext requestContext, CourseBatch courseBatch) {
Map<String, Object> map = mapper.convertValue(courseBatch, Map.class);
map = CassandraUtil.changeCassandraColumnMapping(map);
return cassandraOperation.insertRecord(
requestContext, courseBatchDb.getKeySpace(), courseBatchDb.getTableName(), map);
}
Expand All @@ -38,6 +44,7 @@ public Response update(RequestContext requestContext, String courseId, String ba
attributeMap.putAll(map);
attributeMap.remove(JsonKey.COURSE_ID);
attributeMap.remove(JsonKey.BATCH_ID);
attributeMap = CassandraUtil.changeCassandraColumnMapping(attributeMap);
return cassandraOperation.updateRecord(
requestContext, courseBatchDb.getKeySpace(), courseBatchDb.getTableName(), attributeMap, primaryKey);
}
Expand Down
Loading