|
|
|
@ -65,6 +65,13 @@ public class WhiteLabelManagementServiceImpl implements WhiteLabelManagementServ
|
|
|
|
|
initializeWhiteLabelThemes();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initializes white label themes for a tenant by retrieving white label metadata and updating it if necessary.
|
|
|
|
|
* If the white label metadata is found and the "DocUrl" is missing,it updates the metadata with the default value
|
|
|
|
|
* for DocUrl.
|
|
|
|
|
*
|
|
|
|
|
* @throws MetadataManagementException if an error occurs while managing metadata or transactions.
|
|
|
|
|
*/
|
|
|
|
|
private void initializeWhiteLabelThemes() throws MetadataManagementException {
|
|
|
|
|
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
|
|
|
|
|
WhiteLabelTheme defaultTheme = getDefaultWhiteLabelTheme();
|
|
|
|
@ -83,8 +90,7 @@ public class WhiteLabelManagementServiceImpl implements WhiteLabelManagementServ
|
|
|
|
|
log.debug("WhiteLabel theme's DocUrl was missing and has been updated to the default value " +
|
|
|
|
|
"for tenant: " + tenantId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (MetadataManagementDAOException e) {
|
|
|
|
|
} catch (MetadataManagementDAOException e) {
|
|
|
|
|
MetadataManagementDAOFactory.rollbackTransaction();
|
|
|
|
|
String msg = "Error occurred while fetching white label metadata for tenant: " + tenantId;
|
|
|
|
|
log.error(msg, e);
|
|
|
|
@ -167,7 +173,7 @@ public class WhiteLabelManagementServiceImpl implements WhiteLabelManagementServ
|
|
|
|
|
*/
|
|
|
|
|
private FileResponse getImageFileResponseFromUrl(String url) throws IOException, NotFoundException {
|
|
|
|
|
FileResponse fileResponse = new FileResponse();
|
|
|
|
|
try(CloseableHttpClient client = HttpClients.createDefault()) {
|
|
|
|
|
try (CloseableHttpClient client = HttpClients.createDefault()) {
|
|
|
|
|
HttpGet imageGetRequest = new HttpGet(url);
|
|
|
|
|
HttpResponse response = client.execute(imageGetRequest);
|
|
|
|
|
InputStream imageStream = response.getEntity().getContent();
|
|
|
|
@ -528,12 +534,13 @@ public class WhiteLabelManagementServiceImpl implements WhiteLabelManagementServ
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Load White label Meta Data for given tenant Id.
|
|
|
|
|
*
|
|
|
|
|
* @param tenantId Id of the tenant
|
|
|
|
|
* @return {@link Metadata}
|
|
|
|
|
* @throws MetadataManagementException if an error occurred while getting Meta-Data info from Database for a
|
|
|
|
|
* given tenant ID.
|
|
|
|
|
*/
|
|
|
|
|
private Metadata getWhiteLabelMetaData (int tenantId) throws MetadataManagementException {
|
|
|
|
|
private Metadata getWhiteLabelMetaData(int tenantId) throws MetadataManagementException {
|
|
|
|
|
try {
|
|
|
|
|
MetadataManagementDAOFactory.openConnection();
|
|
|
|
|
return metadataDAO.getMetadata(tenantId, MetadataConstants.WHITELABEL_META_KEY);
|
|
|
|
|