Examples of BDayType


Examples of net.sourceforge.cardme.vcard.types.BDayType

    Calendar birthday = Calendar.getInstance();
    birthday.clear();
    birthday.set(Calendar.YEAR, 1980);
    birthday.set(Calendar.MONTH, 4);
    birthday.set(Calendar.DAY_OF_MONTH, 21);
    vcard.setBDay(new BDayType(birthday));

    Calendar revision = Calendar.getInstance();
    revision.clear();
    revision.set(Calendar.YEAR, 2012);
    revision.set(Calendar.MONTH, 6);
View Full Code Here

Examples of net.sourceforge.cardme.vcard.types.BDayType

    bday.set(Calendar.YEAR, 1980);
    bday.set(Calendar.MONTH, 4);
    bday.set(Calendar.DAY_OF_MONTH, 21);
   
    VCardImpl vcard = getSimpleVCard();
    BDayType bdayType = new BDayType(bday);
    bdayType.setParam(BDayParamType.DATE);
    vcard.setBDay(bdayType);
   
    VCardWriter vcardWriter = new VCardWriter();
    vcardWriter.setOutputVersion(VCardVersion.V3_0);
    vcardWriter.setCompatibilityMode(CompatibilityMode.RFC2426);
View Full Code Here

Examples of net.sourceforge.cardme.vcard.types.BDayType

   * @param vcard
   * @throws VCardParseException
   */
  private void parseBDayType(String group, String value, List<ParameterType> paramTypeList, VCardImpl vcard) throws VCardParseException {
    try {
      BDayType bdayType = new BDayType();
      parseParamTypes(bdayType, paramTypeList, value, VCardTypeName.BDAY);
     
      Calendar cal = ISOUtils.parseISO8601Date(value);
      bdayType.setBirthday(cal);

      if(group != null) {
        bdayType.setGroup(group);
      }
     
      vcard.setBDay(bdayType);
    }
    catch(Exception ex) {
View Full Code Here

Examples of net.sourceforge.cardme.vcard.types.BDayType

      assertTrue(types.contains(AdrParamType.HOME));
    }
   
    //BDAY
    {
      BDayType f = vcard.getBDay();
      assertEquals(1980, f.getBirthday().get(Calendar.YEAR));
      assertEquals(Calendar.MARCH, f.getBirthday().get(Calendar.MONTH));
      assertEquals(22, f.getBirthday().get(Calendar.DAY_OF_MONTH));
    }
   
    //REV
    {
      RevType f = vcard.getRev();
      Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
      c.clear();
      c.set(Calendar.YEAR, 2012);
      c.set(Calendar.MONTH, Calendar.MARCH);
      c.set(Calendar.DAY_OF_MONTH, 5);
      c.set(Calendar.HOUR_OF_DAY, 13);
      c.set(Calendar.MINUTE, 32);
      c.set(Calendar.SECOND, 54);
      Calendar actual = f.getRevision();
      assertEquals(c.getTime(), actual.getTime());
    }
   
    //custom types
    {
      List<ExtendedType> it = vcard.getExtendedTypes();
      assertEquals(7, it.size());
     
      ExtendedType f = it.get(0);
      assertEquals("X-COUCHDB-APPLICATION-ANNOTATIONS", f.getExtendedName());
      assertEquals("{\"Evolution\":{\"revision\":\"2012-03-05T13:32:54Z\"}}", f.getExtendedValue());
     
      f = it.get(1);
      assertEquals("X-AIM", f.getExtendedName());
      assertEquals("johnny5@aol.com", f.getExtendedValue());
     
      List<ExtendedParamType> xParamTypes = f.getExtendedParams();
      assertEquals(2, xParamTypes.size());
     
      ExtendedParamType xParamType = xParamTypes.get(0);
      assertEquals("TYPE", xParamType.getTypeName());
      assertEquals("HOME", xParamType.getTypeValue());
     
      xParamType = xParamTypes.get(1);
      assertEquals("X-COUCHDB-UUID",xParamType.getTypeName());
      assertEquals("cb9e11fc-bb97-4222-9cd8-99820c1de454".toUpperCase(), xParamType.getTypeValue());
     
      f = it.get(2);
      assertEquals("X-EVOLUTION-FILE-AS", f.getExtendedName());
      assertEquals("Doe, John", f.getExtendedValue());
     
      f = it.get(3);
      assertEquals("X-EVOLUTION-SPOUSE", f.getExtendedName());
      assertEquals("Maria", f.getExtendedValue());

      f = it.get(4);
      assertEquals("X-EVOLUTION-MANAGER", f.getExtendedName());
      assertEquals("Big Blue", f.getExtendedValue());
     
      f = it.get(5);
      assertEquals("X-EVOLUTION-ASSISTANT", f.getExtendedName());
      assertEquals("Little Red", f.getExtendedValue());
     
      f = it.get(6);
      assertEquals("X-EVOLUTION-ANNIVERSARY", f.getExtendedName());
      assertEquals("1980-03-22", f.getExtendedValue());
    }
   
    VCardImpl vcard2 = (VCardImpl)vcard;
   
    if(vcard2.hasErrors()) {
View Full Code Here

Examples of net.sourceforge.cardme.vcard.types.BDayType

      assertEquals("Money Counter", f.getTitle());
    }
   
    //BDAY
    {
      BDayType f = vcard.getBDay();
      assertEquals(1980, f.getBirthday().get(Calendar.YEAR));
      assertEquals(Calendar.MARCH, f.getBirthday().get(Calendar.MONTH));
      assertEquals(22, f.getBirthday().get(Calendar.DAY_OF_MONTH));
    }
   
    //URL
    {
      List<UrlType> it = vcard.getUrls();
      assertEquals(1, it.size());
     
      UrlType f = it.get(0);
      assertEquals("http://www.ibm.com", f.getUrl().toString());
      assertEquals("http://www.ibm.com", f.getRawUrl());
     
      List<UrlParamType> types = f.getParams();
      assertEquals(1, types.size());
      assertTrue(types.contains(UrlParamType.WORK));
    }

    //NOTE
    {
      List<NoteType> it = vcard.getNotes();
      assertEquals(1, it.size());
      NoteType f = it.get(0);
      assertEquals("THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \\\"AS IS\\\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\nFavotire Color: Blue", f.getNote());
    }
   
    //custom types
    {
      List<ExtendedType> it = vcard.getExtendedTypes();
      assertEquals(6, it.size());
     
      ExtendedType f = it.get(0);
      assertEquals("X-PHONETIC-FIRST-NAME", f.getExtendedName());
      assertEquals("Jon", f.getExtendedValue());
     
      f = it.get(1);
      assertEquals("X-PHONETIC-LAST-NAME", f.getExtendedName());
      assertEquals("Dow", f.getExtendedValue());

      f = it.get(2);
      assertEquals("item1", f.getGroup());
      assertEquals("X-ABDATE", f.getExtendedName());
      assertEquals("1975-03-01", f.getExtendedValue());
     
      f = it.get(3);
      assertEquals("item1", f.getGroup());
      assertEquals("X-ABLABEL", f.getExtendedName());
      assertEquals("_$!<Anniversary>!$_", f.getExtendedValue());

      f = it.get(4);
      assertEquals("item2", f.getGroup());
      assertEquals("X-ABRELATEDNAMES", f.getExtendedName());
      assertEquals("Jenny", f.getExtendedValue());
     
      f = it.get(5);
      assertEquals("item2", f.getGroup());
      assertEquals("X-ABLABEL", f.getExtendedName());
      assertEquals("_$!<Spouse>!$_", f.getExtendedValue());
    }
   
    VCardImpl vcard2 = (VCardImpl)vcard;
   
    if(vcard2.hasErrors()) {
View Full Code Here

Examples of net.sourceforge.cardme.vcard.types.BDayType

      assertTrue(types.contains(UrlParamType.PREF));
    }
   
    //BDAY
    {
      BDayType f = vcard.getBDay();
      assertEquals(2012, f.getBirthday().get(Calendar.YEAR));
      assertEquals(Calendar.JUNE, f.getBirthday().get(Calendar.MONTH));
      assertEquals(6, f.getBirthday().get(Calendar.DAY_OF_MONTH));
      assertEquals(ISOFormat.ISO8601_DATE_EXTENDED, f.getISO8601Format());
    }
   
    //PHOTO
    {
      List<PhotoType> it = vcard.getPhotos();
      assertEquals(1, it.size());
     
      PhotoType f = it.get(0);
      assertEquals(EncodingType.BINARY, f.getEncodingType());
      assertEquals(ImageMediaType.JPEG, f.getImageMediaType());
      assertEquals(32531, f.getPhoto().length);
    }
   
    //custom types
    {
      List<ExtendedType> it = vcard.getExtendedTypes();
      assertEquals(4, it.size());
     
      ExtendedType f = it.get(0);
      assertEquals("item2", f.getGroup());
      assertEquals("X-ABLABEL", f.getExtendedName());
      assertEquals("_$!<AssistantPhone>!$_", f.getExtendedValue());

      f = it.get(1);
      assertEquals("item3", f.getGroup());
      assertEquals("X-ABADR", f.getExtendedName());
      assertEquals("Silicon Alley", f.getExtendedValue());
     
      f = it.get(2);
      assertEquals("item4", f.getGroup());
      assertEquals("X-ABADR", f.getExtendedName());
      assertEquals("Street 4, Building 6,\n Floor 8\nNew York\nUSA", f.getExtendedValue());
     
      f = it.get(3);
      assertEquals("item5", f.getGroup());
      assertEquals("X-ABLABEL", f.getExtendedName());
      assertEquals("_$!<HomePage>!$_", f.getExtendedValue());
    }
   
    VCardImpl vcard2 = (VCardImpl)vcard;
   
    if(vcard2.hasErrors()) {
View Full Code Here

Examples of net.sourceforge.cardme.vcard.types.BDayType

      assertTrue(types.contains(UrlParamType.PREF));
    }
   
    //BDAY
    {
      BDayType f = vcard.getBDay();
      assertEquals(1980, f.getBirthday().get(Calendar.YEAR));
      assertEquals(Calendar.MAY, f.getBirthday().get(Calendar.MONTH));
      assertEquals(21, f.getBirthday().get(Calendar.DAY_OF_MONTH));
      assertEquals(ISOFormat.ISO8601_DATE_EXTENDED, f.getISO8601Format());
    }
   
    //PHOTO
    {
      List<PhotoType> it = vcard.getPhotos();
      assertEquals(1, it.size());
     
      PhotoType f = it.get(0);
      assertEquals(EncodingType.BINARY, f.getEncodingType());
      assertEquals(ImageMediaType.JPEG, f.getImageMediaType());
      assertEquals(7957, f.getPhoto().length);
    }
   
    //UID
    {
      UidType f = vcard.getUid();
      assertEquals("0e7602cc-443e-4b82-b4b1-90f62f99a199", f.getUid());
    }
   
    //GEO
    {
      GeoType f = vcard.getGeo();
      assertEquals(-2.6, f.getLatitude(), .01);
      assertEquals(3.4, f.getLongitude(), .01);
    }
   
    //CLASS
    {
      ClassType f = vcard.getSecurityClass();
      assertEquals("Public", f.getSecurityClass());
    }
   
    //PROFILE
    {
      ProfileType f = vcard.getProfile();
      assertEquals("VCard", f.getProfile());
    }
   
    //TZ
    {
      TzType f = vcard.getTz();
      assertEquals(1, f.getHourOffset());
      assertEquals(0, f.getMinuteOffset());
    }
   
    //LABEL
    {
      //This label does not get parsed because its parameter types
      //do not match any of the parameter types of any of the existing
      //addresses. In this case the parameter type PARCEL is extra from
      //the address.
      //
      //This is an issue with the way Labels and Addresses are defined in
      //the VCard RFC. There are 2 ways to go about it:
      //
      //1: An ADR may have only 1 LABEL associated to it, the LABEL directly under it
      //2: An ADR may have only 1 LABEL associated to it by parameter types. Only
      //   one ADR and LABEL without zero parameter types may hold an association.
      //
      // Cardme takes approach 2.
     
      /*
      List<LabelType> it = vcard.getLables();
      assertEquals(1, it.size());
     
      LabelType f = it.get(0);
      assertEquals("John Doe\nNew York, NewYork,\nSouth Crecent Drive,\nBuilding 5, floor 3,\nUSA", f.getLabel());
      List<LabelParamType> types = f.getParams();
      assertEquals(3, types.size());
      assertTrue(types.contains(LabelParamType.HOME));
      assertTrue(types.contains(LabelParamType.PARCEL));
      assertTrue(types.contains(LabelParamType.PREF));
      */
     
    }
   
    //SORT-STRING
    {
      SortStringFeature f = vcard.getSortString();
      assertEquals("JOHN", f.getSortString());
    }
   
    //ROLE
    {
      RoleFeature f = vcard.getRole();
      assertEquals("Counting Money", f.getRole());
    }
   
    //SOURCE
    {
      SourceFeature f = vcard.getSource();
      assertEquals("Whatever", f.getSource());
    }
   
    //MAILER
    {
      MailerFeature f = vcard.getMailer();
      assertEquals("Mozilla Thunderbird", f.getMailer());
    }
   
    //NAME
    {
      NameType f = vcard.getName();
      assertEquals("VCard for John Doe", f.getName());
    }
   
    //custom types
    {
      List<ExtendedType> it = vcard.getExtendedTypes();
      assertEquals(4, it.size());
     
      ExtendedType f = it.get(0);
      assertEquals("item2", f.getGroup());
      assertEquals("X-ABLABEL", f.getExtendedName());
      assertEquals("_$!<HomePage>!$_", f.getExtendedValue());

      f = it.get(1);
      assertEquals("X-ABUID", f.getExtendedName());
      assertEquals("0E7602CC-443E-4B82-B4B1-90F62F99A199:ABPerson", f.getExtendedValue());
     
      f = it.get(2);
      assertEquals("X-GENERATOR", f.getExtendedName());
      assertEquals("Cardme Generator", f.getExtendedValue());
     
      f = it.get(3);
      assertEquals("X-LONG-STRING", f.getExtendedName());
      assertEquals("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", f.getExtendedValue());
    }
   
    VCardImpl vcard2 = (VCardImpl)vcard;
   
    if(vcard2.hasErrors()) {
View Full Code Here

Examples of net.sourceforge.cardme.vcard.types.BDayType

      assertEquals("Counting Money", f.getRole());
    }
   
    //BDAY
    {
      BDayType f = vcard.getBDay();
      assertEquals(1980, f.getBirthday().get(Calendar.YEAR));
      assertEquals(Calendar.MARCH, f.getBirthday().get(Calendar.MONTH));
      assertEquals(22, f.getBirthday().get(Calendar.DAY_OF_MONTH));
    }
   
    //EMAIL
    {
      List<EmailType> it = vcard.getEmails();
      assertEquals(1, it.size());
     
      EmailType f = it.get(0);
      assertEquals("john.doe@ibm.cm", f.getEmail());
     
      List<EmailParamType> types = f.getParams();
      assertEquals(2, types.size());
      assertTrue(types.contains(EmailParamType.PREF));
      assertTrue(types.contains(EmailParamType.INTERNET));
    }

    //PHOTO
    {
      List<PhotoType> it = vcard.getPhotos();
      assertEquals(1, it.size());
     
      PhotoType f = it.get(0);
      assertEquals(EncodingType.BINARY, f.getEncodingType());
      assertEquals(ImageMediaType.JPEG, f.getImageMediaType());
      assertEquals(860, f.getPhoto().length);
    }
   
    //REV
    {
      RevType f = vcard.getRev();
      Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
      c.clear();
      c.set(Calendar.YEAR, 2012);
      c.set(Calendar.MONTH, Calendar.MARCH);
      c.set(Calendar.DAY_OF_MONTH, 5);
      c.set(Calendar.HOUR_OF_DAY, 13);
      c.set(Calendar.MINUTE, 19);
      c.set(Calendar.SECOND, 33);
      Calendar actual = f.getRevision();
      assertEquals(c.getTime(), actual.getTime());
    }
   
    //custom types
    {
      List<ExtendedType> it = vcard.getExtendedTypes();
      assertEquals(6, it.size());
     
      ExtendedType f = it.get(0);
      assertEquals("X-MS-OL-DEFAULT-POSTAL-ADDRESS", f.getExtendedName());
      assertEquals("2", f.getExtendedValue());
     
      f = it.get(1);
      assertEquals("X-MS-ANNIVERSARY", f.getExtendedName());
      assertEquals("20110113", f.getExtendedValue());
     
      f = it.get(2);
      assertEquals("X-MS-IMADDRESS", f.getExtendedName());
      assertEquals("johny5@aol.com", f.getExtendedValue());

      f = it.get(3);
      assertEquals("X-MS-OL-DESIGN", f.getExtendedName());
      assertEquals("<card xmlns=\"http://schemas.microsoft.com/office/outlook/12/electronicbusinesscards\" ver=\"1.0\" layout=\"left\" bgcolor=\"ffffff\"><img xmlns=\"\" align=\"tleft\" area=\"32\" use=\"photo\"/><fld xmlns=\"\" prop=\"name\" align=\"left\" dir=\"ltr\" style=\"b\" color=\"000000\" size=\"10\"/><fld xmlns=\"\" prop=\"org\" align=\"left\" dir=\"ltr\" color=\"000000\" size=\"8\"/><fld xmlns=\"\" prop=\"title\" align=\"left\" dir=\"ltr\" color=\"000000\" size=\"8\"/><fld xmlns=\"\" prop=\"dept\" align=\"left\" dir=\"ltr\" color=\"000000\" size=\"8\"/><fld xmlns=\"\" prop=\"telwork\" align=\"left\" dir=\"ltr\" color=\"000000\" size=\"8\"><label align=\"right\" color=\"626262\">Work</label></fld><fld xmlns=\"\" prop=\"telhome\" align=\"left\" dir=\"ltr\" color=\"000000\" size=\"8\"><label align=\"right\" color=\"626262\">Home</label></fld><fld xmlns=\"\" prop=\"email\" align=\"left\" dir=\"ltr\" color=\"000000\" size=\"8\"/><fld xmlns=\"\" prop=\"addrwork\" align=\"left\" dir=\"ltr\" color=\"000000\" size=\"8\"/><fld xmlns=\"\" prop=\"addrhome\" align=\"left\" dir=\"ltr\" color=\"000000\" size=\"8\"/><fld xmlns=\"\" prop=\"webwork\" align=\"left\" dir=\"ltr\" color=\"000000\" size=\"8\"/><fld xmlns=\"\" prop=\"blank\" size=\"8\"/><fld xmlns=\"\" prop=\"blank\" size=\"8\"/><fld xmlns=\"\" prop=\"blank\" size=\"8\"/><fld xmlns=\"\" prop=\"blank\" size=\"8\"/><fld xmlns=\"\" prop=\"blank\" size=\"8\"/><fld xmlns=\"\" prop=\"blank\" size=\"8\"/></card>", f.getExtendedValue());
      assertEquals(Charset.forName("UTF-8"), f.getCharset());
     
      f = it.get(4);
      assertEquals("X-MS-MANAGER", f.getExtendedName());
      assertEquals("Big Blue", f.getExtendedValue());
     
      f = it.get(5);
      assertEquals("X-MS-ASSISTANT", f.getExtendedName());
      assertEquals("Jenny", f.getExtendedValue());
    }
   
    VCardImpl vcard2 = (VCardImpl)vcard;
   
    if(vcard2.hasErrors()) {
View Full Code Here

Examples of net.sourceforge.cardme.vcard.types.BDayType

      assertTrue(types.contains(UrlParamType.PREF));
    }
   
    //BDAY
    {
      BDayType f = vcard.getBDay();
      assertEquals(2012, f.getBirthday().get(Calendar.YEAR));
      assertEquals(Calendar.JUNE, f.getBirthday().get(Calendar.MONTH));
      assertEquals(6, f.getBirthday().get(Calendar.DAY_OF_MONTH));
      assertEquals(ISOFormat.ISO8601_DATE_EXTENDED, f.getISO8601Format());
    }
   
    //PHOTO
    {
      List<PhotoType> it = vcard.getPhotos();
      assertEquals(1, it.size());
     
      PhotoType f = it.get(0);
      assertEquals(EncodingType.BINARY, f.getEncodingType());
      assertEquals(null, f.getImageMediaType());
      assertEquals(18242, f.getPhoto().length);
    }
   
    //custom types
    {
      List<ExtendedType> it = vcard.getExtendedTypes();
      assertEquals(9, it.size());
     
      ExtendedType f = it.get(0);
      assertEquals("X-PHONETIC-FIRST-NAME", f.getExtendedName());
      assertEquals("Jon", f.getExtendedValue());
     
      f = it.get(1);
      assertEquals("X-PHONETIC-LAST-NAME", f.getExtendedName());
      assertEquals("Dow", f.getExtendedValue());
     
      f = it.get(2);
      assertEquals("item1", f.getGroup());
      assertEquals("X-ABLABEL", f.getExtendedName());
      assertEquals("AssistantPhone", f.getExtendedValue());

      f = it.get(3);
      assertEquals("item2", f.getGroup());
      assertEquals("X-ABADR", f.getExtendedName());
      assertEquals("Silicon Alley", f.getExtendedValue());
     
      f = it.get(4);
      assertEquals("item3", f.getGroup());
      assertEquals("X-ABADR", f.getExtendedName());
      assertEquals("Street 4, Building 6,\nFloor 8\nNew York\nUSA", f.getExtendedValue());
     
      f = it.get(5);
      assertEquals("item4", f.getGroup());
      assertEquals("X-ABLABEL", f.getExtendedName());
      assertEquals("_$!<HomePage>!$_", f.getExtendedValue());
     
      f = it.get(6);
      assertEquals("item5", f.getGroup());
      assertEquals("X-ABRELATEDNAMES", f.getExtendedName());
      assertEquals("Jenny", f.getExtendedValue());
     
      List<ExtendedParamType> xlist = f.getExtendedParams();
      assertEquals(1, xlist.size());
      assertEquals("TYPE", xlist.get(0).getTypeName());
      assertEquals("PREF", xlist.get(0).getTypeValue());
     
      f = it.get(7);
      assertEquals("item5", f.getGroup());
      assertEquals("X-ABLABEL", f.getExtendedName());
      assertEquals("Spouse", f.getExtendedValue());
     
      f = it.get(8);
      assertEquals("X-ABUID", f.getExtendedName());
      assertEquals("6B29A774-D124-4822-B8D0-2780EC117F60:ABPerson", f.getExtendedValue());
    }
   
    VCardImpl vcard2 = (VCardImpl)vcard;
   
    if(vcard2.hasErrors()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.