Package org.simpleframework.xml.stream

Examples of org.simpleframework.xml.stream.InputNode


    StringWriter sw = new StringWriter();
    Transformer xformer = TransformerFactory.newInstance().newTransformer();
        xformer.transform(new DOMSource(doc), new StreamResult(sw));
       
    List<User> list = new ArrayList<User>();
    InputNode root = NodeBuilder.read(new StringReader(sw.toString()));
    InputNode root1 = NodeBuilder.read(new StringReader(sw.toString())); //HACK to handle Address inside user
    InputNode listNode = root.getNext();
    InputNode listNode1 = root1.getNext(); //HACK to handle Address inside user
    if (listNodeName.equals(listNode.getName())) {
      InputNode item = listNode.getNext();
      InputNode item1 = listNode1.getNext(); //HACK to handle Address inside user
      while (item != null) {
        User u = ser.read(User.class, item, false);
       
        //HACK to handle Address inside user
        if (u.getAdresses() == null) {
          Address a = ser.read(Address.class, item1, false);
          u.setAdresses(a);
        }
        list.add(u);
        item = listNode.getNext();
        do {
          item1 = listNode1.getNext(); //HACK to handle Address inside user
        } while (item != null && !"user".equals(item1.getName()));
      }
    }
    return list;
  }
