Implement VPP app creation

vpp^2
amanda 5 years ago
parent 008b24dc37
commit 37c8a50bf3

@ -26,6 +26,11 @@ public class Application {
required = true)
private int id;
@ApiModelProperty(name = "adamId",
value = "The unique identifier for a product in the iTunes Store",
required = true)
private String adamId;
@ApiModelProperty(name = "name",
value = "Name of the application",
required = true)
@ -107,6 +112,14 @@ public class Application {
this.packageName = packageName;
}
public String getAdamId() {
return adamId;
}
public void setAdamId(String adamId) {
this.adamId = adamId;
}
public int getId() { return id; }
public void setId(int id) { this.id = id; }

@ -36,6 +36,7 @@ import org.wso2.carbon.device.application.mgt.common.wrapper.ApplicationUpdateWr
import org.wso2.carbon.device.application.mgt.common.wrapper.ApplicationWrapper;
import org.wso2.carbon.device.application.mgt.common.wrapper.PublicAppReleaseWrapper;
import org.wso2.carbon.device.application.mgt.common.wrapper.PublicAppWrapper;
import org.wso2.carbon.device.application.mgt.common.wrapper.VPPAppWrapper;
import org.wso2.carbon.device.application.mgt.common.wrapper.WebAppReleaseWrapper;
import org.wso2.carbon.device.application.mgt.common.wrapper.WebAppWrapper;
@ -66,6 +67,15 @@ public interface ApplicationManager {
Application createCustomApp(CustomAppWrapper customAppWrapper, ApplicationArtifact applicationArtifact)
throws ApplicationManagementException;
/**
* The method is responsible to add new VPP Asset into entgra App Manager.
*
* @param vppAppWrapper Asset that need to be created.
* @return {@link Application}
* @throws ApplicationManagementException Catch all other throwing exceptions and throw {@link ApplicationManagementException}
*/
Application createVPPApp(VPPAppWrapper vppAppWrapper) throws ApplicationManagementException;
/**
* Check the existence of an application for given application name and the device type.
*

@ -0,0 +1,192 @@
/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.application.mgt.common.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
@ApiModel(value = "VPP App Release Wrapper", description = "This class holds the details when releasing a VPP App"
+ " Release to application store")
public class VPPAppReleaseWrapper {
@ApiModelProperty(name = "description",
value = "Description of the VPP app release")
@NotNull
private String description;
@ApiModelProperty(name = "releaseType",
value = "Release type of the VPP app release",
required = true,
example = "alpha, beta etc")
@NotNull
private String releaseType;
@ApiModelProperty(name = "price",
value = "Price of the VPP app release",
required = true)
private Double price;
@ApiModelProperty(name = "isSharedWithAllTenants",
value = "If VPP app release is shared with all tenants it is equal to 1 otherwise 0",
required = true)
@NotNull
private boolean isSharedWithAllTenants;
@ApiModelProperty(name = "metaData",
value = "Meta data of the VPP app release",
required = true)
private String metaData;
@ApiModelProperty(name = "version",
value = "Version of the VPP app release.",
required = true)
@NotNull
private String version;
@ApiModelProperty(name = "packageName",
value = "Package name of the VPP app release.",
required = true)
@NotNull
private String packageName;
@ApiModelProperty(name = "supportedOsVersions",
value = "Application release supported OS versions",
required = true,
example = "4.0-10.0")
@NotNull
private String supportedOsVersions;
@ApiModelProperty(name = "smallIconName",
value = "icon file location",
required = true)
@NotNull
private String smallIconName;
@ApiModelProperty(name = "largeIconName",
value = "icon file location",
required = true)
@NotNull
private String largeIconName;
@ApiModelProperty(name = "installerName",
value = "VPP app URL",
required = true)
@NotNull
private String installerName;
@ApiModelProperty(name = "ratedUsers",
value = "Number of users who has rated the application release")
private int ratedUsers;
@ApiModelProperty(name = "rating",
value = "Rating value of the application release")
private double rating;
public String getReleaseType() {
return releaseType;
}
public void setReleaseType(String releaseType) {
this.releaseType = releaseType;
}
public void setIsSharedWithAllTenants(boolean isSharedWithAllTenants) {
this.isSharedWithAllTenants = isSharedWithAllTenants;
}
public String getSmallIconName() {
return smallIconName;
}
public void setSmallIconName(String smallIconName) {
this.smallIconName = smallIconName;
}
public String getLargeIconName() {
return largeIconName;
}
public void setLargeIconName(String largeIconName) {
this.largeIconName = largeIconName;
}
public String getInstallerName() {
return installerName;
}
public void setInstallerName(String installerName) {
this.installerName = installerName;
}
public int getRatedUsers() {
return ratedUsers;
}
public void setRatedUsers(int ratedUsers) {
this.ratedUsers = ratedUsers;
}
public double getRating() {
return rating;
}
public void setRating(double rating) {
this.rating = rating;
}
public void setMetaData(String metaData) {
this.metaData = metaData;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public boolean getIsSharedWithAllTenants() {
return isSharedWithAllTenants;
}
public String getMetaData() {
return metaData;
}
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
public boolean isSharedWithAllTenants() { return isSharedWithAllTenants; }
public void setSharedWithAllTenants(boolean sharedWithAllTenants) { isSharedWithAllTenants = sharedWithAllTenants; }
public String getVersion() { return version; }
public void setVersion(String version) { this.version = version; }
public String getPackageName() { return packageName; }
public void setPackageName(String packageName) { this.packageName = packageName; }
public String getSupportedOsVersions() { return supportedOsVersions; }
public void setSupportedOsVersions(String supportedOsVersions) { this.supportedOsVersions = supportedOsVersions; }
}

@ -0,0 +1,152 @@
/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.application.mgt.common.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
import java.util.List;
@ApiModel(value = "VPPAppWrapper", description = "VPPAppWrapper represents an Application in App Store")
public class VPPAppWrapper {
@ApiModelProperty(name = "adamId",
value = "The unique identifier for a product in the iTunes Store",
required = true)
@NotNull
private String adamId;
@ApiModelProperty(name = "name",
value = "Name of the VPP app",
required = true)
@NotNull
private String name;
@ApiModelProperty(name = "deviceType",
value = "Related device type of the public app",
required = true,
example = "IoS, Android, Arduino, RaspberryPi etc")
@NotNull
private String deviceType;
@ApiModelProperty(name = "description",
value = "Description of the VPP app",
required = true)
@NotNull
private String description;
@ApiModelProperty(name = "categories",
value = "List of Categories",
required = true,
example = "Educational, Gaming, Travel, Entertainment etc")
@NotNull
private List<String> categories;
@ApiModelProperty(name = "subType",
value = "Subscription method of the VPP app",
required = true,
example = "PAID, FREE")
@NotNull
private String subMethod;
@ApiModelProperty(name = "paymentCurrency",
value = "Payment currency of the VPP app",
required = true,
example = "$")
private String paymentCurrency;
@ApiModelProperty(name = "tags",
value = "List of tags")
@NotNull
private List<String> tags;
@ApiModelProperty(name = "unrestrictedRoles",
value = "List of roles that users should have to view the VPP app")
@NotNull
private List<String> unrestrictedRoles;
@ApiModelProperty(name = "applicationReleaseWrappers",
value = "List of VPP app releases",
required = true)
@NotNull
private List<VPPAppReleaseWrapper> vppAppReleaseWrappers;
@ApiModelProperty(name = "rating",
value = "Rating value of the application release")
private double rating;
public String getName() {
return name;
}
public void setName(String name) { this.name = name; }
public String getDeviceType() {
return deviceType;
}
public void setDeviceType(String deviceType) {
this.deviceType = deviceType;
}
public String getAdamId() {
return adamId;
}
public void setAdamId(String adamId) {
this.adamId = adamId;
}
public double getRating() {
return rating;
}
public void setRating(double rating) {
this.rating = rating;
}
public List<String> getTags() { return tags; }
public void setTags(List<String> tags) { this.tags = tags; }
public String getPaymentCurrency() { return paymentCurrency; }
public void setPaymentCurrency(String paymentCurrency) { this.paymentCurrency = paymentCurrency; }
public List<String> getUnrestrictedRoles() { return unrestrictedRoles; }
public void setUnrestrictedRoles(List<String> unrestrictedRoles) { this.unrestrictedRoles = unrestrictedRoles; }
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
public List<VPPAppReleaseWrapper> getVppAppReleaseWrappers() { return vppAppReleaseWrappers; }
public void setVppAppReleaseWrappers(List<VPPAppReleaseWrapper> vppAppReleaseWrappers) {
this.vppAppReleaseWrappers = vppAppReleaseWrappers; }
public List<String> getCategories() { return categories; }
public void setCategories(List<String> categories) { this.categories = categories; }
public String getSubMethod() { return subMethod; }
public void setSubMethod(String subMethod) { this.subMethod = subMethod; }
}

@ -63,8 +63,9 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
+ "TYPE, "
+ "SUB_TYPE, "
+ "TENANT_ID, "
+ "DEVICE_TYPE_ID,"
+ "ADAM_ID) VALUES (?, ?, ?, ?, ?, ?, ?)";
+ "DEVICE_TYPE_ID, "
+ "RATING, "
+ "ADAM_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
int applicationId = -1;
try {
Connection conn = this.getDBConnection();
@ -75,11 +76,8 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
stmt.setString(4, applicationDTO.getSubType());
stmt.setInt(5, tenantId);
stmt.setInt(6, applicationDTO.getDeviceTypeId());
if(!StringUtils.isEmpty(applicationDTO.getAdamId())){
stmt.setString(7, applicationDTO.getAdamId());
} else{
stmt.setString(7, null);
}
stmt.setDouble(7, applicationDTO.getAppRating());
stmt.setString(8, applicationDTO.getAdamId());
stmt.executeUpdate();
try (ResultSet rs = stmt.getGeneratedKeys()) {
if (rs.next()) {
@ -402,6 +400,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
+ "AP_APP.CURRENCY AS APP_CURRENCY, "
+ "AP_APP.RATING AS APP_RATING, "
+ "AP_APP.DEVICE_TYPE_ID AS APP_DEVICE_TYPE_ID, "
+ "AP_APP.ADAM_ID AS APP_ADAM_ID, "
+ "AP_APP_RELEASE.ID AS RELEASE_ID, "
+ "AP_APP_RELEASE.DESCRIPTION AS RELEASE_DESCRIPTION, "
+ "AP_APP_RELEASE.VERSION AS RELEASE_VERSION, "
@ -475,6 +474,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
+ "AP_APP.CURRENCY AS APP_CURRENCY, "
+ "AP_APP.RATING AS APP_RATING, "
+ "AP_APP.DEVICE_TYPE_ID AS APP_DEVICE_TYPE_ID, "
+ "AP_APP.ADAM_ID AS APP_ADAM_ID, "
+ "AP_APP_RELEASE.ID AS RELEASE_ID, "
+ "AP_APP_RELEASE.DESCRIPTION AS RELEASE_DESCRIPTION, "
+ "AP_APP_RELEASE.VERSION AS RELEASE_VERSION, "
@ -552,6 +552,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
+ "AP_APP.CURRENCY AS APP_CURRENCY, "
+ "AP_APP.RATING AS APP_RATING, "
+ "AP_APP.DEVICE_TYPE_ID AS APP_DEVICE_TYPE_ID, "
+ "AP_APP.ADAM_ID AS APP_ADAM_ID, "
+ "AP_APP_RELEASE.ID AS RELEASE_ID, "
+ "AP_APP_RELEASE.DESCRIPTION AS RELEASE_DESCRIPTION, "
+ "AP_APP_RELEASE.VERSION AS RELEASE_VERSION, "
@ -622,6 +623,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
+ "AP_APP.CURRENCY AS APP_CURRENCY, "
+ "AP_APP.RATING AS APP_RATING, "
+ "AP_APP.DEVICE_TYPE_ID AS APP_DEVICE_TYPE_ID, "
+ "AP_APP.ADAM_ID AS APP_ADAM_ID, "
+ "AP_APP_RELEASE.ID AS RELEASE_ID, "
+ "AP_APP_RELEASE.DESCRIPTION AS RELEASE_DESCRIPTION, "
+ "AP_APP_RELEASE.VERSION AS RELEASE_VERSION, "

@ -66,8 +66,10 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
+ "APP_META_INFO,"
+ "SUPPORTED_OS_VERSIONS,"
+ "CURRENT_STATE,"
+ "RATING,"
+ "RATED_USERS,"
+ "AP_APP_ID) "
+ "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
+ "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
try {
Connection connection = this.getDBConnection();
@ -90,7 +92,9 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
statement.setString(16, applicationReleaseDTO.getMetaData());
statement.setString(17, applicationReleaseDTO.getSupportedOsVersions());
statement.setString(18, applicationReleaseDTO.getCurrentState().toUpperCase());
statement.setInt(19, appId);
statement.setDouble(19, applicationReleaseDTO.getRating());
statement.setInt(20, applicationReleaseDTO.getRatedUsers());
statement.setInt(21, appId);
statement.executeUpdate();
try(ResultSet resultSet = statement.getGeneratedKeys()){
if (resultSet.next()) {

@ -63,6 +63,8 @@ import org.wso2.carbon.device.application.mgt.common.wrapper.ApplicationUpdateWr
import org.wso2.carbon.device.application.mgt.common.wrapper.ApplicationWrapper;
import org.wso2.carbon.device.application.mgt.common.wrapper.PublicAppReleaseWrapper;
import org.wso2.carbon.device.application.mgt.common.wrapper.PublicAppWrapper;
import org.wso2.carbon.device.application.mgt.common.wrapper.VPPAppReleaseWrapper;
import org.wso2.carbon.device.application.mgt.common.wrapper.VPPAppWrapper;
import org.wso2.carbon.device.application.mgt.common.wrapper.WebAppReleaseWrapper;
import org.wso2.carbon.device.application.mgt.common.wrapper.WebAppWrapper;
import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager;
@ -232,6 +234,42 @@ public class ApplicationManagerImpl implements ApplicationManager {
return addAppDataIntoDB(applicationDTO, tenantId);
}
@Override
public Application createVPPApp(VPPAppWrapper vppAppWrapper)
throws ApplicationManagementException {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
if (log.isDebugEnabled()) {
log.debug("VPP app creating request is received. App name: " + vppAppWrapper.getName()
+ " Adam ID: " + vppAppWrapper.getAdamId());
}
ApplicationDTO applicationDTO = APIUtil.convertToAppDTO(vppAppWrapper);
ApplicationReleaseDTO applicationReleaseDTO = applicationDTO.getApplicationReleaseDTOs().get(0);
applicationReleaseDTO.setUuid(UUID.randomUUID().toString());
applicationReleaseDTO.setAppHashValue(DigestUtils.md5Hex(applicationReleaseDTO.getPackageName()));
try {
ConnectionManagerUtil.openDBConnection();
List<ApplicationReleaseDTO> exitingPubAppReleases = applicationReleaseDAO
.getReleaseByPackages(Collections.singletonList(applicationReleaseDTO.getPackageName()), tenantId);
if (!exitingPubAppReleases.isEmpty()) {
String msg = "VPP app release exists for package name " + applicationReleaseDTO.getPackageName()
+ ". Hence you can't add new VPP app for package name "
+ applicationReleaseDTO.getPackageName();
log.error(msg);
throw new BadRequestException(msg);
}
} catch (ApplicationManagementDAOException e) {
String msg = "Error Occurred when fetching release: " + vppAppWrapper.getName();
log.error(msg);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
}
//insert application data into database
return addAppDataIntoDB(applicationDTO, tenantId);
}
@Override
public Application createCustomApp(CustomAppWrapper customAppWrapper, ApplicationArtifact applicationArtifact)
throws ApplicationManagementException {
@ -3186,6 +3224,48 @@ public class ApplicationManagerImpl implements ApplicationManager {
throw new BadRequestException(msg);
}
unrestrictedRoles = publicAppWrapper.getUnrestrictedRoles();
} else if (param instanceof VPPAppWrapper) {
VPPAppWrapper vppAppWrapper = (VPPAppWrapper) param;
appName = vppAppWrapper.getName();
if (StringUtils.isEmpty(appName)) {
String msg = "Application name cannot be empty for VPP app.";
log.error(msg);
throw new BadRequestException(msg);
}
if (StringUtils.isEmpty(vppAppWrapper.getAdamId())) {
String msg = "Adam ID cannot be empty for VPP Asset.";
log.error(msg);
throw new BadRequestException(msg);
}
appCategories = vppAppWrapper.getCategories();
if (appCategories == null) {
String msg = "Application category can't be null.";
log.error(msg);
throw new BadRequestException(msg);
}
if (appCategories.isEmpty()) {
String msg = "Application category can't be empty.";
log.error(msg);
throw new BadRequestException(msg);
}
if (StringUtils.isEmpty(vppAppWrapper.getDeviceType())) {
String msg = "Device type can't be empty for the VPP application.";
log.error(msg);
throw new BadRequestException(msg);
}
DeviceType deviceType = APIUtil.getDeviceTypeData(vppAppWrapper.getDeviceType());
deviceTypeId = deviceType.getId();
List<VPPAppReleaseWrapper> vppAppReleaseWrappers;
vppAppReleaseWrappers = vppAppWrapper.getVppAppReleaseWrappers();
if (vppAppReleaseWrappers == null || vppAppReleaseWrappers.size() != 1) {
String msg = "Invalid VPP app creating request. Request must have single release. Application name:"
+ vppAppWrapper.getName() + "Adam ID: " + vppAppWrapper.getAdamId() + ".";
log.error(msg);
throw new BadRequestException(msg);
}
unrestrictedRoles = vppAppWrapper.getUnrestrictedRoles();
} else if (param instanceof CustomAppWrapper) {
CustomAppWrapper customAppWrapper = (CustomAppWrapper) param;
appName = customAppWrapper.getName();
@ -3366,6 +3446,45 @@ public class ApplicationManagerImpl implements ApplicationManager {
log.error(msg);
throw new BadRequestException(msg);
}
} else if (param instanceof VPPAppReleaseWrapper) {
VPPAppReleaseWrapper vppAppReleaseWrapper = (VPPAppReleaseWrapper) param;
if (StringUtils.isEmpty(vppAppReleaseWrapper.getSupportedOsVersions())) {
String msg = "Supported OS Version shouldn't be null or empty for VPP app release creating request.";
log.error(msg);
throw new BadRequestException(msg);
}
if (StringUtils.isEmpty(vppAppReleaseWrapper.getVersion())) {
String msg = "Version shouldn't be empty or null for the VPP App release creating request.";
log.error(msg);
throw new BadRequestException(msg);
}
if (StringUtils.isEmpty(vppAppReleaseWrapper.getPackageName())) {
String msg = "Package name shouldn't be empty or null for the VPP App release creating request.";
log.error(msg);
throw new BadRequestException(msg);
}
if (StringUtils.isEmpty(vppAppReleaseWrapper.getInstallerName())) {
String msg = "Installer name name shouldn't be empty or null for the VPP App release creating request.";
log.error(msg);
throw new BadRequestException(msg);
}
if (StringUtils.isEmpty(vppAppReleaseWrapper.getSmallIconName())) {
String msg = "Small Icon shouldn't be empty or null for the VPP App release creating request.";
log.error(msg);
throw new BadRequestException(msg);
}
if (StringUtils.isEmpty(vppAppReleaseWrapper.getLargeIconName())) {
String msg = "Large Icon shouldn't be empty or null for the VPP App release creating request.";
log.error(msg);
throw new BadRequestException(msg);
}
if (isInvalidOsVersionRange(vppAppReleaseWrapper.getSupportedOsVersions(), deviceType)) {
String msg = "You are trying to create application which has an application release contains invalid or "
+ "unsupported OS versions in the supportedOsVersions section. Hence, please re-evaluate the "
+ "request payload.";
log.error(msg);
throw new BadRequestException(msg);
}
} else if (param instanceof CustomAppReleaseWrapper) {
CustomAppReleaseWrapper customAppReleaseWrapper = (CustomAppReleaseWrapper) param;
if (StringUtils.isEmpty(customAppReleaseWrapper.getVersion())) {

@ -40,6 +40,8 @@ import org.wso2.carbon.device.application.mgt.common.wrapper.PublicAppReleaseWra
import org.wso2.carbon.device.application.mgt.common.wrapper.PublicAppWrapper;
import org.wso2.carbon.device.application.mgt.common.wrapper.WebAppReleaseWrapper;
import org.wso2.carbon.device.application.mgt.common.wrapper.WebAppWrapper;
import org.wso2.carbon.device.application.mgt.common.wrapper.VPPAppReleaseWrapper;
import org.wso2.carbon.device.application.mgt.common.wrapper.VPPAppWrapper;
import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager;
import org.wso2.carbon.device.application.mgt.core.exception.BadRequestException;
import org.wso2.carbon.device.application.mgt.core.exception.UnexpectedServerErrorException;
@ -275,6 +277,23 @@ public class APIUtil {
List<ApplicationReleaseDTO> applicationReleaseEntities = publicAppWrapper.getPublicAppReleaseWrappers()
.stream().map(APIUtil::releaseWrapperToReleaseDTO).collect(Collectors.toList());
applicationDTO.setApplicationReleaseDTOs(applicationReleaseEntities);
} else if (param instanceof VPPAppWrapper) {
VPPAppWrapper vppAppWrapper = (VPPAppWrapper) param;
DeviceType deviceType = getDeviceTypeData(vppAppWrapper.getDeviceType());
applicationDTO.setAdamId(vppAppWrapper.getAdamId());
applicationDTO.setName(vppAppWrapper.getName());
applicationDTO.setDescription(vppAppWrapper.getDescription());
applicationDTO.setAppCategories(vppAppWrapper.getCategories());
applicationDTO.setType(ApplicationType.PUBLIC.toString());
applicationDTO.setSubType(vppAppWrapper.getSubMethod());
applicationDTO.setPaymentCurrency(vppAppWrapper.getPaymentCurrency());
applicationDTO.setTags(vppAppWrapper.getTags());
applicationDTO.setUnrestrictedRoles(vppAppWrapper.getUnrestrictedRoles());
applicationDTO.setDeviceTypeId(deviceType.getId());
applicationDTO.setAppRating(vppAppWrapper.getRating());
List<ApplicationReleaseDTO> applicationReleaseEntities = vppAppWrapper.getVppAppReleaseWrappers()
.stream().map(APIUtil::releaseWrapperToReleaseDTO).collect(Collectors.toList());
applicationDTO.setApplicationReleaseDTOs(applicationReleaseEntities);
} else if (param instanceof CustomAppWrapper){
CustomAppWrapper customAppWrapper = (CustomAppWrapper) param;
DeviceType deviceType = getDeviceTypeData(customAppWrapper.getDeviceType());
@ -325,6 +344,21 @@ public class APIUtil {
applicationReleaseDTO.setIsSharedWithAllTenants(publicAppReleaseWrapper.getIsSharedWithAllTenants());
applicationReleaseDTO.setMetaData(publicAppReleaseWrapper.getMetaData());
applicationReleaseDTO.setSupportedOsVersions(publicAppReleaseWrapper.getSupportedOsVersions());
} else if (param instanceof VPPAppReleaseWrapper) {
VPPAppReleaseWrapper vppAppReleaseWrapper = (VPPAppReleaseWrapper) param;
applicationReleaseDTO.setDescription(vppAppReleaseWrapper.getDescription());
applicationReleaseDTO.setReleaseType(vppAppReleaseWrapper.getReleaseType());
applicationReleaseDTO.setVersion(vppAppReleaseWrapper.getVersion());
applicationReleaseDTO.setPackageName(vppAppReleaseWrapper.getPackageName());
applicationReleaseDTO.setPrice(vppAppReleaseWrapper.getPrice());
applicationReleaseDTO.setIsSharedWithAllTenants(vppAppReleaseWrapper.getIsSharedWithAllTenants());
applicationReleaseDTO.setMetaData(vppAppReleaseWrapper.getMetaData());
applicationReleaseDTO.setSupportedOsVersions(vppAppReleaseWrapper.getSupportedOsVersions());
applicationReleaseDTO.setIconName(vppAppReleaseWrapper.getSmallIconName());
applicationReleaseDTO.setScreenshotName1(vppAppReleaseWrapper.getSmallIconName());
applicationReleaseDTO.setInstallerName(vppAppReleaseWrapper.getInstallerName());
applicationReleaseDTO.setRatedUsers(vppAppReleaseWrapper.getRatedUsers());
applicationReleaseDTO.setRating(vppAppReleaseWrapper.getRating());
} else if (param instanceof CustomAppReleaseWrapper) {
CustomAppReleaseWrapper customAppReleaseWrapper = (CustomAppReleaseWrapper) param;
applicationReleaseDTO.setDescription(customAppReleaseWrapper.getDescription());
@ -363,6 +397,9 @@ public class APIUtil {
.contains("GooglePlaySyncedApp")) {
application.setAndroidEnterpriseApp(true);
}
if (!StringUtils.isEmpty(applicationDTO.getAdamId())) {
application.setAdamId(applicationDTO.getAdamId());
}
for (ApplicationReleaseDTO applicationReleaseDTO : applicationDTO.getApplicationReleaseDTOs()) {
applicationReleases.add(releaseDtoToRelease(applicationReleaseDTO));
}

Loading…
Cancel
Save