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
f177b112
Commit
f177b112
authored
2 years ago
by
PrasadMoka
Browse files
Options
Download
Patches
Plain Diff
LR-278 getBaseUrl to cloud util
parent
22a5b485
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
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
+3
-2
...tors/certificate/service/CourseBatchCertificateActor.java
course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/qrcodedownload/QRCodeDownloadManagementActor.java
+1
-7
.../actors/qrcodedownload/QRCodeDownloadManagementActor.java
course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/util/CloudStorageUtil.java
+13
-0
...c/main/java/org/sunbird/common/util/CloudStorageUtil.java
with
17 additions
and
9 deletions
+17
-9
course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/certificate/service/CourseBatchCertificateActor.java
+
3
−
2
View file @
f177b112
...
...
@@ -18,6 +18,7 @@ import org.sunbird.common.models.util.TelemetryEnvKey;
import
org.sunbird.common.request.Request
;
import
org.sunbird.common.request.RequestContext
;
import
org.sunbird.common.responsecode.ResponseCode
;
import
org.sunbird.common.util.CloudStorageUtil
;
import
org.sunbird.learner.actors.coursebatch.dao.CourseBatchDao
;
import
org.sunbird.learner.actors.coursebatch.dao.impl.CourseBatchDaoImpl
;
import
org.sunbird.learner.constants.CourseJsonKey
;
...
...
@@ -146,8 +147,8 @@ public class CourseBatchCertificateActor extends BaseActor {
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
)
+
"/"
+
getConfigValue
(
CONTENT_CLOUD_STORAGE_CONTAINER
)))
templateUrl
=
templateUrl
.
replace
(
getConfigValue
(
CLOUD_STORE_BASE_PATH
)+
"/"
+
getConfigValue
(
CONTENT_CLOUD_STORAGE_CONTAINER
),
getConfigValue
(
CLOUD_STORE_BASE_PATH_PLACEHOLDER
));
if
(
templateUrl
.
contains
(
CloudStorageUtil
.
getBaseUrl
(
)
+
"/"
+
getConfigValue
(
CONTENT_CLOUD_STORAGE_CONTAINER
)))
templateUrl
=
templateUrl
.
replace
(
CloudStorageUtil
.
getBaseUrl
(
)+
"/"
+
getConfigValue
(
CONTENT_CLOUD_STORAGE_CONTAINER
),
getConfigValue
(
CLOUD_STORE_BASE_PATH_PLACEHOLDER
));
}
return
templateUrl
;
}
...
...
This diff is collapsed.
Click to expand it.
course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/qrcodedownload/QRCodeDownloadManagementActor.java
+
1
−
7
View file @
f177b112
...
...
@@ -245,17 +245,11 @@ public class QRCodeDownloadManagementActor extends BaseActor {
private
String
resolvePlaceholder
(
String
templateUrl
,
String
placeHolder
,
String
containerName
)
{
if
(
templateUrl
.
contains
(
placeHolder
))
templateUrl
=
templateUrl
.
replace
(
placeHolder
,
getBaseUrl
()
templateUrl
=
templateUrl
.
replace
(
placeHolder
,
CloudStorageUtil
.
getBaseUrl
()
+
"/"
+
containerName
);
return
templateUrl
;
}
private
String
getBaseUrl
()
{
String
baseUrl
=
getConfigValue
(
CLOUD_STORAGE_CNAME_URL
);
if
(
StringUtils
.
isEmpty
(
baseUrl
))
baseUrl
=
getConfigValue
(
CLOUD_STORE_BASE_PATH
);
return
baseUrl
;
}
/**
* Uploading the generated csv to aws
...
...
This diff is collapsed.
Click to expand it.
course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/util/CloudStorageUtil.java
+
13
−
0
View file @
f177b112
...
...
@@ -2,6 +2,8 @@ package org.sunbird.common.util;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.apache.commons.lang.StringUtils
;
import
org.sunbird.cloud.storage.BaseStorageService
;
import
org.sunbird.cloud.storage.factory.StorageConfig
;
import
org.sunbird.cloud.storage.factory.StorageServiceFactory
;
...
...
@@ -11,6 +13,10 @@ import org.sunbird.common.models.util.PropertiesCache;
import
scala.Option
;
import
scala.Some
;
import
static
org
.
sunbird
.
common
.
models
.
util
.
JsonKey
.
CLOUD_STORAGE_CNAME_URL
;
import
static
org
.
sunbird
.
common
.
models
.
util
.
JsonKey
.
CLOUD_STORE_BASE_PATH
;
import
static
org
.
sunbird
.
common
.
models
.
util
.
ProjectUtil
.
getConfigValue
;
public
class
CloudStorageUtil
{
private
static
final
int
STORAGE_SERVICE_API_RETRY_COUNT
=
3
;
...
...
@@ -76,4 +82,11 @@ public class CloudStorageUtil {
BaseStorageService
storageService
=
getStorageService
(
storageType
);
return
storageService
.
getUri
(
container
,
prefix
,
Option
.
apply
(
isDirectory
));
}
public
static
String
getBaseUrl
()
{
String
baseUrl
=
getConfigValue
(
CLOUD_STORAGE_CNAME_URL
);
if
(
StringUtils
.
isEmpty
(
baseUrl
))
baseUrl
=
getConfigValue
(
CLOUD_STORE_BASE_PATH
);
return
baseUrl
;
}
}
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