Fix app-install operation adding issue for custom apps

feature/appm-store/pbac
lasanthaDLPDS 5 years ago
parent a3e0eb031c
commit 34f1b25c84

@ -463,6 +463,30 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
throws ApplicationManagementException {
try {
//todo rethink and modify the {@link App} usage
if (ApplicationType.CUSTOM.toString().equalsIgnoreCase(application.getType())) {
ProfileOperation operation = new ProfileOperation();
if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) {
operation.setCode(MDMAppConstants.AndroidConstants.OPCODE_INSTALL_APPLICATION);
operation.setType(Operation.Type.PROFILE);
CustomApplication customApplication = new CustomApplication();
customApplication.setType(application.getType());
customApplication.setUrl(application.getApplicationReleases().get(0).getInstallerPath());
operation.setPayLoad(customApplication.toJSON());
return operation;
} else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) {
operation.setCode(MDMAppConstants.AndroidConstants.OPCODE_UNINSTALL_APPLICATION);
operation.setType(Operation.Type.PROFILE);
CustomApplication customApplication = new CustomApplication();
customApplication.setType(application.getType());
//todo get application package name and set
operation.setPayLoad(customApplication.toJSON());
return operation;
} else {
String msg = "Invalid Action is found. Action: " + action;
log.error(msg);
throw new ApplicationManagementException(msg);
}
} else {
App app = new App();
MobileAppTypes mobileAppType = MobileAppTypes.valueOf(application.getType());
if (DeviceTypes.ANDROID.toString().equalsIgnoreCase(deviceType)) {
@ -479,9 +503,10 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
}
} else if (DeviceTypes.IOS.toString().equalsIgnoreCase(deviceType)) {
if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) {
String plistDownloadEndpoint = APIUtil.getArtifactDownloadBaseURL()
+ MDMAppConstants.IOSConstants.PLIST + Constants.FORWARD_SLASH
+ application.getApplicationReleases().get(0).getUuid();
String plistDownloadEndpoint =
APIUtil.getArtifactDownloadBaseURL() + MDMAppConstants.IOSConstants.PLIST
+ Constants.FORWARD_SLASH + application.getApplicationReleases().get(0)
.getUuid();
app.setType(mobileAppType);
app.setLocation(plistDownloadEndpoint);
Properties properties = new Properties();
@ -527,6 +552,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
throw new ApplicationManagementException(msg);
}
}
}
} catch (UnknownApplicationTypeException e) {
String msg = "Unknown Application type is found.";
log.error(msg, e);

Loading…
Cancel
Save