View Full Code Here


        log.debug(msg);
      } else {
        throw new Exception(msg);
      }
    } else {
      InputNode root = NodeBuilder.read(new FileInputStream(xml));
      InputNode listNode = root.getNext();
      if (listNodeName.equals(listNode.getName())) {
        InputNode item = listNode.getNext();
        while (item != null) {
          T o = ser.read(clazz, item, false);
          list.add(o);
          item = listNode.getNext();
        }
View Full Code Here

    StringWriter sw = new StringWriter();
    Transformer xformer = TransformerFactory.newInstance().newTransformer();
        xformer.transform(new DOMSource(doc), new StreamResult(sw));
       
    List<MeetingMember> list = new ArrayList<MeetingMember>();
    InputNode root = NodeBuilder.read(new StringReader(sw.toString()));
    InputNode root1 = NodeBuilder.read(new StringReader(sw.toString())); //HACK to handle external attendee's firstname, lastname, email
    InputNode listNode = root.getNext();
    InputNode listNode1 = root1.getNext(); //HACK to handle external attendee's firstname, lastname, email
    if (listNodeName.equals(listNode.getName())) {
      InputNode item = listNode.getNext();
      InputNode item1 = listNode1.getNext(); //HACK to handle external attendee's firstname, lastname, email
      while (item != null) {
        MeetingMember mm = ser.read(MeetingMember.class, item, false);

        boolean needToSkip1 = true;
        if (mm.getUser() == null) {
          mm.setUser(new User());
        }
        if (mm.getUser().getUser_id() == null) {
          //HACK to handle external attendee's firstname, lastname, email
          boolean contactValid = false;
          do {
            if (Type.contact == mm.getUser().getType() && "firstname".equals(item1.getName())) {
              mm.getUser().setFirstname(item1.getValue());
            }
            if (Type.contact == mm.getUser().getType() && "lastname".equals(item1.getName())) {
              mm.getUser().setLastname(item1.getValue());
            }
            if ("email".equals(item1.getName())) {
              String email = item1.getValue();
              if (mm.getAppointment() != null && mm.getAppointment().getOwner() != null) {
                mm.setUser(usersDao.getContact(email, mm.getAppointment().getOwner()));
              }
              contactValid = true;
            }
            item1 = listNode1.getNext(); //HACK to handle old om_time_zone
          } while (item1 != null && !"meetingmember".equals(item1.getName()));
          if (!contactValid) {
            mm = null;
          }
          needToSkip1 = false;
        }
        if (needToSkip1) {
          do {
            item1 = listNode1.getNext(); //HACK to handle Address inside user
          } while (item1 != null && !"meetingmember".equals(item1.getName()));
        }
        item = listNode.getNext();
        if (mm != null && !mm.isDeleted() && mm.getUser() != null && mm.getAppointment() != null && mm.getAppointment().getId() != null) {
          mm.setId(null);
          list.add(mm);
View Full Code Here

    StringWriter sw = new StringWriter();
    Transformer xformer = TransformerFactory.newInstance().newTransformer();
        xformer.transform(new DOMSource(doc), new StreamResult(sw));
       
    List<User> list = new ArrayList<User>();
    InputNode root = NodeBuilder.read(new StringReader(sw.toString()));
    InputNode root1 = NodeBuilder.read(new StringReader(sw.toString())); //HACK to handle Address inside user
    InputNode root2 = NodeBuilder.read(new StringReader(sw.toString())); //HACK to handle old om_time_zone, level_id, status
    InputNode listNode = root.getNext();
    InputNode listNode1 = root1.getNext(); //HACK to handle Address inside user
    InputNode listNode2 = root2.getNext(); //HACK to handle old om_time_zone
    if (listNodeName.equals(listNode.getName())) {
      InputNode item = listNode.getNext();
      InputNode item1 = listNode1.getNext(); //HACK to handle Address inside user
      InputNode item2 = listNode2.getNext(); //HACK to handle old om_time_zone, level_id, status
      while (item != null) {
        User u = ser.read(User.class, item, false);
       
        boolean needToSkip1 = true;
        //HACK to handle Address inside user
        if (u.getAdresses() == null) {
          Address a = ser.read(Address.class, item1, false);
          u.setAdresses(a);
          needToSkip1 = false;
        }
        if (needToSkip1) {
          do {
            item1 = listNode1.getNext(); //HACK to handle Address inside user
          } while (item1 != null && !"user".equals(item1.getName()));
        }
        String level_id = null, status = null;
        do {
          if (u.getTimeZoneId() == null && "omTimeZone".equals(item2.getName())) {
            String jName = item2.getValue();
            u.setTimeZoneId(jName == null ? null : tzUtil.getTimezoneByInternalJName(jName).getID());
          }
          if ("level_id".equals(item2.getName())) {
            level_id = item2.getValue();
          }
          if ("status".equals(item2.getName())) {
            status = item2.getValue();
          }
          item2 = listNode2.getNext(); //HACK to handle old om_time_zone, level_id, status
        } while (item2 != null && !"user".equals(item2.getName()));
        if (u.getRights().isEmpty()) {
          u.getRights().add(Right.Room);
          if ("1".equals(status)) {
            u.getRights().add(Right.Dashboard);
            u.getRights().add(Right.Login);
View Full Code Here

        log.debug(msg);
      } else {
        throw new Exception(msg);
      }
    } else {
      InputNode root = NodeBuilder.read(new FileInputStream(xml));
      InputNode listNode = root.getNext();
      if (listNodeName.equals(listNode.getName())) {
        InputNode item = listNode.getNext();
        while (item != null) {
          T o = ser.read(clazz, item, false);
          list.add(o);
          item = listNode.getNext();
        }
View Full Code Here

    StringWriter sw = new StringWriter();
    Transformer xformer = TransformerFactory.newInstance().newTransformer();
        xformer.transform(new DOMSource(doc), new StreamResult(sw));
       
    List<User> list = new ArrayList<User>();
    InputNode root = NodeBuilder.read(new StringReader(sw.toString()));
    InputNode root1 = NodeBuilder.read(new StringReader(sw.toString())); //HACK to handle Address inside user
    InputNode listNode = root.getNext();
    InputNode listNode1 = root1.getNext(); //HACK to handle Address inside user
    if (listNodeName.equals(listNode.getName())) {
      InputNode item = listNode.getNext();
      InputNode item1 = listNode1.getNext(); //HACK to handle Address inside user
      while (item != null) {
        User u = ser.read(User.class, item, false);
       
        //HACK to handle Address inside user
        if (u.getAdresses() == null) {
          Address a = ser.read(Address.class, item1, false);
          u.setAdresses(a);
        }
        list.add(u);
        item = listNode.getNext();
        do {
          item1 = listNode1.getNext(); //HACK to handle Address inside user
        } while (item != null && !"user".equals(item1.getName()));
      }
    }
    return list;
  }
View Full Code Here

        log.debug(msg);
      } else {
        throw new Exception(msg);
      }
    } else {
      InputNode root = NodeBuilder.read(new FileInputStream(xml));
      InputNode listNode = root.getNext();
      if (listNodeName.equals(listNode.getName())) {
        InputNode item = listNode.getNext();
        while (item != null) {
          T o = ser.read(clazz, item, false);
          list.add(o);
          item = listNode.getNext();
        }
View Full Code Here

    StringWriter sw = new StringWriter();
    Transformer xformer = TransformerFactory.newInstance().newTransformer();
        xformer.transform(new DOMSource(doc), new StreamResult(sw));
       
    List<MeetingMember> list = new ArrayList<MeetingMember>();
    InputNode root = NodeBuilder.read(new StringReader(sw.toString()));
    InputNode root1 = NodeBuilder.read(new StringReader(sw.toString())); //HACK to handle external attendee's firstname, lastname, email
    InputNode listNode = root.getNext();
    InputNode listNode1 = root1.getNext(); //HACK to handle external attendee's firstname, lastname, email
    if (listNodeName.equals(listNode.getName())) {
      InputNode item = listNode.getNext();
      InputNode item1 = listNode1.getNext(); //HACK to handle external attendee's firstname, lastname, email
      while (item != null) {
        MeetingMember mm = ser.read(MeetingMember.class, item, false);

        boolean needToSkip1 = true;
        if (mm.getUser() == null) {
          mm.setUser(new User());
        }
        if (mm.getUser().getUser_id() == null) {
          //HACK to handle external attendee's firstname, lastname, email
          boolean contactValid = false;
          do {
            if (Type.contact == mm.getUser().getType() && "firstname".equals(item1.getName())) {
              mm.getUser().setFirstname(item1.getValue());
            }
            if (Type.contact == mm.getUser().getType() && "lastname".equals(item1.getName())) {
              mm.getUser().setLastname(item1.getValue());
            }
            if ("email".equals(item1.getName())) {
              String email = item1.getValue();
              if (mm.getAppointment() != null && mm.getAppointment().getOwner() != null) {
                mm.setUser(usersDao.getContact(email, mm.getAppointment().getOwner()));
              }
              contactValid = true;
            }
            item1 = listNode1.getNext(); //HACK to handle old om_time_zone
          } while (item1 != null && !"meetingmember".equals(item1.getName()));
          if (!contactValid) {
            mm = null;
          }
          needToSkip1 = false;
        }
        if (needToSkip1) {
          do {
            item1 = listNode1.getNext(); //HACK to handle Address inside user
          } while (item1 != null && !"meetingmember".equals(item1.getName()));
        }
        item = listNode.getNext();
        if (mm != null && !mm.isDeleted() && mm.getUser() != null && mm.getAppointment() != null && mm.getAppointment().getId() != null) {
          mm.setId(null);
          list.add(mm);
View Full Code Here

    StringWriter sw = new StringWriter();
    Transformer xformer = TransformerFactory.newInstance().newTransformer();
        xformer.transform(new DOMSource(doc), new StreamResult(sw));
       
    List<User> list = new ArrayList<User>();
    InputNode root = NodeBuilder.read(new StringReader(sw.toString()));
    InputNode root1 = NodeBuilder.read(new StringReader(sw.toString())); //HACK to handle Address inside user
    InputNode root2 = NodeBuilder.read(new StringReader(sw.toString())); //HACK to handle old om_time_zone
    InputNode listNode = root.getNext();
    InputNode listNode1 = root1.getNext(); //HACK to handle Address inside user
    InputNode listNode2 = root2.getNext(); //HACK to handle old om_time_zone
    if (listNodeName.equals(listNode.getName())) {
      InputNode item = listNode.getNext();
      InputNode item1 = listNode1.getNext(); //HACK to handle Address inside user
      InputNode item2 = listNode2.getNext(); //HACK to handle old om_time_zone
      while (item != null) {
        User u = ser.read(User.class, item, false);
       
        boolean needToSkip1 = true;
        //HACK to handle Address inside user
        if (u.getAdresses() == null) {
          Address a = ser.read(Address.class, item1, false);
          u.setAdresses(a);
          needToSkip1 = false;
        }
        if (needToSkip1) {
          do {
            item1 = listNode1.getNext(); //HACK to handle Address inside user
          } while (item1 != null && !"user".equals(item1.getName()));
        }
        do {
          if (u.getTimeZoneId() == null && "omTimeZone".equals(item2.getName())) {
            String jName = item2.getValue();
            u.setTimeZoneId(jName == null ? null : tzUtil.getTimezoneByInternalJName(jName).getID());
          }
          item2 = listNode2.getNext(); //HACK to handle old om_time_zone
        } while (item2 != null && !"user".equals(item2.getName()));
        // check that email is unique
        if (u.getAdresses() != null && u.getAdresses().getEmail() != null) {
          if (userEmailMap.containsKey(u.getAdresses().getEmail())) {
            log.warn("Email is dublicated for user " + u.toString());
            String updateEmail = "modified_by_import_<" + list.size() + ">" + u.getAdresses().getEmail();
View Full Code Here

    this.encryptedFields = getEncryptedFields(transferSettingsClass);
  }

  @Override
  public String read(InputNode node) throws Exception {
    InputNode encryptedAttribute = node.getAttribute("encrypted");
   
    if (encryptedAttribute != null && encryptedAttribute.getValue().equals(Boolean.TRUE.toString())) {
      return TransferSettings.decrypt(node.getValue());
    }

    return node.getValue();
  }
View Full Code Here

TOP

Related Classes of org.simpleframework.xml.stream.InputNode

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.