mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'application-mgt-new' into 'application-mgt-new'
Fix app release artifact updating issue See merge request entgra/carbon-device-mgt!179
This commit is contained in:
commit
fce3596e04
@ -57,7 +57,7 @@ import javax.ws.rs.core.Response;
|
||||
public interface ArtifactDownloadAPI {
|
||||
|
||||
@GET
|
||||
@Path("/{uuid}/{fileName}")
|
||||
@Path("/{uuid}/{folderName}/{fileName}")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
@ApiOperation(
|
||||
produces = MediaType.APPLICATION_OCTET_STREAM,
|
||||
@ -86,6 +86,11 @@ public interface ArtifactDownloadAPI {
|
||||
value = "UUID of the application release.",
|
||||
required = true)
|
||||
@PathParam("uuid") String uuid,
|
||||
@ApiParam(
|
||||
name = "folderName",
|
||||
value = "Name of the folder where the artifact store.",
|
||||
required = true)
|
||||
@PathParam("folderName") String folderName,
|
||||
@ApiParam(
|
||||
name = "fileName",
|
||||
value = "Name of the artifact",
|
||||
|
||||
@ -47,12 +47,14 @@ public class ArtifactDownloadAPIImpl implements ArtifactDownloadAPI {
|
||||
@GET
|
||||
@Override
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
@Path("/{uuid}/{fileName}")
|
||||
public Response getArtifact(@PathParam("uuid") String uuid,
|
||||
@Path("/{uuid}/{folderName}/{fileName}")
|
||||
public Response getArtifact(
|
||||
@PathParam("uuid") String uuid,
|
||||
@PathParam("folderName") String folderName,
|
||||
@PathParam("fileName") String fileName) {
|
||||
AppmDataHandler dataHandler = APIUtil.getDataHandler();
|
||||
try {
|
||||
InputStream fileInputStream = dataHandler.getArtifactStream(uuid, fileName);
|
||||
InputStream fileInputStream = dataHandler.getArtifactStream(uuid, folderName, fileName);
|
||||
Response.ResponseBuilder response = Response
|
||||
.ok(fileInputStream, MediaType.APPLICATION_OCTET_STREAM);
|
||||
response.status(Response.Status.OK);
|
||||
|
||||
@ -72,7 +72,7 @@ public interface ApplicationStorageManager {
|
||||
*
|
||||
* @throws ApplicationStorageManagementException Not Found Exception.
|
||||
*/
|
||||
void deleteAppReleaseArtifact(String appReleaseHashVal, String fileName) throws ApplicationStorageManagementException;
|
||||
void deleteAppReleaseArtifact(String appReleaseHashVal, String folderName, String fileName) throws ApplicationStorageManagementException;
|
||||
|
||||
/**
|
||||
* To delete all release artifacts related with particular ApplicationDTO Release.
|
||||
@ -84,9 +84,9 @@ public interface ApplicationStorageManager {
|
||||
|
||||
/***
|
||||
* Get the InputStream of the file which is located in filePath
|
||||
* @param path file path
|
||||
* @param hashVal Hash Value of the application release.
|
||||
* @return {@link InputStream}
|
||||
* @throws ApplicationStorageManagementException throws if an error occurs when accessing the file.
|
||||
*/
|
||||
InputStream getFileSttream(String path) throws ApplicationStorageManagementException;
|
||||
InputStream getFileStream(String hashVal, String folderName, String fileName) throws ApplicationStorageManagementException;
|
||||
}
|
||||
|
||||
@ -35,5 +35,6 @@ public interface AppmDataHandler {
|
||||
|
||||
Map<String, LifecycleState> getLifecycleConfiguration() throws LifecycleManagementException;
|
||||
|
||||
InputStream getArtifactStream(String uuid, String artifactName) throws ApplicationManagementException;
|
||||
InputStream getArtifactStream(String uuid, String folderName, String artifactName)
|
||||
throws ApplicationManagementException;
|
||||
}
|
||||
|
||||
@ -451,12 +451,14 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
||||
ApplicationStorageManager applicationStorageManager = DAOUtil.getApplicationStorageManager();
|
||||
|
||||
if (!StringUtils.isEmpty(applicationArtifact.getIconName())) {
|
||||
applicationStorageManager.deleteAppReleaseArtifact(applicationReleaseDTO.getAppHashValue(),
|
||||
applicationStorageManager
|
||||
.deleteAppReleaseArtifact(applicationReleaseDTO.getAppHashValue(), Constants.ICON_ARTIFACT,
|
||||
applicationReleaseDTO.getIconName());
|
||||
applicationReleaseDTO.setIconName(applicationArtifact.getIconName());
|
||||
}
|
||||
if (!StringUtils.isEmpty(applicationArtifact.getBannerName())){
|
||||
applicationStorageManager.deleteAppReleaseArtifact(applicationReleaseDTO.getAppHashValue(),
|
||||
applicationStorageManager
|
||||
.deleteAppReleaseArtifact(applicationReleaseDTO.getAppHashValue(), Constants.BANNER_ARTIFACT,
|
||||
applicationReleaseDTO.getBannerName());
|
||||
applicationReleaseDTO.setBannerName(applicationArtifact.getBannerName());
|
||||
}
|
||||
@ -470,16 +472,20 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
||||
|
||||
int counter = 1;
|
||||
for (String scName : screenshotNames) {
|
||||
String folderPath = Constants.SCREENSHOT_ARTIFACT + counter;
|
||||
if (counter == 1) {
|
||||
applicationStorageManager.deleteAppReleaseArtifact(applicationReleaseDTO.getAppHashValue(),
|
||||
applicationStorageManager
|
||||
.deleteAppReleaseArtifact(applicationReleaseDTO.getAppHashValue(), folderPath,
|
||||
applicationReleaseDTO.getScreenshotName1());
|
||||
applicationReleaseDTO.setScreenshotName1(scName);
|
||||
} else if (counter == 2) {
|
||||
applicationStorageManager.deleteAppReleaseArtifact(applicationReleaseDTO.getAppHashValue(),
|
||||
applicationStorageManager
|
||||
.deleteAppReleaseArtifact(applicationReleaseDTO.getAppHashValue(), folderPath,
|
||||
applicationReleaseDTO.getScreenshotName2());
|
||||
applicationReleaseDTO.setScreenshotName2(scName);
|
||||
} else if (counter == 3) {
|
||||
applicationStorageManager.deleteAppReleaseArtifact(applicationReleaseDTO.getAppHashValue(),
|
||||
applicationStorageManager
|
||||
.deleteAppReleaseArtifact(applicationReleaseDTO.getAppHashValue(), folderPath,
|
||||
applicationReleaseDTO.getScreenshotName3());
|
||||
applicationReleaseDTO.setScreenshotName3(scName);
|
||||
}
|
||||
@ -583,12 +589,14 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
||||
log.error(msg);
|
||||
throw new ApplicationManagementException(msg, e);
|
||||
} catch (UserStoreException e) {
|
||||
throw new ApplicationManagementException(
|
||||
"User-store exception while checking whether the user " + userName + " of tenant " + tenantId
|
||||
+ " has the publisher permission", e);
|
||||
String msg = "User-store exception while checking whether the user " + userName + " of tenant " + tenantId
|
||||
+ " has the publisher permission";
|
||||
log.error(msg);
|
||||
throw new ApplicationManagementException(msg, e);
|
||||
} catch (ApplicationManagementDAOException e) {
|
||||
throw new ApplicationManagementException(
|
||||
"DAO exception while getting applications for the user " + userName + " of tenant " + tenantId, e);
|
||||
String msg = "DAO exception while getting applications for the user " + userName + " of tenant " + tenantId;
|
||||
log.error(msg);
|
||||
throw new ApplicationManagementException(msg, e);
|
||||
} finally {
|
||||
ConnectionManagerUtil.closeDBConnection();
|
||||
}
|
||||
@ -792,23 +800,26 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
||||
ConnectionManagerUtil.commitDBTransaction();
|
||||
return applicationRelease;
|
||||
} catch (TransactionManagementException e) {
|
||||
throw new ApplicationManagementException(
|
||||
"Error occurred while staring application release creating transaction for application Id: "
|
||||
+ applicationId, e);
|
||||
String msg = "Error occurred while staring application release creating transaction for application Id: "
|
||||
+ applicationId;
|
||||
log.error(msg);
|
||||
throw new ApplicationManagementException(msg, e);
|
||||
} catch (DBConnectionException e) {
|
||||
throw new ApplicationManagementException(
|
||||
"Error occurred while adding application release into IoTS app management ApplicationDTO id of the "
|
||||
+ "application release: " + applicationId, e);
|
||||
|
||||
String msg = "Error occurred while adding application release into IoTS app management ApplicationDTO id of"
|
||||
+ " the application release: " + applicationId;
|
||||
log.error(msg);
|
||||
throw new ApplicationManagementException(msg, e);
|
||||
} catch (LifeCycleManagementDAOException e) {
|
||||
ConnectionManagerUtil.rollbackDBTransaction();
|
||||
throw new ApplicationManagementException(
|
||||
"Error occurred while adding new application release lifecycle state to the application release: "
|
||||
+ applicationId, e);
|
||||
String msg = "Error occurred while adding new application release lifecycle state to the application"
|
||||
+ " release: " + applicationId;
|
||||
log.error(msg);
|
||||
throw new ApplicationManagementException(msg, e);
|
||||
} catch (ApplicationManagementDAOException e) {
|
||||
ConnectionManagerUtil.rollbackDBTransaction();
|
||||
throw new ApplicationManagementException(
|
||||
"Error occurred while adding new application release for application " + applicationId, e);
|
||||
String msg = "Error occurred while adding new application release for application " + applicationId;
|
||||
log.error(msg);
|
||||
throw new ApplicationManagementException(msg, e);
|
||||
} finally {
|
||||
ConnectionManagerUtil.closeDBConnection();
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@ import org.wso2.carbon.device.application.mgt.common.exception.ResourceManagemen
|
||||
import org.wso2.carbon.device.application.mgt.common.services.ApplicationStorageManager;
|
||||
import org.wso2.carbon.device.application.mgt.core.exception.ParsingException;
|
||||
import org.wso2.carbon.device.application.mgt.core.util.ArtifactsParser;
|
||||
import org.wso2.carbon.device.application.mgt.core.util.Constants;
|
||||
import org.wso2.carbon.device.application.mgt.core.util.StorageManagementUtil;
|
||||
|
||||
import java.io.*;
|
||||
@ -60,21 +61,24 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
|
||||
public ApplicationReleaseDTO uploadImageArtifacts(ApplicationReleaseDTO applicationReleaseDTO,
|
||||
InputStream iconFileStream, InputStream bannerFileStream, List<InputStream> screenShotStreams)
|
||||
throws ResourceManagementException {
|
||||
String artifactDirectoryPath;
|
||||
String iconStoredLocation;
|
||||
String bannerStoredLocation;
|
||||
String scStoredLocation = null;
|
||||
|
||||
try {
|
||||
artifactDirectoryPath = storagePath + applicationReleaseDTO.getAppHashValue();
|
||||
StorageManagementUtil.createArtifactDirectory(artifactDirectoryPath);
|
||||
String artifactStoringBaseDirPath = storagePath + applicationReleaseDTO.getAppHashValue();
|
||||
StorageManagementUtil.createArtifactDirectory(artifactStoringBaseDirPath);
|
||||
|
||||
if (iconFileStream != null) {
|
||||
iconStoredLocation = artifactDirectoryPath + File.separator + applicationReleaseDTO.getIconName();
|
||||
String iconStoringDir = artifactStoringBaseDirPath + File.separator + Constants.ICON_ARTIFACT;
|
||||
StorageManagementUtil.createArtifactDirectory(iconStoringDir);
|
||||
iconStoredLocation = iconStoringDir + File.separator + applicationReleaseDTO.getIconName();
|
||||
saveFile(iconFileStream, iconStoredLocation);
|
||||
}
|
||||
if (bannerFileStream != null) {
|
||||
bannerStoredLocation = artifactDirectoryPath + File.separator + applicationReleaseDTO.getBannerName();
|
||||
String bannerStoringDir = artifactStoringBaseDirPath + File.separator + Constants.BANNER_ARTIFACT;
|
||||
StorageManagementUtil.createArtifactDirectory(bannerStoringDir);
|
||||
bannerStoredLocation = bannerStoringDir + File.separator + applicationReleaseDTO.getBannerName();
|
||||
saveFile(bannerFileStream, bannerStoredLocation);
|
||||
}
|
||||
if (!screenShotStreams.isEmpty()) {
|
||||
@ -86,14 +90,16 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
|
||||
}
|
||||
int count = 1;
|
||||
for (InputStream screenshotStream : screenShotStreams) {
|
||||
String scStoringDir = artifactStoringBaseDirPath + File.separator + Constants.SCREENSHOT_ARTIFACT + count;
|
||||
StorageManagementUtil.createArtifactDirectory(scStoringDir);
|
||||
if (count == 1) {
|
||||
scStoredLocation = artifactDirectoryPath + File.separator + applicationReleaseDTO.getScreenshotName1();
|
||||
scStoredLocation = scStoringDir + File.separator + applicationReleaseDTO.getScreenshotName1();
|
||||
}
|
||||
if (count == 2) {
|
||||
scStoredLocation = artifactDirectoryPath + File.separator + applicationReleaseDTO.getScreenshotName2();
|
||||
scStoredLocation = scStoringDir + File.separator + applicationReleaseDTO.getScreenshotName2();
|
||||
}
|
||||
if (count == 3) {
|
||||
scStoredLocation = artifactDirectoryPath + File.separator + applicationReleaseDTO.getScreenshotName3();
|
||||
scStoredLocation = scStoringDir + File.separator + applicationReleaseDTO.getScreenshotName3();
|
||||
}
|
||||
saveFile(screenshotStream, scStoredLocation);
|
||||
count++;
|
||||
@ -101,8 +107,10 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
|
||||
}
|
||||
return applicationReleaseDTO;
|
||||
} catch (IOException e) {
|
||||
throw new ApplicationStorageManagementException("IO Exception while saving the screens hots for " +
|
||||
"the application " + applicationReleaseDTO.getUuid(), e);
|
||||
String msg = "IO Exception occurred while saving application artifacts for the application which has UUID "
|
||||
+ applicationReleaseDTO.getUuid();
|
||||
log.error(msg);
|
||||
throw new ApplicationStorageManagementException(msg, e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,7 +150,8 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
|
||||
String artifactPath;
|
||||
byte [] content = IOUtils.toByteArray(binaryFile);
|
||||
|
||||
artifactDirectoryPath = storagePath + applicationReleaseDTO.getAppHashValue();
|
||||
artifactDirectoryPath =
|
||||
storagePath + applicationReleaseDTO.getAppHashValue() + File.separator + Constants.APP_ARTIFACT;
|
||||
StorageManagementUtil.createArtifactDirectory(artifactDirectoryPath);
|
||||
artifactPath = artifactDirectoryPath + File.separator + applicationReleaseDTO.getInstallerName();
|
||||
saveFile(new ByteArrayInputStream(content), artifactPath);
|
||||
@ -168,24 +177,38 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
|
||||
String screenshot3 = applicationReleaseDTO.getScreenshotName3();
|
||||
|
||||
if (bannerName != null) {
|
||||
StorageManagementUtil.copy(storagePath + deletingAppHashValue + File.separator + bannerName,
|
||||
storagePath + appHashValue + File.separator + bannerName);
|
||||
StorageManagementUtil
|
||||
.copy(storagePath + deletingAppHashValue + File.separator + Constants.BANNER_ARTIFACT
|
||||
+ File.separator + bannerName,
|
||||
storagePath + appHashValue + File.separator + Constants.BANNER_ARTIFACT + File.separator
|
||||
+ bannerName);
|
||||
}
|
||||
if (iconName != null) {
|
||||
StorageManagementUtil.copy(storagePath + deletingAppHashValue + File.separator + iconName,
|
||||
storagePath + appHashValue + File.separator + iconName);
|
||||
StorageManagementUtil.copy(storagePath + deletingAppHashValue + File.separator + Constants.ICON_ARTIFACT
|
||||
+ File.separator + iconName,
|
||||
storagePath + appHashValue + File.separator + Constants.ICON_ARTIFACT + File.separator
|
||||
+ iconName);
|
||||
}
|
||||
if (screenshot1 != null) {
|
||||
StorageManagementUtil.copy(storagePath + deletingAppHashValue + File.separator + screenshot1,
|
||||
storagePath + appHashValue + File.separator + screenshot1);
|
||||
StorageManagementUtil
|
||||
.copy(storagePath + deletingAppHashValue + File.separator + Constants.SCREENSHOT_ARTIFACT + 1
|
||||
+ File.separator + screenshot1,
|
||||
storagePath + appHashValue + File.separator + Constants.SCREENSHOT_ARTIFACT + 1
|
||||
+ File.separator + screenshot1);
|
||||
}
|
||||
if (screenshot2 != null) {
|
||||
StorageManagementUtil.copy(storagePath + deletingAppHashValue + File.separator + screenshot2,
|
||||
storagePath + appHashValue + File.separator + screenshot2);
|
||||
StorageManagementUtil
|
||||
.copy(storagePath + deletingAppHashValue + File.separator + Constants.SCREENSHOT_ARTIFACT + 2
|
||||
+ File.separator + screenshot2,
|
||||
storagePath + appHashValue + File.separator + Constants.SCREENSHOT_ARTIFACT + 2
|
||||
+ File.separator + screenshot2);
|
||||
}
|
||||
if (screenshot3 != null) {
|
||||
StorageManagementUtil.copy(storagePath + deletingAppHashValue + File.separator + screenshot3,
|
||||
storagePath + appHashValue + File.separator + screenshot3);
|
||||
StorageManagementUtil
|
||||
.copy(storagePath + deletingAppHashValue + File.separator + Constants.SCREENSHOT_ARTIFACT + 3
|
||||
+ File.separator + screenshot3,
|
||||
storagePath + appHashValue + File.separator + Constants.SCREENSHOT_ARTIFACT + 3
|
||||
+ File.separator + screenshot3);
|
||||
}
|
||||
deleteAppReleaseArtifact( storagePath + deletingAppHashValue);
|
||||
} catch (IOException e) {
|
||||
@ -198,8 +221,9 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteAppReleaseArtifact(String appReleaseHashVal, String fileName) throws ApplicationStorageManagementException {
|
||||
String artifactPath = storagePath + appReleaseHashVal + File.separator + fileName;
|
||||
public void deleteAppReleaseArtifact(String appReleaseHashVal, String folderName, String fileName)
|
||||
throws ApplicationStorageManagementException {
|
||||
String artifactPath = storagePath + appReleaseHashVal + File.separator + folderName + File.separator + fileName;
|
||||
deleteAppReleaseArtifact(artifactPath);
|
||||
}
|
||||
|
||||
@ -212,8 +236,9 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getFileSttream (String path) throws ApplicationStorageManagementException {
|
||||
String filePath = storagePath + path;
|
||||
public InputStream getFileStream(String hashVal, String folderName, String fileName)
|
||||
throws ApplicationStorageManagementException {
|
||||
String filePath = storagePath + hashVal + File.separator + folderName + File.separator + fileName;
|
||||
try {
|
||||
return StorageManagementUtil.getInputStream(filePath);
|
||||
} catch (IOException e) {
|
||||
|
||||
@ -64,12 +64,11 @@ public class AppmDataHandlerImpl implements AppmDataHandler {
|
||||
return lifecycleStateManager.getLifecycleConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getArtifactStream(String uuid, String artifactName) throws ApplicationManagementException {
|
||||
@Override public InputStream getArtifactStream(String uuid, String folderName, String artifactName)
|
||||
throws ApplicationManagementException {
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
|
||||
ApplicationStorageManager applicationStorageManager = DAOUtil.getApplicationStorageManager();
|
||||
ApplicationReleaseDAO applicationReleaseDAO = ApplicationManagementDAOFactory.getApplicationReleaseDAO();
|
||||
String artifactPath;
|
||||
String appReleaseHashValue;
|
||||
try {
|
||||
ConnectionManagerUtil.openDBConnection();
|
||||
@ -79,10 +78,10 @@ public class AppmDataHandlerImpl implements AppmDataHandler {
|
||||
log.error(msg);
|
||||
throw new NotFoundException(msg);
|
||||
}
|
||||
artifactPath = appReleaseHashValue + Constants.FORWARD_SLASH + artifactName;
|
||||
InputStream inputStream = applicationStorageManager.getFileSttream(artifactPath);
|
||||
InputStream inputStream = applicationStorageManager
|
||||
.getFileStream(appReleaseHashValue, folderName, artifactName);
|
||||
if (inputStream == null) {
|
||||
String msg = "Couldn't file the file in the file system. File path: " + artifactPath;
|
||||
String msg = "Couldn't file the file in the file system.";
|
||||
log.error(msg);
|
||||
throw new ApplicationManagementException(msg);
|
||||
}
|
||||
|
||||
@ -338,8 +338,7 @@ public class APIUtil {
|
||||
String artifactDownloadEndpoint = ConfigurationManager.getInstance().getConfiguration()
|
||||
.getArtifactDownloadEndpoint();
|
||||
String basePath = Constants.ARTIFACT_DOWNLOAD_PROTOCOL + "://" + host + ":" + port + artifactDownloadEndpoint
|
||||
+ Constants.FORWARD_SLASH + applicationReleaseDTO.getUuid()
|
||||
+ Constants.FORWARD_SLASH;
|
||||
+ Constants.FORWARD_SLASH + applicationReleaseDTO.getUuid() + Constants.FORWARD_SLASH;
|
||||
|
||||
List<String> screenshotPaths = new ArrayList<>();
|
||||
ApplicationRelease applicationRelease = new ApplicationRelease();
|
||||
@ -356,28 +355,37 @@ public class APIUtil {
|
||||
applicationRelease.setIsSharedWithAllTenants(applicationReleaseDTO.getIsSharedWithAllTenants());
|
||||
applicationRelease.setSupportedOsVersions(applicationReleaseDTO.getSupportedOsVersions());
|
||||
applicationRelease.setRating(applicationReleaseDTO.getRating());
|
||||
applicationRelease.setIconPath(basePath + applicationReleaseDTO.getIconName());
|
||||
applicationRelease.setIconPath(
|
||||
basePath + Constants.ICON_ARTIFACT + Constants.FORWARD_SLASH + applicationReleaseDTO.getIconName());
|
||||
|
||||
if (!StringUtils.isEmpty(applicationReleaseDTO.getBannerName())){
|
||||
applicationRelease.setBannerPath(basePath + applicationReleaseDTO.getBannerName());
|
||||
applicationRelease.setBannerPath(
|
||||
basePath + Constants.BANNER_ARTIFACT + Constants.FORWARD_SLASH + applicationReleaseDTO
|
||||
.getBannerName());
|
||||
}
|
||||
|
||||
if (urlValidator.isValid(applicationReleaseDTO.getInstallerName())){
|
||||
applicationRelease
|
||||
.setInstallerPath(applicationReleaseDTO.getInstallerName());
|
||||
if (urlValidator.isValid(applicationReleaseDTO.getInstallerName())) {
|
||||
applicationRelease.setInstallerPath(applicationReleaseDTO.getInstallerName());
|
||||
} else {
|
||||
applicationRelease
|
||||
.setInstallerPath(basePath + applicationReleaseDTO.getInstallerName());
|
||||
applicationRelease.setInstallerPath(
|
||||
basePath + Constants.APP_ARTIFACT + Constants.FORWARD_SLASH + applicationReleaseDTO
|
||||
.getInstallerName());
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(applicationReleaseDTO.getScreenshotName1())) {
|
||||
screenshotPaths.add(basePath + applicationReleaseDTO.getScreenshotName1());
|
||||
screenshotPaths
|
||||
.add(basePath + Constants.SCREENSHOT_ARTIFACT + 1 + Constants.FORWARD_SLASH + applicationReleaseDTO
|
||||
.getScreenshotName1());
|
||||
}
|
||||
if (!StringUtils.isEmpty(applicationReleaseDTO.getScreenshotName2())) {
|
||||
screenshotPaths.add(basePath + applicationReleaseDTO.getScreenshotName2());
|
||||
screenshotPaths
|
||||
.add(basePath + Constants.SCREENSHOT_ARTIFACT + 2 + Constants.FORWARD_SLASH + applicationReleaseDTO
|
||||
.getScreenshotName2());
|
||||
}
|
||||
if (!StringUtils.isEmpty(applicationReleaseDTO.getScreenshotName3())) {
|
||||
screenshotPaths.add(basePath + applicationReleaseDTO.getScreenshotName3());
|
||||
screenshotPaths
|
||||
.add(basePath + Constants.SCREENSHOT_ARTIFACT + 3 + Constants.FORWARD_SLASH + applicationReleaseDTO
|
||||
.getScreenshotName3());
|
||||
}
|
||||
applicationRelease.setScreenshots(screenshotPaths);
|
||||
return applicationRelease;
|
||||
|
||||
@ -61,16 +61,25 @@ public class Constants {
|
||||
public static final String DB_TYPE_POSTGRESQL = "PostgreSQL";
|
||||
}
|
||||
|
||||
/**
|
||||
* Directory name of the icon artifact that are saved in the file system.
|
||||
*/
|
||||
public static final String ICON_ARTIFACT = "icon";
|
||||
|
||||
/**
|
||||
* Name of the image artifacts that are saved in the file system.
|
||||
* Directory name of the banner artifact that are saved in the file system.
|
||||
*/
|
||||
public static final String[] IMAGE_ARTIFACTS = {"icon", "banner", "screenshot"};
|
||||
public static final String BANNER_ARTIFACT = "banner";
|
||||
|
||||
/**
|
||||
* Directory name of the release artifacts that are saved in the file system.
|
||||
* Common directory name of the screenshot artifact that are saved in the file system.
|
||||
*/
|
||||
public static final String RELEASE_ARTIFACT = "artifact";
|
||||
public static final String SCREENSHOT_ARTIFACT = "screenshot";
|
||||
|
||||
/**
|
||||
* Naming directory name of the application artifact that are saved in the file system.
|
||||
*/
|
||||
public static final String APP_ARTIFACT = "app";
|
||||
|
||||
public static final int REVIEW_PARENT_ID = -1;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user