Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
UPHRH-lms-service
Commits
9c260e4e
Commit
9c260e4e
authored
2 years ago
by
PrasadMoka
Browse files
Options
Download
Patches
Plain Diff
LR-265 template variable changes
parent
8dd51b80
master
bootcamp
helmchart
release-5.0.1
release-5.0.2
release-5.1.0
release-5.2.0
release-5.2.1
release-5.3.0
release-5.3.1
release-5.4.0
release-5.3.1_RC1
release-5.3.0_RC1
release-5.2.0_RC2
release-5.2.0_RC1
release-5.1.0_RC2
release-5.1.0_RC1
release-5.0.1_RC3
release-5.0.1_RC2
release-5.0.1_RC1
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/certificate/service/CourseBatchCertificateActor.java
+23
-9
...tors/certificate/service/CourseBatchCertificateActor.java
course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/JsonKey.java
+0
-2
...src/main/java/org/sunbird/common/models/util/JsonKey.java
course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/resources/externalresource.properties
+1
-1
...ommon-util/src/main/resources/externalresource.properties
with
24 additions
and
12 deletions
+24
-12
course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/certificate/service/CourseBatchCertificateActor.java
+
23
−
9
View file @
9c260e4e
...
...
@@ -102,10 +102,7 @@ public class CourseBatchCertificateActor extends BaseActor {
String
certName
=
(
String
)
templateData
.
getOrDefault
(
JsonKey
.
TITLE
,
(
String
)
templateDetails
.
getOrDefault
(
JsonKey
.
NAME
,
""
));
template
.
put
(
JsonKey
.
NAME
,
certName
);
// replace the actual cloud url with the template value
String
templateUrl
=
(
String
)
templateDetails
.
getOrDefault
(
"artifactUrl"
,
""
);
if
(
templateUrl
.
contains
(
getConfigValue
(
CLOUD_STORE_BASE_PATH
)))
templateUrl
=
templateUrl
.
replace
(
getConfigValue
(
CLOUD_STORE_BASE_PATH
),
CLOUD_STORE_BASE_PATH_PLACEHOLDER
);
String
templateUrl
=
getPlaceholderUrl
(
templateDetails
,
"artifactUrl"
);
template
.
put
(
JsonKey
.
URL
,
templateUrl
);
template
.
put
(
JsonKey
.
CRITERIA
,
mapper
.
writeValueAsString
(
template
.
get
(
JsonKey
.
CRITERIA
)));
if
(
null
!=
template
.
get
(
CourseJsonKey
.
ISSUER
))
{
...
...
@@ -124,10 +121,13 @@ public class CourseBatchCertificateActor extends BaseActor {
CourseJsonKey
.
ISSUER
,
mapper
.
writeValueAsString
(
templateDetails
.
get
(
CourseJsonKey
.
SIGNATORY_LIST
)));
}
if
(
MapUtils
.
isNotEmpty
((
Map
<
String
,
Object
>)
template
.
get
(
CourseJsonKey
.
NOTIFY_TEMPLATE
)))
{
//TODO Do we need to change stateImgUrl in notifyTemplate??
// We need to change stateImgUrl in notifyTemplate
Map
<
String
,
Object
>
notifyData
=
(
Map
<
String
,
Object
>)
template
.
get
(
CourseJsonKey
.
NOTIFY_TEMPLATE
);
String
notifyTemplateUrl
=
getPlaceholderUrl
(
notifyData
,
JsonKey
.
stateImgUrl
);
notifyData
.
replace
(
JsonKey
.
stateImgUrl
,
notifyTemplateUrl
);
template
.
put
(
CourseJsonKey
.
NOTIFY_TEMPLATE
,
mapper
.
writeValueAsString
(
template
.
get
(
CourseJsonKey
.
NOTIFY_TEMPLATE
)
));
mapper
.
writeValueAsString
(
notifyData
));
}
if
(
MapUtils
.
isNotEmpty
((
Map
<
String
,
Object
>)
template
.
get
(
CourseJsonKey
.
ADDITIONAL_PROPS
)))
{
template
.
put
(
...
...
@@ -141,6 +141,17 @@ public class CourseBatchCertificateActor extends BaseActor {
}
}
private
String
getPlaceholderUrl
(
Map
<
String
,
Object
>
templateDetails
,
String
key
)
{
String
templateUrl
=
""
;
if
(
MapUtils
.
isNotEmpty
(
templateDetails
)
&&
templateDetails
.
containsKey
(
key
))
{
// replace the actual cloud url with the template value
templateUrl
=
(
String
)
templateDetails
.
get
(
key
);
if
(
templateUrl
.
contains
(
getConfigValue
(
CLOUD_STORE_BASE_PATH
)))
templateUrl
=
templateUrl
.
replace
(
getConfigValue
(
CLOUD_STORE_BASE_PATH
),
getConfigValue
(
CLOUD_STORE_BASE_PATH_PLACEHOLDER
));
}
return
templateUrl
;
}
private
Map
<
String
,
Object
>
mapESFieldsToObject
(
Map
<
String
,
Object
>
courseBatch
)
{
Map
<
String
,
Map
<
String
,
Object
>>
certificateTemplates
=
(
Map
<
String
,
Map
<
String
,
Object
>>)
...
...
@@ -181,11 +192,14 @@ public class CourseBatchCertificateActor extends BaseActor {
new
TypeReference
<
HashMap
<
String
,
Object
>>()
{
}));
}
if
(
StringUtils
.
isNotEmpty
((
String
)
template
.
get
(
CourseJsonKey
.
NOTIFY_TEMPLATE
)))
{
if
(
StringUtils
.
isNotEmpty
((
String
)
template
.
get
(
CourseJsonKey
.
NOTIFY_TEMPLATE
)))
{
String
notifyTemplateData
=
(
String
)
template
.
get
(
CourseJsonKey
.
NOTIFY_TEMPLATE
);
//Modify the placeholder with the actual configured cloud base path as ES should have the actual cloud path
if
(
notifyTemplateData
.
contains
(
getConfigValue
(
CLOUD_STORE_BASE_PATH_PLACEHOLDER
)))
notifyTemplateData
=
notifyTemplateData
.
replace
(
getConfigValue
(
CLOUD_STORE_BASE_PATH_PLACEHOLDER
),
getConfigValue
(
CLOUD_STORE_BASE_PATH
));
template
.
put
(
CourseJsonKey
.
NOTIFY_TEMPLATE
,
mapper
.
readValue
(
(
String
)
template
.
get
(
CourseJsonKey
.
NOTIFY_TEMPLATE
),
mapper
.
readValue
(
notifyTemplateData
,
new
TypeReference
<
HashMap
<
String
,
Object
>>()
{
}));
}
...
...
This diff is collapsed.
Click to expand it.
course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/JsonKey.java
+
0
−
2
View file @
9c260e4e
...
...
@@ -1071,8 +1071,6 @@ public final class JsonKey {
public
static
final
String
OLD_CREATED_DATE
=
"oldCreatedDate"
;
public
static
final
String
X_LOGGING_HEADERS
=
"X_LOGGING_HEADERS"
;
public
static
final
String
LAST_CONTENT_ACCESS_TIME
=
"lastcontentaccesstime"
;
public
static
final
String
CLOUD_STORE_BASE_PATH_PLACEHOLDER
=
"cloud_store_base_path_placeholder"
;
public
static
final
String
CLOUD_STORE_BASE_PATH
=
"cloud_store_base_path"
;
public
static
final
String
GCP
=
"gcloud"
;
public
static
final
String
TEMPLATE_URL
=
"templateUrl"
;
...
...
This diff is collapsed.
Click to expand it.
course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/resources/externalresource.properties
+
1
−
1
View file @
9c260e4e
...
...
@@ -206,5 +206,5 @@ sunbird_msg_sender=
sunbird_msg_91_auth
=
sunbird_api_mgr_base_url
=
https://dev.sunbirded.org/api
enrollment_list_size
=
1000
cloud_store_base_path
=
https://sunbirddev.blob.core.windows.net
/
cloud_store_base_path
=
https://sunbirddev.blob.core.windows.net
cloud_store_base_path_placeholder
=
$CLOUD_STORE_BASE_PATH
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets