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
knowledge-platform
Commits
b7d1722a
Commit
b7d1722a
authored
2 years ago
by
Jayaprakash n
Browse files
Options
Download
Patches
Plain Diff
Issue #KN-257 feat: Content Release DIAL codes API refactor.
parent
f0c762b2
release-5.3.0
AmiableAnil-patch-1
Gcloud_copy
Gcloud_fix
Remove_unwantedCode_Gcloud_fix
bulk-upload-comptenecy-mapping
bulk-upload-excelsheet
bulk-upload-test_excel
bulk_upload
csp-migration
knowlg-oneclick
local-setup-kube
master
patch-1
patch-2
patch-3
poc_bulk_upload
rahul_bulk_upload_postgres
release-5.1.0
release-5.1.0-content
release-5.2.0
release-5.2.0_RC2
release-5.2.0_RC1
release-5.1.0_RC1
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
content-api/content-actors/src/main/scala/org/sunbird/content/dial/DIALErrors.scala
+2
-0
.../src/main/scala/org/sunbird/content/dial/DIALErrors.scala
content-api/content-actors/src/main/scala/org/sunbird/content/dial/DIALManager.scala
+4
-0
...src/main/scala/org/sunbird/content/dial/DIALManager.scala
with
6 additions
and
0 deletions
+6
-0
content-api/content-actors/src/main/scala/org/sunbird/content/dial/DIALErrors.scala
+
2
−
0
View file @
b7d1722a
...
@@ -17,6 +17,7 @@ object DIALErrors {
...
@@ -17,6 +17,7 @@ object DIALErrors {
val
ERR_CONTENT_MISSING_RESERVED_DIAL_CODES
:
String
=
"ERR_CONTENT_MISSING_RESERVED_DIAL_CODES"
val
ERR_CONTENT_MISSING_RESERVED_DIAL_CODES
:
String
=
"ERR_CONTENT_MISSING_RESERVED_DIAL_CODES"
val
ERR_ALL_DIALCODES_UTILIZED
:
String
=
"ERR_ALL_DIALCODES_UTILIZED"
val
ERR_ALL_DIALCODES_UTILIZED
:
String
=
"ERR_ALL_DIALCODES_UTILIZED"
val
ERR_INVALID_OPERATION
:
String
=
"ERR_INVALID_OPERATION"
val
ERR_INVALID_OPERATION
:
String
=
"ERR_INVALID_OPERATION"
val
ERR_COUNT_GREATER_THAN_RESERVED_DIAL_CODES
:
String
=
"ERR_COUNT_GREATER_THAN_RESERVED_DIAL_CODES"
//Error Messages
//Error Messages
val
ERR_INVALID_REQ_MSG
:
String
=
"Invalid Request! Please Provide Valid Request."
val
ERR_INVALID_REQ_MSG
:
String
=
"Invalid Request! Please Provide Valid Request."
...
@@ -40,4 +41,5 @@ object DIALErrors {
...
@@ -40,4 +41,5 @@ object DIALErrors {
val
ERR_CONTENT_MISSING_RESERVED_DIAL_CODES_MSG
:
String
=
"Invalid Request. Content does not have reserved DIAL codes."
val
ERR_CONTENT_MISSING_RESERVED_DIAL_CODES_MSG
:
String
=
"Invalid Request. Content does not have reserved DIAL codes."
val
ERR_ALL_DIALCODES_UTILIZED_MSG
:
String
=
"Error! All Reserved DIAL Codes are Utilized."
val
ERR_ALL_DIALCODES_UTILIZED_MSG
:
String
=
"Error! All Reserved DIAL Codes are Utilized."
val
ERR_INVALID_OPERATION_MSG
:
String
=
"Invalid operation request!"
val
ERR_INVALID_OPERATION_MSG
:
String
=
"Invalid operation request!"
val
ERR_COUNT_GREATER_THAN_RESERVED_DIAL_CODES_MSG
:
String
=
"Invalid Request. Count greater than reserved DIAL codes."
}
}
This diff is collapsed.
Click to expand it.
content-api/content-actors/src/main/scala/org/sunbird/content/dial/DIALManager.scala
+
4
−
0
View file @
b7d1722a
...
@@ -313,6 +313,10 @@ object DIALManager {
...
@@ -313,6 +313,10 @@ object DIALManager {
val
reservedDialCodes
=
if
(
contentMetadata
.
containsKey
(
DIALConstants
.
RESERVED_DIALCODES
))
ScalaJsonUtils
.
deserialize
[
Map
[
String
,
Integer
]](
contentMetadata
.
get
(
DIALConstants
.
RESERVED_DIALCODES
).
asInstanceOf
[
String
])
val
reservedDialCodes
=
if
(
contentMetadata
.
containsKey
(
DIALConstants
.
RESERVED_DIALCODES
))
ScalaJsonUtils
.
deserialize
[
Map
[
String
,
Integer
]](
contentMetadata
.
get
(
DIALConstants
.
RESERVED_DIALCODES
).
asInstanceOf
[
String
])
else
throw
new
ClientException
(
DIALErrors
.
ERR_CONTENT_MISSING_RESERVED_DIAL_CODES
,
DIALErrors
.
ERR_CONTENT_MISSING_RESERVED_DIAL_CODES_MSG
)
else
throw
new
ClientException
(
DIALErrors
.
ERR_CONTENT_MISSING_RESERVED_DIAL_CODES
,
DIALErrors
.
ERR_CONTENT_MISSING_RESERVED_DIAL_CODES_MSG
)
val
countInRequest
=
request
.
get
(
DIALConstants
.
COUNT
).
asInstanceOf
[
Integer
]
if
(
reservedDialCodes
.
keySet
.
size
<
countInRequest
)
throw
new
ClientException
(
DIALErrors
.
ERR_COUNT_GREATER_THAN_RESERVED_DIAL_CODES
,
DIALErrors
.
ERR_COUNT_GREATER_THAN_RESERVED_DIAL_CODES_MSG
)
populateAssignedDialCodes
(
contentId
,
contentMetadata
,
request
).
map
(
assignedDialCodes
=>
{
populateAssignedDialCodes
(
contentId
,
contentMetadata
,
request
).
map
(
assignedDialCodes
=>
{
val
toReleaseDIALCodes
=
reservedDialCodes
.
keySet
--
assignedDialCodes
.
toSet
val
toReleaseDIALCodes
=
reservedDialCodes
.
keySet
--
assignedDialCodes
.
toSet
...
...
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