forked from community/device-mgt-core
Merge branch 'application-mgt-new' of https://gitlab.com/tcdlpds/carbon-device-mgt into application-mgt-new
commit
e1589575e9
7
components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/lifecycle/config/LifecycleState.java → components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/config/LifecycleState.java
7
components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/lifecycle/config/LifecycleState.java → components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/config/LifecycleState.java
@ -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; }
|
||||||
|
}
|
@ -1,51 +0,0 @@
|
|||||||
package org.wso2.carbon.device.application.mgt.core.lifecycle;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class represents the state of the lifecycle
|
|
||||||
*/
|
|
||||||
public class State {
|
|
||||||
|
|
||||||
private Set<String> proceedingStates;
|
|
||||||
private String stateName;
|
|
||||||
private String permission;
|
|
||||||
private boolean isAppUpdatable;
|
|
||||||
private boolean isAppInstallable;
|
|
||||||
private boolean isInitialState;
|
|
||||||
private boolean isEndState;
|
|
||||||
|
|
||||||
public State(String stateName, List<String> states, String permission, boolean isAppUpdatable,
|
|
||||||
boolean isAppInstallable, boolean isInitialState, boolean isEndState) {
|
|
||||||
this.stateName = stateName;
|
|
||||||
this.permission = permission;
|
|
||||||
this.isAppUpdatable=isAppUpdatable;
|
|
||||||
this.isAppInstallable=isAppInstallable;
|
|
||||||
this.isInitialState=isInitialState;
|
|
||||||
this.isEndState=isEndState;
|
|
||||||
if (states != null && !states.isEmpty()) {
|
|
||||||
proceedingStates = new HashSet<>(states);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getState() {
|
|
||||||
return stateName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<String> getProceedingStates() {
|
|
||||||
return proceedingStates;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPermission(){ return permission;}
|
|
||||||
|
|
||||||
public boolean isAppUpdatable(){ return isAppUpdatable;}
|
|
||||||
|
|
||||||
public boolean isAppInstallable(){ return isAppInstallable;}
|
|
||||||
|
|
||||||
public boolean isInitialState(){ return isInitialState;}
|
|
||||||
|
|
||||||
public boolean isEndState(){ return isEndState;}
|
|
||||||
|
|
||||||
}
|
|
@ -1,25 +1,22 @@
|
|||||||
package org.wso2.carbon.device.application.mgt.core;
|
package org.wso2.carbon.device.application.mgt.core;
|
||||||
|
|
||||||
import org.wso2.carbon.device.application.mgt.core.lifecycle.LifecycleStateManager;
|
import org.wso2.carbon.device.application.mgt.core.lifecycle.LifecycleStateManager;
|
||||||
import org.wso2.carbon.device.application.mgt.core.lifecycle.State;
|
import org.wso2.carbon.device.application.mgt.common.config.LifecycleState;
|
||||||
import org.wso2.carbon.device.application.mgt.core.lifecycle.config.LifecycleState;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class LifeCycleStateManagerTest extends LifecycleStateManager {
|
class LifeCycleStateManagerTest extends LifecycleStateManager {
|
||||||
|
|
||||||
public void initializeLifeCycleDetails(List<LifecycleState> states) {
|
void initializeLifeCycleDetails(List<LifecycleState> lifecycleStates) {
|
||||||
HashMap<String, State> lifecycleStates = new HashMap<>();
|
HashMap<String, LifecycleState> lifecycleStatesMap = new HashMap<>();
|
||||||
for (LifecycleState s : states) {
|
for (LifecycleState lifecycleState : lifecycleStates) {
|
||||||
if (s.getProceedingStates() != null) {
|
if (lifecycleState.getProceedingStates() != null) {
|
||||||
s.getProceedingStates().replaceAll(String::toUpperCase);
|
lifecycleState.getProceedingStates().replaceAll(String::toUpperCase);
|
||||||
}
|
}
|
||||||
lifecycleStates.put(s.getName().toUpperCase(), new State(s.getName().toUpperCase(),
|
lifecycleStatesMap.put(lifecycleState.getName().toUpperCase(), lifecycleState);
|
||||||
s.getProceedingStates(), s.getPermission(), s.isAppUpdatable(), s.isAppInstallable(),
|
|
||||||
s.isInitialState(), s.isEndState()));
|
|
||||||
}
|
}
|
||||||
setLifecycleStates(lifecycleStates);
|
setLifecycleStates(lifecycleStatesMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue