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

Construct artifact download URL by using system properties

See merge request entgra/carbon-device-mgt!147
4.x.x
Dharmakeerthi Lasantha 5 years ago
commit ae91bb3a06

@ -49,9 +49,9 @@ public class LifecycleState {
value = "Timestamp of the lifecycle has been updated")
private Timestamp updatedAt;
@ApiModelProperty(name = "resonForChange",
@ApiModelProperty(name = "reasonForChange",
value = "Reason for the application release lifecycle change from previous state to current state.")
private String resonForChange;
private String reasonForChange;
public String getCurrentState() {
return currentState;
@ -93,7 +93,7 @@ public class LifecycleState {
this.nextStates = nextStates;
}
public String getResonForChange() { return resonForChange; }
public String getReasonForChange() { return reasonForChange; }
public void setResonForChange(String resonForChange) { this.resonForChange = resonForChange; }
public void setReasonForChange(String reasonForChange) { this.reasonForChange = reasonForChange; }
}

@ -188,7 +188,7 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
stmt.setInt(3, tenantId);
stmt.setString(4, state.getUpdatedBy());
stmt.setTimestamp(5, timestamp);
stmt.setString(6, state.getResonForChange());
stmt.setString(6, state.getReasonForChange());
stmt.setInt(7, appReleaseId);
stmt.setInt(8, appReleaseId);
stmt.executeUpdate();

@ -1451,7 +1451,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
lifecycleState.setCurrentState(lifecycleChanger.getAction());
lifecycleState.setPreviousState(applicationReleaseDTO.getCurrentState());
lifecycleState.setUpdatedBy(userName);
lifecycleState.setResonForChange(lifecycleChanger.getReason());
lifecycleState.setReasonForChange(lifecycleChanger.getReason());
applicationReleaseDTO.setCurrentState(lifecycleChanger.getAction());
if (this.applicationReleaseDAO.updateRelease(applicationReleaseDTO, tenantId) == null) {
String msg = "Application release updating is failed/.";
@ -2528,10 +2528,14 @@ public class ApplicationManagerImpl implements ApplicationManager {
throw new NotFoundException(msg);
}
ApplicationReleaseDTO applicationReleaseDTO = applicationDTO.getApplicationReleaseDTOs().get(0);
String host = System.getProperty(Constants.IOT_HOST_PROPERTY);
String port = System.getProperty(Constants.IOT_PORT_PROPERTY);
String artifactDownloadEndpoint = ConfigurationManager.getInstance().getConfiguration()
.getArtifactDownloadEndpoint();
String artifactDownloadURL = artifactDownloadEndpoint + Constants.FORWARD_SLASH + applicationReleaseDTO.getUuid()
+ Constants.FORWARD_SLASH + applicationReleaseDTO.getInstallerName();
String artifactDownloadURL =
Constants.ARTIFACT_DOWNLOAD_PROTOCOL + "://" + host + ":" + port + artifactDownloadEndpoint
+ Constants.FORWARD_SLASH + applicationReleaseDTO.getUuid() + Constants.FORWARD_SLASH
+ applicationReleaseDTO.getInstallerName();
String plistContent = "<!DOCTYPE plist PUBLIC "-//Apple//DTDPLIST1.0//EN" "" +
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="" +
"1.0"><dict><key>items</key><array><dict><" +

@ -478,11 +478,14 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
}
} else if (DeviceTypes.IOS.toString().equalsIgnoreCase(deviceType)) {
if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) {
String host = System.getProperty(Constants.IOT_HOST_PROPERTY);
String port = System.getProperty(Constants.IOT_PORT_PROPERTY);
String artifactDownloadEndpoint = ConfigurationManager.getInstance().getConfiguration()
.getArtifactDownloadEndpoint();
String plistDownloadEndpoint = artifactDownloadEndpoint + Constants.FORWARD_SLASH +
MDMAppConstants.IOSConstants.PLIST + Constants.FORWARD_SLASH +
application.getApplicationReleases().get(0).getUuid();
String plistDownloadEndpoint =
Constants.ARTIFACT_DOWNLOAD_PROTOCOL + "://" + host + ":" + port + artifactDownloadEndpoint
+ Constants.FORWARD_SLASH + MDMAppConstants.IOSConstants.PLIST
+ Constants.FORWARD_SLASH + application.getApplicationReleases().get(0).getUuid();
mobileApp.setType(mobileAppType);
mobileApp.setLocation(plistDownloadEndpoint);
Properties properties = new Properties();

@ -334,9 +334,12 @@ public class APIUtil {
}
public static ApplicationRelease releaseDtoToRelease(ApplicationReleaseDTO applicationReleaseDTO){
String host = System.getProperty(Constants.IOT_HOST_PROPERTY);
String port = System.getProperty(Constants.IOT_PORT_PROPERTY);
String artifactDownloadEndpoint = ConfigurationManager.getInstance().getConfiguration()
.getArtifactDownloadEndpoint();
String basePath = artifactDownloadEndpoint + Constants.FORWARD_SLASH + applicationReleaseDTO.getUuid()
String basePath = Constants.ARTIFACT_DOWNLOAD_PROTOCOL + "://" + host + ":" + port + artifactDownloadEndpoint
+ Constants.FORWARD_SLASH + applicationReleaseDTO.getUuid()
+ Constants.FORWARD_SLASH;
List<String> screenshotPaths = new ArrayList<>();

@ -36,6 +36,9 @@ public class Constants {
public static final String PLIST_NAME = "Info.plist";
public static final String CF_BUNDLE_VERSION = "CFBundleVersion";
public static final String APP_EXTENSION = ".app";
public static final String IOT_HOST_PROPERTY = "iot.core.host";
public static final String IOT_PORT_PROPERTY = "iot.core.http.port";
public static final String ARTIFACT_DOWNLOAD_PROTOCOL = "http";
public static final String FORWARD_SLASH = "/";
public static final String ANY = "ANY";

@ -367,9 +367,8 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
try {
if (!ApplicationType.ENTERPRISE.toString().equals(appType)) {
String msg = "If ApplicationDTO type is " + appType
+ ", therefore you don't have application release artifact to update for application release UUID: "
+ applicationReleaseUuid;
String msg = "If Application type is " + appType + ", then you don't have application release artifact "
+ "to update for application release UUID: " + applicationReleaseUuid;
log.error(msg);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
}

@ -172,7 +172,7 @@
</ErrorCallback>
</UIConfigs>
<ArtifactDownloadEndpoint>https://localhost:9443/api/application-mgt/v1.0/artifact</ArtifactDownloadEndpoint>
<ArtifactDownloadEndpoint>/api/application-mgt/v1.0/artifact</ArtifactDownloadEndpoint>
<AppCategories>
<Category>EMM</Category>
<Category>IoT</Category>

Loading…
Cancel
Save