当前位置: 首页>>代码示例>>Java>>正文


Java EnrolmentInfo.Status方法代码示例

本文整理汇总了Java中org.wso2.carbon.device.mgt.common.EnrolmentInfo.Status方法的典型用法代码示例。如果您正苦于以下问题:Java EnrolmentInfo.Status方法的具体用法?Java EnrolmentInfo.Status怎么用?Java EnrolmentInfo.Status使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.wso2.carbon.device.mgt.common.EnrolmentInfo的用法示例。


在下文中一共展示了EnrolmentInfo.Status方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setStatus

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
@Override
public boolean setStatus(int enrolmentID, String currentOwner, EnrolmentInfo.Status status,
                         int tenantId) throws DeviceManagementDAOException {
    Connection conn;
    PreparedStatement stmt = null;
    try {
        conn = this.getConnection();
        String sql = "UPDATE DM_ENROLMENT SET STATUS = ? WHERE ID = ? AND OWNER = ? AND TENANT_ID = ?";
        stmt = conn.prepareStatement(sql);
        stmt.setString(1, status.toString());
        stmt.setInt(2, enrolmentID);
        stmt.setString(3, currentOwner);
        stmt.setInt(4, tenantId);
        stmt.executeUpdate();
    } catch (SQLException e) {
        throw new DeviceManagementDAOException("Error occurred while setting the status of device enrolment", e);
    } finally {
        DeviceManagementDAOUtil.cleanupResources(stmt, null);
    }
    return true;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:22,代码来源:EnrollmentDAOImpl.java

示例2: getStatus

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
@Override
public EnrolmentInfo.Status getStatus(int deviceId, String currentOwner,
                                      int tenantId) throws DeviceManagementDAOException {
    Connection conn;
    PreparedStatement stmt = null;
    ResultSet rs = null;
    EnrolmentInfo.Status status = null;
    try {
        conn = this.getConnection();
        String sql = "SELECT STATUS FROM DM_ENROLMENT WHERE DEVICE_ID = ? AND OWNER = ? AND TENANT_ID = ?";
        stmt = conn.prepareStatement(sql);
        stmt.setInt(1, deviceId);
        stmt.setString(2, currentOwner);
        stmt.setInt(3, tenantId);
        rs = stmt.executeQuery();
        if (rs.next()) {
            status = EnrolmentInfo.Status.valueOf(rs.getString("STATUS"));
        }
        return status;
    } catch (SQLException e) {
        throw new DeviceManagementDAOException("Error occurred while setting the status of device enrolment", e);
    } finally {
        DeviceManagementDAOUtil.cleanupResources(stmt, rs);
    }
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:26,代码来源:EnrollmentDAOImpl.java

示例3: generateEnrollmentInfo

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
public static EnrolmentInfo generateEnrollmentInfo(long dateOfEnrollment, long dateOfLastUpdate,
                                                   String owner, EnrolmentInfo.OwnerShip ownership,
                                                   EnrolmentInfo.Status status) {
    EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
    enrolmentInfo.setDateOfEnrolment(dateOfEnrollment);
    enrolmentInfo.setDateOfLastUpdate(dateOfLastUpdate);
    enrolmentInfo.setOwner(owner);
    enrolmentInfo.setOwnership(ownership);
    enrolmentInfo.setStatus(status);
    return enrolmentInfo;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:12,代码来源:DeviceMgtAPITestHelper.java

示例4: changeStatus

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
private void changeStatus(EnrolmentInfo.Status status) throws DeviceManagementException,
        OperationManagementException {
    Device device = this.deviceMgmtProvider.getDevice(this.deviceIds.get(1));
    Assert.assertTrue(device != null);
    Assert.assertEquals(device.getType(), DEVICE_TYPE);
    Assert.assertTrue(device.getEnrolmentInfo() != null);
    device.getEnrolmentInfo().setStatus(status);
    boolean modified = this.deviceMgmtProvider.changeDeviceStatus(this.deviceIds.get(1), status);
    Assert.assertTrue(modified);
    device = this.deviceMgmtProvider.getDevice(this.deviceIds.get(1));
    Assert.assertEquals(device.getEnrolmentInfo().getStatus(), status);
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:13,代码来源:OperationManagementTests.java

示例5: loadMatchingEnrolment

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
public static EnrolmentInfo loadMatchingEnrolment(ResultSet rs) throws SQLException {
    Map<EnrolmentInfo.Status, EnrolmentInfo> enrolmentInfos = new HashMap<>();
    EnrolmentInfo enrolmentInfo = loadEnrolment(rs);
    if (EnrolmentInfo.Status.ACTIVE.equals(enrolmentInfo.getStatus())) {
        return enrolmentInfo;
    }
    enrolmentInfos.put(enrolmentInfo.getStatus(), enrolmentInfo);
    while (rs.next()) {
        enrolmentInfo = loadEnrolment(rs);
        if (EnrolmentInfo.Status.ACTIVE.equals(enrolmentInfo.getStatus())) {
            return enrolmentInfo;
        }
        enrolmentInfos.put(enrolmentInfo.getStatus(), enrolmentInfo);
    }
    if (enrolmentInfos.containsKey(EnrolmentInfo.Status.UNREACHABLE)) {
        return enrolmentInfos.get(EnrolmentInfo.Status.UNREACHABLE);
    } else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.INACTIVE)) {
        return enrolmentInfos.get(EnrolmentInfo.Status.INACTIVE);
    } else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.DISENROLLMENT_REQUESTED)) {
        return enrolmentInfos.get(EnrolmentInfo.Status.DISENROLLMENT_REQUESTED);
    } else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.CREATED)) {
        return enrolmentInfos.get(EnrolmentInfo.Status.CREATED);
    } else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.REMOVED)) {
        return enrolmentInfos.get(EnrolmentInfo.Status.REMOVED);
    } else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.UNCLAIMED)) {
        return enrolmentInfos.get(EnrolmentInfo.Status.UNCLAIMED);
    } else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.SUSPENDED)) {
        return enrolmentInfos.get(EnrolmentInfo.Status.SUSPENDED);
    } else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.BLOCKED)) {
        return enrolmentInfos.get(EnrolmentInfo.Status.BLOCKED);
    }
    return enrolmentInfo;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:34,代码来源:DeviceManagementDAOUtil.java

