Package com.cumulocity.me.rest.representation.inventory

Examples of com.cumulocity.me.rest.representation.inventory.ManagedObjectRepresentation


    public PagedCollectionResource getMeasurementsByFilter(MeasurementFilter filter) throws SDKException {
        String type = filter.getType();
        Date fromDate = filter.getFromDate();
        Date toDate = filter.getToDate();
        Class fragmentType = filter.getFragmentType();
        ManagedObjectRepresentation source = filter.getSource();

        if (source != null && fromDate != null && toDate != null && fragmentType != null && type != null) {
            return getMeasurementsBySourceAndDateAndFragmentTypeAndType(source, fromDate, toDate, fragmentType, type);
        } else if (fromDate != null && toDate != null && fragmentType != null && type != null) {
            return getMeasurementsByDateAndFragmentTypeAndType(fromDate, toDate, fragmentType, type);
View Full Code Here


        return (AlarmRepresentation) restConnector.post(getAlarmsApiRepresentation().getAlarms().getSelf(), AlarmMediaType.ALARM, representation);
    }

    public PagedCollectionResource getAlarmsByFilter(AlarmFilter alarmFilter) throws SDKException {
        CumulocityAlarmStatuses status = alarmFilter.getStatus();
        ManagedObjectRepresentation source = alarmFilter.getSource();
        Date dateFrom = alarmFilter.getFromDate();
        Date dateTo = alarmFilter.getToDate();

        Map filter = new HashMap();

        if (null != status) {
            filter.put(PARAMETER_STATUS, status.name());
        }
        if (null != source) {
            filter.put(PARAMETER_SOURCE, source.getId().getValue());
        }
        if (null != dateFrom) {
            filter.put(DATE_FROM, DateUtils.format(dateFrom));
        }
        if (null != dateTo) {
View Full Code Here

        //    Background:
        //    Given I have a platform and a tenant
        //    And I have '3' managed objects
        //    And I create all
        for (int i = 0; i < 3; ++i) {
            ManagedObjectRepresentation mo = platform.getInventoryApi().create(aSampleMo().withName("MO" + i).build());
            managedObjects.add(mo);
        }
    }
View Full Code Here

    }

    @When("I query all measurements by source '(\\d+)'")
    public void iQueryAllBySource(int index) throws SDKException {
        try {
            ManagedObjectRepresentation source = (ManagedObjectRepresentation) managedObjects.get(index);
            MeasurementFilter filter = new MeasurementFilter().bySource(source);
            collection1 = (MeasurementCollectionRepresentation) measurementApi.getMeasurementsByFilter(filter).get();
        } catch (SDKException ex) {
            status = ex.getHttpStatus();
        }
View Full Code Here

    }

    @When("I query all measurements by source '(\\d+)' and time from '([^']*)' and time to '([^']*)'")
    public void iQueryAllBySourceAndTime(int index, String from, String to) throws SDKException {
        try {
            ManagedObjectRepresentation source = (ManagedObjectRepresentation) managedObjects.get(index);
            Date fromDate = DateConverter.string2Date(from);
            Date toDate = DateConverter.string2Date(to);
            MeasurementFilter filter = new MeasurementFilter().byDate(fromDate, toDate).bySource(source);
            collection1 = (MeasurementCollectionRepresentation) measurementApi.getMeasurementsByFilter(filter).get();
        } catch (SDKException ex) {
View Full Code Here

        //        And I add child devices as per the following:
        //        | parent | child |
        //        | 0      | 1     |
        //        | 2      | 3     |

        ManagedObjectRepresentation agent = aSampleMo().withName("Agent").withType("com.cumulocity.me.rest.representation.devicecontrol.Agent").with(new Agent()).build();
        ManagedObjectRepresentation device = aSampleMo().withName("Device").withType("com.type").build();
        ManagedObjectRepresentation agent2 = aSampleMo().withName("Agent2").withType("com.cumulocity.me.rest.representation.devicecontrol.Agent").with(new Agent()).build();
        ManagedObjectRepresentation device2 = aSampleMo().withName("Device2").withType("com.type").build();

        inventoryApi = platform.getInventoryApi();

        agent = inventoryApi.create(agent);
        device = inventoryApi.create(device);
View Full Code Here

    @When("I query all measurements by source '(\\d+)' and fragment type '([^']*)'")
    public void iQueryAllBySourceAndType(int index, String fragmentType) throws SDKException, ClassNotFoundException {
        try {
            Class<?> fragmentClass = Class.forName(fragmentType);
            ManagedObjectRepresentation source = (ManagedObjectRepresentation) managedObjects.get(index);
            MeasurementFilter filter = new MeasurementFilter().byFragmentType(fragmentClass).bySource(source);
            collection1 = (MeasurementCollectionRepresentation) measurementApi.getMeasurementsByFilter(filter).get();
        } catch (SDKException ex) {
            status = ex.getHttpStatus();
        }
View Full Code Here

    @When("I query all measurements by source '(\\d+)' and fragment type '([^']*)' and time from '([^']*)' and time to '([^']*)'")
    public void iQueryAllBySourceTypeAndTime(int index, String fragmentType, String from, String to) throws SDKException,
            ClassNotFoundException {
        try {
            Class<?> fragmentClass = Class.forName(fragmentType);
            ManagedObjectRepresentation source = (ManagedObjectRepresentation) managedObjects.get(index);
            Date fromDate = DateConverter.string2Date(from);
            Date toDate = DateConverter.string2Date(to);
            MeasurementFilter filter = new MeasurementFilter().bySource(source).byDate(fromDate, toDate).byFragmentType(fragmentClass);
            collection1 = (MeasurementCollectionRepresentation) measurementApi.getMeasurementsByFilter(filter).get();
        } catch (SDKException ex) {
View Full Code Here

    private static ManagedObjectRepresentation managedObject;

    @BeforeClass
    public static void createManagedObject() throws Exception {
        ManagedObjectRepresentation mo = new ManagedObjectRepresentation();
        mo.setName("MO");

        managedObject = platform.getInventoryApi().create(mo);
    }
View Full Code Here

        result2 = new ArrayList();

        //    Given I have '3' managed objects
        //    And I create all
        for (int i = 0; i < 3; ++i) {
            ManagedObjectRepresentation mo = platform.getInventoryApi().create(aSampleMo().withName("MO" + i).build());
            managedObjects.add(mo);
        }
    }
View Full Code Here

TOP

Related Classes of com.cumulocity.me.rest.representation.inventory.ManagedObjectRepresentation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.