Package com.ibm.sbt.services.client.base.datahandlers

Examples of com.ibm.sbt.services.client.base.datahandlers.XmlDataHandler


   * @param data
   * @param namespaceCtx
   * @param xpathExpression
   */
  public AtomEntity(BaseService service, Node node, NamespaceContext namespaceCtx, XPathExpression xpathExpression) {
    super(service, new XmlDataHandler(node, namespaceCtx, xpathExpression));
  }
View Full Code Here


   * Set the data for the entity from the specified response.
   *
   * @param response
   */
  public void setData(Node node, NamespaceContext namespaceCtx, XPathExpression xpathExpression) {
    dataHandler = new XmlDataHandler(node, namespaceCtx, xpathExpression);
  }   
View Full Code Here

    public Person getAuthor() {
      if (fields.containsKey(AtomXPath.author.getName())) {
      return (Person)fields.get(AtomXPath.author.getName());
    }
    if (dataHandler != null){
        return new Person(getService(), new XmlDataHandler((Node)this.getDataHandler().getData(),
            ConnectionsConstants.nameSpaceCtx, (XPathExpression)AtomXPath.author.getPath()));
    }
    return null;
    }
View Full Code Here

    public Person getContributor() {
      if (fields.containsKey(AtomXPath.contributor.getName())) {
      return (Person)fields.get(AtomXPath.contributor.getName());
    }
    if (dataHandler != null){
        return new Person(getService(), new XmlDataHandler((Node)this.getDataHandler().getData(),
            ConnectionsConstants.nameSpaceCtx, (XPathExpression)AtomXPath.contributor.getPath()));
    }
    return null;
    }
View Full Code Here

   *
   * @return
   * @throws XMLException
   */
  public String toXmlString() throws XMLException {
    XmlDataHandler dataHandler = (XmlDataHandler)getDataHandler();
    if (dataHandler != null && dataHandler.getData() != null) {
      return DOMUtil.getXMLString(dataHandler.getData());
    }
    return null;
  }
View Full Code Here

 
  /**
   * Create a link to from the specified node
   */
  protected Link createLink(Node node, FieldEntry fieldEntry) {
    XmlDataHandler dataHandler = new XmlDataHandler(node, ConnectionsConstants.nameSpaceCtx, (XPathExpression)fieldEntry.getPath());
    if (dataHandler.getData() != null) {
      return new Link(getService(), dataHandler);
    }
    return null;
  }
View Full Code Here

    String output = "";
    if (entity==null) return output;
    DataHandler<?> dataHandler = entity.getDataHandler();
    if (dataHandler!=null) {
      if (dataHandler instanceof XmlDataHandler) {
        XmlDataHandler handler = (XmlDataHandler)dataHandler;
          output = xmlToString(handler.getData());
      }
    }
    return output;
  }
View Full Code Here

  @Test
  public void testFields() throws XMLException, IOException {
    Node doc = readXml("fields.xml");
       
    XmlDataHandler dataHandler = new XmlDataHandler(doc, nameSpaceCtx);
    List<Node> nodeFields = dataHandler.getEntries(ActivityXPath.entry_field);
    List<Field> fields = new ArrayList<Field>();
    for (Node node : nodeFields) {
      XPathExpression xpath = (node instanceof Document) ? (XPathExpression)ActivityXPath.field.getPath() : null;
     
      XPathExpression fieldType = ActivityXPath.field_type.getPath();
View Full Code Here

   
  @Test
  public void testActivityFeed() throws XMLException, IOException {
    Node doc = readXml("activities.xml");
   
    XmlDataHandler dataHandler = new XmlDataHandler(doc, nameSpaceCtx);
    List<Node> nodeEntries = dataHandler.getEntries(ConnectionsFeedXpath.Entry);
    List<Activity> activities = new ArrayList<Activity>();
    for (Node node : nodeEntries) {
      XPathExpression xpath = (node instanceof Document) ? (XPathExpression)AtomXPath.singleEntry.getPath() : null;
      activities.add(new Activity(activityService, node, nameSpaceCtx, xpath));
    }
View Full Code Here

        Member member = activity.addMember(Member.TYPE_PERSON, email, Member.ROLE_OWNER);
        long durationAdd = System.currentTimeMillis() - startAdd;
       
        long startRead = System.currentTimeMillis();
        EntityList<Member> members = activity.getMembers();
        XmlDataHandler dataHandler = new XmlDataHandler((Document)members.getData(), ConnectionsConstants.nameSpaceCtx);
        long durationRead = System.currentTimeMillis() - startRead;
       
        System.out.println(email+","+durationAdd+","+durationRead);
      } catch (Exception ignore) {
      }
View Full Code Here

TOP

Related Classes of com.ibm.sbt.services.client.base.datahandlers.XmlDataHandler

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.