|
|
@ -82,7 +82,6 @@ import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.core.common.exception.StorageManagementException;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.core.common.exception.StorageManagementException;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService;
|
|
|
|
import io.entgra.device.mgt.core.tenant.mgt.common.exception.TenantMgtException;
|
|
|
|
|
|
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
|
import org.apache.commons.lang.StringEscapeUtils;
|
|
|
|
import org.apache.commons.lang.StringEscapeUtils;
|
|
|
@ -4439,13 +4438,9 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void deleteApplicationDataByTenantDomain(String tenantDomain) throws ApplicationManagementException {
|
|
|
|
public void deleteApplicationDataByTenantId(int tenantId) throws ApplicationManagementException {
|
|
|
|
int tenantId;
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
tenantId = DataHolder.getInstance().getTenantManagerAdminService().getTenantId(tenantDomain);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ConnectionManagerUtil.beginDBTransaction();
|
|
|
|
ConnectionManagerUtil.beginDBTransaction();
|
|
|
|
|
|
|
|
|
|
|
|
vppApplicationDAO.deleteAssociationByTenant(tenantId);
|
|
|
|
vppApplicationDAO.deleteAssociationByTenant(tenantId);
|
|
|
|
vppApplicationDAO.deleteVppUserByTenant(tenantId);
|
|
|
|
vppApplicationDAO.deleteVppUserByTenant(tenantId);
|
|
|
|
vppApplicationDAO.deleteAssetsByTenant(tenantId);
|
|
|
|
vppApplicationDAO.deleteAssetsByTenant(tenantId);
|
|
|
@ -4471,48 +4466,36 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|
|
|
ConnectionManagerUtil.commitDBTransaction();
|
|
|
|
ConnectionManagerUtil.commitDBTransaction();
|
|
|
|
} catch (DBConnectionException e) {
|
|
|
|
} catch (DBConnectionException e) {
|
|
|
|
String msg = "Error occurred while observing the database connection to delete applications for tenant with " +
|
|
|
|
String msg = "Error occurred while observing the database connection to delete applications for tenant with " +
|
|
|
|
"domain: " + tenantDomain;
|
|
|
|
"tenant ID: " + tenantId;
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
throw new ApplicationManagementException(msg, e);
|
|
|
|
throw new ApplicationManagementException(msg, e);
|
|
|
|
} catch (ApplicationManagementDAOException e) {
|
|
|
|
} catch (ApplicationManagementDAOException e) {
|
|
|
|
ConnectionManagerUtil.rollbackDBTransaction();
|
|
|
|
ConnectionManagerUtil.rollbackDBTransaction();
|
|
|
|
String msg = "Database access error is occurred when getting applications for tenant with domain: "
|
|
|
|
String msg = "Database access error is occurred when getting applications for tenant with tenant Id: "
|
|
|
|
+ tenantDomain;
|
|
|
|
+ tenantId;
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
throw new ApplicationManagementException(msg, e);
|
|
|
|
throw new ApplicationManagementException(msg, e);
|
|
|
|
} catch (LifeCycleManagementDAOException e) {
|
|
|
|
} catch (LifeCycleManagementDAOException e) {
|
|
|
|
ConnectionManagerUtil.rollbackDBTransaction();
|
|
|
|
ConnectionManagerUtil.rollbackDBTransaction();
|
|
|
|
String msg = "Error occurred while deleting life-cycle state data of application releases of the tenant"
|
|
|
|
String msg = "Error occurred while deleting life-cycle state data of application releases of the tenant"
|
|
|
|
+ " of domain: " + tenantDomain ;
|
|
|
|
+ " of id: " + tenantId ;
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
throw new ApplicationManagementException(msg, e);
|
|
|
|
throw new ApplicationManagementException(msg, e);
|
|
|
|
} catch (ReviewManagementDAOException e) {
|
|
|
|
} catch (ReviewManagementDAOException e) {
|
|
|
|
ConnectionManagerUtil.rollbackDBTransaction();
|
|
|
|
ConnectionManagerUtil.rollbackDBTransaction();
|
|
|
|
String msg = "Error occurred while deleting reviews of application releases of the applications"
|
|
|
|
String msg = "Error occurred while deleting reviews of application releases of the applications"
|
|
|
|
+ " of tenant of domain: " + tenantDomain ;
|
|
|
|
+ " of tenant of id: " + tenantId ;
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
throw new ApplicationManagementException(msg, e);
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
String msg = "Error getting tenant ID from domain: "
|
|
|
|
|
|
|
|
+ tenantDomain;
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
throw new ApplicationManagementException(msg, e);
|
|
|
|
throw new ApplicationManagementException(msg, e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void deleteApplicationArtifactsByTenantDomain(String tenantDomain) throws ApplicationManagementException {
|
|
|
|
public void deleteApplicationArtifactsByTenantId(int tenantId) throws ApplicationManagementException {
|
|
|
|
int tenantId;
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
tenantId = DataHolder.getInstance().getTenantManagerAdminService().getTenantId(tenantDomain);
|
|
|
|
|
|
|
|
DataHolder.getInstance().getApplicationStorageManager().deleteAppFolderOfTenant(tenantId);
|
|
|
|
DataHolder.getInstance().getApplicationStorageManager().deleteAppFolderOfTenant(tenantId);
|
|
|
|
} catch (ApplicationStorageManagementException e) {
|
|
|
|
} catch (ApplicationStorageManagementException e) {
|
|
|
|
String msg = "Error deleting app artifacts of tenant of domain: " + tenantDomain ;
|
|
|
|
String msg = "Error deleting app artifacts of tenant of Id: " + tenantId;
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
throw new ApplicationManagementException(msg, e);
|
|
|
|
|
|
|
|
} catch (TenantMgtException e) {
|
|
|
|
|
|
|
|
String msg = "Error getting tenant ID from domain: "
|
|
|
|
|
|
|
|
+ tenantDomain + " when trying to delete application artifacts of tenant";
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
throw new ApplicationManagementException(msg, e);
|
|
|
|
throw new ApplicationManagementException(msg, e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|