Committing initial refactoring for visibility change.

feature/appm-store/pbac
sinthuja 7 years ago
parent e4ddac22d2
commit c04e4d3c42

@ -18,6 +18,8 @@
*/
package org.wso2.carbon.device.application.mgt.common;
import java.util.List;
/**
* This class represents the visibility details of an Application.
*/
@ -25,19 +27,7 @@ public class Visibility {
private Type type;
private String value;
private Application application;
private ApplicationRelease applicationRelease;
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
private List<String> allowedList;
public Type getType() {
return type;
@ -47,55 +37,18 @@ public class Visibility {
this.type = type;
}
public Application getApplication() {
return application;
}
public void setApplication(Application application) {
this.application = application;
}
public ApplicationRelease getApplicationRelease() {
return applicationRelease;
public List<String> getAllowedList() {
return allowedList;
}
public void setApplicationRelease(ApplicationRelease applicationRelease) {
this.applicationRelease = applicationRelease;
public void setAllowedList(List<String> allowedList) {
this.allowedList = allowedList;
}
/**
* Type of the visibility of the application.
*/
public class Type {
private String id;
private String name;
private String description;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public enum Type {
PUBLIC, ROLES, DEVICE_GROUPS
}
}

@ -15,9 +15,23 @@
* under the License.
*
*/
package org.wso2.carbon.device.application.mgt.core.impl;
package org.wso2.carbon.device.application.mgt.common.exception;
import org.wso2.carbon.device.application.mgt.common.services.VisibilityTypeManager;
/**
* This specialized exception is thrown by the Visibility Manager during unexpected behaviour
* or unsupported parameters.
*/
public class VisibilityManagementException extends ApplicationManagementException {
public class VisibilityTypeManagerImpl implements VisibilityTypeManager {
public VisibilityManagementException(String msg, Exception nestedEx) {
super(msg, nestedEx);
}
public VisibilityManagementException(String message, Throwable cause) {
super(message, cause);
}
public VisibilityManagementException(String msg) {
super(msg);
}
}

@ -18,9 +18,18 @@
package org.wso2.carbon.device.application.mgt.common.services;
import org.wso2.carbon.device.application.mgt.common.Visibility;
/**
* This interface manages all the operations related with Application Visibility.
* This interface manages all the operations related with Application Visibility, and in the case of the restr
*/
public interface VisibilityManager {
void addVisibilityMapping(String applicationId, Visibility visibility);
Visibility getVisibility(String applicationId);
void updateVisibilityMapping(String applicationId, Visibility visibility);
void removeVisibilityMapping(String applicationId);
}

@ -1,26 +0,0 @@
/*
* Copyright (c) 2017, 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.
*
*/
package org.wso2.carbon.device.application.mgt.common.services;
/**
* VisibilityTypeManager is responsible for handling all the operations related to VisibilityType, this includes
* creating, updating and viewing the {@link org.wso2.carbon.device.application.mgt.common.Visibility.Type}
*/
public interface VisibilityTypeManager {
}

@ -1,22 +0,0 @@
/*
* Copyright (c) 2017, 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.
*
*/
package org.wso2.carbon.device.application.mgt.core.dao;
public interface ResourceTypeDAO {
}

@ -44,11 +44,9 @@ public class GenericLifecycleStateImpl extends AbstractDAOImpl implements Lifecy
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
String sql = "";
try {
conn = this.getDBConnection();
sql += "SELECT * FROM APPM_LIFECYCLE_STATE WHERE IDENTIFIER = ? ";
String sql = "SELECT * FROM APPM_LIFECYCLE_STATE WHERE IDENTIFIER = ? ";
stmt = conn.prepareStatement(sql);
stmt.setString(1, identifier);

@ -17,7 +17,30 @@
*/
package org.wso2.carbon.device.application.mgt.core.impl;
import org.wso2.carbon.device.application.mgt.common.Visibility;
import org.wso2.carbon.device.application.mgt.common.services.VisibilityManager;
public class VisibilityManagerImpl implements VisibilityManager{
/**
* This is the defaut implementation for the visibility manager.
*/
public class VisibilityManagerImpl implements VisibilityManager {
@Override
public void addVisibilityMapping(String applicationId, Visibility visibility) {
}
@Override
public Visibility getVisibility(String applicationId) {
return null;
}
@Override
public void updateVisibilityMapping(String applicationId, Visibility visibility) {
}
@Override
public void removeVisibilityMapping(String applicationId) {
}
}

Loading…
Cancel
Save