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


Java EnrolmentInfo.setOwnership方法代码示例

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


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

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
public static List<Device> getDeviceList2 (DeviceType deviceType) {
    List<Device> deviceList = new ArrayList<Device>();

    Device device = new Device();
    device.setId(2);
    device.setType(deviceType.getName());
    device.setName("Apple 5S");
    device.setDeviceIdentifier("def123");
    EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
    enrolmentInfo.setOwner("Dilshan");
    enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
    enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
    device.setEnrolmentInfo(enrolmentInfo);

    deviceList.add(device);
    return deviceList;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:18,代码来源:DeviceCreator.java

示例4: getDeviceList3

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
public static List<Device> getDeviceList3 (DeviceType deviceType) {
    List<Device> deviceList = new ArrayList<Device>();

    Device device = new Device();
    device.setId(3);
    device.setType(deviceType.getName());
    device.setName("Apple 6 Large");
    device.setDeviceIdentifier("xxxx123");
    EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
    enrolmentInfo.setOwner("Harshan");
    enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
    enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
    device.setEnrolmentInfo(enrolmentInfo);

    deviceList.add(device);
    return deviceList;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:18,代码来源:DeviceCreator.java

示例5: getDeviceList4

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
public static List<Device> getDeviceList4 (DeviceType deviceType) {
    List<Device> deviceList = new ArrayList<Device>();

    Device device = new Device();
    device.setId(4);
    device.setType(deviceType.getName());
    device.setName("HTC M");
    device.setDeviceIdentifier("ppp456");
    EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
    enrolmentInfo.setOwner("Dilan");
    enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
    enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
    device.setEnrolmentInfo(enrolmentInfo);

    deviceList.add(device);
    return deviceList;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:18,代码来源:DeviceCreator.java

示例6: getDeviceList5

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
public static List<Device> getDeviceList5 (DeviceType deviceType) {
    List<Device> deviceList = new ArrayList<Device>();

    Device device = new Device();
    device.setId(5);
    device.setType(deviceType.getName());
    device.setName("Sony Experia L");
    device.setDeviceIdentifier("ssss123");
    EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
    enrolmentInfo.setOwner("Milan");
    enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
    enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
    device.setEnrolmentInfo(enrolmentInfo);

    deviceList.add(device);
    return deviceList;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:18,代码来源:DeviceCreator.java

示例7: getDeviceList6

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
public static List<Device> getDeviceList6 (DeviceType deviceType) {
    List<Device> deviceList = new ArrayList<Device>();

    Device device = new Device();
    device.setId(6);
    device.setType(deviceType.getName());
    device.setName("Alcatel RTS");
    device.setDeviceIdentifier("ttt123");
    EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
    enrolmentInfo.setOwner("Dileesha");
    enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
    enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
    device.setEnrolmentInfo(enrolmentInfo);

    deviceList.add(device);
    return deviceList;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:18,代码来源:DeviceCreator.java

示例8: getSingleDevice

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
public static Device getSingleDevice() {

        Device device = new Device();
        device.setId(1);
        device.setType("android");
        device.setName("Galaxy S6");
        device.setDeviceIdentifier("abc123");
        EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
        enrolmentInfo.setOwner("Geeth");
        enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
        enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
        device.setEnrolmentInfo(enrolmentInfo);


        return device;
    }
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:17,代码来源:DeviceCreator.java

示例9: 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

示例10: 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

示例11: 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

示例12: getDeviceList

import org.wso2.carbon.device.mgt.common.EnrolmentInfo; //导入方法依赖的package包/类
public static List<Device> getDeviceList(DeviceType deviceType) {

        List<Device> deviceList = new ArrayList<Device>();

        Device device = new Device();
        device.setId(1);
        device.setType(deviceType.getName());
        device.setName("Galaxy S6");
        device.setDeviceIdentifier("abc123");
        EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
        enrolmentInfo.setOwner("Geeth");
        enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
        enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
        device.setEnrolmentInfo(enrolmentInfo);

//        Device device1 = new Device();
//        device1.setId(2);
//        device1.setType(deviceType.getName());
//        device1.setName("Nexus 5");
//        device1.setDeviceIdentifier("def456");
//        EnrolmentInfo enrolmentInfo1 = new EnrolmentInfo();
//        enrolmentInfo1.setOwner("Manoj");
//        enrolmentInfo1.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
//        enrolmentInfo1.setStatus(EnrolmentInfo.Status.ACTIVE);
//        device1.setEnrolmentInfo(enrolmentInfo);

        deviceList.add(device);
       // deviceList.add(device1);

        return deviceList;
    }
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:32,代码来源:DeviceCreator.java

示例13: 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

示例14: 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

示例15: 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


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