forked from community/device-mgt-plugins
Merge branch 'master' of https://github.com/geethkokila/product-cdm
commit
460e1521ff
@ -1,20 +1,40 @@
|
|||||||
/**
|
/*
|
||||||
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
* you may not use this file except in compliance with the 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
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* software distributed under the License is distributed on an
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* See the License for the specific language governing permissions and
|
* KIND, either express or implied. See the License for the
|
||||||
* limitations under the License.
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.wso2.carbon.device.mgt.core.dao;
|
package org.wso2.carbon.device.mgt.core.dao;
|
||||||
|
|
||||||
public class DeviceMgtDAO {
|
import org.wso2.carbon.device.mgt.core.dao.exception.CDMDAOException;
|
||||||
|
import org.wso2.carbon.device.mgt.core.dao.exception.CDMDatabaseConnectionException;
|
||||||
|
import org.wso2.carbon.device.mgt.core.dto.Device;
|
||||||
|
import org.wso2.carbon.device.mgt.core.dto.Status;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface DeviceMgtDAO {
|
||||||
|
|
||||||
|
void addDevice(Device device) throws CDMDAOException, CDMDatabaseConnectionException;
|
||||||
|
|
||||||
|
void updateDevice(Device device) throws CDMDAOException, CDMDatabaseConnectionException;
|
||||||
|
|
||||||
|
void updateDeviceStatus(Long deviceId, Status status) throws CDMDAOException, CDMDatabaseConnectionException;
|
||||||
|
|
||||||
|
void deleteDevice(Long deviceId) throws CDMDAOException, CDMDatabaseConnectionException;
|
||||||
|
|
||||||
|
List<Device> getDeviceByDeviceId(Long deviceId) throws CDMDAOException, CDMDatabaseConnectionException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014, 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.mgt.core.dao;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.core.dao.exception.CDMDAOException;
|
||||||
|
import org.wso2.carbon.device.mgt.core.dao.exception.CDMDatabaseConnectionException;
|
||||||
|
import org.wso2.carbon.device.mgt.core.dto.DeviceType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface DeviceTypeMgtDAO {
|
||||||
|
|
||||||
|
void addDeviceType(DeviceType deviceType) throws CDMDAOException, CDMDatabaseConnectionException;
|
||||||
|
|
||||||
|
void updateDeviceType(DeviceType deviceType) throws CDMDAOException, CDMDatabaseConnectionException;
|
||||||
|
|
||||||
|
List<DeviceType> getDeviceTypes() throws CDMDAOException, CDMDatabaseConnectionException;
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014, 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.mgt.core.dao.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom exception class for data access related exceptions
|
||||||
|
*/
|
||||||
|
public class CDMDAOException extends Exception {
|
||||||
|
|
||||||
|
private String message;
|
||||||
|
private static final long serialVersionUID = 2021891706072918864L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new exception with the specified detail message and nested exception.
|
||||||
|
*
|
||||||
|
* @param message error message
|
||||||
|
* @param nestedException exception
|
||||||
|
*/
|
||||||
|
public CDMDAOException(String message, Exception nestedException) {
|
||||||
|
super(message, nestedException);
|
||||||
|
setErrorMessage(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new exception with the specified detail message and cause.
|
||||||
|
*
|
||||||
|
* @param message the detail message.
|
||||||
|
* @param cause the cause of this exception.
|
||||||
|
*/
|
||||||
|
public CDMDAOException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
setErrorMessage(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new exception with the specified detail message
|
||||||
|
*
|
||||||
|
* @param message the detail message.
|
||||||
|
*/
|
||||||
|
public CDMDAOException(String message) {
|
||||||
|
super(message);
|
||||||
|
setErrorMessage(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new exception with the specified and cause.
|
||||||
|
*
|
||||||
|
* @param cause the cause of this exception.
|
||||||
|
*/
|
||||||
|
public CDMDAOException(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setErrorMessage(String errorMessage) {
|
||||||
|
this.message = errorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014, 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.mgt.core.dao.exception;
|
||||||
|
|
||||||
|
public class CDMDatabaseConnectionException extends Exception {
|
||||||
|
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new exception with the specified detail message and nested exception.
|
||||||
|
*
|
||||||
|
* @param message error message
|
||||||
|
* @param nestedException exception
|
||||||
|
*/
|
||||||
|
public CDMDatabaseConnectionException(String message, Exception nestedException) {
|
||||||
|
super(message, nestedException);
|
||||||
|
setErrorMessage(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new exception with the specified detail message and cause.
|
||||||
|
*
|
||||||
|
* @param message the detail message.
|
||||||
|
* @param cause the cause of this exception.
|
||||||
|
*/
|
||||||
|
public CDMDatabaseConnectionException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
setErrorMessage(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new exception with the specified detail message
|
||||||
|
*
|
||||||
|
* @param message the detail message.
|
||||||
|
*/
|
||||||
|
public CDMDatabaseConnectionException(String message) {
|
||||||
|
super(message);
|
||||||
|
setErrorMessage(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new exception with the specified and cause.
|
||||||
|
*
|
||||||
|
* @param cause the cause of this exception.
|
||||||
|
*/
|
||||||
|
public CDMDatabaseConnectionException(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setErrorMessage(String errorMessage) {
|
||||||
|
this.message = errorMessage;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014, 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.mgt.core.dao.impl;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.wso2.carbon.device.mgt.core.dao.DeviceMgtDAO;
|
||||||
|
import org.wso2.carbon.device.mgt.core.dao.exception.CDMDAOException;
|
||||||
|
import org.wso2.carbon.device.mgt.core.dao.exception.CDMDatabaseConnectionException;
|
||||||
|
import org.wso2.carbon.device.mgt.core.dto.Device;
|
||||||
|
import org.wso2.carbon.device.mgt.core.dto.Status;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DeviceMgtDAOImpl implements DeviceMgtDAO {
|
||||||
|
|
||||||
|
private static final Log log = LogFactory.getLog(DeviceMgtDAOImpl.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addDevice(Device device) throws CDMDAOException, CDMDatabaseConnectionException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateDevice(Device device) throws CDMDAOException, CDMDatabaseConnectionException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateDeviceStatus(Long deviceId, Status status)
|
||||||
|
throws CDMDAOException, CDMDatabaseConnectionException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteDevice(Long deviceId) throws CDMDAOException, CDMDatabaseConnectionException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Device> getDeviceByDeviceId(Long deviceId)
|
||||||
|
throws CDMDAOException, CDMDatabaseConnectionException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,116 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014, 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.mgt.core.dto;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class Device implements Serializable{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -8101106997837486245L;
|
||||||
|
private Long id;
|
||||||
|
private String description;
|
||||||
|
private String name;
|
||||||
|
private Long dateOfEnrolment;
|
||||||
|
private Long dateOfLastUpdate;
|
||||||
|
private Long deviceIdentificationId;
|
||||||
|
private Status status;
|
||||||
|
private String ownerId;
|
||||||
|
private String ownerShip;
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDateOfEnrolment() {
|
||||||
|
return dateOfEnrolment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDateOfEnrolment(Long dateOfEnrolment) {
|
||||||
|
this.dateOfEnrolment = dateOfEnrolment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDateOfLastUpdate() {
|
||||||
|
return dateOfLastUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDateOfLastUpdate(Long dateOfLastUpdate) {
|
||||||
|
this.dateOfLastUpdate = dateOfLastUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDeviceIdentificationId() {
|
||||||
|
return deviceIdentificationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceIdentificationId(Long deviceIdentificationId) {
|
||||||
|
this.deviceIdentificationId = deviceIdentificationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwnerShip(String ownerShip) {
|
||||||
|
this.ownerShip = ownerShip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwnerShip() {
|
||||||
|
return ownerShip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Status getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwnerId() {
|
||||||
|
return ownerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(Status status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwnerId(String ownerId) {
|
||||||
|
this.ownerId = ownerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getTenantId() {
|
||||||
|
return tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTenantId(Long tenantId) {
|
||||||
|
this.tenantId = tenantId;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014, 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.mgt.core.dto;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class DeviceType implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 7927802716452548282L;
|
||||||
|
private Long id;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014, 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.mgt.core.dto;
|
||||||
|
|
||||||
|
public enum Status {
|
||||||
|
ACTIVE, INACTIVE
|
||||||
|
}
|
Loading…
Reference in new issue