Fix issues in category updating functionality

feature/appm-store/pbac
lasanthaDLPDS 6 years ago
parent d241c9fa2e
commit 9b66b8e44c

@ -81,10 +81,6 @@ public class ApplicationRelease {
required = true) required = true)
private String metaData; private String metaData;
@ApiModelProperty(name = "url",
value = "URL which is used for WEB-CLIP")
private String url;
@ApiModelProperty(name = "supportedOsVersions", @ApiModelProperty(name = "supportedOsVersions",
value = "ApplicationDTO release supported OS versions") value = "ApplicationDTO release supported OS versions")
private String supportedOsVersions; private String supportedOsVersions;
@ -125,14 +121,6 @@ public class ApplicationRelease {
return metaData; return metaData;
} }
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getDescription() { return description; } public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; } public void setDescription(String description) { this.description = description; }

@ -1036,8 +1036,8 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
conn = this.getDBConnection(); conn = this.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) { try (PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setString(1, categoryDTO.getCategoryName()); stmt.setString(1, categoryDTO.getCategoryName());
stmt.setInt(1, categoryDTO.getId()); stmt.setInt(2, categoryDTO.getId());
stmt.setInt(2, tenantId); stmt.setInt(3, tenantId);
stmt.executeUpdate(); stmt.executeUpdate();
} }
} catch (DBConnectionException e) { } catch (DBConnectionException e) {

@ -21,7 +21,9 @@ package org.wso2.carbon.device.application.mgt.core.util;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.commons.validator.routines.UrlValidator;
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.application.mgt.common.ApplicationType;
import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
import org.wso2.carbon.device.application.mgt.common.dto.ApplicationReleaseDTO; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationReleaseDTO;
import org.wso2.carbon.device.application.mgt.common.response.Application; import org.wso2.carbon.device.application.mgt.common.response.Application;
@ -280,10 +282,11 @@ public class APIUtil {
throws BadRequestException, UnexpectedServerErrorException { throws BadRequestException, UnexpectedServerErrorException {
Application application = new Application(); Application application = new Application();
//This is for handling web-apps if (!ApplicationType.WEB_CLIP.toString().equals(applicationDTO.getType())) {
if (applicationDTO.getDeviceTypeId() > 0) {
DeviceType deviceType = getDeviceTypeData(applicationDTO.getDeviceTypeId()); DeviceType deviceType = getDeviceTypeData(applicationDTO.getDeviceTypeId());
application.setDeviceType(deviceType.getName()); application.setDeviceType(deviceType.getName());
} else {
application.setDeviceType("ANY");
} }
application.setId(applicationDTO.getId()); application.setId(applicationDTO.getId());
application.setName(applicationDTO.getName()); application.setName(applicationDTO.getName());
@ -306,8 +309,11 @@ public class APIUtil {
.getArtifactDownloadEndpoint(); .getArtifactDownloadEndpoint();
String basePath = artifactDownloadEndpoint + Constants.FORWARD_SLASH + applicationReleaseDTO.getUuid() String basePath = artifactDownloadEndpoint + Constants.FORWARD_SLASH + applicationReleaseDTO.getUuid()
+ Constants.FORWARD_SLASH; + Constants.FORWARD_SLASH;
List<String> screenshotPaths = new ArrayList<>(); List<String> screenshotPaths = new ArrayList<>();
ApplicationRelease applicationRelease = new ApplicationRelease(); ApplicationRelease applicationRelease = new ApplicationRelease();
UrlValidator urlValidator = new UrlValidator();
applicationRelease.setDescription(applicationReleaseDTO.getDescription()); applicationRelease.setDescription(applicationReleaseDTO.getDescription());
applicationRelease.setVersion(applicationReleaseDTO.getVersion()); applicationRelease.setVersion(applicationReleaseDTO.getVersion());
applicationRelease.setUuid(applicationReleaseDTO.getUuid()); applicationRelease.setUuid(applicationReleaseDTO.getUuid());
@ -315,16 +321,21 @@ public class APIUtil {
applicationRelease.setPrice(applicationReleaseDTO.getPrice()); applicationRelease.setPrice(applicationReleaseDTO.getPrice());
applicationRelease.setIsSharedWithAllTenants(applicationReleaseDTO.getIsSharedWithAllTenants()); applicationRelease.setIsSharedWithAllTenants(applicationReleaseDTO.getIsSharedWithAllTenants());
applicationRelease.setMetaData(applicationReleaseDTO.getMetaData()); applicationRelease.setMetaData(applicationReleaseDTO.getMetaData());
applicationRelease.setUrl(applicationReleaseDTO.getUrl());
applicationRelease.setCurrentStatus(applicationReleaseDTO.getCurrentState()); applicationRelease.setCurrentStatus(applicationReleaseDTO.getCurrentState());
applicationRelease.setIsSharedWithAllTenants(applicationReleaseDTO.getIsSharedWithAllTenants()); applicationRelease.setIsSharedWithAllTenants(applicationReleaseDTO.getIsSharedWithAllTenants());
applicationRelease.setSupportedOsVersions(applicationReleaseDTO.getSupportedOsVersions()); applicationRelease.setSupportedOsVersions(applicationReleaseDTO.getSupportedOsVersions());
applicationRelease.setRating(applicationReleaseDTO.getRating()); applicationRelease.setRating(applicationReleaseDTO.getRating());
applicationRelease
.setInstallerPath(basePath + applicationReleaseDTO.getInstallerName());
applicationRelease.setIconPath(basePath + applicationReleaseDTO.getIconName()); applicationRelease.setIconPath(basePath + applicationReleaseDTO.getIconName());
applicationRelease.setBannerPath(basePath + applicationReleaseDTO.getBannerName()); applicationRelease.setBannerPath(basePath + applicationReleaseDTO.getBannerName());
if (urlValidator.isValid(applicationReleaseDTO.getInstallerName())){
applicationRelease
.setInstallerPath(applicationReleaseDTO.getInstallerName());
} else {
applicationRelease
.setInstallerPath(basePath + applicationReleaseDTO.getInstallerName());
}
if (!StringUtils.isEmpty(applicationReleaseDTO.getScreenshotName1())) { if (!StringUtils.isEmpty(applicationReleaseDTO.getScreenshotName1())) {
screenshotPaths.add(basePath + applicationReleaseDTO.getScreenshotName1()); screenshotPaths.add(basePath + applicationReleaseDTO.getScreenshotName1());
} }

Loading…
Cancel
Save