Examples of ItemStateListBean


Examples of org.openhab.io.cv.internal.resources.beans.ItemStateListBean

    return new BroadcastAction(ACTION.CONTINUE, message);
  }

  private Object getSingleResponseObject(ItemStateListBean stateBean,
      Item item, HttpServletRequest request) {
    ItemStateListBean responseBean;
    if (stateBean == null) {
      stateBean = new ItemStateListBean();
    }
    ItemListBean list = stateBean.stateList;

    if (item instanceof GroupItem) {
      GroupItem groupItem = (GroupItem) item;
      // get the base item
      if (groupItem.getBaseItem() != null) {
        item = groupItem.getBaseItem();
      }
    }
    list.entries.add(new JAXBElement(new QName(item.getName()),
        String.class, item.getState().toString()));

    responseBean = new ItemStateListBean(list);
    responseBean.index = System.currentTimeMillis();
    return responseBean;

  }
View Full Code Here

Examples of org.openhab.io.cv.internal.resources.beans.ItemStateListBean

    this.itemNames = itemNames;
  }

  @Override
  protected Object getResponseObject(HttpServletRequest request) {
    ItemStateListBean stateBean = getItemStateListBean(request);
    if(stateBean!=null) {
      return stateBean;
      }
    return null;
  }
View Full Code Here

Examples of org.openhab.io.cv.internal.resources.beans.ItemStateListBean

    return null;
  }

  @Override
  protected Object getSingleResponseObject(Item item, HttpServletRequest request) {
    ItemStateListBean responseBean ;
    Collection<ItemBean> beans = new LinkedList<ItemBean>();
    beans.add(new ItemBean(item.getName(), item.getState().toString()));
    responseBean = new ItemStateListBean( new ItemListBean(beans));
    responseBean.index = System.currentTimeMillis();
    return responseBean;
  }
View Full Code Here

Examples of org.openhab.io.cv.internal.resources.beans.ItemStateListBean

  private ItemStateListBean getItemStateListBean(HttpServletRequest request){
    String pathInfo = request.getPathInfo();
    String responseType = (new ResponseTypeHelper()).getResponseType(request);
    if(responseType!=null) {
      if (pathInfo.startsWith("/" +ReadResource.PATH_READ)) {
            ItemStateListBean bean = new ItemStateListBean(new ItemListBean(getItemBeans(request)));
            bean.index = System.currentTimeMillis();
        return bean;
          }
    }
    return null;
View Full Code Here

Examples of org.openhab.io.cv.internal.resources.beans.ItemStateListBean

   
    @Override
  public List<Object> retrieveFromCache(String broadcasterId,
      AtmosphereResource r) {
    List<Object> result = new ArrayList<Object>();
    ItemStateListBean response = new ItemStateListBean(new ItemListBean());
    for (Object cacheMessage : super.retrieveFromCache(broadcasterId, r)) {
      if (cacheMessage instanceof ItemStateListBean) {
        ItemStateListBean cachedStateList = (ItemStateListBean) cacheMessage;
        // add states to the response (maybe a comparison is needed here
        // so that only the last state of an item is used)
        for (JAXBElement elem : cachedStateList.stateList.entries) {
          boolean exists = false;
          for (JAXBElement responseElem : response.stateList.entries) {
View Full Code Here

Examples of org.openhab.io.cv.internal.resources.beans.ItemStateListBean

      .broadcaster(itemBroadcaster)
      .outputComments(true).build();
  }
 
  public ItemStateListBean getItemStateListBean(List<String> itemNames, long index) {
    ItemStateListBean stateList = new ItemStateListBean(new ItemListBean(getItemBeans(itemNames)));
    stateList.index = index+1;
    return stateList;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.