Package net.wimpi.pim.contact.io

Examples of net.wimpi.pim.contact.io.ContactUnmarshaller


  public SimpleContact[] importVCardContacts(File file) throws IOException
  {
    FileInputStream in = new FileInputStream(file);
    try {
      ContactIOFactory factory = Pim.getContactIOFactory();
        ContactUnmarshaller unmarshaller = factory.createContactUnmarshaller();
        unmarshaller.setEncoding("UTF-8");
        Contact[] contacts = unmarshaller.unmarshallContacts(in);
        if (contacts != null) {
          SimpleContact[] result = new SimpleContact[contacts.length];
          for (int i = 0; i < contacts.length; i++) {
            SimpleContact contact = new SimpleContact(contacts[i]);
            getSelectedContactCollection().add(contact);
View Full Code Here


  public boolean importData(JComponent component, Transferable transferable)
  {
        if (canImport(component, transferable.getTransferDataFlavors())) {
            try {
          ContactIOFactory factory = Pim.getContactIOFactory();
            ContactUnmarshaller unmarshaller = factory.createContactUnmarshaller();
            InputStream in = (InputStream)transferable.getTransferData(ContactTransferable.VCARD_FLAVOR);
            unmarshaller.setEncoding("UTF-8");
            Contact[] contacts = unmarshaller.unmarshallContacts(in);
            if (contacts != null && contacts.length > 0) {
              importData(contacts);
            }
                return true;
            }
View Full Code Here

        Boolean isGroup =  "PartyGroup".equals(partyType); // By default we import a Person.
        Map<String, Object> serviceCtx = FastMap.newInstance();

        try {
            ContactIOFactory ciof = Pim.getContactIOFactory();
            ContactUnmarshaller unmarshaller = ciof.createContactUnmarshaller();
            Contact[] contacts = unmarshaller.unmarshallContacts(in);

            for (Contact contact: contacts) {
                PersonalIdentity pid = contact.getPersonalIdentity();
                if (!isGroup) {
                    serviceCtx.put("firstName", pid.getFirstname());
View Full Code Here

        ByteBuffer byteBuffer = (ByteBuffer) context.get("infile");
        byte[] inputByteArray = byteBuffer.array();
        InputStream in = new ByteArrayInputStream(inputByteArray);
        try {
            ContactIOFactory ciof = Pim.getContactIOFactory();
            ContactUnmarshaller unmarshaller = ciof.createContactUnmarshaller();
            Contact[] contacts = unmarshaller.unmarshallContacts(in);

            for (Contact contact: contacts) {
                PersonalIdentity pid = contact.getPersonalIdentity();
                Map<String, Object> serviceCtx = UtilMisc.<String, Object>toMap("firstName", pid.getFirstname(), "lastName", pid.getLastname());
View Full Code Here

        Boolean isGroup =  "PartyGroup".equals(partyType); // By default we import a Person.
        Map<String, Object> serviceCtx = FastMap.newInstance();

        try {
            ContactIOFactory ciof = Pim.getContactIOFactory();
            ContactUnmarshaller unmarshaller = ciof.createContactUnmarshaller();
            Contact[] contacts = unmarshaller.unmarshallContacts(in);

            for (Contact contact: contacts) {
                PersonalIdentity pid = contact.getPersonalIdentity();
                if (!isGroup) {
                    serviceCtx.put("firstName", pid.getFirstname());
View Full Code Here

        Boolean isGroup =  "PartyGroup".equals(partyType); // By default we import a Person.
        Map<String, Object> serviceCtx = FastMap.newInstance();

        try {
            ContactIOFactory ciof = Pim.getContactIOFactory();
            ContactUnmarshaller unmarshaller = ciof.createContactUnmarshaller();
            Contact[] contacts = unmarshaller.unmarshallContacts(in);

            for (Contact contact: contacts) {
                PersonalIdentity pid = contact.getPersonalIdentity();
                if (!isGroup) {
                    serviceCtx.put("firstName", pid.getFirstname());
View Full Code Here

        ByteBuffer byteBuffer = (ByteBuffer) context.get("infile");
        byte[] inputByteArray = byteBuffer.array();
        InputStream in = new ByteArrayInputStream(inputByteArray);
        try {
            ContactIOFactory ciof = Pim.getContactIOFactory();
            ContactUnmarshaller unmarshaller = ciof.createContactUnmarshaller();
            Contact[] contact = unmarshaller.unmarshallContacts(in);
           
            for (int i = 0; i < contact.length; i++) {
                PersonalIdentity pid = contact[i].getPersonalIdentity();
                Map serviceCtx = UtilMisc.toMap("firstName", pid.getFirstname(), "lastName", pid.getLastname());
               
View Full Code Here

TOP

Related Classes of net.wimpi.pim.contact.io.ContactUnmarshaller

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.