Add application release deleting API

feature/appm-store/pbac
lasanthaDLPDS 5 years ago
parent 3a5cf16c26
commit f95f872732

@ -0,0 +1,68 @@
/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.application.mgt.common.dto;
import java.sql.Timestamp;
public class DeviceSubscriptionDTO {
private int id;
private String subscribedBy;
private Timestamp subscribedTimestamp;
private boolean isUnsubscribed;
private String unsubscribedBy;
private Timestamp unsubscribedTimestapm;
private String subscribedFrom;
private int deviceId;
public int getId() { return id; }
public void setId(int id) { this.id = id; }
public String getSubscribedBy() { return subscribedBy; }
public void setSubscribedBy(String subscribedBy) { this.subscribedBy = subscribedBy; }
public Timestamp getSubscribedTimestamp() { return subscribedTimestamp; }
public void setSubscribedTimestamp(Timestamp subscribedTimestamp) {
this.subscribedTimestamp = subscribedTimestamp;
}
public boolean isUnsubscribed() { return isUnsubscribed; }
public void setUnsubscribed(boolean unsubscribed) { isUnsubscribed = unsubscribed; }
public String getUnsubscribedBy() { return unsubscribedBy; }
public void setUnsubscribedBy(String unsubscribedBy) { this.unsubscribedBy = unsubscribedBy; }
public Timestamp getUnsubscribedTimestapm() { return unsubscribedTimestapm; }
public void setUnsubscribedTimestapm(Timestamp unsubscribedTimestapm) {
this.unsubscribedTimestapm = unsubscribedTimestapm;
}
public String getSubscribedFrom() { return subscribedFrom; }
public void setSubscribedFrom(String subscribedFrom) { this.subscribedFrom = subscribedFrom; }
public int getDeviceId() { return deviceId; }
public void setDeviceId(int deviceId) { this.deviceId = deviceId; }
}

@ -76,7 +76,7 @@ public interface ApplicationManager {
* @param releaseUuid UUID of tha application release
* @throws ApplicationManagementException ApplicationDTO Management Exception
*/
String deleteApplicationRelease(int applicationId, String releaseUuid) throws ApplicationManagementException;
void deleteApplicationRelease(int applicationId, String releaseUuid) throws ApplicationManagementException;
/**
* To get the applications based on the search filter.

@ -20,6 +20,7 @@ package org.wso2.carbon.device.application.mgt.core.dao;
import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
import org.wso2.carbon.device.application.mgt.common.dto.ApplicationReleaseDTO;
import org.wso2.carbon.device.application.mgt.common.dto.DeviceSubscriptionDTO;
import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup;
@ -86,4 +87,8 @@ public interface SubscriptionDAO {
*/
void subscribeGroupToApplication(int tenantId, String subscribedBy, List<DeviceGroup> groupList, int appId,
int releaseId) throws ApplicationManagementDAOException;
public List<DeviceSubscriptionDTO> getDeviceSubscriptions(int appReleaseId, int tenantId) throws
ApplicationManagementDAOException;
}

