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-jobs
Commits
cd4351f8
Commit
cd4351f8
authored
4 years ago
by
Mahesh Kumar Gangula
Browse files
Options
Download
Patches
Plain Diff
Issue #000 fix: update action list for relation cache update.
parent
68fa81f2
release-3.3.0
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
post-publish-processor/src/main/scala/org/sunbird/job/functions/PostPublishEventRouter.scala
+1
-8
...la/org/sunbird/job/functions/PostPublishEventRouter.scala
relation-cache-updater/src/main/scala/org/sunbird/job/functions/RelationCacheUpdater.scala
+4
-3
...cala/org/sunbird/job/functions/RelationCacheUpdater.scala
with
5 additions
and
11 deletions
+5
-11
post-publish-processor/src/main/scala/org/sunbird/job/functions/PostPublishEventRouter.scala
+
1
−
8
View file @
cd4351f8
...
...
@@ -48,8 +48,7 @@ class PostPublishEventRouter(config: PostPublishProcessorConfig)
val
action
=
eData
.
getOrDefault
(
"action"
,
""
).
asInstanceOf
[
String
]
val
mimeType
=
eData
.
getOrDefault
(
"mimeType"
,
""
).
asInstanceOf
[
String
]
val
identifier
=
eData
.
getOrDefault
(
"identifier"
,
""
).
asInstanceOf
[
String
]
val
manualSync
=
eData
.
getOrDefault
(
"manual-sync"
,
false
.
asInstanceOf
[
AnyRef
]).
asInstanceOf
[
Boolean
]
if
(
validEvent
(
mimeType
,
action
,
manualSync
))
{
if
(
StringUtils
.
equals
(
"application/vnd.ekstep.content-collection"
,
mimeType
)
&&
StringUtils
.
equals
(
action
,
"post-publish-process"
))
{
// Check shallow copied contents and publish.
val
shallowCopied
=
getShallowCopiedContents
(
identifier
)
logger
.
info
(
"Shallow copied by this content - "
+
identifier
+
" are: "
+
shallowCopied
.
size
)
...
...
@@ -89,12 +88,6 @@ class PostPublishEventRouter(config: PostPublishProcessorConfig)
List
(
config
.
successEventCount
,
config
.
failedEventCount
,
config
.
skippedEventCount
,
config
.
totalEventsCount
)
}
def
validEvent
(
mimeType
:
String
,
action
:
String
,
manualSync
:
Boolean
)
:
Boolean
=
{
(
StringUtils
.
equals
(
"application/vnd.ekstep.content-collection"
,
mimeType
)
&&
StringUtils
.
equals
(
action
,
"post-publish-process"
)
&&
!
manualSync
)
}
def
getShallowCopiedContents
(
identifier
:
String
)
:
List
[
PublishMetadata
]
=
{
val
httpRequest
=
s
"""{"request":{"filters":{"status":["Draft","Review","Live","Unlisted","Failed"],"origin":"${identifier}"},"fields":["identifier","mimeType","contentType","versionKey","channel","status","pkgVersion","lastPublishedBy","origin","originData"]}}"""
val
httpResponse
=
PPPStreamTask
.
httpUtil
.
post
(
config
.
searchBaseUrl
+
"/v3/search"
,
httpRequest
)
...
...
This diff is collapsed.
Click to expand it.
relation-cache-updater/src/main/scala/org/sunbird/job/functions/RelationCacheUpdater.scala
+
4
−
3
View file @
cd4351f8
...
...
@@ -29,6 +29,7 @@ class RelationCacheUpdater(config: RelationCacheUpdaterConfig)
private
var
dataCache
:
DataCache
=
_
private
var
collectionCache
:
DataCache
=
_
lazy
private
val
mapper
:
ObjectMapper
=
new
ObjectMapper
()
private
val
actions
:
List
[
String
]
=
List
(
"post-publish-process"
,
"relation-cache-update"
)
override
def
open
(
parameters
:
Configuration
)
:
Unit
=
{
...
...
@@ -90,9 +91,9 @@ class RelationCacheUpdater(config: RelationCacheUpdaterConfig)
val
mimeType
=
eData
.
getOrDefault
(
"mimeType"
,
""
).
asInstanceOf
[
String
]
val
identifier
=
eData
.
getOrDefault
(
"identifier"
,
""
).
asInstanceOf
[
String
]
StringUtils
.
equalsIgnoreCase
(
action
,
"post-publish-process"
)
&&
StringUtils
.
equalsIgnoreCase
(
mimeType
,
"application/vnd.ekstep.content-collection"
)
&&
StringUtils
.
isNotBlank
(
identifier
)
actions
.
contains
(
action
)
&&
StringUtils
.
isNotBlank
(
identifier
)
&&
StringUtils
.
equalsIgnoreCase
(
mimeType
,
"application/vnd.ekstep.content-collection"
)
}
private
def
getHierarchy
(
identifier
:
String
)(
implicit
metrics
:
Metrics
)
:
java.util.Map
[
String
,
AnyRef
]
=
{
...
...
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