Improve application create functionality

feature/appm-store/pbac
lasanthaDLPDS 6 years ago
parent 5399ae1a3c
commit 6dafe59eab

@ -197,7 +197,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
if (!StringUtils.isEmpty(filter.getAppReleaseState())) { if (!StringUtils.isEmpty(filter.getAppReleaseState())) {
sql += " AND AP_APP_RELEASE.CURRENT_STATE = ?"; sql += " AND AP_APP_RELEASE.CURRENT_STATE = ?";
} }
if (deviceTypeId > 0) { if (deviceTypeId != -1) {
sql += " AND AP_APP.DEVICE_TYPE_ID = ?"; sql += " AND AP_APP.DEVICE_TYPE_ID = ?";
} }

@ -87,6 +87,7 @@ import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedList; import java.util.LinkedList;
@ -135,79 +136,126 @@ public class ApplicationManagerImpl implements ApplicationManager {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
ApplicationDTO applicationDTO;
Application application;
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Application create request is received for the tenant : " + tenantId + " From" + " the user : " log.debug("Application create request is received for the tenant : " + tenantId + " From" + " the user : "
+ userName); + userName);
} }
try {
applicationDTO = appWrapperToAppDTO(applicationWrapper);
ApplicationReleaseDTO initialApplicationReleaseDTO = applicationDTO.getApplicationReleaseDTOs().get(0);
applicationDTO.getApplicationReleaseDTOs().clear();
ApplicationReleaseDTO applicationReleaseDTO = addApplicationReleaseArtifacts(applicationDTO.getType(), ApplicationDTO applicationDTO;
applicationWrapper.getDeviceType(), initialApplicationReleaseDTO, applicationArtifact, false); List<String> unrestrictedRoles;
applicationDTO.getApplicationReleaseDTOs().add(addImageArtifacts(applicationReleaseDTO, applicationArtifact)); Optional<CategoryDTO> category;
} catch (UnexpectedServerErrorException e) { List<String> tags;
String msg = "Error occurred when getting Device Type data.";
log.error(msg);
throw new ApplicationManagementException(msg, e);
} catch (ResourceManagementException e) {
String msg = "Error Occured when uploading artifacts of the application: " + applicationWrapper.getName();
log.error(msg);
throw new ApplicationManagementException(msg, e);
}
//validating and verifying application data
try { try {
List<ApplicationReleaseDTO> applicationReleaseEntities = new ArrayList<>(); ConnectionManagerUtil.openDBConnection();
ApplicationReleaseDTO applicationReleaseDTO; applicationDTO = appWrapperToAppDTO(applicationWrapper);
unrestrictedRoles = applicationWrapper.getUnrestrictedRoles();
tags = applicationWrapper.getTags();
if (unrestrictedRoles != null && !unrestrictedRoles.isEmpty()) {
if (!isValidRestrictedRole(unrestrictedRoles)) {
String msg = "Unrestricted role list contain role/roles which are not in the user store.";
log.error(msg);
throw new ApplicationManagementException(msg);
}
if (!hasUserRole(unrestrictedRoles, userName)) {
String msg = "You are trying to restrict the visibility of the application for a role set, but "
+ "in order to perform the action at least one role should be assigned to user: "
+ userName;
log.error(msg);
throw new BadRequestException(msg);
}
}
Filter filter = new Filter(); Filter filter = new Filter();
filter.setFullMatch(true); filter.setFullMatch(true);
filter.setAppName(applicationDTO.getName().trim()); filter.setAppName(applicationDTO.getName().trim());
filter.setOffset(0); filter.setOffset(0);
filter.setLimit(1); filter.setLimit(1);
ConnectionManagerUtil.beginDBTransaction();
List<ApplicationDTO> applicationList = applicationDAO List<ApplicationDTO> applicationList = applicationDAO
.getApplications(filter, applicationDTO.getDeviceTypeId(), tenantId); .getApplications(filter, applicationDTO.getDeviceTypeId(), tenantId);
if (!applicationList.isEmpty()) { if (!applicationList.isEmpty()) {
String msg = String msg = "Already an application registered with same name - " + applicationList.get(0).getName()
"Already an application registered with same name - " + applicationList.get(0) + " for the device type " + applicationWrapper.getDeviceType();
.getName();
log.error(msg); log.error(msg);
throw new RequestValidatingException(msg); throw new RequestValidatingException(msg);
} }
List<CategoryDTO> registeredCategories = this.applicationDAO.getAllCategories(tenantId);
String categoryName = applicationWrapper.getAppCategory();
if (registeredCategories.isEmpty()) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Registered application category set is empty. Since it is mandatory to add application "
+ "category when adding new application, registered application category list shouldn't be null.";
log.error(msg);
throw new ApplicationManagementException(msg);
}
category = registeredCategories.stream().filter(obj -> obj.getCategoryName().equals(categoryName))
.findAny();
if (!category.isPresent()) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Request contains invalid category: " + categoryName;
log.error(msg);
throw new ApplicationManagementException(msg);
}
} catch (DBConnectionException e) {
String msg = "Error occurred while getting database connection.";
log.error(msg);
throw new ApplicationManagementException(msg, e);
} catch (UnexpectedServerErrorException e) {
String msg = "Error occurred when getting Device Type data.";
log.error(msg);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) {
String msg = "Error occurred while getting data which is related to application. application name: "
+ applicationWrapper.getName() + " and application type: " + applicationWrapper.getType();
log.error(msg);
throw new ApplicationManagementException(msg, e);
} catch (UserStoreException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred when validating the unrestricted roles given for the application";
log.error(msg);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
}
//uploading application artifacts
try {
ApplicationReleaseDTO applicationReleaseDTO = applicationDTO.getApplicationReleaseDTOs().get(0);
applicationReleaseDTO = addApplicationReleaseArtifacts(applicationDTO.getType(),
applicationWrapper.getDeviceType(), applicationReleaseDTO, applicationArtifact, false);
applicationReleaseDTO = addImageArtifacts(applicationReleaseDTO, applicationArtifact);
applicationDTO.getApplicationReleaseDTOs().clear();
applicationDTO.getApplicationReleaseDTOs().add(applicationReleaseDTO);
} catch (ResourceManagementException e) {
String msg = "Error Occured when uploading artifacts of the application: " + applicationWrapper.getName();
log.error(msg);
throw new ApplicationManagementException(msg, e);
}
//insert application data into databse
ApplicationStorageManager applicationStorageManager = Util.getApplicationStorageManager();
ApplicationReleaseDTO applicationReleaseDTO = applicationDTO.getApplicationReleaseDTOs().get(0);
try {
List<ApplicationReleaseDTO> applicationReleaseEntities = new ArrayList<>();
ConnectionManagerUtil.beginDBTransaction();
// Insert to application table // Insert to application table
int appId = this.applicationDAO.createApplication(applicationDTO, tenantId); int appId = this.applicationDAO.createApplication(applicationDTO, tenantId);
if (appId == -1) { if (appId == -1) {
log.error("ApplicationDTO creation is Failed"); log.error("Application data storing is Failed.");
ConnectionManagerUtil.rollbackDBTransaction(); ConnectionManagerUtil.rollbackDBTransaction();
deleteApplicationArtifacts(Collections.singletonList(applicationReleaseDTO.getAppHashValue()));
return null; return null;
} else { } else {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("New ApplicationDTO entry added to AP_APP table. App Id:" + appId); log.debug("New ApplicationDTO entry added to AP_APP table. App Id:" + appId);
} }
//adding application unrestricted roles //adding application unrestricted roles
List<String> unrestrictedRoles = applicationWrapper.getUnrestrictedRoles(); if (unrestrictedRoles != null && !unrestrictedRoles.isEmpty()) {
if (!unrestrictedRoles.isEmpty()) {
if (!isValidRestrictedRole(unrestrictedRoles)) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Unrestricted role list contain role/roles which are not in the user store.";
log.error(msg);
throw new ApplicationManagementException(msg);
}
if (!hasUserRole(unrestrictedRoles, userName)){
ConnectionManagerUtil.rollbackDBTransaction();
String msg =
"You are trying to restrict the visibility of the application for a role set, but in order to perform the action at least one role should be assigned to user: "
+ userName;
log.error(msg);
throw new BadRequestException(msg);
}
this.visibilityDAO.addUnrestrictedRoles(unrestrictedRoles, appId, tenantId); this.visibilityDAO.addUnrestrictedRoles(unrestrictedRoles, appId, tenantId);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("New restricted roles to app ID mapping added to AP_UNRESTRICTED_ROLE table." log.debug("New restricted roles to app ID mapping added to AP_UNRESTRICTED_ROLE table."
@ -215,25 +263,6 @@ public class ApplicationManagerImpl implements ApplicationManager {
} }
} }
List<CategoryDTO> registeredCategories = this.applicationDAO.getAllCategories(tenantId);
String categoryName = applicationWrapper.getAppCategory();
Optional<CategoryDTO> category = registeredCategories.stream()
.filter(obj -> obj.getCategoryName().equals(categoryName)).findAny();
if (registeredCategories.isEmpty()) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Registered application category set is empty category: " + categoryName;
log.error(msg);
throw new ApplicationManagementException(msg);
}
if (!category.isPresent()){
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Request contains invalid category: " + categoryName;
log.error(msg);
throw new ApplicationManagementException(msg);
}
/* /*
In current flow, allow to add one category for an application. If it is required to add multiple In current flow, allow to add one category for an application. If it is required to add multiple
categories DAO layer is implemented to match with that requirement. Hence logic is also implemented categories DAO layer is implemented to match with that requirement. Hence logic is also implemented
@ -241,11 +270,10 @@ public class ApplicationManagerImpl implements ApplicationManager {
*/ */
List<Integer> categoryIds = new ArrayList<>(); List<Integer> categoryIds = new ArrayList<>();
categoryIds.add(category.get().getId()); categoryIds.add(category.get().getId());
this.applicationDAO.addCategoryMapping(categoryIds,appId,tenantId); this.applicationDAO.addCategoryMapping(categoryIds, appId, tenantId);
//adding application tags //adding application tags
List<String> tags = applicationWrapper.getTags(); if (tags != null && !tags.isEmpty()) {
if (!tags.isEmpty()) {
List<TagDTO> registeredTags = applicationDAO.getAllTags(tenantId); List<TagDTO> registeredTags = applicationDAO.getAllTags(tenantId);
List<String> registeredTagNames = new ArrayList<>(); List<String> registeredTagNames = new ArrayList<>();
List<Integer> tagIds = new ArrayList<>(); List<Integer> tagIds = new ArrayList<>();
@ -277,61 +305,84 @@ public class ApplicationManagerImpl implements ApplicationManager {
log.debug("Creating a new release. App Id:" + appId); log.debug("Creating a new release. App Id:" + appId);
} }
String initialLifecycleState = lifecycleStateManager.getInitialState(); String initialLifecycleState = lifecycleStateManager.getInitialState();
applicationReleaseDTO = applicationDTO.getApplicationReleaseDTOs().get(0);
applicationReleaseDTO.setCurrentState(initialLifecycleState); applicationReleaseDTO.setCurrentState(initialLifecycleState);
applicationReleaseDTO = this.applicationReleaseDAO.createRelease(applicationReleaseDTO, appId, tenantId); applicationReleaseDTO = this.applicationReleaseDAO
.createRelease(applicationReleaseDTO, appId, tenantId);
LifecycleStateDTO lifecycleStateDTO = getLifecycleStateInstance(initialLifecycleState, LifecycleStateDTO lifecycleStateDTO = getLifecycleStateInstance(initialLifecycleState,
initialLifecycleState); initialLifecycleState);
this.lifecycleStateDAO this.lifecycleStateDAO
.addLifecycleState(lifecycleStateDTO, appId, applicationReleaseDTO.getUuid(), tenantId); .addLifecycleState(lifecycleStateDTO, appId, applicationReleaseDTO.getUuid(), tenantId);
applicationReleaseEntities.add(applicationReleaseDTO); applicationReleaseEntities.add(applicationReleaseDTO);
applicationDTO.setApplicationReleaseDTOs(applicationReleaseEntities); applicationDTO.setApplicationReleaseDTOs(applicationReleaseEntities);
application = appDtoToAppResponse(applicationDTO); Application application = appDtoToAppResponse(applicationDTO);
ConnectionManagerUtil.commitDBTransaction(); ConnectionManagerUtil.commitDBTransaction();
return application;
} }
return application;
} catch (LifeCycleManagementDAOException e) { } catch (LifeCycleManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction(); ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred while adding lifecycle state. application name: " + applicationWrapper.getName() String msg =
+ " application type: is " + applicationWrapper.getType(); "Error occurred while adding lifecycle state. application name: " + applicationWrapper.getName()
+ " application type: is " + applicationWrapper.getType();
log.error(msg); log.error(msg);
try {
applicationStorageManager.deleteAllApplicationReleaseArtifacts(
Collections.singletonList(applicationReleaseDTO.getAppHashValue()));
} catch (ApplicationStorageManagementException ex) {
String errorLog =
"Error occurred when deleting application artifacts. Application artifacts are tried to "
+ "delete because of lifecycle state adding issue in the application creating operation.";
log.error(errorLog);
throw new ApplicationManagementException(errorLog, e);
}
throw new ApplicationManagementException(msg, e); throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) { } catch (ApplicationManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction(); ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred while adding application or application release. application name: " String msg = "Error occurred while adding application or application release. application name: "
+ applicationWrapper.getName() + " application type: " + applicationWrapper.getType(); + applicationWrapper.getName() + " application type: " + applicationWrapper.getType();
log.error(msg); log.error(msg);
deleteApplicationArtifacts(Collections.singletonList(applicationReleaseDTO.getAppHashValue()));
throw new ApplicationManagementException(msg, e); throw new ApplicationManagementException(msg, e);
} catch(LifecycleManagementException e){ } catch (LifecycleManagementException e) {
ConnectionManagerUtil.rollbackDBTransaction(); ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred when getting initial lifecycle state. application name: " + applicationWrapper String msg = "Error occurred when getting initial lifecycle state. application name: " + applicationWrapper
.getName() + " application type: is " + applicationWrapper.getType(); .getName() + " application type: is " + applicationWrapper.getType();
log.error(msg); log.error(msg);
deleteApplicationArtifacts(Collections.singletonList(applicationReleaseDTO.getAppHashValue()));
throw new ApplicationManagementException(msg, e); throw new ApplicationManagementException(msg, e);
}catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Error occurred while getting database connection."; String msg = "Error occurred while getting database connection.";
log.error(msg); log.error(msg);
throw new ApplicationManagementException(msg, e); throw new ApplicationManagementException(msg, e);
} catch (VisibilityManagementDAOException e) { } catch (VisibilityManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction(); ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred while adding unrestricted roles. application name: " + applicationWrapper.getName() String msg =
+ " application type: " + applicationWrapper.getType(); "Error occurred while adding unrestricted roles. application name: " + applicationWrapper.getName()
+ " application type: " + applicationWrapper.getType();
log.error(msg); log.error(msg);
deleteApplicationArtifacts(Collections.singletonList(applicationReleaseDTO.getAppHashValue()));
throw new ApplicationManagementException(msg, e); throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) { } catch (TransactionManagementException e) {
String msg = "Error occurred while disabling AutoCommit."; String msg = "Error occurred while disabling AutoCommit.";
log.error(msg); log.error(msg);
throw new ApplicationManagementException(msg, e); throw new ApplicationManagementException(msg, e);
} catch (UserStoreException e) {
ConnectionManagerUtil.rollbackDBTransaction();
String msg = "Error occurred when validating the unrestricted roles given for the application";
log.error(msg);
throw new ApplicationManagementException(msg, e);
} finally { } finally {
ConnectionManagerUtil.closeDBConnection(); ConnectionManagerUtil.closeDBConnection();
} }
} }
private void deleteApplicationArtifacts(List<String> directoryPaths) throws ApplicationManagementException {
ApplicationStorageManager applicationStorageManager = Util.getApplicationStorageManager();
try {
applicationStorageManager.deleteAllApplicationReleaseArtifacts(directoryPaths);
} catch (ApplicationStorageManagementException e) {
String errorLog = "Error occurred when deleting application artifacts. directory paths: ." + directoryPaths
.toString();
log.error(errorLog);
throw new ApplicationManagementException(errorLog, e);
}
}
private ApplicationReleaseDTO addApplicationReleaseArtifacts(String applicationType, String deviceType, private ApplicationReleaseDTO addApplicationReleaseArtifacts(String applicationType, String deviceType,
ApplicationReleaseDTO applicationReleaseDTO, ApplicationArtifact applicationArtifact, boolean isNewRelease) ApplicationReleaseDTO applicationReleaseDTO, ApplicationArtifact applicationArtifact, boolean isNewRelease)
throws ResourceManagementException, ApplicationManagementException { throws ResourceManagementException, ApplicationManagementException {
@ -576,9 +627,6 @@ public class ApplicationManagerImpl implements ApplicationManager {
try { try {
//set default values //set default values
if (StringUtils.isEmpty(filter.getSortBy())) {
filter.setSortBy("ASC");
}
if (filter.getLimit() == 0) { if (filter.getLimit() == 0) {
filter.setLimit(20); filter.setLimit(20);
} }
@ -586,16 +634,15 @@ public class ApplicationManagerImpl implements ApplicationManager {
if (!StringUtils.isEmpty(deviceTypename)) { if (!StringUtils.isEmpty(deviceTypename)) {
deviceType = getDeviceTypeData(deviceTypename); deviceType = getDeviceTypeData(deviceTypename);
} }
ConnectionManagerUtil.openDBConnection();
validateFilter(filter);
if (deviceType == null) { if (deviceType == null) {
appDTOs = applicationDAO.getApplications(filter, 0, tenantId); deviceType = new DeviceType();
} else { deviceType.setId(-1);
appDTOs = applicationDAO.getApplications(filter, deviceType.getId(), tenantId);
} }
ConnectionManagerUtil.openDBConnection();
validateFilter(filter);
appDTOs = applicationDAO.getApplications(filter, deviceType.getId(), tenantId);
//todo as a performance improvement get these data from DB. Consider where in clause.
for (ApplicationDTO app : appDTOs) { for (ApplicationDTO app : appDTOs) {
boolean isSearchingApp = true; boolean isSearchingApp = true;
List<String> filteringTags = filter.getTags(); List<String> filteringTags = filter.getTags();
@ -905,6 +952,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
} }
private String[] getRoleNames() throws UserStoreException { private String[] getRoleNames() throws UserStoreException {
//todo check role by role
UserRealm userRealm = CarbonContext.getThreadLocalCarbonContext().getUserRealm(); UserRealm userRealm = CarbonContext.getThreadLocalCarbonContext().getUserRealm();
if (userRealm != null) { if (userRealm != null) {
return userRealm.getUserStoreManager().getRoleNames(); return userRealm.getUserStoreManager().getRoleNames();

@ -407,6 +407,7 @@ public interface ApplicationManagementPublisherAPI {
code = 404, code = 404,
message = "Application not found"), message = "Application not found"),
}) })
//todo add new scope and permission
Response deleteApplication( Response deleteApplication(
@ApiParam( @ApiParam(
name = "UUID", name = "UUID",

@ -84,7 +84,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
} }
return Response.status(Response.Status.OK).entity(applications).build(); return Response.status(Response.Status.OK).entity(applications).build();
} catch(BadRequestException e){ } catch(BadRequestException e){
String msg = "Incompatible request payload is found. Please try with valid reuest payload."; String msg = "Incompatible request payload is found. Please try with valid request payload.";
log.error(msg, e); log.error(msg, e);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
}catch (ApplicationManagementException e) { }catch (ApplicationManagementException e) {
@ -161,7 +161,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
if (application != null) { if (application != null) {
return Response.status(Response.Status.CREATED).entity(application).build(); return Response.status(Response.Status.CREATED).entity(application).build();
} else { } else {
String msg = "ApplicationDTO creation is failed"; String msg = "Application creation is failed";
log.error(msg); log.error(msg);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} }
@ -285,9 +285,6 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
@Multipart("binaryFile") Attachment binaryFile) { @Multipart("binaryFile") Attachment binaryFile) {
try { try {
ApplicationManager applicationManager = APIUtil.getApplicationManager();
applicationManager.validateBinaryArtifact(binaryFile, appType);
if (!ApplicationType.ENTERPRISE.toString().equals(appType)) { if (!ApplicationType.ENTERPRISE.toString().equals(appType)) {
String msg = "If ApplicationDTO type is " + appType String msg = "If ApplicationDTO type is " + appType
+ ", therefore you don't have application release artifact to update for application release UUID: " + ", therefore you don't have application release artifact to update for application release UUID: "
@ -295,7 +292,8 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
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();
} }
ApplicationManager applicationManager = APIUtil.getApplicationManager();
applicationManager.validateBinaryArtifact(binaryFile, appType);
applicationManager.updateApplicationArtifact(deviceType, appType, applicationReleaseUuid, applicationManager.updateApplicationArtifact(deviceType, appType, applicationReleaseUuid,
constructApplicationArtifact(binaryFile, null, null, null)); constructApplicationArtifact(binaryFile, null, null, null));
return Response.status(Response.Status.OK) return Response.status(Response.Status.OK)
@ -371,9 +369,10 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
applicationManager.validateImageArtifacts(iconFile, bannerFile, screenshots); applicationManager.validateImageArtifacts(iconFile, bannerFile, screenshots);
if (!applicationManager.updateRelease(deviceType, appType, applicationUUID, applicationReleaseWrapper, if (!applicationManager.updateRelease(deviceType, appType, applicationUUID, applicationReleaseWrapper,
constructApplicationArtifact(binaryFile, iconFile, bannerFile, screenshots))) { constructApplicationArtifact(binaryFile, iconFile, bannerFile, screenshots))) {
log.error("Application release updating is failed. Please contact the administrator. " String msg ="Application release updating is failed. Please contact the administrator. "
+ "ApplicationDTO release UUID: " + applicationUUID + ", Supported device type: " + deviceType); + "ApplicationDTO release UUID: " + applicationUUID + ", Supported device type: " + deviceType;
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(applicationReleaseWrapper).build(); log.error(msg);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} }
return Response.status(Response.Status.OK).entity("Application release is successfully updated.").build(); return Response.status(Response.Status.OK).entity("Application release is successfully updated.").build();
} catch (BadRequestException e) { } catch (BadRequestException e) {
@ -402,9 +401,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
} }
} }
/*
//todo ----------------------
*/
@DELETE @DELETE
@Path("/{appId}") @Path("/{appId}")
public Response deleteApplication(@PathParam("appId") int applicationId) { public Response deleteApplication(@PathParam("appId") int applicationId) {
@ -429,6 +426,10 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
} }
} }
/*
//todo ----------------------
*/
@GET @GET
@Path("/lifecycle/{appId}/{uuid}") @Path("/lifecycle/{appId}/{uuid}")
public Response getLifecycleState( public Response getLifecycleState(

Loading…
Cancel
Save