Rechange the app manager lifecycle xml file, add comments and headers

feature/appm-store/pbac
Gathika94 6 years ago
parent dc5547bb38
commit bb808fd9e3

@ -1,3 +1,39 @@
/*
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.
*/
/*
* Copyright (c) 2019, Entgra Inc. (http://www.entgra.io) All Rights Reserved.
*
* Entgra Inc. 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.core.lifecycle; package org.wso2.carbon.device.application.mgt.core.lifecycle;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -37,11 +73,10 @@ public class LifecycleStateManger {
try { try {
PermissionUtils.putPermission(s.getPermission()); PermissionUtils.putPermission(s.getPermission());
} catch (PermissionManagementException e) { } catch (PermissionManagementException e) {
log.error("Error when adding permission " + s.getPermission() + " related to the state: " String msg = "Error when adding permission " + s.getPermission() + " related to the state: "
+ s.getName(), e); + s.getName();
throw new LifecycleManagementException ( log.error(msg, e);
"Error when adding permission " + s.getPermission() + " related to the state: " throw new LifecycleManagementException(msg, e);
+ s.getName(), e);
} }
} }
} }
@ -53,7 +88,7 @@ public class LifecycleStateManger {
public boolean isValidStateChange(String currentState, String nextState, String username, public boolean isValidStateChange(String currentState, String nextState, String username,
int tenantId) throws LifecycleManagementException { int tenantId) throws LifecycleManagementException {
UserRealm userRealm = null; UserRealm userRealm;
String permission = getPermissionForStateChange(nextState); String permission = getPermissionForStateChange(nextState);
if (permission != null) { if (permission != null) {
try { try {

@ -38,7 +38,9 @@ public class LifecycleState {
} }
@XmlElement(name = "Permission") @XmlElement(name = "Permission")
public String getPermission(){return permission;} public String getPermission() {
return permission;
}
public void setPermission(String permission) { public void setPermission(String permission) {
this.permission = permission; this.permission = permission;
@ -48,24 +50,36 @@ public class LifecycleState {
public boolean isAppInstallable() { public boolean isAppInstallable() {
return isAppInstallable; return isAppInstallable;
} }
public void setAppInstallable(boolean isAppInstallable){ this.isAppInstallable =isAppInstallable;}
public void setAppInstallable(boolean isAppInstallable) {
this.isAppInstallable = isAppInstallable;
}
@XmlElement(name = "IsAppUpdatable") @XmlElement(name = "IsAppUpdatable")
public boolean isAppUpdatable() { public boolean isAppUpdatable() {
return isAppUpdatable; return isAppUpdatable;
} }
public void setAppUpdatable(boolean isAppUpdatable){ this.isAppUpdatable=isAppUpdatable;}
public void setAppUpdatable(boolean isAppUpdatable) {
this.isAppUpdatable = isAppUpdatable;
}
@XmlElement(name = "IsInitialState") @XmlElement(name = "IsInitialState")
public boolean isInitialState() { public boolean isInitialState() {
return isInitialState; return isInitialState;
} }
public void setInitialState(boolean isInitialState){ this.isInitialState=isInitialState;}
public void setInitialState(boolean isInitialState) {
this.isInitialState = isInitialState;
}
@XmlElement(name = "IsEndState") @XmlElement(name = "IsEndState")
public boolean isEndState() { public boolean isEndState() {
return isEndState; return isEndState;
} }
public void setEndState(boolean isEndState){ this.isEndState=isEndState;}
public void setEndState(boolean isEndState) {
this.isEndState = isEndState;
}
} }

@ -56,13 +56,26 @@
If there is a requirement to introduce a new state to the lifecycle, please refer above If there is a requirement to introduce a new state to the lifecycle, please refer above
diagram and add relevant state to the below configuration appropriately. diagram and add relevant state to the below configuration appropriately.
--> -->
<LifecycleStates>
<LifecycleState name="Created"> <!-- a lifecyclestate can have following properties
<LifecycleState name="In-Review">
<IsAppInstallable>false</IsAppInstallable> <IsAppInstallable>false</IsAppInstallable>
<IsAppUpdatable>true</IsAppUpdatable> <IsAppUpdatable>true</IsAppUpdatable>
<IsInitialState>true</IsInitialState> <IsInitialState>false</IsInitialState>
<IsEndState>false</IsEndState> <IsEndState>false</IsEndState>
<Permission>
/device-mgt/applications/life-cycle/in-review
</Permission>
<ProceedingStates>
<State>Rejected</State>
<State>Approved</State>
</ProceedingStates>
</LifecycleState>
-->
<LifecycleStates>
<LifecycleState name="Created">
<IsAppUpdatable>true</IsAppUpdatable>
<IsInitialState>true</IsInitialState>
<Permission> <Permission>
/device-mgt/applications/life-cycle/create /device-mgt/applications/life-cycle/create
</Permission> </Permission>
@ -71,10 +84,6 @@
</ProceedingStates> </ProceedingStates>
</LifecycleState> </LifecycleState>
<LifecycleState name="In-Review"> <LifecycleState name="In-Review">
<IsAppInstallable>false</IsAppInstallable>
<IsAppUpdatable>true</IsAppUpdatable>
<IsInitialState>false</IsInitialState>
<IsEndState>false</IsEndState>
<Permission> <Permission>
/device-mgt/applications/life-cycle/in-review /device-mgt/applications/life-cycle/in-review
</Permission> </Permission>
@ -84,37 +93,27 @@
</ProceedingStates> </ProceedingStates>
</LifecycleState> </LifecycleState>
<LifecycleState name="Approved"> <LifecycleState name="Approved">
<IsAppInstallable>false</IsAppInstallable>
<IsAppUpdatable>false</IsAppUpdatable>
<IsInitialState>false</IsInitialState>
<IsEndState>false</IsEndState>
<Permission> <Permission>
/device-mgt/applications/life-cycle/approved /device-mgt/applications/life-cycle/approve
</Permission> </Permission>
<ProceedingStates> <ProceedingStates>
<State>Published</State> <State>Published</State>
<State>Created</State>
</ProceedingStates> </ProceedingStates>
</LifecycleState> </LifecycleState>
<LifecycleState name="Rejected"> <LifecycleState name="Rejected">
<IsAppInstallable>false</IsAppInstallable>
<IsAppUpdatable>false</IsAppUpdatable>
<IsInitialState>false</IsInitialState>
<IsEndState>false</IsEndState>
<Permission> <Permission>
/device-mgt/applications/life-cycle/rejected /device-mgt/applications/life-cycle/reject
</Permission> </Permission>
<ProceedingStates> <ProceedingStates>
<State>In-Review</State> <State>Created</State>
<State>Removed</State> <State>Removed</State>
</ProceedingStates> </ProceedingStates>
</LifecycleState> </LifecycleState>
<LifecycleState name="Published"> <LifecycleState name="Published">
<IsAppInstallable>true</IsAppInstallable> <IsAppInstallable>true</IsAppInstallable>
<IsAppUpdatable>false</IsAppUpdatable>
<IsInitialState>false</IsInitialState>
<IsEndState>false</IsEndState>
<Permission> <Permission>
/device-mgt/applications/life-cycle/published /device-mgt/applications/life-cycle/publish
</Permission> </Permission>
<ProceedingStates> <ProceedingStates>
<State>Unpublished</State> <State>Unpublished</State>
@ -122,36 +121,28 @@
</ProceedingStates> </ProceedingStates>
</LifecycleState> </LifecycleState>
<LifecycleState name="Unpublished"> <LifecycleState name="Unpublished">
<IsAppInstallable>false</IsAppInstallable>
<IsAppUpdatable>false</IsAppUpdatable>
<IsInitialState>false</IsInitialState>
<IsEndState>false</IsEndState>
<Permission> <Permission>
/device-mgt/applications/life-cycle/unpublished /device-mgt/applications/life-cycle/unpublish
</Permission> </Permission>
<ProceedingStates> <ProceedingStates>
<State>Published</State>
<State>In-Review</State>
<State>Removed</State> <State>Removed</State>
</ProceedingStates> </ProceedingStates>
</LifecycleState> </LifecycleState>
<LifecycleState name="Deprecated"> <LifecycleState name="Deprecated">
<IsAppInstallable>false</IsAppInstallable>
<IsAppUpdatable>false</IsAppUpdatable>
<IsInitialState>false</IsInitialState>
<IsEndState>false</IsEndState>
<Permission> <Permission>
/device-mgt/applications/life-cycle/deprecated /device-mgt/applications/life-cycle/deprecate
</Permission> </Permission>
<ProceedingStates> <ProceedingStates>
<State>Removed</State> <State>Removed</State>
<State>In-Review</State>
</ProceedingStates> </ProceedingStates>
</LifecycleState> </LifecycleState>
<LifecycleState name="Removed"> <LifecycleState name="Removed">
<IsAppInstallable>false</IsAppInstallable>
<IsAppUpdatable>false</IsAppUpdatable>
<IsInitialState>false</IsInitialState>
<IsEndState>true</IsEndState> <IsEndState>true</IsEndState>
<Permission> <Permission>
/device-mgt/applications/life-cycle/removed /device-mgt/applications/life-cycle/remove
</Permission> </Permission>
</LifecycleState> </LifecycleState>
</LifecycleStates> </LifecycleStates>

Loading…
Cancel
Save