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
15d26626
Commit
15d26626
authored
1 year ago
by
Rahul Bowade
Browse files
Options
Download
Patches
Plain Diff
Removed the unwanted changes from the branch
parent
a9a93f0f
Remove_unwantedCode_Gcloud_fix
No related merge requests found
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
assessment-api/assessment-actors/src/main/scala/org/sunbird/actors/QuestionActor.scala
+0
-1
...ors/src/main/scala/org/sunbird/actors/QuestionActor.scala
assessment-api/assessment-actors/src/main/scala/org/sunbird/managers/AssessmentManager.scala
+0
-4
...c/main/scala/org/sunbird/managers/AssessmentManager.scala
assessment-api/assessment-service/app/controllers/BaseController.scala
+0
-6
...i/assessment-service/app/controllers/BaseController.scala
assessment-api/assessment-service/app/controllers/v4/QuestionController.scala
+1
-43
...sment-service/app/controllers/v4/QuestionController.scala
assessment-api/assessment-service/app/handlers/CompetencyExcelParser.scala
+0
-113
...sessment-service/app/handlers/CompetencyExcelParser.scala
assessment-api/assessment-service/app/utils/ApiId.scala
+0
-1
assessment-api/assessment-service/app/utils/ApiId.scala
assessment-api/assessment-service/app/utils/QuestionOperations.scala
+1
-1
...api/assessment-service/app/utils/QuestionOperations.scala
assessment-api/assessment-service/conf/application.conf
+0
-4
assessment-api/assessment-service/conf/application.conf
assessment-api/assessment-service/conf/routes
+0
-1
assessment-api/assessment-service/conf/routes
schemas/competency/1.0/config.json
+0
-46
schemas/competency/1.0/config.json
schemas/competency/1.0/schema.json
+0
-42
schemas/competency/1.0/schema.json
with
2 additions
and
262 deletions
+2
-262
assessment-api/assessment-actors/src/main/scala/org/sunbird/actors/QuestionActor.scala
+
0
−
1
View file @
15d26626
...
...
@@ -38,7 +38,6 @@ class QuestionActor @Inject()(implicit oec: OntologyEngineContext) extends BaseA
case
"rejectQuestion"
=>
reject
(
request
)
case
"copyQuestion"
=>
copy
(
request
)
case
"bulkUploadQuestion"
=>
bulkUpload
(
request
)
case
"bulkUploadFrameworkMapping"
=>
AssessmentManager
.
createMapping
(
request
,
"ERR_QUESTION_CREATE"
)
case
_
=>
ERROR
(
request
.
getOperation
)
}
...
...
This diff is collapsed.
Click to expand it.
assessment-api/assessment-actors/src/main/scala/org/sunbird/managers/AssessmentManager.scala
+
0
−
4
View file @
15d26626
...
...
@@ -221,8 +221,4 @@ object AssessmentManager {
}}
(
actor
,
context
,
objData
,
eData
)
}
def
createMapping
(
request
:
Request
,
str
:
String
)(
implicit
oec
:
OntologyEngineContext
,
ec
:
ExecutionContext
)
:
Future
[
Response
]
=
{
oec
.
graphService
.
saveExternalProps
(
request
)
}
}
This diff is collapsed.
Click to expand it.
assessment-api/assessment-service/app/controllers/BaseController.scala
+
0
−
6
View file @
15d26626
...
...
@@ -13,7 +13,6 @@ import collection.JavaConverters._
import
scala.concurrent.
{
ExecutionContext
,
Future
}
import
org.slf4j.
{
Logger
,
LoggerFactory
}
import
org.sunbird.cache.impl.RedisCache
import
play.api.libs.Files
abstract
class
BaseController
(
protected
val
cc
:
ControllerComponents
)(
implicit
exec
:
ExecutionContext
)
extends
AbstractController
(
cc
)
{
...
...
@@ -23,11 +22,6 @@ abstract class BaseController(protected val cc: ControllerComponents)(implicit e
JavaJsonUtils
.
deserialize
[
java.util.Map
[
String
,
Object
]](
body
).
getOrDefault
(
"request"
,
new
java
.
util
.
HashMap
()).
asInstanceOf
[
java.util.Map
[
String
,
Object
]]
}
def
competencyRequestBody
()(
implicit
request
:
Request
[
MultipartFormData
[
Files.TemporaryFile
]])
=
{
val
body
=
request
.
body
.
file
(
Files
.
TemporaryFile
.
toString
).
getOrElse
(
"{}"
).
toString
JavaJsonUtils
.
deserialize
[
java.util.Map
[
String
,
Object
]](
body
).
getOrDefault
(
"request"
,
new
java
.
util
.
HashMap
()).
asInstanceOf
[
java.util.Map
[
String
,
Object
]]
}
def
commonHeaders
()(
implicit
request
:
Request
[
AnyContent
])
:
java.util.Map
[
String
,
Object
]
=
{
val
customHeaders
=
Map
(
"x-channel-id"
->
"channel"
,
"X-Consumer-ID"
->
"consumerId"
,
"X-App-Id"
->
"appId"
)
customHeaders
.
map
(
ch
=>
{
...
...
This diff is collapsed.
Click to expand it.
assessment-api/assessment-service/app/controllers/v4/QuestionController.scala
+
1
−
43
View file @
15d26626
...
...
@@ -2,7 +2,7 @@ package controllers.v4
import
akka.actor.
{
ActorRef
,
ActorSystem
}
import
controllers.BaseController
import
handlers.
{
CompetencyExcelParser
,
QuestionExcelParser
}
import
handlers.QuestionExcelParser
import
org.slf4j.
{
Logger
,
LoggerFactory
}
import
org.sunbird.cache.impl.RedisCache
import
org.sunbird.common.dto.Response
...
...
@@ -184,46 +184,4 @@ class QuestionController @Inject()(@Named(ActorNames.QUESTION_ACTOR) questionAct
logger
.
info
(
"in Future sequence"
)
Await
.
result
(
f
,
Duration
.
apply
(
"300s"
))
}
def
createFrameworkMappingData
()
=
Action
(
parse
.
multipartFormData
)
{
implicit
request
=>
val
competency
=
request
.
body
.
file
(
"file"
)
.
map
{
filePart
=>
val
absolutePath
=
filePart
.
ref
.
path
.
toAbsolutePath
println
(
"createFrameworkMappingData:= "
+
absolutePath
)
CompetencyExcelParser
.
getCompetency
(
absolutePath
.
toFile
)
}
val
futures
=
competency
.
get
.
map
(
competncy
=>
{
val
headers
=
commonHeaders
(
request
.
headers
)
logger
.
info
(
"put headers "
+
headers
)
val
questionRequest
=
getRequest
(
competncy
,
headers
,
QuestionOperations
.
createQuestion
.
toString
)
logger
.
info
(
"After the questionRequest"
)
setRequestContext
(
questionRequest
,
version
,
objectType
,
schemaName
)
logger
.
info
(
"After the setRequestContext"
)
getResponse
(
ApiId
.
CREATE_QUESTION
,
questionActor
,
questionRequest
)
}
)
val
futures1
=
competency
.
get
.
map
(
competncy
=>
{
val
headers
=
commonHeaders
(
request
.
headers
)
System
.
out
.
println
(
"Headers is "
+
headers
)
val
body
=
competencyRequestBody
()
System
.
out
.
println
(
"body is "
+
body
)
val
question
=
body
.
getOrDefault
(
"competency"
,
new
java
.
util
.
HashMap
()).
asInstanceOf
[
java.util.Map
[
String
,
AnyRef
]]
competncy
.
putAll
(
headers
)
val
questionRequest
=
getRequest
(
competncy
,
headers
,
QuestionOperations
.
bulkUploadFrameworkMapping
.
toString
)
setRequestContext
(
questionRequest
,
version
,
"competency"
,
"competency"
)
getResult
(
ApiId
.
FRAMEWORK_COMPETENCY_QUESTION
,
questionActor
,
questionRequest
)
})
logger
.
info
(
"After the getResponse"
)
val
f
=
Future
.
sequence
(
futures1
).
map
(
results
=>
results
.
map
(
_
.
asInstanceOf
[
Response
]).
groupBy
(
_
.
getResponseCode
.
toString
).
mapValues
(
listResult
=>
{
listResult
.
map
(
result
=>
{
setResponseEnvelope
(
result
)
JavaJsonUtils
.
serialize
(
result
.
getResult
)
})
})).
map
(
f
=>
Ok
(
Json
.
stringify
(
Json
.
toJson
(
f
))).
as
(
"application/json"
))
logger
.
info
(
"in Future sequence"
)
Await
.
result
(
f
,
Duration
.
apply
(
"30s"
))
}
}
This diff is collapsed.
Click to expand it.
assessment-api/assessment-service/app/handlers/CompetencyExcelParser.scala
deleted
100644 → 0
+
0
−
113
View file @
a9a93f0f
package
handlers
import
org.apache.poi.ss.usermodel.DataFormatter
import
org.apache.poi.xssf.usermodel.
{
XSSFRow
,
XSSFSheet
,
XSSFWorkbook
}
import
org.slf4j.
{
Logger
,
LoggerFactory
}
import
java.io.
{
File
,
FileInputStream
}
import
java.util
import
scala.collection.JavaConverters.
{
asScalaIteratorConverter
,
iterableAsScalaIterableConverter
,
mapAsScalaMapConverter
}
import
scala.collection.mutable
import
scala.collection.mutable.ListBuffer
case
class
Activity
(
code
:
String
,
label
:
String
)
object
CompetencyExcelParser
{
private
val
logger
:
Logger
=
LoggerFactory
.
getLogger
(
getClass
.
getName
)
private
var
getData
:
List
[
util.Map
[
String
,
AnyRef
]]
=
List
.
empty
def
parseCompetencyData
(
xssFRow
:
XSSFRow
)
=
{
val
data
=
new
java
.
util
.
HashMap
().
asInstanceOf
[
java.util.Map
[
String
,
AnyRef
]]
val
listData
=
new
util
.
ArrayList
[
AnyRef
]()
val
rowContent
=
(
0
until
xssFRow
.
getPhysicalNumberOfCells
)
.
map
(
colId
=>
Option
(
xssFRow
.
getCell
(
colId
)).
getOrElse
(
""
).
toString
).
toList
val
function
=
rowContent
.
apply
(
0
).
trim
val
year
=
rowContent
.
apply
(
1
).
trim
val
roleId
=
rowContent
.
apply
(
2
).
trim
val
roleLabel
=
rowContent
.
apply
(
3
).
trim
val
competencyMapping
=
rowContent
.
apply
(
4
).
trim
val
activityId
=
rowContent
.
apply
(
5
).
trim
val
activityLabel
=
rowContent
.
apply
(
6
).
trim
val
competencyId
=
rowContent
.
apply
(
7
).
trim
val
competency
=
rowContent
.
apply
(
8
).
trim
val
competencyLevelId
=
rowContent
.
apply
(
9
).
trim
listData
.
add
(
function
)
listData
.
add
(
year
)
listData
.
add
(
roleId
)
listData
.
add
(
roleLabel
)
listData
.
add
(
activityId
)
listData
.
add
(
activityLabel
)
listData
.
add
(
competencyId
)
listData
.
add
(
competency
)
listData
.
add
(
competencyLevelId
)
data
.
put
(
competencyMapping
,
listData
)
data
}
def
getCompetency
(
file
:
File
)
:
List
[
java.util.Map
[
String
,
AnyRef
]]
=
{
logger
.
info
(
"enter into the getCompetency method"
)
val
finalData
:
mutable.Map
[
String
,
List
[
Map
[
String
,
AnyRef
]]]
=
mutable
.
Map
.
empty
try
{
val
workbook
=
new
XSSFWorkbook
(
new
FileInputStream
(
file
))
(
0
until
workbook
.
getNumberOfSheets
)
.
foreach
(
index
=>
{
getData
=
getCompetenciesData
(
workbook
.
getSheetAt
(
index
))
val
convertedData
=
getData
.
map
(
_
.
asScala
.
toMap
)
finalData
+=
(
workbook
.
getSheetName
(
index
)
->
convertedData
)
getData
=
finalData
.
toList
.
flatMap
{
case
(
_
,
maps
)
=>
maps
.
map
(
convertMap
)
}
})
getData
}
catch
{
case
e
:
Exception
=>
throw
new
Exception
(
"Invalid File"
)
}
}
def
convertMap
(
map
:
Map
[
String
,
AnyRef
])
:
util.Map
[
String
,
AnyRef
]
=
{
val
javaMap
=
new
util
.
HashMap
[
String
,
AnyRef
]()
map
.
foreach
{
case
(
k
,
v
)
=>
javaMap
.
put
(
k
,
v
)
}
javaMap
}
def
getCompetenciesData
(
sheet
:
XSSFSheet
)
:
List
[
util.Map
[
String
,
AnyRef
]]
=
{
val
rows
=
sheet
.
asScala
.
drop
(
1
)
getData
=
rows
.
flatMap
(
row
=>
{
val
rowValue
=
{
if
(
sheet
.
getWorkbook
.
getSheetIndex
(
sheet
)
==
1
)
{
if
(!
row
.
getCell
(
4
).
getStringCellValue
.
isEmpty
)
{
row
.
getCell
(
4
)
}
}
else
if
(!
row
.
getCell
(
5
).
getStringCellValue
.
isEmpty
)
{
row
.
getCell
(
5
)
}
}
if
(
sheet
.
getWorkbook
.
getSheetIndex
(
sheet
)
==
1
&&
rowValue
!=
null
&&
!
rowValue
.
toString
.
equals
(
"()"
))
Option
(
sheet
.
getRow
(
row
.
getRowNum
)).
map
(
parseCompetencyData
)
else
if
(
sheet
.
getWorkbook
.
getSheetIndex
(
sheet
)
==
2
&&
rowValue
!=
null
&&
!
rowValue
.
toString
.
equals
(
"()"
))
Option
(
sheet
.
getRow
(
row
.
getRowNum
)).
map
(
parseCompetencyData
)
else
if
(
sheet
.
getWorkbook
.
getSheetIndex
(
sheet
)
==
3
&&
rowValue
!=
null
&&
!
rowValue
.
toString
.
equals
(
"()"
))
Option
(
sheet
.
getRow
(
row
.
getRowNum
)).
map
(
parseCompetencyData
)
else
if
(
sheet
.
getWorkbook
.
getSheetIndex
(
sheet
)
==
4
&&
rowValue
!=
null
&&
!
rowValue
.
toString
.
equals
(
"()"
))
Option
(
sheet
.
getRow
(
row
.
getRowNum
)).
map
(
parseCompetencyData
)
else
if
(
sheet
.
getWorkbook
.
getSheetIndex
(
sheet
)
==
5
&&
rowValue
!=
null
&&
!
rowValue
.
toString
.
equals
(
"()"
))
Option
(
sheet
.
getRow
(
row
.
getRowNum
)).
map
(
parseCompetencyData
)
else
if
(
sheet
.
getWorkbook
.
getSheetIndex
(
sheet
)
==
6
&&
rowValue
!=
null
&&
!
rowValue
.
toString
.
equals
(
"()"
))
Option
(
sheet
.
getRow
(
row
.
getRowNum
)).
map
(
parseCompetencyData
)
else
if
(
sheet
.
getWorkbook
.
getSheetIndex
(
sheet
)
==
7
&&
rowValue
!=
null
&&
!
rowValue
.
toString
.
equals
(
"()"
))
Option
(
sheet
.
getRow
(
row
.
getRowNum
)).
map
(
parseCompetencyData
)
else
if
(
sheet
.
getWorkbook
.
getSheetIndex
(
sheet
)
==
8
&&
rowValue
!=
null
&&
!
rowValue
.
toString
.
equals
(
"()"
))
Option
(
sheet
.
getRow
(
row
.
getRowNum
)).
map
(
parseCompetencyData
)
else
if
(
sheet
.
getWorkbook
.
getSheetIndex
(
sheet
)
==
9
&&
rowValue
!=
null
&&
!
rowValue
.
toString
.
equals
(
"()"
))
Option
(
sheet
.
getRow
(
row
.
getRowNum
)).
map
(
parseCompetencyData
)
else
{
None
}
}).
toList
getData
}
}
This diff is collapsed.
Click to expand it.
assessment-api/assessment-service/app/utils/ApiId.scala
+
0
−
1
View file @
15d26626
...
...
@@ -26,7 +26,6 @@ object ApiId {
val
REJECT_QUESTION
=
"api.question.reject"
val
COPY_QUESTION
=
"api.question.copy"
val
BULK_UPLOAD_QUESTION
=
"api.question.bulk.upload"
val
FRAMEWORK_COMPETENCY_QUESTION
=
"api.question.mapping"
//QuestionSet APIs
val
CREATE_QUESTION_SET
=
"api.questionset.create"
val
READ_QUESTION_SET
=
"api.questionset.read"
...
...
This diff is collapsed.
Click to expand it.
assessment-api/assessment-service/app/utils/QuestionOperations.scala
+
1
−
1
View file @
15d26626
package
utils
object
QuestionOperations
extends
Enumeration
{
val
createQuestion
,
readQuestion
,
readPrivateQuestion
,
updateQuestion
,
reviewQuestion
,
publishQuestion
,
retireQuestion
,
importQuestion
,
systemUpdateQuestion
,
listQuestions
,
rejectQuestion
,
copyQuestion
,
bulkUploadFrameworkMapping
=
Value
val
createQuestion
,
readQuestion
,
readPrivateQuestion
,
updateQuestion
,
reviewQuestion
,
publishQuestion
,
retireQuestion
,
importQuestion
,
systemUpdateQuestion
,
listQuestions
,
rejectQuestion
,
copyQuestion
=
Value
}
This diff is collapsed.
Click to expand it.
assessment-api/assessment-service/conf/application.conf
+
0
−
4
View file @
15d26626
...
...
@@ -395,10 +395,6 @@ question {
keyspace
=
"question_store"
list
.
limit
=
20
}
competency
{
keyspace
=
"taxonomy"
list
.
limit
=
20
}
questionset
.
keyspace
=
"hierarchy_store"
cassandra
{
...
...
This diff is collapsed.
Click to expand it.
assessment-api/assessment-service/conf/routes
+
0
−
1
View file @
15d26626
...
...
@@ -25,7 +25,6 @@ POST /question/v4/list controllers.v4.QuestionControl
POST /question/v4/reject/:identifier controllers.v4.QuestionController.reject(identifier:String)
POST /question/v4/copy/:identifier controllers.v4.QuestionController.copy(identifier:String, mode:Option[String])
POST /question/v4/bulk/upload controllers.v4.QuestionController.uploadExcel
POST /question/v4/bulk/upload/mapping controllers.v4.QuestionController.createFrameworkMappingData
# QuestionSet API's
POST /questionset/v4/create controllers.v4.QuestionSetController.create
...
...
This diff is collapsed.
Click to expand it.
schemas/competency/1.0/config.json
deleted
100644 → 0
+
0
−
46
View file @
a9a93f0f
{
"objectType"
:
"competency"
,
"version"
:
"enable"
,
"versionCheckMode"
:
"ON"
,
"cacheEnabled"
:
false
,
"schema_restrict_api"
:
true
,
"external"
:
{
"tableName"
:
"competency"
,
"properties"
:
{
"function"
:
{
"type"
:
"string"
},
"competency_code"
:
{
"type"
:
"string"
},
"subject"
:
{
"type"
:
"string"
},
"competency_label"
:
{
"type"
:
"string"
},
"competency_description"
:
{
"type"
:
"string"
},
"competency_level_code"
:
{
"type"
:
"string"
},
"competency_level_label"
:
{
"type"
:
"string"
},
"competency_level_description"
:
{
"type"
:
"string"
},
"activity_code"
:
{
"type"
:
"string"
},
"activity_label"
:
{
"type"
:
"string"
},
"question_code"
:
{
"type"
:
"string"
}
},
"primaryKey"
:
[
"identifier"
]
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
schemas/competency/1.0/schema.json
deleted
100644 → 0
+
0
−
42
View file @
a9a93f0f
{
"$id"
:
"competency-schema.json"
,
"$schema"
:
"http://json-schema.org/draft-07/schema#"
,
"title"
:
"Competency"
,
"type"
:
"object"
,
"properties"
:
{
"function"
:
{
"type"
:
"string"
},
"competency_code"
:
{
"type"
:
"string"
},
"subject"
:
{
"type"
:
"string"
},
"competency_label"
:
{
"type"
:
"string"
},
"competency_description"
:
{
"type"
:
"string"
},
"competency_level_code"
:
{
"type"
:
"string"
},
"competency_level_label"
:
{
"type"
:
"string"
},
"competency_level_description"
:
{
"type"
:
"string"
},
"activity_code"
:
{
"type"
:
"string"
},
"activity_label"
:
{
"type"
:
"string"
},
"question_code"
:
{
"type"
:
"string"
}
},
"additionalProperties"
:
false
}
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