Fix issues in lifecycle management feature

feature/appm-store/pbac
lasanthaDLPDS 6 years ago
parent 6d4252a5dd
commit 38006c8ff0

@ -144,7 +144,6 @@ public interface ApplicationManager {
/**
* To get all the releases of a particular ApplicationDTO.
*
* @param applicationId ID of the ApplicationDTO.
* @param releaseUuid UUID of the ApplicationDTO Release.
* @param stateName Lifecycle state to change the app
* @throws ApplicationManagementException ApplicationDTO Management Exception.

@ -129,6 +129,7 @@ public class Util {
*/
public static ApplicationReleaseDTO loadAppRelease(ResultSet rs) throws SQLException {
ApplicationReleaseDTO appRelease = new ApplicationReleaseDTO();
appRelease.setId(rs.getInt("RELEASE_ID"));
appRelease.setDescription(rs.getString("RELEASE_DESCRIPTION"));
appRelease.setUuid(rs.getString("RELEASE_UUID"));
appRelease.setReleaseType(rs.getString("RELEASE_TYPE"));

@ -144,6 +144,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
+ "AP_APP.CURRENCY AS APP_CURRENCY, "
+ "AP_APP.RATING AS APP_RATING, "
+ "AP_APP.DEVICE_TYPE_ID AS APP_DEVICE_TYPE_ID, "
+ "AP_APP_RELEASE.ID AS RELEASE_ID, "
+ "AP_APP_RELEASE.DESCRIPTION AS RELEASE_DESCRIPTION, "
+ "AP_APP_RELEASE.VERSION AS RELEASE_VERSION, "
+ "AP_APP_RELEASE.UUID AS RELEASE_UUID, "
@ -502,6 +503,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
+ "AP_APP.CURRENCY AS APP_CURRENCY, "
+ "AP_APP.RATING AS APP_RATING, "
+ "AP_APP.DEVICE_TYPE_ID AS APP_DEVICE_TYPE_ID, "
+ "AP_APP_RELEASE.ID AS RELEASE_ID, "
+ "AP_APP_RELEASE.DESCRIPTION AS RELEASE_DESCRIPTION, "
+ "AP_APP_RELEASE.VERSION AS RELEASE_VERSION, "
+ "AP_APP_RELEASE.UUID AS RELEASE_UUID, "

@ -226,7 +226,8 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
public ApplicationReleaseDTO getReleaseByUUID( String uuid, int tenantId) throws ApplicationManagementDAOException {
Connection connection;
String sql =
"SELECT AR.DESCRIPTION AS RELEASE_DESCRIPTION, "
"SELECT AR.ID AS RELEASE_ID, "
+ "AR.DESCRIPTION AS RELEASE_DESCRIPTION, "
+ "AR.VERSION AS RELEASE_VERSION, "
+ "AR.UUID AS RELEASE_UUID, "
+ "AR.RELEASE_TYPE AS RELEASE_TYPE, "

@ -1625,6 +1625,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
applicationReleaseDTO.setCurrentState(stateName);
this.applicationReleaseDAO.updateRelease(applicationReleaseDTO, tenantId);
this.lifecycleStateDAO.addLifecycleState(lifecycleState, applicationReleaseDTO.getId(), tenantId);
ConnectionManagerUtil.commitDBTransaction();
} else {
String msg = "Invalid lifecycle state transition from '" + applicationReleaseDTO.getCurrentState() + "'"
+ " to '" + stateName + "'";

@ -47,7 +47,7 @@ public class LifecycleStateManager {
if (lifecycleState.getProceedingStates() != null) {
lifecycleState.getProceedingStates().replaceAll(String::toUpperCase);
}
lifecycleStates.put(lifecycleState.getName(), lifecycleState);
lifecycleStates.put(lifecycleState.getName().toUpperCase(), lifecycleState);
try {
PermissionUtils.putPermission(lifecycleState.getPermission());
} catch (PermissionManagementException e) {
@ -123,15 +123,10 @@ public class LifecycleStateManager {
}
private String getPermissionForStateChange(String nextState) {
Iterator it = lifecycleStates.entrySet().iterator();
LifecycleState nextLifecycleState;
while (it.hasNext()) {
Map.Entry pair = (Map.Entry) it.next();
if (pair.getKey().toString().equalsIgnoreCase(nextState)) {
nextLifecycleState = lifecycleStates.get(nextState);
return nextLifecycleState.getPermission();
for (Map.Entry<String, LifecycleState> lifecycyleState : lifecycleStates.entrySet()) {
if (lifecycyleState.getKey().equalsIgnoreCase(nextState)) {
return lifecycyleState.getValue().getPermission();
}
it.remove();
}
return null;
}

Loading…
Cancel
Save