From 3c76c78d764ceb639c450b490dff657c379d3437 Mon Sep 17 00:00:00 2001 From: megala21 Date: Tue, 3 Oct 2017 10:46:25 +0530 Subject: [PATCH] Making the icon to be returned with the Application --- .../api/services/impl/ApplicationManagementAPIImpl.java | 3 +++ .../carbon/device/application/mgt/common/Application.java | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementAPIImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementAPIImpl.java index c73e2a8487..74d8b4fb87 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementAPIImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementAPIImpl.java @@ -97,12 +97,15 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI { @Path("/{uuid}") public Response getApplication(@PathParam("uuid") String uuid) { ApplicationManager applicationManager = APIUtil.getApplicationManager(); + ApplicationStorageManager applicationStorageManager = APIUtil.getApplicationStorageManager(); try { Application application = applicationManager.getApplication(uuid); if (application == null) { return Response.status(Response.Status.NOT_FOUND) .entity("Application with UUID " + uuid + " not found").build(); } + ImageArtifact icon = applicationStorageManager.getImageArtifact(uuid, "icon", 0); + application.setIcon(icon); return Response.status(Response.Status.OK).entity(application).build(); } catch (NotFoundException e) { return Response.status(Response.Status.NOT_FOUND).build(); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java index 246089b2a7..0f76dd36e5 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java @@ -21,6 +21,7 @@ package org.wso2.carbon.device.application.mgt.common; import org.wso2.carbon.device.application.mgt.common.jaxrs.Exclude; +import java.awt.*; import java.util.Date; import java.util.List; import java.util.Map; @@ -69,6 +70,8 @@ public class Application { private User user; + private ImageArtifact icon; + public int getId() { return id; } @@ -221,6 +224,10 @@ public class Application { return screenShotCount; } + public void setIcon(ImageArtifact icon) { + this.icon = icon; + } + @Override public String toString() { String app = "UUID : " + uuid + "\tName : " + name + "\tShort Description : "