Package net.wimpi.pim.factory

Examples of net.wimpi.pim.factory.ContactIOFactory


  public void exportContacts(File file, SimpleContact[] contacts) throws IOException
  {
    FileOutputStream out = new FileOutputStream(file);
    try {
      ContactIOFactory factory = Pim.getContactIOFactory();
        ContactMarshaller marshaller = factory.createContactMarshaller();
        marshaller.setEncoding("UTF-8");
        for (SimpleContact contact : contacts) {
          marshaller.marshallContact(out, contact.getContact())
      }
    }
View Full Code Here


  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++) {
View Full Code Here

      if (contacts.length == 0) {
        return super.createTransferable(c);
      }
     
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      ContactIOFactory factory = Pim.getContactIOFactory();
      ContactMarshaller marshaller = factory.createContactMarshaller();
      marshaller.setEncoding("UTF-8");
      for (SimpleContact contact : contacts) {
        marshaller.marshallContact(out, contact.getContact())
      }
      return new ContactTransferable(new ByteArrayInputStream(out.toByteArray()));
View Full Code Here

  @Override
  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);
View Full Code Here

        String partyType = (String) context.get("partyType");
        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) {
View Full Code Here

            GenericValue emailAddress = PartyWorker.findPartyLatestContactMech(partyId, "EMAIL_ADDRESS", delegator);
            if (UtilValidate.isNotEmpty(emailAddress.getString("infoString"))) {
                email.setAddress(emailAddress.getString("infoString"));
                communication.addEmailAddress(email);
            }
            ContactIOFactory ciof = Pim.getContactIOFactory();
            ContactMarshaller marshaller = ciof.createContactMarshaller();
            String saveToDirectory = UtilProperties.getPropertyValue("sfa.properties", "save.outgoing.directory", "");
            if (UtilValidate.isEmpty(saveToDirectory)) {
                saveToDirectory = System.getProperty("ofbiz.home");
            }
            String saveToFilename = fullName + ".vcf";
View Full Code Here

            GenericValue emailAddress = PartyWorker.findPartyLatestContactMech(partyId, "EMAIL_ADDRESS", delegator);
            if (UtilValidate.isNotEmpty(emailAddress.getString("infoString"))) {
                email.setAddress(emailAddress.getString("infoString"));
                communication.addEmailAddress(email);
            }
            ContactIOFactory ciof = Pim.getContactIOFactory();
            ContactMarshaller marshaller = ciof.createContactMarshaller();
            String saveToDirectory = UtilProperties.getPropertyValue("sfa.properties", "save.outgoing.directory", "");
            if (UtilValidate.isEmpty(saveToDirectory)) {
                saveToDirectory = System.getProperty("ofbiz.home");
            }
            String saveToFilename = fullName + ".vcf";
View Full Code Here

        String phone = null;
        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

        String partyType = (String) context.get("partyType");
        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) {
View Full Code Here

            GenericValue emailAddress = PartyWorker.findPartyLatestContactMech(partyId, "EMAIL_ADDRESS", delegator);
            if (UtilValidate.isNotEmpty(emailAddress.getString("infoString"))) {
                email.setAddress(emailAddress.getString("infoString"));
                communication.addEmailAddress(email);
            }
            ContactIOFactory ciof = Pim.getContactIOFactory();
            ContactMarshaller marshaller = ciof.createContactMarshaller();
            String saveToDirectory = UtilProperties.getPropertyValue("sfa.properties", "save.outgoing.directory", "");
            if (UtilValidate.isEmpty(saveToDirectory)) {
                saveToDirectory = System.getProperty("ofbiz.home");
            }
            String saveToFilename = fullName + ".vcf";
View Full Code Here

TOP

Related Classes of net.wimpi.pim.factory.ContactIOFactory

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.