mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'vpp-dao' into 'vpp'
Add VPP to APPM See merge request entgra/carbon-device-mgt!499
This commit is contained in:
commit
1b35bd1109
@ -96,6 +96,30 @@ public class ApplicationDTO {
|
||||
value = "package name of the application")
|
||||
private String packageName;
|
||||
|
||||
@ApiModelProperty(name = "adamId",
|
||||
value = "The unique identifier for a product in the iTunes Store")
|
||||
private String adamId;
|
||||
|
||||
@ApiModelProperty(name = "licenses",
|
||||
value = "List of application licenses")
|
||||
private List<LicenseDTO> licenses;
|
||||
|
||||
public String getAdamId() {
|
||||
return adamId;
|
||||
}
|
||||
|
||||
public void setAdamId(String adamId) {
|
||||
this.adamId = adamId;
|
||||
}
|
||||
|
||||
public List<LicenseDTO> getLicenses() {
|
||||
return licenses;
|
||||
}
|
||||
|
||||
public void setLicenses(List<LicenseDTO> licenses) {
|
||||
this.licenses = licenses;
|
||||
}
|
||||
|
||||
public String getPackageName() {
|
||||
return packageName;
|
||||
}
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
package org.wso2.carbon.device.application.mgt.common.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel(value = "LicenseDTO", description = "LicenseDTO represents License details.")
|
||||
public class LicenseDTO {
|
||||
@ApiModelProperty(name = "id",
|
||||
value = "The ID given to the license when it is stored in the APPM database")
|
||||
private int id;
|
||||
|
||||
@ApiModelProperty(name = "licenseId",
|
||||
value = "The identifier of the assigned license")
|
||||
private String licenseId;
|
||||
|
||||
@ApiModelProperty(name = "adamId",
|
||||
value = "The unique identifier for a product in the iTunes Store")
|
||||
private String adamId;
|
||||
|
||||
@ApiModelProperty(name = "status",
|
||||
value = "The current state of the license",
|
||||
example = "Available, Refunded")
|
||||
private String status;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLicenseId() {
|
||||
return licenseId;
|
||||
}
|
||||
|
||||
public void setLicenseId(String licenseId) {
|
||||
this.licenseId = licenseId;
|
||||
}
|
||||
|
||||
public String getAdamId() {
|
||||
return adamId;
|
||||
}
|
||||
|
||||
public void setAdamId(String adamId) {
|
||||
this.adamId = adamId;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package org.wso2.carbon.device.application.mgt.common.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel(value = "VPPDeviceDTO", description = "VPPDeviceDTO represents VPP Device details.")
|
||||
public class VPPDeviceDTO {
|
||||
|
||||
@ApiModelProperty(name = "id",
|
||||
value = "The ID given to the device when it is stored in the APPM database")
|
||||
private int id;
|
||||
|
||||
@ApiModelProperty(name = "serialNumber",
|
||||
value = "serialNumber of the ios device",
|
||||
required = true)
|
||||
private String serialNumber;
|
||||
|
||||
@ApiModelProperty(name = "userId",
|
||||
value = "userId of the device owner",
|
||||
required = true)
|
||||
private String userId;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSerialNumber() {
|
||||
return serialNumber;
|
||||
}
|
||||
|
||||
public void setSerialNumber(String serialNumber) {
|
||||
this.serialNumber = serialNumber;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
}
|
||||
@ -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; }
|
||||
}
|
||||
|
||||
@ -20,7 +20,9 @@ package org.wso2.carbon.device.application.mgt.core.dao;
|
||||
import org.wso2.carbon.device.application.mgt.common.*;
|
||||
import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
|
||||
import org.wso2.carbon.device.application.mgt.common.dto.CategoryDTO;
|
||||
import org.wso2.carbon.device.application.mgt.common.dto.TagDTO;
|
||||
import org.wso2.carbon.device.application.mgt.common.dto.VPPDeviceDTO;
|
||||
import org.wso2.carbon.device.application.mgt.common.dto.LicenseDTO;
|
||||
import org.wso2.carbon.device.application.mgt.common.dto.TagDTO;;
|
||||
import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException;
|
||||
|
||||
import java.util.List;
|
||||
@ -39,6 +41,10 @@ public interface ApplicationDAO {
|
||||
*/
|
||||
int createApplication(ApplicationDTO applicationDTO, int tenantId) throws ApplicationManagementDAOException;
|
||||
|
||||
int createVPPDevice(VPPDeviceDTO vppDeviceDTO, int tenantId) throws ApplicationManagementDAOException;
|
||||
|
||||
void addLicenses(List<LicenseDTO> licenses, int tenantId) throws ApplicationManagementDAOException;
|
||||
|
||||
/**
|
||||
* To add tags for a particular application.
|
||||
*
|
||||
|
||||
@ -23,6 +23,8 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.device.application.mgt.common.AppLifecycleState;
|
||||
import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
|
||||
import org.wso2.carbon.device.application.mgt.common.dto.CategoryDTO;
|
||||
import org.wso2.carbon.device.application.mgt.common.dto.VPPDeviceDTO;
|
||||
import org.wso2.carbon.device.application.mgt.common.dto.LicenseDTO;
|
||||
import org.wso2.carbon.device.application.mgt.common.Filter;
|
||||
import org.wso2.carbon.device.application.mgt.common.dto.TagDTO;
|
||||
import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException;
|
||||
@ -61,7 +63,9 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
|
||||
+ "TYPE, "
|
||||
+ "SUB_TYPE, "
|
||||
+ "TENANT_ID, "
|
||||
+ "DEVICE_TYPE_ID) VALUES (?, ?, ?, ?, ?, ?)";
|
||||
+ "DEVICE_TYPE_ID, "
|
||||
+ "RATING, "
|
||||
+ "ADAM_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
int applicationId = -1;
|
||||
try {
|
||||
Connection conn = this.getDBConnection();
|
||||
@ -72,6 +76,8 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
|
||||
stmt.setString(4, applicationDTO.getSubType());
|
||||
stmt.setInt(5, tenantId);
|
||||
stmt.setInt(6, applicationDTO.getDeviceTypeId());
|
||||
stmt.setDouble(7, applicationDTO.getAppRating());
|
||||
stmt.setString(8, applicationDTO.getAdamId());
|
||||
stmt.executeUpdate();
|
||||
try (ResultSet rs = stmt.getGeneratedKeys()) {
|
||||
if (rs.next()) {
|
||||
@ -93,6 +99,45 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int createVPPDevice(VPPDeviceDTO vppDeviceDTO, int tenantId) throws ApplicationManagementDAOException {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Request received in DAO Layer to create a VPP Device");
|
||||
log.debug("VPPDeviceDTO Details : ");
|
||||
log.debug("Serial number : " + vppDeviceDTO.getSerialNumber() + " User ID : " + vppDeviceDTO.getUserId());
|
||||
}
|
||||
String sql = "INSERT INTO AP_VPP_DEVICE "
|
||||
+ "(SERIAL_NUMBER, "
|
||||
+ "USER_ID, "
|
||||
+ "TENANT_ID) VALUES (?, ?, ?)";
|
||||
int deviceId = -1;
|
||||
try {
|
||||
Connection conn = this.getDBConnection();
|
||||
try (PreparedStatement stmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) {
|
||||
stmt.setString(1, vppDeviceDTO.getSerialNumber());
|
||||
stmt.setString(2, vppDeviceDTO.getUserId());
|
||||
stmt.setInt(3, tenantId);
|
||||
stmt.executeUpdate();
|
||||
try (ResultSet rs = stmt.getGeneratedKeys()) {
|
||||
if (rs.next()) {
|
||||
deviceId = rs.getInt(1);
|
||||
}
|
||||
return deviceId;
|
||||
}
|
||||
}
|
||||
} catch (DBConnectionException e) {
|
||||
String msg = "Error occurred while obtaining the DB connection to create a VPP Device which has "
|
||||
+ "Serial number : " + vppDeviceDTO.getSerialNumber();
|
||||
log.error(msg, e);
|
||||
throw new ApplicationManagementDAOException(msg, e);
|
||||
} catch (SQLException e) {
|
||||
String msg = "Error occurred while executing SQL to create a VPP Device which has Serial number : "
|
||||
+ vppDeviceDTO.getSerialNumber();
|
||||
log.error(msg, e);
|
||||
throw new ApplicationManagementDAOException(msg, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ApplicationDTO> getApplications(Filter filter, int deviceTypeId, int tenantId) throws
|
||||
ApplicationManagementDAOException {
|
||||
@ -115,6 +160,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, "
|
||||
@ -354,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, "
|
||||
@ -427,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, "
|
||||
@ -504,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, "
|
||||
@ -574,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, "
|
||||
@ -747,6 +797,40 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLicenses(List<LicenseDTO> licenses, int tenantId) throws ApplicationManagementDAOException {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Request received in DAO Layer to add Licenses");
|
||||
}
|
||||
String sql = "INSERT INTO AP_LICENSE "
|
||||
+ "(LICENSE_ID, "
|
||||
+ "ADAM_ID, "
|
||||
+ "STATUS, "
|
||||
+ "TENANT_ID) "
|
||||
+ "VALUES (?, ?, ?, ?)";
|
||||
try {
|
||||
Connection conn = this.getDBConnection();
|
||||
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
|
||||
for (LicenseDTO license : licenses) {
|
||||
stmt.setString(1, license.getLicenseId());
|
||||
stmt.setString(2, license.getAdamId());
|
||||
stmt.setString(3, license.getStatus());
|
||||
stmt.setInt(4, tenantId);
|
||||
stmt.addBatch();
|
||||
}
|
||||
stmt.executeBatch();
|
||||
}
|
||||
} catch (DBConnectionException e) {
|
||||
String msg = "Error occurred while obtaining the DB connection when adding licenses";
|
||||
log.error(msg, e);
|
||||
throw new ApplicationManagementDAOException(msg, e);
|
||||
} catch (SQLException e) {
|
||||
String msg = "SQL Error occurred while adding licenses. Executed Query: " + sql;
|
||||
log.error(msg, e);
|
||||
throw new ApplicationManagementDAOException(msg, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TagDTO> getAllTags(int tenantId) throws ApplicationManagementDAOException {
|
||||
if (log.isDebugEnabled()) {
|
||||
|
||||
@ -62,6 +62,7 @@ public class OracleApplicationDAOImpl extends GenericApplicationDAOImpl {
|
||||
+ "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, "
|
||||
|
||||
@ -61,6 +61,7 @@ public class SQLServerApplicationDAOImpl extends GenericApplicationDAOImpl {
|
||||
+ "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 {
|
||||
@ -893,6 +931,15 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
||||
}
|
||||
}
|
||||
|
||||
//adding licenses
|
||||
if (applicationDTO.getLicenses() != null && !applicationDTO.getLicenses().isEmpty()) {
|
||||
this.applicationDAO.addLicenses(applicationDTO.getLicenses(), tenantId);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Licenses added to AP_LICENSE table. App Id:" + appId +
|
||||
" AdamId : " + applicationDTO.getAdamId());
|
||||
}
|
||||
}
|
||||
|
||||
//adding application tags
|
||||
if (tags != null && !tags.isEmpty()) {
|
||||
List<TagDTO> registeredTags = applicationDAO.getAllTags(tenantId);
|
||||
@ -3189,6 +3236,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();
|
||||
@ -3369,6 +3458,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));
|
||||
}
|
||||
|
||||
@ -80,6 +80,7 @@ public class DAOUtil {
|
||||
application.setStatus(rs.getString("APP_STATUS"));
|
||||
application.setAppRating(rs.getDouble("APP_RATING"));
|
||||
application.setDeviceTypeId(rs.getInt("APP_DEVICE_TYPE_ID"));
|
||||
application.setAdamId(rs.getString("APP_ADAM_ID"));
|
||||
application.setPackageName(rs.getString("PACKAGE_NAME"));
|
||||
application.getApplicationReleaseDTOs().add(constructAppReleaseDTO(rs));
|
||||
} else {
|
||||
|
||||
@ -168,6 +168,7 @@
|
||||
<Category>Video Players & Editors</Category>
|
||||
<Category>Weather</Category>
|
||||
<Category>GooglePlaySyncedApp</Category>
|
||||
<Category>LicensedVPPAssets</Category>
|
||||
</AppCategories>
|
||||
|
||||
<RatingConfig>
|
||||
|
||||
@ -12,9 +12,55 @@ CREATE TABLE IF NOT EXISTS AP_APP(
|
||||
CURRENCY VARCHAR(45) NULL DEFAULT '$',
|
||||
RATING DOUBLE NULL DEFAULT NULL,
|
||||
DEVICE_TYPE_ID INTEGER NOT NULL,
|
||||
ADAM_ID VARCHAR(45) NULL UNIQUE ,
|
||||
PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_VPP_LICENSE
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS AP_VPP_LICENSE
|
||||
(
|
||||
LICENSE_ID INTEGER NOT NULL AUTO_INCREMENT,
|
||||
ADAM_ID VARCHAR(45) NOT NULL UNIQUE ,
|
||||
AVAILABILITY VARCHAR(350) NOT NULL,
|
||||
PRIMARY KEY (LICENSE_ID),
|
||||
CONSTRAINT fk_AP_VPP_LICENSE_AP_APP1
|
||||
FOREIGN KEY (ADAM_ID)
|
||||
REFERENCES AP_APP (ADAM_ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_VPP_LICENSE_AP_APP1_idx ON AP_VPP_LICENSE (ADAM_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_VPP_DEVICE
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS AP_VPP_DEVICE
|
||||
(
|
||||
ID INTEGER NOT NULL AUTO_INCREMENT,
|
||||
SERIAL_NUMBER INTEGER NOT NULL,
|
||||
USER_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_VPP_DEVICE_LICENSE_MAPPING
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS AP_VPP_DEVICE_LICENSE_MAPPING
|
||||
(
|
||||
LICENSE_ID INTEGER NOT NULL,
|
||||
DEVICE_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (LICENSE_ID, DEVICE_ID),
|
||||
CONSTRAINT fk_AP_VPP_DEVICE_LICENSE_MAPPING_AP_VPP_DEVICE
|
||||
FOREIGN KEY (DEVICE_ID)
|
||||
REFERENCES AP_VPP_DEVICE (ID),
|
||||
CONSTRAINT fk_AP_VPP_DEVICE_LICENSE_MAPPING_AP_VPP_LICENSE
|
||||
FOREIGN KEY (LICENSE_ID)
|
||||
REFERENCES AP_VPP_LICENSE (LICENSE_ID)
|
||||
);
|
||||
CREATE INDEX fk_AP_VPP_DEVICE_LICENSE_MAPPING_AP_VPP_DEVICE_idx ON AP_VPP_DEVICE (ID ASC);
|
||||
CREATE INDEX fk_AP_VPP_DEVICE_LICENSE_MAPPING_AP_VPP_LICENSE_idx ON AP_VPP_LICENSE (LICENSE_ID ASC);
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_APP_RELEASE
|
||||
-- -----------------------------------------------------
|
||||
|
||||
@ -12,9 +12,57 @@ CREATE TABLE AP_APP(
|
||||
CURRENCY VARCHAR(45) NULL DEFAULT '$',
|
||||
RATING FLOAT NULL DEFAULT NULL,
|
||||
DEVICE_TYPE_ID INTEGER NOT NULL,
|
||||
ADAM_ID VARCHAR(45) NULL ,
|
||||
CONSTRAINT ADAM_ID_CONSTRAINT UNIQUE (ADAM_ID),
|
||||
PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_VPP_LICENSE
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE AP_VPP_LICENSE
|
||||
(
|
||||
LICENSE_ID INTEGER NOT NULL IDENTITY,
|
||||
ADAM_ID VARCHAR(45) NOT NULL ,
|
||||
AVAILABILITY VARCHAR(350) NOT NULL,
|
||||
PRIMARY KEY (LICENSE_ID),
|
||||
CONSTRAINT ADAMID_CONSTRAINT UNIQUE (ADAM_ID),
|
||||
CONSTRAINT fk_AP_VPP_LICENSE_AP_APP1
|
||||
FOREIGN KEY (ADAM_ID)
|
||||
REFERENCES AP_APP (ADAM_ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_VPP_LICENSE_AP_APP1_idx ON AP_VPP_LICENSE (ADAM_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_VPP_DEVICE
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE AP_VPP_DEVICE
|
||||
(
|
||||
ID INTEGER NOT NULL IDENTITY,,
|
||||
SERIAL_NUMBER INTEGER NOT NULL,
|
||||
USER_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_VPP_DEVICE_LICENSE_MAPPING
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE AP_VPP_DEVICE_LICENSE_MAPPING
|
||||
(
|
||||
LICENSE_ID INTEGER NOT NULL,
|
||||
DEVICE_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (LICENSE_ID, DEVICE_ID),
|
||||
CONSTRAINT fk_AP_VPP_DEVICE_LICENSE_MAPPING_AP_VPP_DEVICE
|
||||
FOREIGN KEY (DEVICE_ID)
|
||||
REFERENCES AP_VPP_DEVICE (ID),
|
||||
CONSTRAINT fk_AP_VPP_DEVICE_LICENSE_MAPPING_AP_VPP_LICENSE
|
||||
FOREIGN KEY (LICENSE_ID)
|
||||
REFERENCES AP_VPP_LICENSE (LICENSE_ID)
|
||||
);
|
||||
CREATE INDEX fk_AP_VPP_DEVICE_LICENSE_MAPPING_AP_VPP_DEVICE_idx ON AP_VPP_DEVICE (ID ASC);
|
||||
CREATE INDEX fk_AP_VPP_DEVICE_LICENSE_MAPPING_AP_VPP_LICENSE_idx ON AP_VPP_LICENSE (LICENSE_ID ASC);
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_APP_RELEASE
|
||||
-- -----------------------------------------------------
|
||||
|
||||
@ -12,9 +12,55 @@ CREATE TABLE IF NOT EXISTS AP_APP(
|
||||
CURRENCY VARCHAR(45) NULL DEFAULT '$',
|
||||
RATING DOUBLE NULL DEFAULT NULL,
|
||||
DEVICE_TYPE_ID INTEGER NOT NULL,
|
||||
ADAM_ID VARCHAR(45) NULL UNIQUE ,
|
||||
PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_LICENSE
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS AP_LICENSE(
|
||||
ID INTEGER NOT NULL AUTO_INCREMENT,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
LICENSE_ID VARCHAR(45) NOT NULL UNIQUE ,
|
||||
ADAM_ID VARCHAR(45) NOT NULL ,
|
||||
STATUS VARCHAR(350) NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_LICENSE_AP_APP1
|
||||
FOREIGN KEY (ADAM_ID)
|
||||
REFERENCES AP_APP (ADAM_ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_LICENSE_AP_APP1_idx ON AP_LICENSE (ADAM_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_VPP_DEVICE
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS AP_VPP_DEVICE(
|
||||
ID INTEGER NOT NULL AUTO_INCREMENT,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
SERIAL_NUMBER VARCHAR(45) NOT NULL,
|
||||
USER_ID VARCHAR(45) NOT NULL,
|
||||
PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_VPP_DEVICE_LICENSE_MAPPING
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS AP_VPP_DEVICE_LICENSE_MAPPING(
|
||||
LICENSE_ID INTEGER NOT NULL,
|
||||
DEVICE_ID INTEGER NOT NULL,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (LICENSE_ID, DEVICE_ID),
|
||||
CONSTRAINT fk_AP_VPP_DEVICE_LICENSE_MAPPING_AP_VPP_DEVICE
|
||||
FOREIGN KEY (DEVICE_ID)
|
||||
REFERENCES AP_VPP_DEVICE (ID),
|
||||
CONSTRAINT fk_AP_VPP_DEVICE_LICENSE_MAPPING_AP_LICENSE
|
||||
FOREIGN KEY (LICENSE_ID)
|
||||
REFERENCES AP_LICENSE (ID)
|
||||
);
|
||||
CREATE INDEX fk_AP_VPP_DEVICE_LICENSE_MAPPING_AP_VPP_DEVICE_idx ON AP_VPP_DEVICE (ID ASC);
|
||||
CREATE INDEX fk_AP_VPP_DEVICE_LICENSE_MAPPING_AP_LICENSE_idx ON AP_LICENSE (LICENSE_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_APP_RELEASE
|
||||
-- -----------------------------------------------------
|
||||
|
||||
@ -228,6 +228,7 @@ INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESC
|
||||
CREATE TABLE APPM_APPLICATION (
|
||||
ID INT UNIQUE,
|
||||
UUID VARCHAR(100) NOT NULL,
|
||||
ADAM_ID VARCHAR(100) NULL,
|
||||
IDENTIFIER VARCHAR(255) NULL,
|
||||
NAME VARCHAR(100) NOT NULL,
|
||||
SHORT_DESCRIPTION VARCHAR(255) NULL,
|
||||
@ -255,6 +256,9 @@ CREATE TABLE APPM_APPLICATION (
|
||||
CREATE INDEX UUID_UNIQUE ON APPM_APPLICATION(UUID ASC)
|
||||
/
|
||||
|
||||
CREATE INDEX ADAM_ID_UNIQUE ON APPM_APPLICATION(ADAM_ID ASC)
|
||||
/
|
||||
|
||||
CREATE INDEX FK_APP_APP_CATEGORY ON APPM_APPLICATION(APPLICATION_CATEGORY_ID ASC)
|
||||
/
|
||||
|
||||
@ -277,6 +281,82 @@ CREATE OR REPLACE TRIGGER APPM_APPLICATION_TRIG
|
||||
END;
|
||||
/
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_VPP_LICENSE
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE AP_VPP_LICENSE(
|
||||
LICENSE_ID NUMBER(10) NOT NULL,
|
||||
ADAM_ID VARCHAR2(45) NOT NULL UNIQUE ,
|
||||
AVAILABILITY VARCHAR2(350) NOT NULL,
|
||||
PRIMARY KEY (LICENSE_ID),
|
||||
CONSTRAINT FK_AP_VPP_LICENSE_AP_APP
|
||||
FOREIGN KEY (ADAM_ID)
|
||||
REFERENCES APPM_APPLICATION (ADAM_ID)
|
||||
);
|
||||
/
|
||||
|
||||
CREATE SEQUENCE AP_VPP_LICENSE_SEQ START WITH 1 INCREMENT BY 1;
|
||||
/
|
||||
|
||||
CREATE OR REPLACE TRIGGER AP_VPP_LICENSE_TRIG
|
||||
BEFORE INSERT
|
||||
ON AP_VPP_LICENSE
|
||||
REFERENCING NEW AS NEW
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
SELECT AP_VPP_LICENSE_SEQ.nextval INTO :NEW.LICENSE_ID FROM dual;
|
||||
END;
|
||||
/
|
||||
|
||||
CREATE INDEX fk_AP_VPP_LICENSE_AP_APP1_idx ON AP_VPP_LICENSE (ADAM_ID ASC);
|
||||
/
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_VPP_DEVICE
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE AP_VPP_DEVICE(
|
||||
ID NUMBER(10) NOT NULL,
|
||||
SERIAL_NUMBER NUMBER(10) NOT NULL,
|
||||
USER_ID NUMBER(10) NOT NULL,
|
||||
PRIMARY KEY (ID)
|
||||
);
|
||||
/
|
||||
|
||||
CREATE SEQUENCE AP_VPP_DEVICE_SEQ START WITH 1 INCREMENT BY 1;
|
||||
/
|
||||
|
||||
CREATE OR REPLACE TRIGGER AP_VPP_DEVICE_TRIG
|
||||
BEFORE INSERT
|
||||
ON AP_VPP_DEVICE
|
||||
REFERENCING NEW AS NEW
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
SELECT AP_VPP_DEVICE_SEQ.nextval INTO :NEW.ID FROM dual;
|
||||
END;
|
||||
/
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_VPP_DEVICE_LICENSE_MAPPING
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE AP_VPP_DEVICE_LICENSE_MAPPING(
|
||||
LICENSE_ID NUMBER(10) NOT NULL,
|
||||
DEVICE_ID NUMBER(10) NOT NULL,
|
||||
PRIMARY KEY (LICENSE_ID, DEVICE_ID),
|
||||
CONSTRAINT fk_AP_VPP_DEVICE_LICENSE_MAPPING_AP_VPP_DEVICE
|
||||
FOREIGN KEY (DEVICE_ID)
|
||||
REFERENCES AP_VPP_DEVICE (ID),
|
||||
CONSTRAINT fk_AP_VPP_DEVICE_LICENSE_MAPPING_AP_VPP_LICENSE
|
||||
FOREIGN KEY (LICENSE_ID)
|
||||
REFERENCES AP_VPP_LICENSE (LICENSE_ID)
|
||||
);
|
||||
/
|
||||
|
||||
CREATE INDEX fk_AP_VPP_DEVICE_LICENSE_MAPPING_AP_VPP_DEVICE_idx ON AP_VPP_DEVICE (ID ASC);
|
||||
/
|
||||
|
||||
CREATE INDEX fk_AP_VPP_DEVICE_LICENSE_MAPPING_AP_VPP_LICENSE_idx ON AP_VPP_LICENSE (LICENSE_ID ASC);
|
||||
/
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table APPM_APPLICATION_PROPERTY
|
||||
-- -----------------------------------------------------
|
||||
|
||||
@ -14,9 +14,58 @@ CREATE TABLE IF NOT EXISTS AP_APP(
|
||||
CURRENCY VARCHAR(45) NULL DEFAULT '$',
|
||||
RATING DOUBLE PRECISION NULL DEFAULT NULL,
|
||||
DEVICE_TYPE_ID INTEGER NOT NULL,
|
||||
ADAM_ID VARCHAR(45) NULL UNIQUE,
|
||||
PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_VPP_LICENSE
|
||||
-- -----------------------------------------------------
|
||||
CREATE SEQUENCE AP_VPP_LICENSE_seq;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS AP_VPP_LICENSE(
|
||||
LICENSE_ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_VPP_LICENSE_seq'),
|
||||
ADAM_ID VARCHAR(45) NOT NULL UNIQUE ,
|
||||
AVAILABILITY VARCHAR(350) NOT NULL,
|
||||
PRIMARY KEY (LICENSE_ID),
|
||||
CONSTRAINT fk_AP_VPP_LICENSE_AP_APP1
|
||||
FOREIGN KEY (ADAM_ID)
|
||||
REFERENCES AP_APP (ADAM_ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_VPP_LICENSE_AP_APP1_idx ON AP_VPP_LICENSE (ADAM_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_VPP_DEVICE
|
||||
-- -----------------------------------------------------
|
||||
CREATE SEQUENCE AP_VPP_DEVICE_seq;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS AP_VPP_DEVICE
|
||||
(
|
||||
ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_VPP_DEVICE_seq'),
|
||||
SERIAL_NUMBER INTEGER NOT NULL,
|
||||
USER_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_VPP_DEVICE_LICENSE_MAPPING
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS AP_VPP_DEVICE_LICENSE_MAPPING
|
||||
(
|
||||
LICENSE_ID INTEGER NOT NULL,
|
||||
DEVICE_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (LICENSE_ID, DEVICE_ID),
|
||||
CONSTRAINT fk_AP_VPP_DEVICE_LICENSE_MAPPING_AP_VPP_DEVICE
|
||||
FOREIGN KEY (DEVICE_ID)
|
||||
REFERENCES AP_VPP_DEVICE (ID),
|
||||
CONSTRAINT fk_AP_VPP_DEVICE_LICENSE_MAPPING_AP_VPP_LICENSE
|
||||
FOREIGN KEY (LICENSE_ID)
|
||||
REFERENCES AP_VPP_LICENSE (LICENSE_ID)
|
||||
);
|
||||
CREATE INDEX fk_AP_VPP_DEVICE_LICENSE_MAPPING_AP_VPP_DEVICE_idx ON AP_VPP_DEVICE (ID ASC);
|
||||
CREATE INDEX fk_AP_VPP_DEVICE_LICENSE_MAPPING_AP_VPP_LICENSE_idx ON AP_VPP_LICENSE (LICENSE_ID ASC);
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_APP_RELEASE
|
||||
-- -----------------------------------------------------
|
||||
|
||||
Loading…
Reference in New Issue
Block a user