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


Java EnrolmentInfo.setDateOfEnrolment方法代码示例

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


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

示例1: testReEnrollmentofSameDeviceWithOtherUser

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
@Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"})
public void testReEnrollmentofSameDeviceWithOtherUser() throws DeviceManagementException {
    if (!isMock()) {
        EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
        enrolmentInfo.setDateOfEnrolment(new Date().getTime());
        enrolmentInfo.setDateOfLastUpdate(new Date().getTime());
        enrolmentInfo.setOwner("user1");
        enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
        enrolmentInfo.setStatus(EnrolmentInfo.Status.CREATED);

        Device alternateDevice = TestDataHolder.generateDummyDeviceData(DEVICE_ID, DEVICE_TYPE,
                enrolmentInfo);
        Device retrievedDevice1 = deviceMgtService.getDevice(new DeviceIdentifier(DEVICE_ID,
                DEVICE_TYPE));

        deviceMgtService.enrollDevice(alternateDevice);
        Device retrievedDevice2 = deviceMgtService.getDevice(new DeviceIdentifier(alternateDevice
                .getDeviceIdentifier(), alternateDevice.getType()));

        Assert.assertFalse(retrievedDevice1.getEnrolmentInfo().getOwner().equalsIgnoreCase
                (retrievedDevice2.getEnrolmentInfo().getOwner()));
    }
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:24,代码来源:DeviceManagementProviderServiceTest.java

示例2: generateDummyDeviceData

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
public static List<Device> generateDummyDeviceData(List<DeviceIdentifier> deviceIds) {
    List<Device> devices = new ArrayList<>();
    for (DeviceIdentifier deviceId : deviceIds) {
        Device device = new Device();
        EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
        enrolmentInfo.setDateOfEnrolment(new Date().getTime());
        enrolmentInfo.setDateOfLastUpdate(new Date().getTime());
        enrolmentInfo.setOwner(OWNER);
        enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
        enrolmentInfo.setStatus(EnrolmentInfo.Status.CREATED);
        device.setEnrolmentInfo(enrolmentInfo);
        device.setDescription("Test Description");
        device.setDeviceIdentifier(deviceId.getId());
        device.setType(deviceId.getType());
        devices.add(device);
    }
    return devices;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:19,代码来源:TestDataHolder.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: loadEnrolment

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
public static EnrolmentInfo loadEnrolment(ResultSet rs) throws SQLException {
    EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
    enrolmentInfo.setId(rs.getInt("ENROLMENT_ID"));
    enrolmentInfo.setOwner(rs.getString("OWNER"));
    enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.valueOf(rs.getString("OWNERSHIP")));
    enrolmentInfo.setDateOfEnrolment(rs.getTimestamp("DATE_OF_ENROLMENT").getTime());
    enrolmentInfo.setDateOfLastUpdate(rs.getTimestamp("DATE_OF_LAST_UPDATE").getTime());
    enrolmentInfo.setStatus(EnrolmentInfo.Status.valueOf(rs.getString("STATUS")));
    return enrolmentInfo;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:11,代码来源:DeviceManagementDAOUtil.java

示例5: loadEnrolment

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
private EnrolmentInfo loadEnrolment(ResultSet rs) throws SQLException {
    EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
    enrolmentInfo.setOwner(rs.getString("OWNER"));
    enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.valueOf(rs.getString("OWNERSHIP")));
    enrolmentInfo.setDateOfEnrolment(rs.getTimestamp("DATE_OF_ENROLMENT").getTime());
    enrolmentInfo.setDateOfLastUpdate(rs.getTimestamp("DATE_OF_LAST_UPDATE").getTime());
    enrolmentInfo.setStatus(EnrolmentInfo.Status.valueOf(rs.getString("STATUS")));
    enrolmentInfo.setId(rs.getInt("ID"));
    return enrolmentInfo;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:11,代码来源:EnrollmentDAOImpl.java

示例6: register

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
@Path("device/register")
@POST
public boolean register(@QueryParam("name") String name) {
    try {
        DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
        String deviceId = shortUUID();
        deviceIdentifier.setId(deviceId);
        deviceIdentifier.setType(ConnectedCupConstants.DEVICE_TYPE);
        if (APIUtil.getDeviceManagementService().isEnrolled(deviceIdentifier)) {
            return false;
        }
        Device device = new Device();
        device.setDeviceIdentifier(deviceId);
        EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
        enrolmentInfo.setDateOfEnrolment(new Date().getTime());
        enrolmentInfo.setDateOfLastUpdate(new Date().getTime());
        enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
        enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
        device.setName(name);
        device.setType(ConnectedCupConstants.DEVICE_TYPE);
        enrolmentInfo.setOwner(APIUtil.getAuthenticatedUser());
        device.setEnrolmentInfo(enrolmentInfo);
        return APIUtil.getDeviceManagementService().enrollDevice(device);
    } catch (DeviceManagementException e) {
        log.error("Failed to enroll device with device name :" + name, e);
        return false;
    }
}
 
开发者ID:wso2,项目名称:product-iots,代码行数:29,代码来源:ConnectedCupServiceImpl.java

示例7: register

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
/**
 * Register device into device management service.
 *
 * @param deviceId unique identifier for given device type instance
 * @param name     name for the device type instance
 * @return check whether device is installed into cdmf
 */
private boolean register(String deviceId, String name) {
    try {
        DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
        deviceIdentifier.setId(deviceId);
        deviceIdentifier.setType(DeviceTypeConstants.DEVICE_TYPE);
        if (APIUtil.getDeviceManagementService().isEnrolled(deviceIdentifier)) {
            return false;
        }
        Device device = new Device();
        device.setDeviceIdentifier(deviceId);
        EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
        enrolmentInfo.setDateOfEnrolment(new Date().getTime());
        enrolmentInfo.setDateOfLastUpdate(new Date().getTime());
        enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
        enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
        device.setName(name);
        device.setType(DeviceTypeConstants.DEVICE_TYPE);
        enrolmentInfo.setOwner(APIUtil.getAuthenticatedUser());
        device.setEnrolmentInfo(enrolmentInfo);
        boolean added = APIUtil.getDeviceManagementService().enrollDevice(device);
        return added;
    } catch (DeviceManagementException e) {
        log.error(e.getMessage(), e);
        return false;
    }
}
 
开发者ID:wso2,项目名称:product-iots,代码行数:34,代码来源:DeviceTypeServiceImpl.java

示例8: register

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
private boolean register(String deviceId, String name) {
    try {
        DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
        deviceIdentifier.setId(deviceId);
        deviceIdentifier.setType(DeviceTypeConstants.DEVICE_TYPE);
        if (APIUtil.getDeviceManagementService().isEnrolled(deviceIdentifier)) {
            return false;
        }
        Device device = new Device();
        device.setDeviceIdentifier(deviceId);
        EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
        enrolmentInfo.setDateOfEnrolment(new Date().getTime());
        enrolmentInfo.setDateOfLastUpdate(new Date().getTime());
        enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
        enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
        device.setName(name);
        device.setType(DeviceTypeConstants.DEVICE_TYPE);
        enrolmentInfo.setOwner(APIUtil.getAuthenticatedUser());
        device.setEnrolmentInfo(enrolmentInfo);
        boolean added = APIUtil.getDeviceManagementService().enrollDevice(device);
        if (added) {
            APIUtil.registerApiAccessRoles(APIUtil.getAuthenticatedUser());
        }
        return added;
    } catch (DeviceManagementException e) {
        log.error(e.getMessage(), e);
        return false;
    }
}
 
开发者ID:wso2,项目名称:product-iots,代码行数:30,代码来源:DeviceTypeServiceImpl.java

示例9: register

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
@Path("/device/register")
@PUT
public boolean register(@QueryParam("deviceId") String deviceId,
						@QueryParam("name") String name, @QueryParam("owner") String owner) {

	DeviceManagement deviceManagement = new DeviceManagement();

	DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
	deviceIdentifier.setId(deviceId);
	deviceIdentifier.setType(FireAlarmConstants.DEVICE_TYPE);
	try {
		if (deviceManagement.getDeviceManagementService().isEnrolled(deviceIdentifier)) {
			Response.status(HttpStatus.SC_CONFLICT).build();
			return false;
		}

		Device device = new Device();
		device.setDeviceIdentifier(deviceId);
		EnrolmentInfo enrolmentInfo = new EnrolmentInfo();

		enrolmentInfo.setDateOfEnrolment(new Date().getTime());
		enrolmentInfo.setDateOfLastUpdate(new Date().getTime());
		enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
		enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);

		device.setName(name);
		device.setType(FireAlarmConstants.DEVICE_TYPE);
		enrolmentInfo.setOwner(owner);
		device.setEnrolmentInfo(enrolmentInfo);
		boolean added = deviceManagement.getDeviceManagementService().enrollDevice(device);

		if (added) {
			Response.status(HttpStatus.SC_OK).build();
		} else {
			Response.status(HttpStatus.SC_EXPECTATION_FAILED).build();
		}

		return added;
	} catch (DeviceManagementException e) {
		log.error(e.getErrorMessage());
		return false;
	}
}
 
开发者ID:wso2-incubator,项目名称:iot-server-appliances,代码行数:44,代码来源:FireAlarmManagerService.java


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