mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Fix issues in category updating functionality
This commit is contained in:
parent
d241c9fa2e
commit
9b66b8e44c
@ -81,10 +81,6 @@ public class ApplicationRelease {
|
||||
required = true)
|
||||
private String metaData;
|
||||
|
||||
@ApiModelProperty(name = "url",
|
||||
value = "URL which is used for WEB-CLIP")
|
||||
private String url;
|
||||
|
||||
@ApiModelProperty(name = "supportedOsVersions",
|
||||
value = "ApplicationDTO release supported OS versions")
|
||||
private String supportedOsVersions;
|
||||
@ -125,14 +121,6 @@ public class ApplicationRelease {
|
||||
return metaData;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getDescription() { return description; }
|
||||
|
||||
public void setDescription(String description) { this.description = description; }
|
||||
|
||||
@ -1036,8 +1036,8 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
|
||||
conn = this.getDBConnection();
|
||||
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
|
||||
stmt.setString(1, categoryDTO.getCategoryName());
|
||||
stmt.setInt(1, categoryDTO.getId());
|
||||
stmt.setInt(2, tenantId);
|
||||
stmt.setInt(2, categoryDTO.getId());
|
||||
stmt.setInt(3, tenantId);
|
||||
stmt.executeUpdate();
|
||||
}
|
||||
} 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.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.commons.validator.routines.UrlValidator;
|
||||
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.ApplicationReleaseDTO;
|
||||
import org.wso2.carbon.device.application.mgt.common.response.Application;
|
||||
@ -280,10 +282,11 @@ public class APIUtil {
|
||||
throws BadRequestException, UnexpectedServerErrorException {
|
||||
|
||||
Application application = new Application();
|
||||
//This is for handling web-apps
|
||||
if (applicationDTO.getDeviceTypeId() > 0) {
|
||||
if (!ApplicationType.WEB_CLIP.toString().equals(applicationDTO.getType())) {
|
||||
DeviceType deviceType = getDeviceTypeData(applicationDTO.getDeviceTypeId());
|
||||
application.setDeviceType(deviceType.getName());
|
||||
} else {
|
||||
application.setDeviceType("ANY");
|
||||
}
|
||||
application.setId(applicationDTO.getId());
|
||||
application.setName(applicationDTO.getName());
|
||||
@ -306,8 +309,11 @@ public class APIUtil {
|
||||
.getArtifactDownloadEndpoint();
|
||||
String basePath = artifactDownloadEndpoint + Constants.FORWARD_SLASH + applicationReleaseDTO.getUuid()
|
||||
+ Constants.FORWARD_SLASH;
|
||||
|
||||
List<String> screenshotPaths = new ArrayList<>();
|
||||
ApplicationRelease applicationRelease = new ApplicationRelease();
|
||||
UrlValidator urlValidator = new UrlValidator();
|
||||
|
||||
applicationRelease.setDescription(applicationReleaseDTO.getDescription());
|
||||
applicationRelease.setVersion(applicationReleaseDTO.getVersion());
|
||||
applicationRelease.setUuid(applicationReleaseDTO.getUuid());
|
||||
@ -315,16 +321,21 @@ public class APIUtil {
|
||||
applicationRelease.setPrice(applicationReleaseDTO.getPrice());
|
||||
applicationRelease.setIsSharedWithAllTenants(applicationReleaseDTO.getIsSharedWithAllTenants());
|
||||
applicationRelease.setMetaData(applicationReleaseDTO.getMetaData());
|
||||
applicationRelease.setUrl(applicationReleaseDTO.getUrl());
|
||||
applicationRelease.setCurrentStatus(applicationReleaseDTO.getCurrentState());
|
||||
applicationRelease.setIsSharedWithAllTenants(applicationReleaseDTO.getIsSharedWithAllTenants());
|
||||
applicationRelease.setSupportedOsVersions(applicationReleaseDTO.getSupportedOsVersions());
|
||||
applicationRelease.setRating(applicationReleaseDTO.getRating());
|
||||
applicationRelease
|
||||
.setInstallerPath(basePath + applicationReleaseDTO.getInstallerName());
|
||||
applicationRelease.setIconPath(basePath + applicationReleaseDTO.getIconName());
|
||||
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())) {
|
||||
screenshotPaths.add(basePath + applicationReleaseDTO.getScreenshotName1());
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user