From f714feb239e85a4e3634e11b1c63138e0cfadeec Mon Sep 17 00:00:00 2001 From: Gathika94 Date: Mon, 1 Apr 2019 08:32:28 +0530 Subject: [PATCH] add new methods to check whether the app is updatable or installable in a given state --- .../mgt/common/ApplicationRelease.java | 3 ++- .../core/lifecycle/LifecycleStateManger.java | 23 +++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java index a2113daf165..6023694164c 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java @@ -21,7 +21,8 @@ package org.wso2.carbon.device.application.mgt.common; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -@ApiModel(value = "ApplicationRelease", description = "This class holds the details when releasing an Application to application store") +@ApiModel(value = "ApplicationRelease", description = "This class holds the details when releasing an Application to " + + "application store") public class ApplicationRelease { @ApiModelProperty(name = "id", diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/lifecycle/LifecycleStateManger.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/lifecycle/LifecycleStateManger.java index 6dd29f5ea3e..9ee8744cac4 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/lifecycle/LifecycleStateManger.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/lifecycle/LifecycleStateManger.java @@ -16,15 +16,14 @@ * under the License. */ -/* - * Copyright (c) 2019, Entgra Inc. (http://www.entgra.io) All Rights Reserved. +/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. * - * Entgra Inc. licenses this file to you under the Apache License, + * 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 + * 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 @@ -153,4 +152,20 @@ public class LifecycleStateManger { } return null; } + + public boolean isUpdatable(String state){ + State currentState = getMatchingState(state); + if(currentState.getIsAppUpdatable()){ + return true; + } + return false; + } + + public boolean isInstallable(String state){ + State currentState = getMatchingState(state); + if(currentState.getIsAppInstallable()){ + return true; + } + return false; + } }