Esempio n. 1
0
  /**
   * Converts the serialized xml back to a ChatChannel object
   *
   * @param channelElement
   * @return the Channel
   */
  public static ChatChannel xmlToChatChannel(Element channelElement, String siteId) {
    ChatChannel tmpChannel = new ChatChannel();
    // tmpChannel.setContext(channelElement.getAttribute("context"));
    tmpChannel.setContext(siteId);

    if (siteId.equalsIgnoreCase(channelElement.getAttribute("context"))) {
      // If importing into the same site, keep the id.  We should get an update instead of saving a
      // new one.
      tmpChannel.setId(channelElement.getAttribute("id"));
    }
    tmpChannel.setDescription(channelElement.getAttribute("description"));
    tmpChannel.setTitle(channelElement.getAttribute("title"));
    tmpChannel.setCreationDate(
        new Date(Long.parseLong(channelElement.getAttribute("creationDate"))));
    tmpChannel.setFilterType(channelElement.getAttribute("filterType"));
    tmpChannel.setFilterParam(Integer.parseInt(channelElement.getAttribute("filterParam")));
    tmpChannel.setPlacementDefaultChannel(
        Boolean.parseBoolean(channelElement.getAttribute("placementDefaultChannel")));

    return tmpChannel;
  }