use of org.eclipse.smarthome.model.items.ItemModel in project smarthome by eclipse.
the class GenericItemProvider method getItemsFromModel.
private Collection<Item> getItemsFromModel(String modelName) {
logger.debug("Read items from model '{}'", modelName);
List<Item> items = new ArrayList<Item>();
if (modelRepository != null) {
ItemModel model = (ItemModel) modelRepository.getModel(modelName);
if (model != null) {
for (ModelItem modelItem : model.getItems()) {
Item item = createItemFromModelItem(modelItem);
if (item != null) {
for (String groupName : modelItem.getGroups()) {
((GenericItem) item).addGroupName(groupName);
}
items.add(item);
}
}
}
}
return items;
}
Aggregations