mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
add getLifecycleState check
This commit is contained in:
parent
853d095706
commit
d9d0d0a5b8
@ -46,6 +46,7 @@ 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.ApplicationManagementDAOFactory;
|
||||||
import org.wso2.carbon.device.application.mgt.core.dao.common.Util;
|
import org.wso2.carbon.device.application.mgt.core.dao.common.Util;
|
||||||
import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException;
|
import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException;
|
||||||
|
import org.wso2.carbon.device.application.mgt.core.exception.ForbiddenException;
|
||||||
import org.wso2.carbon.device.application.mgt.core.exception.LifeCycleManagementDAOException;
|
import org.wso2.carbon.device.application.mgt.core.exception.LifeCycleManagementDAOException;
|
||||||
import org.wso2.carbon.device.application.mgt.core.exception.NotFoundException;
|
import org.wso2.carbon.device.application.mgt.core.exception.NotFoundException;
|
||||||
import org.wso2.carbon.device.application.mgt.core.exception.ValidationException;
|
import org.wso2.carbon.device.application.mgt.core.exception.ValidationException;
|
||||||
@ -733,6 +734,13 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
|||||||
if (applicationRelease == null) {
|
if (applicationRelease == null) {
|
||||||
throw new NotFoundException("No App release associated with the app Id " + appId + "and UUID "+ uuid);
|
throw new NotFoundException("No App release associated with the app Id " + appId + "and UUID "+ uuid);
|
||||||
}
|
}
|
||||||
|
LifecycleState lifecycleState = getLifecycleState(appId, applicationRelease.getUuid());
|
||||||
|
if (AppLifecycleState.PUBLISHED.toString().equals(lifecycleState.getCurrentState()) ||
|
||||||
|
AppLifecycleState.DEPRECATED.toString().equals(lifecycleState.getCurrentState())) {
|
||||||
|
throw new ForbiddenException("Can't Update the application release in " +
|
||||||
|
"PUBLISHED or DEPRECATED state. Hence please demote the application and update " +
|
||||||
|
"the application release");
|
||||||
|
}
|
||||||
ApplicationRelease updatedRelease = applicationStorageManager
|
ApplicationRelease updatedRelease = applicationStorageManager
|
||||||
.updateImageArtifacts(applicationRelease, iconFileStream, bannerFileStream, attachments);
|
.updateImageArtifacts(applicationRelease, iconFileStream, bannerFileStream, attachments);
|
||||||
return updateRelease(appId, updatedRelease);
|
return updateRelease(appId, updatedRelease);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user