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
feature/appm-store/pbac
Dharmakeerthi Lasantha 5 years ago
commit ae91bb3a06

@ -49,9 +49,9 @@ public class LifecycleState {
value = "Timestamp of the lifecycle has been updated") value = "Timestamp of the lifecycle has been updated")
private Timestamp updatedAt; private Timestamp updatedAt;
@ApiModelProperty(name = "resonForChange", @ApiModelProperty(name = "reasonForChange",
value = "Reason for the application release lifecycle change from previous state to current state.") value = "Reason for the application release lifecycle change from previous state to current state.")
private String resonForChange; private String reasonForChange;
public String getCurrentState() { public String getCurrentState() {
return currentState; return currentState;
@ -93,7 +93,7 @@ public class LifecycleState {
this.nextStates = nextStates; 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.setInt(3, tenantId);
stmt.setString(4, state.getUpdatedBy()); stmt.setString(4, state.getUpdatedBy());
stmt.setTimestamp(5, timestamp); stmt.setTimestamp(5, timestamp);
stmt.setString(6, state.getResonForChange()); stmt.setString(6, state.getReasonForChange());
stmt.setInt(7, appReleaseId); stmt.setInt(7, appReleaseId);
stmt.setInt(8, appReleaseId); stmt.setInt(8, appReleaseId);
stmt.executeUpdate(); stmt.executeUpdate();

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

@ -478,11 +478,14 @@ 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 host = System.getProperty(Constants.IOT_HOST_PROPERTY);
String port = System.getProperty(Constants.IOT_PORT_PROPERTY);
String artifactDownloadEndpoint = ConfigurationManager.getInstance().getConfiguration() String artifactDownloadEndpoint = ConfigurationManager.getInstance().getConfiguration()
.getArtifactDownloadEndpoint(); .getArtifactDownloadEndpoint();
String plistDownloadEndpoint = artifactDownloadEndpoint + Constants.FORWARD_SLASH + String plistDownloadEndpoint =
MDMAppConstants.IOSConstants.PLIST + Constants.FORWARD_SLASH + Constants.ARTIFACT_DOWNLOAD_PROTOCOL + "://" + host + ":" + port + artifactDownloadEndpoint
application.getApplicationReleases().get(0).getUuid(); + Constants.FORWARD_SLASH + MDMAppConstants.IOSConstants.PLIST
+ Constants.FORWARD_SLASH + application.getApplicationReleases().get(0).getUuid();
mobileApp.setType(mobileAppType); mobileApp.setType(mobileAppType);
mobileApp.setLocation(plistDownloadEndpoint); mobileApp.setLocation(plistDownloadEndpoint);
Properties properties = new Properties(); Properties properties = new Properties();

@ -334,9 +334,12 @@ public class APIUtil {
} }
public static ApplicationRelease releaseDtoToRelease(ApplicationReleaseDTO applicationReleaseDTO){ 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() String artifactDownloadEndpoint = ConfigurationManager.getInstance().getConfiguration()
.getArtifactDownloadEndpoint(); .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; + Constants.FORWARD_SLASH;
List<String> screenshotPaths = new ArrayList<>(); List<String> screenshotPaths = new ArrayList<>();

@ -36,6 +36,9 @@ public class Constants {
public static final String PLIST_NAME = "Info.plist"; public static final String PLIST_NAME = "Info.plist";
public static final String CF_BUNDLE_VERSION = "CFBundleVersion"; public static final String CF_BUNDLE_VERSION = "CFBundleVersion";
public static final String APP_EXTENSION = ".app"; 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 FORWARD_SLASH = "/";
public static final String ANY = "ANY"; public static final String ANY = "ANY";

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

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

Loading…
Cancel
Save