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


Java Thing类代码示例

本文整理汇总了Java中de.fraunhofer.iosb.ilt.sta.model.Thing的典型用法代码示例。如果您正苦于以下问题:Java Thing类的具体用法?Java Thing怎么用?Java Thing使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: create

import de.fraunhofer.iosb.ilt.sta.model.Thing; //导入依赖的package包/类
@Override
public Thing create(Tuple tuple, Query query, DataSize dataSize) {
    Set<Property> select = query == null ? Collections.emptySet() : query.getSelect();

    Thing entity = new Thing();
    entity.setName(tuple.get(qInstance.name));
    entity.setDescription(tuple.get(qInstance.description));

    UUID id = tuple.get(qInstance.id);
    if (id != null) {
        entity.setId(new UuidId(tuple.get(qInstance.id)));
    }

    if (select.isEmpty() || select.contains(EntityProperty.Properties)) {
        String props = tuple.get(qInstance.properties);
        dataSize.increase(props == null ? 0 : props.length());
        entity.setProperties(jsonToObject(props, Map.class));
    }

    return entity;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:22,代码来源:PropertyHelper.java

示例2: create

import de.fraunhofer.iosb.ilt.sta.model.Thing; //导入依赖的package包/类
@Override
public Thing create(Tuple tuple, Query query, DataSize dataSize) {
    Set<Property> select = query == null ? Collections.emptySet() : query.getSelect();

    Thing entity = new Thing();
    entity.setName(tuple.get(qInstance.name));
    entity.setDescription(tuple.get(qInstance.description));

    Long id = tuple.get(qInstance.id);
    if (id != null) {
        entity.setId(new LongId(tuple.get(qInstance.id)));
    }

    if (select.isEmpty() || select.contains(EntityProperty.Properties)) {
        String props = tuple.get(qInstance.properties);
        dataSize.increase(props == null ? 0 : props.length());
        entity.setProperties(jsonToObject(props, Map.class));
    }

    return entity;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:22,代码来源:PropertyHelper.java

示例3: build

import de.fraunhofer.iosb.ilt.sta.model.Thing; //导入依赖的package包/类
@Override
public Thing build() {
    Thing thing = new Thing(
            id,
            selfLink,
            navigationLink,
            name,
            description,
            properties,
            locations,
            historicalLocations,
            datastreams,
            multiDatastreams);
    thing.setExportObject(isExportObject());
    return thing;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:17,代码来源:ThingBuilder.java

示例4: readLocation_WithLinkedThings_Success

import de.fraunhofer.iosb.ilt.sta.model.Thing; //导入依赖的package包/类
@Test
public void readLocation_WithLinkedThings_Success() throws IOException {
    String json = "{\n"
            + "    \"name\": \"my backyard\",\n"
            + "    \"description\": \"my backyard\",\n"
            + "    \"encodingType\": \"application/vnd.geo+json\",\n"
            + "    \"location\": {\n"
            + "        \"type\": \"Point\",\n"
            + "        \"coordinates\": [-117.123,\n"
            + "        54.123]\n"
            + "    },"
            + "    \"Things\":[{\"@iot.id\":100}]\n"
            + "}";
    Thing thing = new ThingBuilder().setId(new LongId(100)).build();
    EntitySet<Thing> things = new EntitySetImpl<>(EntityType.Thing);
    things.add(thing);
    Location expectedResult = new LocationBuilder()
            .setName("my backyard")
            .setDescription("my backyard")
            .setEncodingType("application/vnd.geo+json")
            .setLocation(TestHelper.getPoint(-117.123, 54.123))
            .setThings(things)
            .build();
    assertEquals(expectedResult, entityParser.parseLocation(json));
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:26,代码来源:EntityParserTest.java

示例5: readThing_Basic_Success

import de.fraunhofer.iosb.ilt.sta.model.Thing; //导入依赖的package包/类
@Test
public void readThing_Basic_Success() throws IOException {
    String json = "{\n"
            + "    \"name\": \"camping lantern\",\n"
            + "    \"description\": \"camping lantern\",\n"
            + "    \"properties\": {\n"
            + "        \"property1\": \"it’s waterproof\",\n"
            + "        \"property2\": \"it glows in the dark\",\n"
            + "        \"property3\": \"it repels insects\"\n"
            + "    }\n"
            + "}";
    Thing expectedResult = new ThingBuilder()
            .setName("camping lantern")
            .setDescription("camping lantern")
            .addProperty("property1", "it’s waterproof")
            .addProperty("property2", "it glows in the dark")
            .addProperty("property3", "it repels insects")
            .build();
    assertEquals(expectedResult, entityParser.parseThing(json));
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:21,代码来源:EntityParserTest.java

示例6: readThing_WithAllValuesPresent_Success

import de.fraunhofer.iosb.ilt.sta.model.Thing; //导入依赖的package包/类
@Test
public void readThing_WithAllValuesPresent_Success() throws IOException {
    String json = "{\n"
            + "    \"name\": \"camping lantern\",\n"
            + "    \"description\": \"camping lantern\",\n"
            + "    \"properties\": {\n"
            + "        \"property1\": \"it’s waterproof\",\n"
            + "        \"property2\": \"it glows in the dark\",\n"
            + "        \"property3\": \"it repels insects\"\n"
            + "    }\n"
            + "}";
    Thing result = entityParser.parseThing(json);
    assert (result.isSetName()
            && result.isSetDescription()
            && result.isSetProperties());
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:17,代码来源:EntityParserTest.java

示例7: readThing_WithNestedProperties_Success

import de.fraunhofer.iosb.ilt.sta.model.Thing; //导入依赖的package包/类
@Test
public void readThing_WithNestedProperties_Success() throws IOException {
    String json = "{\n"
            + "    \"name\": \"camping lantern\",\n"
            + "    \"description\": \"camping lantern\",\n"
            + "    \"properties\": {\n"
            + "        \"property1\": \"it’s waterproof\",\n"
            + "        \"property2\": \"it glows in the dark\",\n"
            + "        \"property3\": {\n"
            + "			\"someNestedProperty\": 10,\n"
            + "			\"someOtherNestedProperty\": \"someValue\"\n"
            + "		} 		\n"
            + "    }\n"
            + "}";
    Map<String, Object> property3 = new HashMap<>();
    property3.put("someNestedProperty", 10);
    property3.put("someOtherNestedProperty", "someValue");
    Thing expectedResult = new ThingBuilder()
            .setName("camping lantern")
            .setDescription("camping lantern")
            .addProperty("property1", "it’s waterproof")
            .addProperty("property2", "it glows in the dark")
            .addProperty("property3", property3)
            .build();
    assertEquals(expectedResult, entityParser.parseThing(json));
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:27,代码来源:EntityParserTest.java

示例8: create

import de.fraunhofer.iosb.ilt.sta.model.Thing; //导入依赖的package包/类
@Override
public Thing create(Tuple tuple, Query query, DataSize dataSize) {
    Set<Property> select = query == null ? Collections.emptySet() : query.getSelect();

    Thing entity = new Thing();
    entity.setName(tuple.get(qInstance.name));
    entity.setDescription(tuple.get(qInstance.description));

    String id = tuple.get(qInstance.id);
    if (id != null) {
        entity.setId(new StringId(tuple.get(qInstance.id)));
    }

    if (select.isEmpty() || select.contains(EntityProperty.Properties)) {
        String props = tuple.get(qInstance.properties);
        dataSize.increase(props == null ? 0 : props.length());
        entity.setProperties(jsonToObject(props, Map.class));
    }

    return entity;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:22,代码来源:PropertyHelper.java

示例9: getAllThings

import de.fraunhofer.iosb.ilt.sta.model.Thing; //导入依赖的package包/类
public Iterator<Thing> getAllThings() {
    List<Thing> result = new ArrayList<>();
    try {
        EntityList<Thing> list = service.things().query().list();
        return list.fullIterator();
    } catch (ServiceFailureException ex) {
        LOGGER.error("Failed to fetch things.", ex);
        return null;
    }
}
 
开发者ID:hylkevds,项目名称:SensorThingsProcessor,代码行数:11,代码来源:Service.java

示例10: getPane

import de.fraunhofer.iosb.ilt.sta.model.Thing; //导入依赖的package包/类
public static <T extends Entity<T>> Node getPane(SensorThingsService service, EntityType type, T entity, boolean showNavProps) throws IOException {
    if (entity != null && entity.getType() != type) {
        throw new IllegalArgumentException("Entity must have given type or be null.");
    }
    switch (type) {
        case DATASTREAM:
            return getDatastreamPane(service, (Datastream) entity, showNavProps);

        case FEATURE_OF_INTEREST:
            return getFeatureOfInterestPane(service, (FeatureOfInterest) entity, showNavProps);

        case HISTORICAL_LOCATION:
            return getHistoricalLocationPane(service, (HistoricalLocation) entity, showNavProps);

        case LOCATION:
            return getLocationPane(service, (Location) entity, showNavProps);

        case MULTIDATASTREAM:
            return getMultiDatastreamPane(service, (MultiDatastream) entity, showNavProps);

        case OBSERVATION:
            return getObservationPane(service, (Observation) entity, showNavProps);

        case OBSERVED_PROPERTY:
            return getObsPropPane(service, (ObservedProperty) entity, showNavProps);

        case SENSOR:
            return getSensorPane(service, (Sensor) entity, showNavProps);

        case THING:
            return getThingPane(service, (Thing) entity, showNavProps);

    }
    return null;
}
 
开发者ID:hylkevds,项目名称:SensorThingsManager,代码行数:36,代码来源:FactoryEntityPanel.java

示例11: getThingPane

import de.fraunhofer.iosb.ilt.sta.model.Thing; //导入依赖的package包/类
public static Node getThingPane(SensorThingsService service, Thing entity, boolean showNavProps) throws IOException {
    FXMLLoader loader = new FXMLLoader(FactoryEntityPanel.class.getResource(ENTITY_PANE_FXML));
    Pane content = (Pane) loader.load();
    ControllerEntity<Thing> controller = loader.<ControllerEntity<Thing>>getController();
    controller.setEntity(service, entity, new EntityGuiController.GuiControllerThing(), showNavProps);
    return content;
}
 
开发者ID:hylkevds,项目名称:SensorThingsManager,代码行数:8,代码来源:FactoryEntityPanel.java

示例12: thingFromId

import de.fraunhofer.iosb.ilt.sta.model.Thing; //导入依赖的package包/类
private static Thing thingFromId(UUID id) {
    if (id == null) {
        return null;
    }
    Thing thing = new Thing();
    thing.setId(new UuidId(id));
    thing.setExportObject(false);
    return thing;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:10,代码来源:PropertyHelper.java

示例13: insertHistoricalLocation

import de.fraunhofer.iosb.ilt.sta.model.Thing; //导入依赖的package包/类
public boolean insertHistoricalLocation(HistoricalLocation h) throws NoSuchEntityException, IncompleteEntityException {
    Thing t = h.getThing();
    entityExistsOrCreate(t);

    SQLQueryFactory qFactory = pm.createQueryFactory();
    QHistLocations qhl = QHistLocations.histLocations;
    SQLInsertClause insert = qFactory.insert(qhl);
    insert.set(qhl.time, new Timestamp(h.getTime().getDateTime().getMillis()));
    insert.set(qhl.thingId, (UUID) h.getThing().getId().getValue());

    UUID generatedId = insert.executeWithKey(qhl.id);
    LOGGER.info("Inserted HistoricalLocation. Created id = {}.", generatedId);
    h.setId(new UuidId(generatedId));

    EntitySet<Location> locations = h.getLocations();
    for (Location l : locations) {
        entityExistsOrCreate(l);
        UUID lId = (UUID) l.getId().getValue();
        QLocationsHistLocations qlhl = QLocationsHistLocations.locationsHistLocations;
        insert = qFactory.insert(qlhl);
        insert.set(qlhl.histLocationId, generatedId);
        insert.set(qlhl.locationId, lId);
        insert.execute();
        LOGGER.debug("Linked Location {} to HistoricalLocation {}.", lId, generatedId);
    }
    return true;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:28,代码来源:EntityInserter.java

示例14: thingFromId

import de.fraunhofer.iosb.ilt.sta.model.Thing; //导入依赖的package包/类
private static Thing thingFromId(Long id) {
    if (id == null) {
        return null;
    }
    Thing thing = new Thing();
    thing.setId(new LongId(id));
    thing.setExportObject(false);
    return thing;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:10,代码来源:PropertyHelper.java

示例15: insertHistoricalLocation

import de.fraunhofer.iosb.ilt.sta.model.Thing; //导入依赖的package包/类
public boolean insertHistoricalLocation(HistoricalLocation h) throws NoSuchEntityException, IncompleteEntityException {
    Thing t = h.getThing();
    entityExistsOrCreate(t);

    SQLQueryFactory qFactory = pm.createQueryFactory();
    QHistLocations qhl = QHistLocations.histLocations;
    SQLInsertClause insert = qFactory.insert(qhl);
    insert.set(qhl.time, new Timestamp(h.getTime().getDateTime().getMillis()));
    insert.set(qhl.thingId, (Long) h.getThing().getId().getValue());

    Long generatedId = insert.executeWithKey(qhl.id);
    LOGGER.info("Inserted HistoricalLocation. Created id = {}.", generatedId);
    h.setId(new LongId(generatedId));

    EntitySet<Location> locations = h.getLocations();
    for (Location l : locations) {
        entityExistsOrCreate(l);
        Long lId = (Long) l.getId().getValue();
        QLocationsHistLocations qlhl = QLocationsHistLocations.locationsHistLocations;
        insert = qFactory.insert(qlhl);
        insert.set(qlhl.histLocationId, generatedId);
        insert.set(qlhl.locationId, lId);
        insert.execute();
        LOGGER.debug("Linked Location {} to HistoricalLocation {}.", lId, generatedId);
    }
    return true;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:28,代码来源:EntityInserter.java


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