|
|
|
@ -437,7 +437,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
* @throws ApplicationManagementException if error occurred while uploading artifacts into file system.
|
|
|
|
|
*/
|
|
|
|
|
private ApplicationReleaseDTO uploadEntAppReleaseArtifacts(ApplicationReleaseDTO releaseDTO,
|
|
|
|
|
ApplicationArtifact applicationArtifact, String deviceTypeName, boolean isNewRelease)
|
|
|
|
|
ApplicationArtifact applicationArtifact, String deviceTypeName, boolean isNewRelease)
|
|
|
|
|
throws ApplicationManagementException {
|
|
|
|
|
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
|
|
|
|
|
try {
|
|
|
|
@ -478,7 +478,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
* @throws ResourceManagementException if error occurred while uploading
|
|
|
|
|
*/
|
|
|
|
|
private ApplicationReleaseDTO uploadPubAppReleaseArtifacts(ApplicationReleaseDTO releaseDTO, ApplicationArtifact applicationArtifact,
|
|
|
|
|
String deviceType)
|
|
|
|
|
String deviceType)
|
|
|
|
|
throws ResourceManagementException {
|
|
|
|
|
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
|
|
|
|
|
String appInstallerUrl = getPublicAppStorePath(deviceType) + releaseDTO.getPackageName();
|
|
|
|
@ -497,7 +497,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
.getReleaseByPackages(Collections.singletonList(packageName), tenantId);
|
|
|
|
|
if (!exitingPubAppReleases.isEmpty()){
|
|
|
|
|
String msg = "Public app release exists for package name " + packageName
|
|
|
|
|
+ ". Hence you can't add new public app for package name "
|
|
|
|
|
+ ". Hence you cannot add new public app for package name "
|
|
|
|
|
+ packageName;
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
@ -521,7 +521,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
* @throws ResourceManagementException if error occurred while uploading
|
|
|
|
|
*/
|
|
|
|
|
private ApplicationReleaseDTO uploadCustomAppReleaseArtifacts(ApplicationReleaseDTO releaseDTO, ApplicationArtifact applicationArtifact,
|
|
|
|
|
String deviceType)
|
|
|
|
|
String deviceType)
|
|
|
|
|
throws ResourceManagementException, ApplicationManagementException {
|
|
|
|
|
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
|
|
|
|
|
ApplicationStorageManager applicationStorageManager = APIUtil.getApplicationStorageManager();
|
|
|
|
@ -669,7 +669,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
String extension = windowsInstallerName.substring(windowsInstallerName.lastIndexOf(".") + 1);
|
|
|
|
|
if (!extension.equalsIgnoreCase(Constants.MSI) &&
|
|
|
|
|
!extension.equalsIgnoreCase(Constants.APPX)) {
|
|
|
|
|
String msg = "Application Type doesn't match with supporting application types of " +
|
|
|
|
|
String msg = "Application Type does not match with supporting application types of " +
|
|
|
|
|
deviceType + "platform which are APPX and MSI";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
@ -771,7 +771,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
try {
|
|
|
|
|
ConnectionManagerUtil.getDBConnection();
|
|
|
|
|
if (this.applicationReleaseDAO.verifyReleaseExistenceByHash(md5OfApp, tenantId)) {
|
|
|
|
|
String msg = "Same binary file is in the server. Hence you can't add same file into the "
|
|
|
|
|
String msg = "Same binary file is in the server. Hence you cannot add same file into the "
|
|
|
|
|
+ "server. Device Type: " + deviceType + " and package name: " + packageName;
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
@ -1175,7 +1175,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
if (!hasUserRole(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 unrestricted role list";
|
|
|
|
|
+ " Cannot filter applications by giving these unrestricted role list";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
@ -1382,7 +1382,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
ConnectionManagerUtil.openDBConnection();
|
|
|
|
|
ApplicationDTO applicationDTO = this.applicationDAO.getApplication(applicationId, tenantId);
|
|
|
|
|
if (applicationDTO == null) {
|
|
|
|
|
String msg = "Couldn't find application for the application Id: " + applicationId;
|
|
|
|
|
String msg = "Could not find application for the application Id: " + applicationId;
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new NotFoundException(msg);
|
|
|
|
|
}
|
|
|
|
@ -2259,7 +2259,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
if (!deviceTypeName.equals(Constants.ALL)) {
|
|
|
|
|
DeviceType deviceType = deviceManagementProviderService.getDeviceType(deviceTypeName);
|
|
|
|
|
if (deviceType == null) {
|
|
|
|
|
String msg = "Device type doesn't exist. Hence check the application name existence with valid "
|
|
|
|
|
String msg = "Device type does not exist. Hence check the application name existence with valid "
|
|
|
|
|
+ "device type name.";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
@ -2310,7 +2310,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
.isExistingAppName(applicationUpdateWrapper.getName().trim(), applicationDTO.getDeviceTypeId(),
|
|
|
|
|
tenantId)) {
|
|
|
|
|
String msg = "Already an application registered with same name " + applicationUpdateWrapper.getName()
|
|
|
|
|
+ ". Hence you can't update the application name from " + applicationDTO.getName() + " to "
|
|
|
|
|
+ ". Hence you cannot update the application name from " + applicationDTO.getName() + " to "
|
|
|
|
|
+ applicationUpdateWrapper.getName();
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
@ -2667,7 +2667,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
ConnectionManagerUtil.beginDBTransaction();
|
|
|
|
|
if (applicationDAO.getTagForTagName(newTagName, tenantId) != null){
|
|
|
|
|
String msg =
|
|
|
|
|
"You are trying to modify tag name into existing tag. Therefore you can't modify tag name from "
|
|
|
|
|
"You are trying to modify tag name into existing tag. Therefore you cannot modify tag name from "
|
|
|
|
|
+ oldTagName + " to new tag name " + newTagName;
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
@ -2929,7 +2929,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
*/
|
|
|
|
|
private void validateFilter(Filter filter) throws BadRequestException {
|
|
|
|
|
if (filter == null) {
|
|
|
|
|
String msg = "Filter validation is failed, Filter shouldn't be null, hence please verify the request payload";
|
|
|
|
|
String msg = "Filter validation is failed, Filter should not be null, hence please verify the request payload";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
@ -3272,7 +3272,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
ConnectionManagerUtil.getDBConnection();
|
|
|
|
|
if (this.applicationReleaseDAO.verifyReleaseExistenceByHash(md5OfApp, tenantId)) {
|
|
|
|
|
String msg =
|
|
|
|
|
"Same binary file is in the server. Hence you can't add same file into the "
|
|
|
|
|
"Same binary file is in the server. Hence you cannot add same file into the "
|
|
|
|
|
+ "server. Device Type: " + deviceTypeObj.getName()
|
|
|
|
|
+ " and package name: " + applicationDTO.getApplicationReleaseDTOs()
|
|
|
|
|
.get(0).getPackageName();
|
|
|
|
@ -3459,17 +3459,17 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
}
|
|
|
|
|
appCategories = applicationWrapper.getCategories();
|
|
|
|
|
if (appCategories == null) {
|
|
|
|
|
String msg = "Application category can't be null.";
|
|
|
|
|
String msg = "Application category cannot be null.";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
|
if (appCategories.isEmpty()) {
|
|
|
|
|
String msg = "Application category can't be empty.";
|
|
|
|
|
String msg = "Application category cannot be empty.";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isEmpty(applicationWrapper.getDeviceType())) {
|
|
|
|
|
String msg = "Device type can't be empty for the application.";
|
|
|
|
|
String msg = "Device type cannot be empty for the application.";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
@ -3496,12 +3496,12 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
}
|
|
|
|
|
appCategories = webAppWrapper.getCategories();
|
|
|
|
|
if (appCategories == null) {
|
|
|
|
|
String msg = "Web Clip category can't be null.";
|
|
|
|
|
String msg = "Web Clip category cannot be null.";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
|
if (appCategories.isEmpty()) {
|
|
|
|
|
String msg = "Web clip category can't be empty.";
|
|
|
|
|
String msg = "Web clip category cannot be empty.";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
@ -3534,17 +3534,17 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
}
|
|
|
|
|
appCategories = publicAppWrapper.getCategories();
|
|
|
|
|
if (appCategories == null) {
|
|
|
|
|
String msg = "Application category can't be null.";
|
|
|
|
|
String msg = "Application category cannot be null.";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
|
if (appCategories.isEmpty()) {
|
|
|
|
|
String msg = "Application category can't be empty.";
|
|
|
|
|
String msg = "Application category cannot be empty.";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isEmpty(publicAppWrapper.getDeviceType())) {
|
|
|
|
|
String msg = "Device type can't be empty for the public application.";
|
|
|
|
|
String msg = "Device type cannot be empty for the public application.";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
@ -3571,17 +3571,17 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
}
|
|
|
|
|
appCategories = customAppWrapper.getCategories();
|
|
|
|
|
if (appCategories == null) {
|
|
|
|
|
String msg = "Application category can't be null.";
|
|
|
|
|
String msg = "Application category cannot be null.";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
|
if (appCategories.isEmpty()) {
|
|
|
|
|
String msg = "Application category can't be empty.";
|
|
|
|
|
String msg = "Application category cannot be empty.";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isEmpty(customAppWrapper.getDeviceType())) {
|
|
|
|
|
String msg = "Device type can't be empty for the application.";
|
|
|
|
|
String msg = "Device type cannot be empty for the application.";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
@ -3673,7 +3673,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
@Override
|
|
|
|
|
public <T> void validateReleaseCreatingRequest(T param, String deviceType) throws ApplicationManagementException {
|
|
|
|
|
if (param == null) {
|
|
|
|
|
String msg = "In order to validate release creating request param shouldn't be null.";
|
|
|
|
|
String msg = "In order to validate release creating request param should not be null.";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
@ -3682,7 +3682,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
AtomicReference<EntAppReleaseWrapper> entAppReleaseWrapper = new AtomicReference<>(
|
|
|
|
|
(EntAppReleaseWrapper) param);
|
|
|
|
|
if (StringUtils.isEmpty(entAppReleaseWrapper.get().getSupportedOsVersions())) {
|
|
|
|
|
String msg = "Supported OS Version shouldn't be null or empty.";
|
|
|
|
|
String msg = "Supported OS Version should not be null or empty.";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
@ -3706,12 +3706,12 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
WebAppReleaseWrapper webAppReleaseWrapper = (WebAppReleaseWrapper) param;
|
|
|
|
|
UrlValidator urlValidator = new UrlValidator();
|
|
|
|
|
if (StringUtils.isEmpty(webAppReleaseWrapper.getVersion())) {
|
|
|
|
|
String msg = "Version shouldn't be empty or null for the WEB CLIP release creating request.";
|
|
|
|
|
String msg = "Version should not be empty or null for the WEB CLIP release creating request.";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isEmpty(webAppReleaseWrapper.getUrl())) {
|
|
|
|
|
String msg = "URL shouldn't be null for the application release creating request for application type "
|
|
|
|
|
String msg = "URL should not be null for the application release creating request for application type "
|
|
|
|
|
+ "WEB_CLIP";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
@ -3724,17 +3724,17 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
} else if (param instanceof PublicAppReleaseWrapper) {
|
|
|
|
|
PublicAppReleaseWrapper publicAppReleaseWrapper = (PublicAppReleaseWrapper) param;
|
|
|
|
|
if (StringUtils.isEmpty(publicAppReleaseWrapper.getSupportedOsVersions())) {
|
|
|
|
|
String msg = "Supported OS Version shouldn't be null or empty for public app release creating request.";
|
|
|
|
|
String msg = "Supported OS Version should not be null or empty for public app release creating request.";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isEmpty(publicAppReleaseWrapper.getVersion())) {
|
|
|
|
|
String msg = "Version shouldn't be empty or null for the Public App release creating request.";
|
|
|
|
|
String msg = "Version should not be empty or null for the Public App release creating request.";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isEmpty(publicAppReleaseWrapper.getPackageName())) {
|
|
|
|
|
String msg = "Package name shouldn't be empty or null for the Public App release creating request.";
|
|
|
|
|
String msg = "Package name should not be empty or null for the Public App release creating request.";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
@ -3748,12 +3748,12 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
|
} else if (param instanceof CustomAppReleaseWrapper) {
|
|
|
|
|
CustomAppReleaseWrapper customAppReleaseWrapper = (CustomAppReleaseWrapper) param;
|
|
|
|
|
if (StringUtils.isEmpty(customAppReleaseWrapper.getVersion())) {
|
|
|
|
|
String msg = "Version shouldn't be empty or null for the custom App release creating request.";
|
|
|
|
|
String msg = "Version should not be empty or null for the custom App release creating request.";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isEmpty(customAppReleaseWrapper.getPackageName())) {
|
|
|
|
|
String msg = "Package name shouldn't be empty or null for the custom App release creating request.";
|
|
|
|
|
String msg = "Package name should not be empty or null for the custom App release creating request.";
|
|
|
|
|
log.error(msg);
|
|
|
|
|
throw new BadRequestException(msg);
|
|
|
|
|
}
|
|
|
|
|