Merge branch 'application-mgt-new' into 'application-mgt-new'

Fix app-install operation adding issue for custom apps

See merge request entgra/carbon-device-mgt!252
feature/appm-store/pbac
Dharmakeerthi Lasantha 5 years ago
commit d45b153a9a

@ -463,6 +463,30 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
throws ApplicationManagementException { throws ApplicationManagementException {
try { try {
//todo rethink and modify the {@link App} usage //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(); App app = new App();
MobileAppTypes mobileAppType = MobileAppTypes.valueOf(application.getType()); MobileAppTypes mobileAppType = MobileAppTypes.valueOf(application.getType());
if (DeviceTypes.ANDROID.toString().equalsIgnoreCase(deviceType)) { if (DeviceTypes.ANDROID.toString().equalsIgnoreCase(deviceType)) {
@ -479,9 +503,10 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
} }
} else if (DeviceTypes.IOS.toString().equalsIgnoreCase(deviceType)) { } else if (DeviceTypes.IOS.toString().equalsIgnoreCase(deviceType)) {
if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) { if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) {
String plistDownloadEndpoint = APIUtil.getArtifactDownloadBaseURL() String plistDownloadEndpoint =
+ MDMAppConstants.IOSConstants.PLIST + Constants.FORWARD_SLASH APIUtil.getArtifactDownloadBaseURL() + MDMAppConstants.IOSConstants.PLIST
+ application.getApplicationReleases().get(0).getUuid(); + Constants.FORWARD_SLASH + application.getApplicationReleases().get(0)
.getUuid();
app.setType(mobileAppType); app.setType(mobileAppType);
app.setLocation(plistDownloadEndpoint); app.setLocation(plistDownloadEndpoint);
Properties properties = new Properties(); Properties properties = new Properties();
@ -527,6 +552,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
throw new ApplicationManagementException(msg); throw new ApplicationManagementException(msg);
} }
} }
}
} catch (UnknownApplicationTypeException e) { } catch (UnknownApplicationTypeException e) {
String msg = "Unknown Application type is found."; String msg = "Unknown Application type is found.";
log.error(msg, e); log.error(msg, e);

Loading…
Cancel
Save