@ -26,6 +26,7 @@ import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
import org.wso2.carbon.device.application.mgt.common.PaginationRequest;
import org.wso2.carbon.device.application.mgt.common.dto.ApplicationReleaseDTO;
import org.wso2.carbon.device.application.mgt.common.dto.DeviceSubscriptionDTO;
import org.wso2.carbon.device.application.mgt.common.exception.ReviewManagementException;
import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager;
import org.wso2.carbon.device.application.mgt.common.services.ApplicationStorageManager;
@ -94,6 +95,31 @@ public class Util {
return applications;
}
/**
* To create list of device subscription objects from the result set retrieved from the Database.
*
* @param rs ResultSet
* @return List of device subscriptions that is retrieved from the Database.
* @throws SQLException SQL Exception
* @throws JSONException JSONException.
*/
public static List<DeviceSubscriptionDTO> loadDeviceSubscriptions(ResultSet rs) throws SQLException {
List<DeviceSubscriptionDTO> deviceSubscriptionDTOS = new ArrayList<>();
while (rs.next()) {
DeviceSubscriptionDTO deviceSubscriptionDTO = new DeviceSubscriptionDTO();
deviceSubscriptionDTO.setId(rs.getInt("ID"));
deviceSubscriptionDTO.setSubscribedBy(rs.getString("SUBSCRIBED_BY"));
deviceSubscriptionDTO.setSubscribedTimestamp(rs.getTimestamp("SUBSCRIBED_AT"));
deviceSubscriptionDTO.setUnsubscribed(rs.getBoolean("IS_UNSUBSCRIBED"));
deviceSubscriptionDTO.setUnsubscribedBy(rs.getString("UNSUBSCRIBED_BY"));
deviceSubscriptionDTO.setUnsubscribedTimestapm(rs.getTimestamp("UNSUBSCRIBED_AT"));
deviceSubscriptionDTO.setSubscribedFrom(rs.getString("SUBSCRIBED_FROM"));
deviceSubscriptionDTO.setDeviceId(rs.getInt("DEVICE_ID"));
deviceSubscriptionDTOS.add(deviceSubscriptionDTO);
}
return deviceSubscriptionDTOS;
}
/**
* Populates {@link ApplicationReleaseDTO} object with the result obtained from the database.
*

@ -19,16 +19,21 @@ package org.wso2.carbon.device.application.mgt.core.dao.impl.subscription;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.json.JSONException;
import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
import org.wso2.carbon.device.application.mgt.common.dto.DeviceSubscriptionDTO;
import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException;
import org.wso2.carbon.device.application.mgt.core.dao.SubscriptionDAO;
import org.wso2.carbon.device.application.mgt.core.dao.common.Util;
import org.wso2.carbon.device.application.mgt.core.dao.impl.AbstractDAOImpl;
import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException;
import org.wso2.carbon.device.application.mgt.core.exception.UnexpectedServerErrorException;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
@ -44,7 +49,7 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
conn = this.getDBConnection();
long time = System.currentTimeMillis() / 1000;
String sql = "INSERT INTO AP_DEVICE_SUBSCRIPTION(TENANT_ID, SUBSCRIBED_BY, SUBSCRIBED_TIMESTAMP, "
+ "DM_DEVICE_ID, AP_APP_RELEASE_ID, AP_APP_ID, INSTALL_STATUS) VALUES (?, ?, ?, ?, ?, ?)";
+ "DM_DEVICE_ID, AP_APP_RELEASE_ID, AP_APP_ID, INSTALL_STATUS) VALUES (?, ?, ?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(sql);
for (Device device : deviceList) {
stmt.setInt(1, tenantId);
@ -168,4 +173,50 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
Util.cleanupResources(stmt, null);
}
}
@Override
public List<DeviceSubscriptionDTO> getDeviceSubscriptions(int appReleaseId, int tenantId) throws
ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Getting device subscriptions for the application release id " + appReleaseId
+ " from the database");
}
Connection conn;
try {
conn = this.getDBConnection();
String sql = "SELECT "
+ "DS.ID AS ID, "
+ "DS.SUBSCRIBED_BY AS SUBSCRIBED_BY, "
+ "DS.SUBSCRIBED_TIMESTAMP AS SUBSCRIBED_AT, "
+ "DS.UNSUBSCRIBED AS IS_UNSUBSCRIBED, "
+ "DS.UNSUBSCRIBED_BY AS UNSUBSCRIBED_BY, "
+ "DS.UNSUBSCRIBED_TIMESTAMP AS UNSUBSCRIBED_AT, "
+ "DS.SUBSCRIBED_FROM AS SUBSCRIBED_FROM, "
+ "DS.DM_DEVICE_ID AS DEVICE_ID "
+ "FROM AP_DEVICE_SUBSCRIPTION DS "
+ "WHERE DS.AP_APP_RELEASE_ID = ? AND DS.TENANT_ID=?";
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setInt(1, appReleaseId);
stmt.setInt(2, tenantId);
try (ResultSet rs = stmt.executeQuery()) {
if (log.isDebugEnabled()) {
log.debug("Successfully retrieved device subscriptions for application release id "
+ appReleaseId);
}
return Util.loadDeviceSubscriptions(rs);
}
}
} catch (SQLException e) {
String msg =
"Error occurred while getting device subscription data for application ID: " + appReleaseId + ".";
log.error(msg);
throw new ApplicationManagementDAOException(msg, e);
} catch (DBConnectionException e) {
String msg =
"Error occurred while obtaining the DB connection for getting device subscription for applicationID: "
+ appReleaseId + ".";
log.error(msg);
throw new ApplicationManagementDAOException(msg, e);
}
}
}

@ -39,6 +39,7 @@ import org.wso2.carbon.device.application.mgt.common.ApplicationSubscriptionType
import org.wso2.carbon.device.application.mgt.common.ApplicationType;
import org.wso2.carbon.device.application.mgt.common.dto.CategoryDTO;
import org.wso2.carbon.device.application.mgt.common.Filter;
import org.wso2.carbon.device.application.mgt.common.dto.DeviceSubscriptionDTO;
import org.wso2.carbon.device.application.mgt.common.dto.LifecycleStateDTO;
import org.wso2.carbon.device.application.mgt.common.dto.TagDTO;
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException;
@ -59,6 +60,7 @@ import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager;
import org.wso2.carbon.device.application.mgt.core.dao.ApplicationDAO;
import org.wso2.carbon.device.application.mgt.core.dao.ApplicationReleaseDAO;
import org.wso2.carbon.device.application.mgt.core.dao.LifecycleStateDAO;
import org.wso2.carbon.device.application.mgt.core.dao.SubscriptionDAO;
import org.wso2.carbon.device.application.mgt.core.dao.VisibilityDAO;
import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOFactory;
import org.wso2.carbon.device.application.mgt.core.dao.common.Util;
@ -109,6 +111,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
private ApplicationDAO applicationDAO;
private ApplicationReleaseDAO applicationReleaseDAO;
private LifecycleStateDAO lifecycleStateDAO;
private SubscriptionDAO subscriptionDAO;
private LifecycleStateManager lifecycleStateManager;
public ApplicationManagerImpl() {
@ -121,6 +124,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
this.applicationDAO = ApplicationManagementDAOFactory.getApplicationDAO();
this.lifecycleStateDAO = ApplicationManagementDAOFactory.getLifecycleStateDAO();
this.applicationReleaseDAO = ApplicationManagementDAOFactory.getApplicationReleaseDAO();
this.subscriptionDAO = ApplicationManagementDAOFactory.getSubscriptionDAO();
}
/***
@ -1230,86 +1234,91 @@ public class ApplicationManagerImpl implements ApplicationManager {
}
@Override
public String deleteApplicationRelease(int applicationId, String releaseUuid)
public void deleteApplicationRelease(int applicationId, String releaseUuid)
throws ApplicationManagementException {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
ApplicationDTO application;
ApplicationStorageManager applicationStorageManager = Util.getApplicationStorageManager();
try {
ConnectionManagerUtil.beginDBTransaction();
application = this.applicationDAO.getApplicationById(applicationId, tenantId);
if (application == null) {
throw new NotFoundException("Couldn't find an application for application ID: " + applicationId);
ApplicationReleaseDTO applicationReleaseDTO = this.applicationReleaseDAO
.getReleaseByUUID(releaseUuid, tenantId);
if (applicationReleaseDTO == null) {
String msg = "Couldn't find an application release for application release UUID: " + releaseUuid;
log.error(msg);
throw new NotFoundException(msg);
}
if (!isAdminUser(userName, tenantId, CarbonConstants.UI_ADMIN_PERMISSION_COLLECTION) && !application
.getUnrestrictedRoles().isEmpty() && hasUserRole(application.getUnrestrictedRoles(), userName)) {
throw new ForbiddenException(
"You don't have permission for deleting application release. ApplicationDTO id: " + applicationId
+ " and release UUID: " + releaseUuid);
}
ApplicationReleaseDTO applicationRelease = this.applicationReleaseDAO
.getReleaseByIds(applicationId, releaseUuid, tenantId);
if (applicationRelease == null) {
throw new NotFoundException("Couldn't find an application release for application ID: " + applicationId
+ " and release UUID: " + releaseUuid);
}
LifecycleStateDTO appLifecycleState = this.lifecycleStateDAO
.getLatestLifeCycleState(applicationId, releaseUuid);
if (appLifecycleState == null) {
throw new NotFoundException(
"Couldn't find an lifecycle sate for application ID: " + applicationId + " and UUID: "
+ releaseUuid);
}
String currentState = appLifecycleState.getCurrentState();
if (AppLifecycleState.DEPRECATED.toString().equals(currentState) || AppLifecycleState.REJECTED.toString()
.equals(currentState) || AppLifecycleState.UNPUBLISHED.toString().equals(currentState)) {
LifecycleStateDTO newAppLifecycleState = getLifecycleStateInstance(AppLifecycleState.REMOVED.toString(),
appLifecycleState.getCurrentState());
if (lifecycleStateManager.isValidStateChange(newAppLifecycleState.getPreviousState(),
newAppLifecycleState.getCurrentState(), userName, tenantId)) {
this.lifecycleStateDAO
.addLifecycleState(newAppLifecycleState, applicationId, applicationRelease.getUuid(),
tenantId);
ConnectionManagerUtil.commitDBTransaction();
} else {
List<String> lifecycleFlow = searchLifecycleStateFlow(currentState,
AppLifecycleState.REMOVED.toString());
for (String nextState : lifecycleFlow) {
LifecycleStateDTO lifecycleState = getLifecycleStateInstance(nextState, currentState);
if (lifecycleStateManager.isValidStateChange(currentState, nextState, userName, tenantId)) {
this.lifecycleStateDAO
.addLifecycleState(lifecycleState, applicationId, applicationRelease.getUuid(),
tenantId);
} else {
ConnectionManagerUtil.rollbackDBTransaction();
throw new ApplicationManagementException(
"Can't delete the application release, You have to move the "
+ "lifecycle state from " + currentState + " to " + nextState);
}
currentState = nextState;
}
if (!applicationReleaseDTO.getCurrentState().equals(lifecycleStateManager.getInitialState())) {
String msg = "Application state is not in the initial state: " + lifecycleStateManager.getInitialState()
+ ". Therefore you are not permitted to delete the application release.";
log.error(msg);
throw new ForbiddenException(msg);
}
List<DeviceSubscriptionDTO> deviceSubscriptionDTOS = subscriptionDAO
.getDeviceSubscriptions(applicationReleaseDTO.getId(), tenantId);
for (DeviceSubscriptionDTO deviceSubscriptionDTO : deviceSubscriptionDTOS) {
if (!deviceSubscriptionDTO.isUnsubscribed()) {
String msg = "This application is subscribed to device/s. Therefore you are not permitted to delete "
+ "the application release.";
log.error(msg);
throw new ForbiddenException(msg);
}
} else {
throw new ApplicationManagementException(
"Can't delete the application release, You have to move the " + "lifecycle state from "
+ currentState + " to acceptable " + "state");
}
return applicationRelease.getAppHashValue();
//todo delete application release data ON delete cascade
applicationStorageManager.deleteApplicationReleaseArtifacts(applicationReleaseDTO.getAppHashValue());
// LifecycleStateDTO appLifecycleState = this.lifecycleStateDAO
// .getLatestLifeCycleState(applicationId, releaseUuid);
// if (appLifecycleState == null) {
// throw new NotFoundException(
// "Couldn't find an lifecycle sate for application ID: " + applicationId + " and UUID: "
// + releaseUuid);
// }
// String currentState = appLifecycleState.getCurrentState();
// if (AppLifecycleState.DEPRECATED.toString().equals(currentState) || AppLifecycleState.REJECTED.toString()
// .equals(currentState) || AppLifecycleState.UNPUBLISHED.toString().equals(currentState)) {
// LifecycleStateDTO newAppLifecycleState = getLifecycleStateInstance(AppLifecycleState.REMOVED.toString(),
// appLifecycleState.getCurrentState());
// if (lifecycleStateManager.isValidStateChange(newAppLifecycleState.getPreviousState(),
// newAppLifecycleState.getCurrentState(), userName, tenantId)) {
// this.lifecycleStateDAO
// .addLifecycleState(newAppLifecycleState, applicationId, applicationRelease.getUuid(),
// tenantId);
// ConnectionManagerUtil.commitDBTransaction();
// } else {
// List<String> lifecycleFlow = searchLifecycleStateFlow(currentState,
// AppLifecycleState.REMOVED.toString());
// for (String nextState : lifecycleFlow) {
// LifecycleStateDTO lifecycleState = getLifecycleStateInstance(nextState, currentState);
// if (lifecycleStateManager.isValidStateChange(currentState, nextState, userName, tenantId)) {
// this.lifecycleStateDAO
// .addLifecycleState(lifecycleState, applicationId, applicationRelease.getUuid(),
// tenantId);
// } else {
// ConnectionManagerUtil.rollbackDBTransaction();
// throw new ApplicationManagementException(
// "Can't delete the application release, You have to move the "
// + "lifecycle state from " + currentState + " to " + nextState);
// }
// currentState = nextState;
// }
// }
// } else {
// throw new ApplicationManagementException(
// "Can't delete the application release, You have to move the " + "lifecycle state from "
// + currentState + " to acceptable " + "state");
// }
// return applicationReleaseDTO.getAppHashValue();
} catch (ApplicationManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
throw new ApplicationManagementDAOException(
"Error ocured when getting application data or application release data for application id of "
+ applicationId + " application release UUID of the " + releaseUuid);
} catch (LifeCycleManagementDAOException e) {
String msg = "Error ocured when getting application data or application release data for application id of "
+ applicationId + " application release UUID of the " + releaseUuid;
throw new ApplicationManagementDAOException(msg, e);
} catch (ApplicationStorageManagementException e) {
ConnectionManagerUtil.rollbackDBTransaction();
throw new ApplicationManagementException(
"Error occured when deleting application release for application ID of " + applicationId
+ " and application release UUID of " + releaseUuid, e);
} catch (UserStoreException e) {
throw new ApplicationManagementException(
"Error occured when checking permission for executing application release update. ApplicationDTO ID: "
+ applicationId + " and ApplicationDTO UUID: " + releaseUuid);
String msg = "Error occured when deleteing the application release artifact from the file system. Application release UUID: " + releaseUuid;
log.error(msg);
throw new ApplicationManagementException(msg, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
}

@ -28,33 +28,18 @@ import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Info;
import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Tag;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.device.application.mgt.common.ApplicationList;
import org.wso2.carbon.device.application.mgt.common.ErrorResponse;
import org.wso2.carbon.device.application.mgt.common.Filter;
import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
import org.wso2.carbon.device.application.mgt.common.dto.ApplicationReleaseDTO;
import org.wso2.carbon.device.application.mgt.common.response.ApplicationRelease;
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 javax.validation.Valid;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.List;
/**
* APIs to handle application management related tasks.
@ -92,19 +77,19 @@ public interface ApplicationManagementPublisherAdminAPI {
String SCOPE = "scope";
@DELETE
@Path("/{appid}/{uuid}")
@Path("/release/{appId}/{uuid}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@ApiOperation(
consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "get all applications",
notes = "This will get all applications",
tags = "ApplicationDTO Management",
httpMethod = "DELETE",
value = "Delete application release.",
notes = "This will delete application release for given UUID",
tags = "Application Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:app:publisher:view")
@ExtensionProperty(name = SCOPE, value = "perm:admin:app:publisher:update")
})
}
)
@ -112,11 +97,11 @@ public interface ApplicationManagementPublisherAdminAPI {
value = {
@ApiResponse(
code = 200,
message = "OK. \n Successfully delete application releaset.",
message = "OK. \n Successfully delete application release.",
response = ApplicationList.class),
@ApiResponse(
code = 404,
message = "Not Found. There doesn't have an application release with UUID" +
message = "Not Found. There doesn't have an application release for UUID" +
"query."),
@ApiResponse(
code = 500,
@ -127,7 +112,7 @@ public interface ApplicationManagementPublisherAdminAPI {
name = "appId",
value = "application Id",
required = true)
@PathParam("appid") int applicationId,
@PathParam("appId") int applicationId,
@ApiParam(
name = "uuid",
value = "application release UUID",

@ -74,16 +74,14 @@ public class ApplicationManagementPublisherAdminAPIImpl implements ApplicationMa
private static Log log = LogFactory.getLog(ApplicationManagementPublisherAdminAPIImpl.class);
@DELETE
@Path("/{appid}/{uuid}")
@Path("/release/{appId}/{uuid}")
public Response deleteApplicationRelease(
@PathParam("appid") int applicationId,
@PathParam("appId") int applicationId,
@PathParam("uuid") String releaseUuid) {
ApplicationManager applicationManager = APIUtil.getApplicationManager();
ApplicationStorageManager applicationStorageManager = APIUtil.getApplicationStorageManager();
try {
String storedLocation = applicationManager.deleteApplicationRelease(applicationId, releaseUuid);
applicationStorageManager.deleteApplicationReleaseArtifacts(storedLocation);
String responseMsg = "Successfully deleted the application release of: " + applicationId + "";
applicationManager.deleteApplicationRelease(applicationId, releaseUuid);
String responseMsg = "Successfully deleted the application release for uuid: " + releaseUuid + "";
return Response.status(Response.Status.OK).entity(responseMsg).build();
} catch (NotFoundException e) {
String msg = "Couldn't found application release which is having application id: " + applicationId
@ -100,10 +98,6 @@ public class ApplicationManagementPublisherAdminAPIImpl implements ApplicationMa
String msg = "Error occurred while deleting the application: " + applicationId;
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (ApplicationStorageManagementException e) {
String msg = "Error occurred while deleting the application storage: " + applicationId;
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
}
}

Loading…
Cancel
Save