Package org.onesocialweb.xml.dom4j

Examples of org.onesocialweb.xml.dom4j.ElementAdapter


        final ActivityDomReader reader = new PersistentActivityDomReader();
        List<Element> items=(List<Element>) itemsElement.elements("item");
        if ((items!=null) && (items.size()!=0)){
          for (Element itemElement :items) {
            ActivityEntry activity = reader
            .readEntry(new ElementAdapter(itemElement
                .element("entry")));
            try {

              ActivityManager.getInstance().handleMessage(
                  fromJID.toBareJID(), toJID.toBareJID(),
                  activity);             
             
            } catch (InvalidActivityException e) {
              throw new PacketRejectedException();
            } catch (AccessDeniedException e) {
              throw new PacketRejectedException();
            }
          }
        } else if (itemsElement.element("retract")!=null)
        {         
          Element retractElement = itemsElement.element("retract");
          String activityId=reader.readActivityId(new ElementAdapter(retractElement));
          ActivityManager.getInstance().deleteMessage(activityId);
        }
        Set<JID> recipientFullJIDs = getFullJIDs(toJID
            .toBareJID());
        Iterator<JID> it = recipientFullJIDs.iterator();
        Message extendedMessage = message.createCopy();
        while (it.hasNext()) {
          String fullJid = it.next().toString();
          extendedMessage.setTo(fullJid);
          server.getMessageRouter().route(extendedMessage);
        }
        throw new PacketRejectedException();
      }
     
      // or a relation event
      else if (itemsElement.attribute("node").getValue().equals(
          RelationManager.NODE)) {
        final RelationDomReader reader = new PersistentRelationDomReader();
        for (Element itemElement : (List<Element>) itemsElement
            .elements("item")) {
          Relation relation = reader.readElement(new ElementAdapter(
              itemElement.element("relation")));
          try {
            RelationManager.getInstance().handleMessage(
                fromJID.toBareJID(), toJID.toBareJID(),
                relation);
View Full Code Here


      ActivityDomReader reader = new PersistentActivityDomReader();
      List<String> itemIds = new ArrayList<String>(items.size());
      for (Element item : items) {
        Element entry = item.element("entry");
        if (entry != null) {
          ActivityEntry activity = reader.readEntry(new ElementAdapter(entry));
          Log.debug("ActivityPublishHandler received activity: " + activity);
          try {
            if ((activity.getId()!=null) && (activity.getId().length()!=0))
              activityManager.updateActivity(sender.toBareJID(), activity);
            else{
View Full Code Here

     
      ActivityDomReader reader = new PersistentActivityDomReader();
      Element pubsubElement = packet.getChildElement();
      Element retractElement = pubsubElement.element("retract");
      Element item = (Element)retractElement.elements("item").get(0);
      String activityId=reader.readActivityId(new ElementAdapter(item));
     
      if ((activityId==null) || (activityId.length()==0)){           
          IQ result = IQ.createResultIQ(packet);
          result.setChildElement(packet.getChildElement().createCopy());
          result.setError(PacketError.Condition.item_not_found);
View Full Code Here

      }

      // Parse the relation
      RelationDomReader reader = new PersistentRelationDomReader();
      Element e_entry = i_entry.next();
      PersistentRelation relation = (PersistentRelation) reader.readElement(new ElementAdapter(e_entry));
      Log.debug("IQRelationUpdate received request: " + relation);
     
      // Setup the relation (this will also trigger the notification to the user)
      relationManager.updateRelation(sender.toBareJID(), relation);
View Full Code Here

      }

      // Parse the relation
      RelationDomReader reader = new PersistentRelationDomReader();
      Element e_entry = i_entry.next();
      PersistentRelation relation = (PersistentRelation) reader.readElement(new ElementAdapter(e_entry));
      Log.debug("IQRelationSetup received request: " + relation);
     
      // Setup the relation (this will also trigger the notification to the user)
      relationManager.setupRelation(sender.toBareJID(), relation);
View Full Code Here

        return result;
      }

      // Parse the profile
      VCard4DomReader reader = new PersistentVCard4DomReader();
      Profile profile = reader.readProfile(new ElementAdapter(e_profile));
     
      // Commit the profile (this will also trigger the messages)
      try {
        ProfileManager.getInstance().publishProfile(sender.toBareJID(), profile);
      } catch (UserNotFoundException e) {
View Full Code Here

TOP

Related Classes of org.onesocialweb.xml.dom4j.ElementAdapter

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.