Package org.openhab.io.rest.internal.resources.beans

Examples of org.openhab.io.rest.internal.resources.beans.ItemBean


        throw new WebApplicationException(404);
      }
  }

    public static ItemBean createItemBean(Item item, boolean drillDown, String uriPath) {
      ItemBean bean;
      if(item instanceof GroupItem && drillDown) {
        GroupItem groupItem = (GroupItem) item;
        GroupItemBean groupBean = new GroupItemBean();
        Collection<ItemBean> members = new HashSet<ItemBean>();
        for(Item member : groupItem.getMembers()) {
          members.add(createItemBean(member, false, uriPath));
        }
        groupBean.members = members.toArray(new ItemBean[members.size()]);
        bean = groupBean;
      } else {
         bean = new ItemBean();
      }
      bean.name = item.getName();
      bean.state = item.getState().toString();
      bean.type = item.getClass().getSimpleName();
      bean.link = UriBuilder.fromUri(uriPath).path(ItemResource.PATH_ITEMS).path(bean.name).build().toASCIIString();
View Full Code Here

TOP

Related Classes of org.openhab.io.rest.internal.resources.beans.ItemBean

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.