forked from community/device-mgt-core
parent
493de22d85
commit
9d5e912d11
@ -1,88 +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.api.dto;
|
|
||||||
|
|
||||||
import org.codehaus.jackson.annotate.JsonIgnore;
|
|
||||||
import org.wso2.carbon.device.application.mgt.core.dto.Application;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class StoreApplication {
|
|
||||||
|
|
||||||
private int id;
|
|
||||||
|
|
||||||
private String uuid;
|
|
||||||
|
|
||||||
private String iconName;
|
|
||||||
|
|
||||||
private String bannerName;
|
|
||||||
|
|
||||||
private List<String> screenshotNames;
|
|
||||||
|
|
||||||
private Application application;
|
|
||||||
|
|
||||||
@JsonIgnore
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUuid() {
|
|
||||||
return uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUuid(String uuid) {
|
|
||||||
this.uuid = uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIconName() {
|
|
||||||
return iconName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIconName(String iconName) {
|
|
||||||
this.iconName = iconName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBannerName() {
|
|
||||||
return bannerName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBannerName(String bannerName) {
|
|
||||||
this.bannerName = bannerName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getScreenshotNames() {
|
|
||||||
return screenshotNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setScreenshotNames(List<String> screenshotNames) {
|
|
||||||
this.screenshotNames = screenshotNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Application getApplication() {
|
|
||||||
return application;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setApplication(Application application) {
|
|
||||||
this.application = application;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,59 +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.api.responses;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import org.apache.commons.beanutils.BeanUtils;
|
|
||||||
import org.wso2.carbon.device.application.mgt.api.dto.StoreApplication;
|
|
||||||
import org.wso2.carbon.device.application.mgt.core.dto.Application;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@XmlRootElement
|
|
||||||
public class ApplicationsListResponse {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "List of applications types returned")
|
|
||||||
@JsonProperty("applications")
|
|
||||||
@XmlElement
|
|
||||||
private List<StoreApplication> applications;
|
|
||||||
|
|
||||||
public ApplicationsListResponse(List<org.wso2.carbon.device.application.mgt.core.dto.StoreApplication> applications)
|
|
||||||
throws InvocationTargetException, IllegalAccessException {
|
|
||||||
this.applications = new ArrayList<>();
|
|
||||||
for(org.wso2.carbon.device.application.mgt.core.dto.StoreApplication applicationDTO : applications){
|
|
||||||
StoreApplication application = new StoreApplication();
|
|
||||||
BeanUtils.copyProperties(application, applicationDTO);
|
|
||||||
this.applications.add(application);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<StoreApplication> getApplications() {
|
|
||||||
return applications;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setApplications(List<StoreApplication> applications) {
|
|
||||||
this.applications = applications;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.wso2.carbon.device.application.mgt.core.config.datasource.DataSourceConfig;
|
||||||
|
import org.wso2.carbon.device.application.mgt.core.dao.impl.GenericAppManagementDAO;
|
||||||
|
import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ApplicationManagementDAOFactory {
|
||||||
|
|
||||||
|
public static final String H2 = "H2";
|
||||||
|
private ApplicationManagementDAO.DatabaseType databaseType;
|
||||||
|
private static DataSource dataSource;
|
||||||
|
|
||||||
|
private static final Log log = LogFactory.getLog(ApplicationManagementDAOFactory.class);
|
||||||
|
|
||||||
|
public ApplicationManagementDAOFactory(DataSourceConfig dataSourceConfig) {
|
||||||
|
dataSource = ConnectionManagerUtil.resolveDataSource(dataSourceConfig);
|
||||||
|
ConnectionManagerUtil.setDataSource(dataSource);
|
||||||
|
String databaseEngine = H2;
|
||||||
|
try {
|
||||||
|
databaseEngine = dataSource.getConnection().getMetaData().getDatabaseProductName();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error("Error occurred while retrieving config.datasource connection", e);
|
||||||
|
}
|
||||||
|
this.databaseType = ApplicationManagementDAO.DatabaseType.lookup(databaseEngine);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplicationManagementDAO getApplicationManagementDAO(){
|
||||||
|
switch (databaseType) {
|
||||||
|
default:
|
||||||
|
return new GenericAppManagementDAO();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,96 +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;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.wso2.carbon.device.application.mgt.core.config.datasource.DataSourceConfig;
|
|
||||||
import org.wso2.carbon.device.application.mgt.core.dto.StoreApplication;
|
|
||||||
import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil;
|
|
||||||
import org.wso2.carbon.device.application.mgt.core.dto.Application;
|
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ApplicationManagementDAOImpl implements ApplicationManagementDAO {
|
|
||||||
|
|
||||||
private DatabaseType databaseType;
|
|
||||||
private static DataSource dataSource;
|
|
||||||
|
|
||||||
private static final String TABLE_PREFIX = "APPM";
|
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(ApplicationManagementDAOImpl.class);
|
|
||||||
|
|
||||||
public ApplicationManagementDAOImpl(DataSourceConfig dataSourceConfig) {
|
|
||||||
dataSource = ConnectionManagerUtil.resolveDataSource(dataSourceConfig);
|
|
||||||
ConnectionManagerUtil.setDataSource(dataSource);
|
|
||||||
String databaseEngine = "H2";
|
|
||||||
try {
|
|
||||||
databaseEngine = dataSource.getConnection().getMetaData().getDatabaseProductName();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
log.error("Error occurred while retrieving config.datasource connection", e);
|
|
||||||
}
|
|
||||||
this.databaseType = DatabaseType.lookup(databaseEngine);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void createApplication(StoreApplication application) throws ApplicationManagementDAOException {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<StoreApplication> getApplications() throws ApplicationManagementDAOException {
|
|
||||||
|
|
||||||
Connection conn = null;
|
|
||||||
PreparedStatement stmt = null;
|
|
||||||
ResultSet rs = null;
|
|
||||||
String sql = null;
|
|
||||||
List<StoreApplication> applications;
|
|
||||||
|
|
||||||
try {
|
|
||||||
conn = ConnectionManagerUtil.getCurrentConnection().get();
|
|
||||||
switch (databaseType) {
|
|
||||||
case H2:
|
|
||||||
case MYSQL:
|
|
||||||
sql = "SELECT * FROM APPM_STORE_APPLICATION";
|
|
||||||
}
|
|
||||||
|
|
||||||
stmt = conn.prepareStatement(sql);
|
|
||||||
rs = stmt.executeQuery();
|
|
||||||
applications = new ArrayList<>();
|
|
||||||
while (rs.next()) {
|
|
||||||
applications.add(ApplicationManagementDAOUtil.loadApplication(rs));
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
throw new ApplicationManagementDAOException("Error occurred while getting application List", e);
|
|
||||||
} catch (JSONException e) {
|
|
||||||
throw new ApplicationManagementDAOException("Error occurred while parsing JSON", e);
|
|
||||||
} finally {
|
|
||||||
ApplicationManagementDAOUtil.cleanupResources(stmt, rs);
|
|
||||||
}
|
|
||||||
return applications;
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,102 @@
|
|||||||
|
/*
|
||||||
|
* 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.impl;
|
||||||
|
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.wso2.carbon.device.application.mgt.core.dao.ApplicationManagementDAO;
|
||||||
|
import org.wso2.carbon.device.application.mgt.core.dao.ApplicationManagementDAOException;
|
||||||
|
import org.wso2.carbon.device.application.mgt.core.dao.ApplicationManagementDAOUtil;
|
||||||
|
import org.wso2.carbon.device.application.mgt.core.dto.Application;
|
||||||
|
import org.wso2.carbon.device.application.mgt.core.dto.ApplicationList;
|
||||||
|
import org.wso2.carbon.device.application.mgt.core.dto.Pagination;
|
||||||
|
import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class GenericAppManagementDAO implements ApplicationManagementDAO {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createApplication(Application application) throws ApplicationManagementDAOException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApplicationList getApplications() throws ApplicationManagementDAOException {
|
||||||
|
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
String sql = null;
|
||||||
|
ApplicationList applicationList = new ApplicationList();
|
||||||
|
List<Application> applications = new ArrayList<>();
|
||||||
|
Pagination pagination = new Pagination();
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
conn = ConnectionManagerUtil.getCurrentConnection().get();
|
||||||
|
|
||||||
|
sql = "SELECT SQL_CALC_FOUND_ROWS AP.*, AT.NAME AS AT_NAME, AT.CODE AS AT_CODE, CT.NAME AS CT_NAME " +
|
||||||
|
"FROM APPM_APPLICATION AS AP " +
|
||||||
|
"INNER JOIN APPM_APPLICATION_TYPE AS AT ON AP.APPLICATION_TYPE_ID = AT.ID " +
|
||||||
|
"INNER JOIN APPM_APPLICATION_CATEGORY AS CT ON AP.CATEGORY_ID = CT.ID;";
|
||||||
|
|
||||||
|
stmt = conn.prepareStatement(sql);
|
||||||
|
rs = stmt.executeQuery();
|
||||||
|
|
||||||
|
int length = 0;
|
||||||
|
sql = "SELECT FOUND_ROWS() AS COUNT;";
|
||||||
|
stmt = conn.prepareStatement(sql);
|
||||||
|
ResultSet rsCount = stmt.executeQuery();
|
||||||
|
if(rsCount.next()){
|
||||||
|
pagination.setCount(rsCount.getInt("COUNT"));
|
||||||
|
}
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
|
||||||
|
//Getting properties
|
||||||
|
sql = "SELECT * FROM APPM_APPLICATION_PROPERTIES WHERE APPLICATION_ID=?";
|
||||||
|
stmt = conn.prepareStatement(sql);
|
||||||
|
stmt.setInt(1, rs.getInt("ID"));
|
||||||
|
ResultSet rsProperties = stmt.executeQuery();
|
||||||
|
|
||||||
|
applications.add(ApplicationManagementDAOUtil.loadApplication(rs, rsProperties));
|
||||||
|
length++;
|
||||||
|
}
|
||||||
|
|
||||||
|
pagination.setLength(length);
|
||||||
|
|
||||||
|
applicationList.setApplications(applications);
|
||||||
|
applicationList.setPagination(pagination);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new ApplicationManagementDAOException("Error occurred while getting application List", e);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
throw new ApplicationManagementDAOException("Error occurred while parsing JSON", e);
|
||||||
|
} finally {
|
||||||
|
ApplicationManagementDAOUtil.cleanupResources(stmt, rs);
|
||||||
|
}
|
||||||
|
return applicationList;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* 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.dto;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ApplicationList {
|
||||||
|
|
||||||
|
private List<Application> applications;
|
||||||
|
|
||||||
|
private Pagination pagination;
|
||||||
|
|
||||||
|
public List<Application> getApplications() {
|
||||||
|
return applications;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApplications(List<Application> applications) {
|
||||||
|
this.applications = applications;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pagination getPagination() {
|
||||||
|
return pagination;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagination(Pagination pagination) {
|
||||||
|
this.pagination = pagination;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* 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.dto;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.application.mgt.core.jaxrs.Exclude;
|
||||||
|
|
||||||
|
public class Category {
|
||||||
|
|
||||||
|
@Exclude
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int 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;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* 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.dto;
|
||||||
|
|
||||||
|
public class Pagination {
|
||||||
|
|
||||||
|
private int offset;
|
||||||
|
|
||||||
|
private int limit;
|
||||||
|
|
||||||
|
private int length;
|
||||||
|
|
||||||
|
private int count;
|
||||||
|
|
||||||
|
public int getOffset() {
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOffset(int offset) {
|
||||||
|
this.offset = offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLimit() {
|
||||||
|
return limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLimit(int limit) {
|
||||||
|
this.limit = limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLength() {
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLength(int length) {
|
||||||
|
this.length = length;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCount() {
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCount(int count) {
|
||||||
|
this.count = count;
|
||||||
|
}
|
||||||
|
}
|
@ -1,79 +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.dto;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class StoreApplication {
|
|
||||||
|
|
||||||
private int id;
|
|
||||||
private String uuid;
|
|
||||||
private String iconName;
|
|
||||||
private String bannerName;
|
|
||||||
private List<String> screenshotNames;
|
|
||||||
private Application application;
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUuid() {
|
|
||||||
return uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUuid(String uuid) {
|
|
||||||
this.uuid = uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIconName() {
|
|
||||||
return iconName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIconName(String iconName) {
|
|
||||||
this.iconName = iconName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBannerName() {
|
|
||||||
return bannerName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBannerName(String bannerName) {
|
|
||||||
this.bannerName = bannerName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getScreenshotNames() {
|
|
||||||
return screenshotNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setScreenshotNames(List<String> screenshotNames) {
|
|
||||||
this.screenshotNames = screenshotNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Application getApplication() {
|
|
||||||
return application;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setApplication(Application application) {
|
|
||||||
this.application = application;
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* 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.jaxrs;
|
||||||
|
|
||||||
|
import com.google.gson.ExclusionStrategy;
|
||||||
|
import com.google.gson.FieldAttributes;
|
||||||
|
|
||||||
|
public class AnnotationExclusionStrategy implements ExclusionStrategy {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldSkipField(FieldAttributes f) {
|
||||||
|
return f.getAnnotation(Exclude.class) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldSkipClass(Class<?> clazz) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* 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.jaxrs;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.FIELD)
|
||||||
|
public @interface Exclude {
|
||||||
|
}
|
Loading…
Reference in new issue