|
|
@ -172,7 +172,9 @@ public class VirtualFireAlarmServiceImpl implements VirtualFireAlarmService {
|
|
|
|
public Response downloadSketch(@QueryParam("deviceName") String deviceName,
|
|
|
|
public Response downloadSketch(@QueryParam("deviceName") String deviceName,
|
|
|
|
@QueryParam("sketchType") String sketchType) {
|
|
|
|
@QueryParam("sketchType") String sketchType) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
ZipArchive zipFile = createDownloadFile(APIUtil.getAuthenticatedUser(), deviceName, sketchType);
|
|
|
|
String user = APIUtil.getAuthenticatedUser() + "@" + PrivilegedCarbonContext.getThreadLocalCarbonContext()
|
|
|
|
|
|
|
|
.getTenantDomain();
|
|
|
|
|
|
|
|
ZipArchive zipFile = createDownloadFile(user, deviceName, sketchType);
|
|
|
|
Response.ResponseBuilder response = Response.ok(FileUtils.readFileToByteArray(zipFile.getZipFile()));
|
|
|
|
Response.ResponseBuilder response = Response.ok(FileUtils.readFileToByteArray(zipFile.getZipFile()));
|
|
|
|
response.status(Response.Status.OK);
|
|
|
|
response.status(Response.Status.OK);
|
|
|
|
response.type("application/zip");
|
|
|
|
response.type("application/zip");
|
|
|
@ -242,7 +244,8 @@ public class VirtualFireAlarmServiceImpl implements VirtualFireAlarmService {
|
|
|
|
if (apiApplicationKey == null) {
|
|
|
|
if (apiApplicationKey == null) {
|
|
|
|
String applicationUsername =
|
|
|
|
String applicationUsername =
|
|
|
|
PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm().getRealmConfiguration()
|
|
|
|
PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm().getRealmConfiguration()
|
|
|
|
.getAdminUserName();
|
|
|
|
.getAdminUserName() + "@" + PrivilegedCarbonContext.getThreadLocalCarbonContext()
|
|
|
|
|
|
|
|
.getTenantDomain();
|
|
|
|
APIManagementProviderService apiManagementProviderService = APIUtil.getAPIManagementProviderService();
|
|
|
|
APIManagementProviderService apiManagementProviderService = APIUtil.getAPIManagementProviderService();
|
|
|
|
String[] tags = {VirtualFireAlarmConstants.DEVICE_TYPE};
|
|
|
|
String[] tags = {VirtualFireAlarmConstants.DEVICE_TYPE};
|
|
|
|
apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys(
|
|
|
|
apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys(
|
|
|
|