Making the icon to be returned with the Application

feature/appm-store/pbac
megala21 7 years ago
parent 1bcd1707bd
commit 3c76c78d76

@ -97,12 +97,15 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
@Path("/{uuid}") @Path("/{uuid}")
public Response getApplication(@PathParam("uuid") String uuid) { public Response getApplication(@PathParam("uuid") String uuid) {
ApplicationManager applicationManager = APIUtil.getApplicationManager(); ApplicationManager applicationManager = APIUtil.getApplicationManager();
ApplicationStorageManager applicationStorageManager = APIUtil.getApplicationStorageManager();
try { try {
Application application = applicationManager.getApplication(uuid); Application application = applicationManager.getApplication(uuid);
if (application == null) { if (application == null) {
return Response.status(Response.Status.NOT_FOUND) return Response.status(Response.Status.NOT_FOUND)
.entity("Application with UUID " + uuid + " not found").build(); .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(); return Response.status(Response.Status.OK).entity(application).build();
} catch (NotFoundException e) { } catch (NotFoundException e) {
return Response.status(Response.Status.NOT_FOUND).build(); return Response.status(Response.Status.NOT_FOUND).build();

@ -21,6 +21,7 @@ package org.wso2.carbon.device.application.mgt.common;
import org.wso2.carbon.device.application.mgt.common.jaxrs.Exclude; import org.wso2.carbon.device.application.mgt.common.jaxrs.Exclude;
import java.awt.*;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -69,6 +70,8 @@ public class Application {
private User user; private User user;
private ImageArtifact icon;
public int getId() { public int getId() {
return id; return id;
} }
@ -221,6 +224,10 @@ public class Application {
return screenShotCount; return screenShotCount;
} }
public void setIcon(ImageArtifact icon) {
this.icon = icon;
}
@Override @Override
public String toString() { public String toString() {
String app = "UUID : " + uuid + "\tName : " + name + "\tShort Description : " String app = "UUID : " + uuid + "\tName : " + name + "\tShort Description : "

Loading…
Cancel
Save