Make banner uploading as optional.

feature/appm-store/pbac
lasanthaDLPDS 5 years ago
parent 48c87384f1
commit 4581238cf3

@ -2559,12 +2559,6 @@ public class ApplicationManagerImpl implements ApplicationManager {
log.error(msg);
throw new RequestValidatingException(msg);
}
//todo remove this check, because banner is not mandatory to have
if (bannerFile == null) {
String msg = "Banner file is not found with the application release creating request.";
log.error(msg);
throw new RequestValidatingException(msg);
}
if (attachmentList == null || attachmentList.isEmpty()) {
String msg = "Screenshots are not found with the application release creating request.";
log.error(msg);

@ -355,7 +355,10 @@ public class APIUtil {
applicationRelease.setSupportedOsVersions(applicationReleaseDTO.getSupportedOsVersions());
applicationRelease.setRating(applicationReleaseDTO.getRating());
applicationRelease.setIconPath(basePath + applicationReleaseDTO.getIconName());
applicationRelease.setBannerPath(basePath + applicationReleaseDTO.getBannerName());
if (!StringUtils.isEmpty(applicationReleaseDTO.getBannerName())){
applicationRelease.setBannerPath(basePath + applicationReleaseDTO.getBannerName());
}
if (urlValidator.isValid(applicationReleaseDTO.getInstallerName())){
applicationRelease

@ -320,8 +320,7 @@ public interface ApplicationManagementPublisherAPI {
@Multipart(value = "icon") Attachment iconFile,
@ApiParam(
name = "banner",
value = "Banner of the uploading application",
required = true)
value = "Banner of the uploading application")
@Multipart(value = "banner") Attachment bannerFile,
@ApiParam(
name = "screenshot1",
@ -385,8 +384,7 @@ public interface ApplicationManagementPublisherAPI {
@Multipart(value = "icon") Attachment iconFile,
@ApiParam(
name = "banner",
value = "Banner of the uploading web app",
required = true)
value = "Banner of the uploading web app")
@Multipart(value = "banner") Attachment bannerFile,
@ApiParam(
name = "screenshot1",
@ -450,8 +448,7 @@ public interface ApplicationManagementPublisherAPI {
@Multipart(value = "icon") Attachment iconFile,
@ApiParam(
name = "banner",
value = "Banner of the uploading public app",
required = true)
value = "Banner of the uploading public app")
@Multipart(value = "banner") Attachment bannerFile,
@ApiParam(
name = "screenshot1",
@ -523,8 +520,7 @@ public interface ApplicationManagementPublisherAPI {
@Multipart(value = "icon") Attachment iconFile,
@ApiParam(
name = "banner",
value = "Banner of the uploading application",
required = true)
value = "Banner of the uploading application")
@Multipart(value = "banner") Attachment bannerFile,
@ApiParam(
name = "screenshot1",
@ -635,8 +631,7 @@ public interface ApplicationManagementPublisherAPI {
@Multipart(value = "icon") Attachment iconFile,
@ApiParam(
name = "banner",
value = "Banner of the uploading application",
required = true)
value = "Banner of the uploading application")
@Multipart(value = "banner") Attachment bannerFile,
@ApiParam(
name = "screenshot1",
@ -776,8 +771,7 @@ public interface ApplicationManagementPublisherAPI {
@Multipart(value = "icon") Attachment iconFile,
@ApiParam(
name = "banner",
value = "banner file of the application release.",
required = true)
value = "banner file of the application release.")
@Multipart(value = "banner") Attachment bannerFile,
@ApiParam(
name = "screenshot1",

@ -46,9 +46,9 @@ import org.wso2.carbon.device.application.mgt.core.exception.NotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import javax.activation.DataHandler;
import javax.validation.Valid;
import javax.ws.rs.Consumes;
@ -85,10 +85,6 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
}
ApplicationList applications = applicationManager.getApplications(filter);
if (applications.getApplications().isEmpty()) {
return Response.status(Response.Status.OK)
.entity("Couldn't find any application for the requested query.").build();
}
return Response.status(Response.Status.OK).entity(applications).build();
} catch (BadRequestException e) {
String msg = "Incompatible request payload is found. Please try with valid request payload.";
@ -175,7 +171,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
@Multipart("application") ApplicationWrapper applicationWrapper,
@Multipart("binaryFile") Attachment binaryFile,
@Multipart("icon") Attachment iconFile,
@Multipart("banner") Attachment bannerFile,
@Multipart(value = "banner", required = false) Attachment bannerFile,
@Multipart("screenshot1") Attachment screenshot1,
@Multipart("screenshot2") Attachment screenshot2,
@Multipart("screenshot3") Attachment screenshot3) {
@ -214,7 +210,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
public Response createWebApp(
@Multipart("webapp") WebAppWrapper webAppWrapper,
@Multipart("icon") Attachment iconFile,
@Multipart("banner") Attachment bannerFile,
@Multipart(value = "banner", required = false) Attachment bannerFile,
@Multipart("screenshot1") Attachment screenshot1,
@Multipart("screenshot2") Attachment screenshot2,
@Multipart("screenshot3") Attachment screenshot3) {
@ -252,7 +248,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
public Response createPubApp(
@Multipart("public-app") PublicAppWrapper publicAppWrapper,
@Multipart("icon") Attachment iconFile,
@Multipart("banner") Attachment bannerFile,
@Multipart(value = "banner", required = false) Attachment bannerFile,
@Multipart("screenshot1") Attachment screenshot1,
@Multipart("screenshot2") Attachment screenshot2,
@Multipart("screenshot3") Attachment screenshot3) {
@ -292,7 +288,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
@Multipart("applicationRelease") ApplicationReleaseWrapper applicationReleaseWrapper,
@Multipart("binaryFile") Attachment binaryFile,
@Multipart("icon") Attachment iconFile,
@Multipart("banner") Attachment bannerFile,
@Multipart(value = "banner", required = false) Attachment bannerFile,
@Multipart("screenshot1") Attachment screenshot1,
@Multipart("screenshot2") Attachment screenshot2,
@Multipart("screenshot3") Attachment screenshot3) {
@ -331,7 +327,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
public Response updateApplicationImageArtifacts(
@PathParam("uuid") String applicationReleaseUuid,
@Multipart("icon") Attachment iconFile,
@Multipart("banner") Attachment bannerFile,
@Multipart(value = "banner", required = false) Attachment bannerFile,
@Multipart("screenshot1") Attachment screenshot1,
@Multipart("screenshot2") Attachment screenshot2,
@Multipart("screenshot3") Attachment screenshot3) {
@ -436,7 +432,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
@Multipart("applicationRelease") ApplicationReleaseWrapper applicationReleaseWrapper,
@Multipart("binaryFile") Attachment binaryFile,
@Multipart("icon") Attachment iconFile,
@Multipart("banner") Attachment bannerFile,
@Multipart(value = "banner", required = false) Attachment bannerFile,
@Multipart("screenshot1") Attachment screenshot1,
@Multipart("screenshot2") Attachment screenshot2,
@Multipart("screenshot3") Attachment screenshot3) {
@ -825,7 +821,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
}
if (attachmentList != null) {
Map<String, InputStream> scrrenshotData = new HashMap<>();
Map<String, InputStream> scrrenshotData = new TreeMap<>();
for (Attachment sc : attachmentList) {
dataHandler = sc.getDataHandler();
String screenshotrFileName = dataHandler.getName();

@ -60,10 +60,6 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
}
filter.setAppReleaseState(applicationManager.getInstallableLifecycleState());
ApplicationList applications = applicationManager.getApplications(filter);
if (applications.getApplications().isEmpty()) {
return Response.status(Response.Status.OK)
.entity("Couldn't find any application for the requested query.").build();
}
return Response.status(Response.Status.OK).entity(applications).build();
} catch (BadRequestException e) {
String msg = e.getMessage();

@ -29,7 +29,7 @@ CREATE TABLE IF NOT EXISTS AP_APP_RELEASE(
APP_PRICE DECIMAL(6, 2) NULL DEFAULT NULL,
INSTALLER_LOCATION VARCHAR(100) NOT NULL,
ICON_LOCATION VARCHAR(100) NOT NULL,
BANNER_LOCATION VARCHAR(100) NOT NULL,
BANNER_LOCATION VARCHAR(100) NULL DEFAULT NULL,
SC_1_LOCATION VARCHAR(100) NOT NULL,
SC_2_LOCATION VARCHAR(100) NULL DEFAULT NULL,
SC_3_LOCATION VARCHAR(100) NULL DEFAULT NULL,

Loading…
Cancel
Save