示例6: loadActiveDevice

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
public static Device loadActiveDevice(ResultSet rs, boolean deviceInfoIncluded) throws SQLException {
    Map<EnrolmentInfo.Status, Device> deviceMap = new HashMap<>();
    Device device = loadDevice(rs);
    if (deviceInfoIncluded) {
        device.setDeviceInfo(loadDeviceInfo(rs));
    }
    return device;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:9,代码来源:DeviceManagementDAOUtil.java

示例7: getDevice

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
@Override
public Device getDevice(DeviceIdentifier deviceIdentifier, EnrolmentInfo.Status status, int tenantId) throws
                                                                                     DeviceManagementDAOException {
    Connection conn;
    PreparedStatement stmt = null;
    ResultSet rs = null;
    Device device = null;
    try {
        conn = this.getConnection();
        String sql = "SELECT d1.ID AS DEVICE_ID, d1.DESCRIPTION, d1.NAME AS DEVICE_NAME, d1.DEVICE_TYPE, " +
                     "d1.DEVICE_IDENTIFICATION, e.OWNER, e.OWNERSHIP, e.STATUS, e.DATE_OF_LAST_UPDATE, " +
                     "e.DATE_OF_ENROLMENT, e.ID AS ENROLMENT_ID FROM DM_ENROLMENT e, (SELECT d.ID, d.DESCRIPTION, d.NAME, " +
                     "t.NAME AS DEVICE_TYPE, d.DEVICE_IDENTIFICATION FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE " +
                     "t.NAME = ? AND t.ID = d.DEVICE_TYPE_ID AND d.DEVICE_IDENTIFICATION = ? AND d.TENANT_ID = ?) d1 WHERE d1.ID = e.DEVICE_ID " +
                     "AND TENANT_ID = ? AND e.STATUS = ? ORDER BY e.DATE_OF_LAST_UPDATE DESC";
        stmt = conn.prepareStatement(sql);
        stmt.setString(1, deviceIdentifier.getType());
        stmt.setString(2, deviceIdentifier.getId());
        stmt.setInt(3, tenantId);
        stmt.setInt(4, tenantId);
        stmt.setString(5, status.toString());
        rs = stmt.executeQuery();
        if (rs.next()) {
            device = DeviceManagementDAOUtil.loadDevice(rs);
        }
    } catch (SQLException e) {
        throw new DeviceManagementDAOException("Error occurred while listing devices for type " +
                                               "'" + deviceIdentifier.getType() + "'", e);
    } finally {
        DeviceManagementDAOUtil.cleanupResources(stmt, rs);
    }
    return device;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:34,代码来源:AbstractDeviceDAOImpl.java

示例8: changeDeviceStatus

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
/**
 * Change device status.
 *
 * @param deviceIdentifier {@link DeviceIdentifier} object
 * @param newStatus        New status of the device
 * @return Whether status is changed or not
 * @throws DeviceManagementException on errors while trying to change device status
 */
@Override
public boolean changeDeviceStatus(DeviceIdentifier deviceIdentifier, EnrolmentInfo.Status newStatus)
        throws DeviceManagementException {
    if (deviceIdentifier == null) {
        String msg = "Received incomplete data for getDevicesByStatus";
        log.error(msg);
        throw new DeviceManagementException(msg);
    }
    if (log.isDebugEnabled()) {
        log.debug("Change device status of device: " + deviceIdentifier.getId() + " of type '"
                + deviceIdentifier.getType() + "'");
    }
    boolean isDeviceUpdated;
    Device device = getDevice(deviceIdentifier, false);
    int deviceId = device.getId();
    EnrolmentInfo enrolmentInfo = device.getEnrolmentInfo();
    enrolmentInfo.setStatus(newStatus);
    int tenantId = this.getTenantId();
    switch (newStatus) {
        case ACTIVE:
            isDeviceUpdated = updateEnrollment(deviceId, enrolmentInfo, tenantId);
            break;
        case INACTIVE:
            isDeviceUpdated = updateEnrollment(deviceId, enrolmentInfo, tenantId);
            break;
        case REMOVED:
            isDeviceUpdated = disenrollDevice(deviceIdentifier);
            break;
        default:
            throw new DeviceManagementException("Invalid status retrieved. Status : " + newStatus);
    }
    return isDeviceUpdated;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:42,代码来源:DeviceManagementProviderServiceImpl.java

示例9: changeDeviceStatus

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
@PUT
@Path("/{type}/{id}/changestatus")
@ApiOperation(
        produces = MediaType.APPLICATION_JSON,
        consumes = MediaType.APPLICATION_JSON,
        httpMethod = "PUT",
        value = "Change device status by device id.",
        notes = "Returns the status of the changed device operation.",
        tags = "Device Management",
        extensions = {
                @Extension(properties = {
                        @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:change-status")
                })
        }
)
@ApiResponses(
        value = {
                @ApiResponse(
                        code = 200,
                        message = "OK. \n Successfully changed the device status.",
                        response = Device.class,
                        responseHeaders = {
                                @ResponseHeader(
                                        name = "Content-Type",
                                        description = "The content type of the body"),
                                @ResponseHeader(
                                        name = "ETag",
                                        description = "Entity Tag of the response resource.\n" +
                                                "Used by caches, or in conditional requests."),
                                @ResponseHeader(
                                        name = "Last-Modified",
                                        description = "Date and time the resource has been modified the last time.\n" +
                                                "Used by caches, or in conditional requests."),
                        }),
                @ApiResponse(
                        code = 304,
                        message = "Not Modified. Empty body because the client already has the latest " +
                                "version of the requested resource."),
                @ApiResponse(
                        code = 400,
                        message = "Bad Request. \n Invalid request or validation error.",
                        response = ErrorResponse.class),
                @ApiResponse(
                        code = 404,
                        message = "Not Found. \n No device is found under the provided type and id.",
                        response = ErrorResponse.class),
                @ApiResponse(
                        code = 500,
                        message = "Internal Server Error. \n " +
                                "Server error occurred while retrieving information requested device.",
                        response = ErrorResponse.class)
        })
Response changeDeviceStatus(
        @ApiParam(
                name = "type",
                value = "The device type, such as ios, android or windows.",
                required = true)
        @PathParam("type")
        @Size(max = 45)
                String type,
        @ApiParam(
                name = "id",
                value = "Device id",
                required = true)
        @PathParam("id")
        @Size(max = 45)
                String id,
        @ApiParam(
                name = "newStatus",
                value = "New status of the device.",
                required = true)
        @QueryParam("newStatus")
                EnrolmentInfo.Status newStatus);
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:74,代码来源:DeviceManagementService.java

示例10: setStatus

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
@Override
public boolean setStatus(DeviceIdentifier deviceIdentifier, String currentUser,
                         EnrolmentInfo.Status status) throws DeviceManagementException {
    return false;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:6,代码来源:DeviceTypeManager.java

示例11: setStatus

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
@Override
public boolean setStatus(DeviceIdentifier deviceId, String currentOwner,
                         EnrolmentInfo.Status status) throws DeviceManagementException {
    return false;
}
 
开发者ID:wso2,项目名称:product-iots,代码行数:6,代码来源:DeviceTypeManager.java

示例12: setStatus

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
boolean setStatus(DeviceIdentifier deviceId, String currentOwner,
EnrolmentInfo.Status status) throws DeviceManagementException;
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:3,代码来源:DeviceManagementProviderService.java

示例13: getDevice

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
@Override
public Device getDevice(DeviceIdentifier deviceId, EnrolmentInfo.Status status) throws DeviceManagementException {
    return this.getDevice(deviceId, status, true);
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:5,代码来源:DeviceManagementProviderServiceImpl.java

示例14: getDevicesByStatus

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
@Override
public List<Device> getDevicesByStatus(EnrolmentInfo.Status status) throws DeviceManagementException {
    return this.getDevicesByStatus(status, true);
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:5,代码来源:DeviceManagementProviderServiceImpl.java

示例15: changeDeviceStatus

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
/**
 * Change device status.
 *
 * @param deviceIdentifier {@link DeviceIdentifier} object
 * @param newStatus        New status of the device
 * @return Whether status is changed or not
 * @throws DeviceManagementException on errors while trying to change device status
 */
boolean changeDeviceStatus(DeviceIdentifier deviceIdentifier, EnrolmentInfo.Status newStatus)
        throws DeviceManagementException;
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:11,代码来源:DeviceManagementProviderService.java


注:本文中的org.wso2.carbon.device.mgt.common.EnrolmentInfo.Status方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。