|
|
|
@ -53,6 +53,7 @@ import org.wso2.carbon.device.application.mgt.common.response.ApplicationRelease
|
|
|
|
|
import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager;
|
|
|
|
|
import org.wso2.carbon.device.application.mgt.common.services.ApplicationStorageManager;
|
|
|
|
|
import org.wso2.carbon.device.application.mgt.common.wrapper.ApplicationReleaseWrapper;
|
|
|
|
|
import org.wso2.carbon.device.application.mgt.common.wrapper.ApplicationUpdateWrapper;
|
|
|
|
|
import org.wso2.carbon.device.application.mgt.common.wrapper.ApplicationWrapper;
|
|
|
|
|
import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager;
|
|
|
|
|
import org.wso2.carbon.device.application.mgt.core.dao.ApplicationDAO;
|
|
|
|
@ -145,8 +146,8 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
ApplicationReleaseDTO initialApplicationReleaseDTO = applicationDTO.getApplicationReleaseDTOs().get(0);
|
|
|
|
|
applicationDTO.getApplicationReleaseDTOs().clear();
|
|
|
|
|
|
|
|
|
|
ApplicationReleaseDTO applicationReleaseDTO = addApplicationReleaseArtifacts(applicationDTO.getType(), applicationDTO.getDeviceTypeName(),
|
|
|
|
|
initialApplicationReleaseDTO, applicationArtifact);
|
|
|
|
|
ApplicationReleaseDTO applicationReleaseDTO = addApplicationReleaseArtifacts(applicationDTO.getType(),
|
|
|
|
|
applicationWrapper.getDeviceType(), initialApplicationReleaseDTO, applicationArtifact);
|
|
|
|
|
applicationDTO.getApplicationReleaseDTOs().add(addImageArtifacts(applicationReleaseDTO, applicationArtifact));
|
|
|
|
|
} catch (UnexpectedServerErrorException e) {
|
|
|
|
|
String msg = "Error occurred when getting Device Type data.";
|
|
|
|
@ -550,7 +551,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
if (!haveAllUserRoles(filteringUnrestrictedRoles, userName)) {
|
|
|
|
|
String msg =
|
|
|
|
|
"At least one filtering role is not assigned for the user: " + userName + ". Hence user " + userName
|
|
|
|
|
+ " Can't filter applications by giving these unrestriced role list";
|
|
|
|
|
+ " Can't filter applications by giving these unrestricted role list";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
@ -582,8 +583,9 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new NotFoundException(msg);
|
|
|
|
|
}
|
|
|
|
|
DeviceType deviceType = getDeviceTypeData(applicationDTO.getDeviceTypeId());
|
|
|
|
|
ApplicationReleaseDTO applicationReleaseDTO = addApplicationReleaseArtifacts(applicationDTO.getType(),
|
|
|
|
|
applicationDTO.getDeviceTypeName(), releaseWrapperToReleaseDTO(applicationReleaseWrapper),
|
|
|
|
|
deviceType.getName(), releaseWrapperToReleaseDTO(applicationReleaseWrapper),
|
|
|
|
|
applicationArtifact);
|
|
|
|
|
applicationReleaseDTO = addImageArtifacts(applicationReleaseDTO, applicationArtifact);
|
|
|
|
|
|
|
|
|
@ -630,18 +632,23 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
|
|
|
|
|
String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
|
|
|
|
|
ApplicationDTO applicationDTO;
|
|
|
|
|
List<ApplicationReleaseDTO> filteredApplicationReleaseDTOs;
|
|
|
|
|
boolean isVisibleApp = false;
|
|
|
|
|
try {
|
|
|
|
|
ConnectionManagerUtil.openDBConnection();
|
|
|
|
|
applicationDTO = this.applicationDAO.getApplicationById(appId, tenantId);
|
|
|
|
|
if (applicationDTO == null) {
|
|
|
|
|
throw new NotFoundException("Couldn't find an application for application Id: " + appId);
|
|
|
|
|
String msg = "Couldn't find an application for application Id: " + appId;
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new NotFoundException(msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
filteredApplicationReleaseDTOs = applicationDTO.getApplicationReleaseDTOs().stream()
|
|
|
|
|
.filter(applicationReleaseDTO -> applicationReleaseDTO.getCurrentState().equals(state))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
List<ApplicationReleaseDTO> filteredApplicationReleaseDTOs = new ArrayList<>();
|
|
|
|
|
for (ApplicationReleaseDTO applicationReleaseDTO : applicationDTO.getApplicationReleaseDTOs()) {
|
|
|
|
|
if (!applicationReleaseDTO.getCurrentState().equals(lifecycleStateManager.getEndState()) && (
|
|
|
|
|
state == null || applicationReleaseDTO.getCurrentState().equals(state))) {
|
|
|
|
|
filteredApplicationReleaseDTOs.add(applicationReleaseDTO);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
applicationDTO.setApplicationReleaseDTOs(filteredApplicationReleaseDTOs);
|
|
|
|
|
if (applicationDTO.getApplicationReleaseDTOs().isEmpty()){
|
|
|
|
|
return null;
|
|
|
|
@ -674,9 +681,14 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
throw new ForbiddenException(msg);
|
|
|
|
|
}
|
|
|
|
|
return appDtoToAppResponse(applicationDTO);
|
|
|
|
|
} catch (UserStoreException e) {
|
|
|
|
|
throw new ApplicationManagementException(
|
|
|
|
|
"User-store exception while getting application with the application id " + appId);
|
|
|
|
|
} catch (LifecycleManagementException e){
|
|
|
|
|
String msg = "Error occurred when getting the last state of the application lifecycle flow";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new ApplicationManagementException(msg, e);
|
|
|
|
|
}catch (UserStoreException e) {
|
|
|
|
|
String msg = "User-store exception while getting application with the application id " + appId;
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new ApplicationManagementException(msg, e);
|
|
|
|
|
} finally {
|
|
|
|
|
ConnectionManagerUtil.closeDBConnection();
|
|
|
|
|
}
|
|
|
|
@ -1412,7 +1424,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateApplication(int applicationId, ApplicationWrapper applicationWrapper)
|
|
|
|
|
public void updateApplication(int applicationId, ApplicationUpdateWrapper applicationUpdateWrapper)
|
|
|
|
|
throws ApplicationManagementException {
|
|
|
|
|
|
|
|
|
|
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
|
|
|
|
@ -1430,81 +1442,63 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
throw new NotFoundException(msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(applicationWrapper.getType()) && !applicationDTO.getType()
|
|
|
|
|
.equals(applicationWrapper.getType())) {
|
|
|
|
|
String msg = "You are trying to change the application type and it is not "
|
|
|
|
|
+ "possible after you create an application. Therefore please remove this application and "
|
|
|
|
|
+ "publish new application with type: " + applicationWrapper.getType();
|
|
|
|
|
if (!StringUtils.isEmpty(applicationUpdateWrapper.getName())){
|
|
|
|
|
Filter filter = new Filter();
|
|
|
|
|
filter.setFullMatch(true);
|
|
|
|
|
filter.setAppName(applicationUpdateWrapper.getName().trim());
|
|
|
|
|
filter.setOffset(0);
|
|
|
|
|
filter.setLimit(1);
|
|
|
|
|
|
|
|
|
|
List<ApplicationDTO> applicationList = applicationDAO
|
|
|
|
|
.getApplications(filter, applicationDTO.getDeviceTypeId(), tenantId);
|
|
|
|
|
if (!applicationList.isEmpty()) {
|
|
|
|
|
String msg = "Already an application registered with same name " + applicationUpdateWrapper.getName()
|
|
|
|
|
+ ". Hence you can't update the application name from " + applicationDTO.getName() + " to "
|
|
|
|
|
+ applicationUpdateWrapper.getName();
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
|
if (!StringUtils.isEmpty(applicationWrapper.getDeviceType()) && !applicationDTO.getDeviceTypeName()
|
|
|
|
|
.equals(applicationWrapper.getDeviceType())) {
|
|
|
|
|
String msg = "You are trying to change the compatible device type of the application type and it is not "
|
|
|
|
|
+ "possible after you create an application for device type. " +
|
|
|
|
|
applicationWrapper.getDeviceType() + "Therefore please remove this application and publish "
|
|
|
|
|
+ "new application with device type: " + applicationWrapper.getDeviceType();
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
applicationDTO.setName(applicationUpdateWrapper.getName());
|
|
|
|
|
}
|
|
|
|
|
if (!StringUtils.isEmpty(applicationWrapper.getSubType()) && !applicationDTO.getSubType()
|
|
|
|
|
.equals(applicationWrapper.getSubType())) {
|
|
|
|
|
if (!ApplicationSubscriptionType.PAID.toString().equals(applicationWrapper.getSubType())
|
|
|
|
|
&& !ApplicationSubscriptionType.FREE.toString().equals(applicationWrapper.getSubType())) {
|
|
|
|
|
if (!StringUtils.isEmpty(applicationUpdateWrapper.getSubType()) && !applicationDTO.getSubType()
|
|
|
|
|
.equals(applicationUpdateWrapper.getSubType())) {
|
|
|
|
|
if (!ApplicationSubscriptionType.PAID.toString().equals(applicationUpdateWrapper.getSubType())
|
|
|
|
|
&& !ApplicationSubscriptionType.FREE.toString().equals(applicationUpdateWrapper.getSubType())) {
|
|
|
|
|
String msg = "Invalid application subscription type is found with application updating request "
|
|
|
|
|
+ applicationWrapper.getSubType();
|
|
|
|
|
+ applicationUpdateWrapper.getSubType();
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
|
|
|
|
|
} else if (ApplicationSubscriptionType.FREE.toString().equals(applicationWrapper.getSubType()) && !StringUtils
|
|
|
|
|
.isEmpty(applicationWrapper.getPaymentCurrency())) {
|
|
|
|
|
} else if (ApplicationSubscriptionType.FREE.toString().equals(applicationUpdateWrapper.getSubType())
|
|
|
|
|
&& !StringUtils.isEmpty(applicationUpdateWrapper.getPaymentCurrency())) {
|
|
|
|
|
String msg = "If you are going to change Non-Free app as Free app, "
|
|
|
|
|
+ "currency attribute in the application updating payload should be null or \"\"";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new ApplicationManagementException(msg);
|
|
|
|
|
} else if (ApplicationSubscriptionType.PAID.toString().equals(applicationWrapper.getSubType())
|
|
|
|
|
&& StringUtils.isEmpty(applicationWrapper.getPaymentCurrency()) ){
|
|
|
|
|
} else if (ApplicationSubscriptionType.PAID.toString().equals(applicationUpdateWrapper.getSubType())
|
|
|
|
|
&& StringUtils.isEmpty(applicationUpdateWrapper.getPaymentCurrency()) ){
|
|
|
|
|
String msg = "If you are going to change Free app as Non-Free app, "
|
|
|
|
|
+ "currency attribute in the application payload should not be null or \"\"";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new ApplicationManagementException(msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
applicationDTO.setSubType(applicationWrapper.getSubType());
|
|
|
|
|
applicationDTO.setPaymentCurrency(applicationWrapper.getPaymentCurrency());
|
|
|
|
|
applicationDTO.setSubType(applicationUpdateWrapper.getSubType());
|
|
|
|
|
applicationDTO.setPaymentCurrency(applicationUpdateWrapper.getPaymentCurrency());
|
|
|
|
|
}
|
|
|
|
|
if (!StringUtils.isEmpty(applicationWrapper.getName())){
|
|
|
|
|
Filter filter = new Filter();
|
|
|
|
|
filter.setFullMatch(true);
|
|
|
|
|
filter.setAppName(applicationWrapper.getName().trim());
|
|
|
|
|
filter.setOffset(0);
|
|
|
|
|
filter.setLimit(1);
|
|
|
|
|
|
|
|
|
|
List<ApplicationDTO> applicationList = applicationDAO
|
|
|
|
|
.getApplications(filter, applicationDTO.getDeviceTypeId(), tenantId);
|
|
|
|
|
if (!applicationList.isEmpty()) {
|
|
|
|
|
String msg = "Already an application registered with same name " + applicationWrapper.getName()
|
|
|
|
|
+ ". Hence you can't update the application name from " + applicationDTO.getName() + " to "
|
|
|
|
|
+ applicationWrapper.getName();
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
|
applicationDTO.setName(applicationWrapper.getName());
|
|
|
|
|
}
|
|
|
|
|
if (!StringUtils.isEmpty(applicationWrapper.getDescription())){
|
|
|
|
|
applicationDTO.setDescription(applicationWrapper.getDescription());
|
|
|
|
|
if (!StringUtils.isEmpty(applicationUpdateWrapper.getDescription())){
|
|
|
|
|
applicationDTO.setDescription(applicationUpdateWrapper.getDescription());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<String> appUnrestrictedRoles = this.visibilityDAO.getUnrestrictedRoles(applicationId, tenantId);
|
|
|
|
|
List<String> appCategories = this.applicationDAO.getAppCategories(applicationId, tenantId);
|
|
|
|
|
|
|
|
|
|
boolean isExistingAppRestricted = !appUnrestrictedRoles.isEmpty();
|
|
|
|
|
boolean isUpdatingAppRestricted = !applicationWrapper.getUnrestrictedRoles().isEmpty();
|
|
|
|
|
boolean isUpdatingAppRestricted = !applicationUpdateWrapper.getUnrestrictedRoles().isEmpty();
|
|
|
|
|
|
|
|
|
|
if (isExistingAppRestricted && !isUpdatingAppRestricted) {
|
|
|
|
|
visibilityDAO.deleteUnrestrictedRoles(appUnrestrictedRoles, applicationId, tenantId);
|
|
|
|
|
} else if (isUpdatingAppRestricted) {
|
|
|
|
|
if (!hasUserRole(applicationWrapper.getUnrestrictedRoles(), userName)) {
|
|
|
|
|
if (!hasUserRole(applicationUpdateWrapper.getUnrestrictedRoles(), userName)) {
|
|
|
|
|
String msg =
|
|
|
|
|
"You are trying to restrict the visibility of visible application.But you are trying to "
|
|
|
|
|
+ "restrict the visibility to roles that there isn't at least one role is assigned "
|
|
|
|
@ -1517,12 +1511,12 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
|
|
|
|
|
if (!isExistingAppRestricted) {
|
|
|
|
|
visibilityDAO
|
|
|
|
|
.addUnrestrictedRoles(applicationWrapper.getUnrestrictedRoles(), applicationId, tenantId);
|
|
|
|
|
.addUnrestrictedRoles(applicationUpdateWrapper.getUnrestrictedRoles(), applicationId, tenantId);
|
|
|
|
|
} else {
|
|
|
|
|
List<String> addingRoleList = getDifference(applicationWrapper.getUnrestrictedRoles(),
|
|
|
|
|
List<String> addingRoleList = getDifference(applicationUpdateWrapper.getUnrestrictedRoles(),
|
|
|
|
|
applicationDTO.getUnrestrictedRoles());
|
|
|
|
|
List<String> removingRoleList = getDifference(applicationDTO.getUnrestrictedRoles(),
|
|
|
|
|
applicationWrapper.getUnrestrictedRoles());
|
|
|
|
|
applicationUpdateWrapper.getUnrestrictedRoles());
|
|
|
|
|
if (!addingRoleList.isEmpty()) {
|
|
|
|
|
visibilityDAO.addUnrestrictedRoles(addingRoleList, applicationId, tenantId);
|
|
|
|
|
}
|
|
|
|
@ -1531,18 +1525,56 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
applicationDTO.setUnrestrictedRoles(applicationWrapper.getUnrestrictedRoles());
|
|
|
|
|
applicationDTO.setUnrestrictedRoles(applicationUpdateWrapper.getUnrestrictedRoles());
|
|
|
|
|
|
|
|
|
|
String updatingAppCategory = applicationUpdateWrapper.getAppCategory();
|
|
|
|
|
if ( updatingAppCategory != null){
|
|
|
|
|
List<String> appCategories = this.applicationDAO.getAppCategories(applicationId, tenantId);
|
|
|
|
|
if (!appCategories.contains(updatingAppCategory)){
|
|
|
|
|
List<CategoryDTO> allCategories = this.applicationDAO.getAllCategories(tenantId);
|
|
|
|
|
List<Integer> categoryIds = allCategories.stream()
|
|
|
|
|
.filter(category -> category.getCategoryName().equals(updatingAppCategory))
|
|
|
|
|
.map(CategoryDTO::getId).collect(Collectors.toList());
|
|
|
|
|
if (categoryIds.isEmpty()){
|
|
|
|
|
ConnectionManagerUtil.rollbackDBTransaction();
|
|
|
|
|
String msg =
|
|
|
|
|
"You are trying to update application category into invalid application category, "
|
|
|
|
|
+ "it is not registered in the system. Therefore please register the category "
|
|
|
|
|
+ updatingAppCategory + " and perform the action";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
|
this.applicationDAO.addCategoryMapping(categoryIds, applicationId, tenantId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<String> updatingAppTags = applicationUpdateWrapper.getTags();
|
|
|
|
|
if ( updatingAppTags!= null){
|
|
|
|
|
List<String> appTags = this.applicationDAO.getAppTags(applicationId, tenantId);
|
|
|
|
|
List<String> addingTagList = getDifference(appTags, applicationWrapper.getTags());
|
|
|
|
|
List<String> removingTagList = getDifference(applicationWrapper.getTags(), appTags);
|
|
|
|
|
List<String> addingTagList = getDifference(appTags, updatingAppTags);
|
|
|
|
|
List<String> removingTagList = getDifference(updatingAppTags, appTags);
|
|
|
|
|
if (!addingTagList.isEmpty()) {
|
|
|
|
|
// applicationDAO.addTags(addingTags, application.getId(), tenantId);
|
|
|
|
|
List<TagDTO> allTags = this.applicationDAO.getAllTags(tenantId);
|
|
|
|
|
List<String> newTags = addingTagList.stream().filter(updatingTagName -> allTags.stream()
|
|
|
|
|
.noneMatch(tag -> tag.getTagName().equals(updatingTagName))).collect(Collectors.toList());
|
|
|
|
|
if (!newTags.isEmpty()){
|
|
|
|
|
this.applicationDAO.addTags(newTags, tenantId);
|
|
|
|
|
}
|
|
|
|
|
List<Integer> addingTagIds = this.applicationDAO.getTagIdsForTagNames(addingTagList, tenantId);
|
|
|
|
|
this.applicationDAO.addTagMapping(addingTagIds, applicationId, tenantId);
|
|
|
|
|
}
|
|
|
|
|
if (!removingTagList.isEmpty()) {
|
|
|
|
|
List<Integer> removingTagIds = this.applicationDAO.getTagIdsForTagNames(removingTagList, tenantId);
|
|
|
|
|
this.applicationDAO.deleteTagMapping(removingTagIds, applicationId, tenantId);
|
|
|
|
|
applicationDAO.deleteTags(removingTagList, applicationId, tenantId);
|
|
|
|
|
}
|
|
|
|
|
applicationDAO.editApplication(applicationDTO, tenantId);
|
|
|
|
|
}
|
|
|
|
|
if (!applicationDAO.updateApplication(applicationDTO, tenantId)){
|
|
|
|
|
ConnectionManagerUtil.rollbackDBTransaction();
|
|
|
|
|
String msg = "Any application is not updated for the application ID: " + applicationId;
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new ApplicationManagementException(msg);
|
|
|
|
|
}
|
|
|
|
|
} catch (UserStoreException e) {
|
|
|
|
|
ConnectionManagerUtil.rollbackDBTransaction();
|
|
|
|
|
throw new ApplicationManagementException(
|
|
|
|
@ -1904,7 +1936,6 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
applicationDTO.setTags(applicationWrapper.getTags());
|
|
|
|
|
applicationDTO.setUnrestrictedRoles(applicationWrapper.getUnrestrictedRoles());
|
|
|
|
|
applicationDTO.setDeviceTypeId(deviceType.getId());
|
|
|
|
|
applicationDTO.setDeviceTypeName(deviceType.getName());
|
|
|
|
|
List<ApplicationReleaseDTO> applicationReleaseEntities = applicationWrapper.getApplicationReleaseWrappers()
|
|
|
|
|
.stream().map(this::releaseWrapperToReleaseDTO).collect(Collectors.toList());
|
|
|
|
|
applicationDTO.setApplicationReleaseDTOs(applicationReleaseEntities);
|
|
|
|
@ -1923,9 +1954,11 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
return applicationReleaseDTO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Application appDtoToAppResponse(ApplicationDTO applicationDTO) {
|
|
|
|
|
private Application appDtoToAppResponse(ApplicationDTO applicationDTO)
|
|
|
|
|
throws BadRequestException, UnexpectedServerErrorException {
|
|
|
|
|
|
|
|
|
|
Application application = new Application();
|
|
|
|
|
DeviceType deviceType = getDeviceTypeData(applicationDTO.getDeviceTypeId());
|
|
|
|
|
application.setId(applicationDTO.getId());
|
|
|
|
|
application.setName(applicationDTO.getName());
|
|
|
|
|
application.setDescription(applicationDTO.getDescription());
|
|
|
|
@ -1935,7 +1968,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
application.setPaymentCurrency(applicationDTO.getPaymentCurrency());
|
|
|
|
|
application.setTags(applicationDTO.getTags());
|
|
|
|
|
application.setUnrestrictedRoles(applicationDTO.getUnrestrictedRoles());
|
|
|
|
|
application.setDeviceType(applicationDTO.getDeviceTypeName());
|
|
|
|
|
application.setDeviceType(deviceType.getName());
|
|
|
|
|
List<ApplicationRelease> applicationReleases = applicationDTO.getApplicationReleaseDTOs()
|
|
|
|
|
.stream().map(this::releaseDtoToRelease).collect(Collectors.toList());
|
|
|
|
|
application.setApplicationReleases(applicationReleases);
|
|
|
|
@ -1943,7 +1976,8 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ApplicationRelease releaseDtoToRelease(ApplicationReleaseDTO applicationReleaseDTO){
|
|
|
|
|
String artifactDownloadEndpoint = ConfigurationManager.getInstance().getConfiguration().getArtifactDownloadEndpoint();
|
|
|
|
|
String artifactDownloadEndpoint = ConfigurationManager.getInstance().getConfiguration()
|
|
|
|
|
.getArtifactDownloadEndpoint();
|
|
|
|
|
String basePath = artifactDownloadEndpoint + Constants.FORWARD_SLASH + applicationReleaseDTO.getUuid();
|
|
|
|
|
ApplicationRelease applicationRelease = new ApplicationRelease();
|
|
|
|
|
applicationRelease.setDescription(applicationReleaseDTO.getDescription());
|
|
|
|
@ -1953,8 +1987,11 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
applicationRelease.setIsSharedWithAllTenants(applicationReleaseDTO.getIsSharedWithAllTenants());
|
|
|
|
|
applicationRelease.setMetaData(applicationReleaseDTO.getMetaData());
|
|
|
|
|
applicationRelease.setUrl(applicationReleaseDTO.getUrl());
|
|
|
|
|
applicationRelease.setCurrentStatus(applicationReleaseDTO.getCurrentState());
|
|
|
|
|
applicationRelease.setIsSharedWithAllTenants(applicationReleaseDTO.getIsSharedWithAllTenants());
|
|
|
|
|
applicationRelease.setSupportedOsVersions(applicationReleaseDTO.getSupportedOsVersions());
|
|
|
|
|
applicationRelease.setInstallerPath(basePath + Constants.FORWARD_SLASH + applicationReleaseDTO.getInstallerName());
|
|
|
|
|
applicationRelease
|
|
|
|
|
.setInstallerPath(basePath + Constants.FORWARD_SLASH + applicationReleaseDTO.getInstallerName());
|
|
|
|
|
applicationRelease.setIconPath(basePath + Constants.FORWARD_SLASH + applicationReleaseDTO.getIconName());
|
|
|
|
|
applicationRelease.setBannerPath(basePath + Constants.FORWARD_SLASH + applicationReleaseDTO.getBannerName());
|
|
|
|
|
|
|
|
|
|