Package org.springframework.social.google.api.plus

Examples of org.springframework.social.google.api.plus.Person$Name


    }

    private static Name getFirstName(InternationalString iname) throws JAXRException {
        for (Object o : iname.getLocalizedStrings()) {
            LocalizedString locName = (LocalizedString) o;
            Name name = objectFactory.createName();
            name.setValue(locName.getValue());
            name.setLang(locName.getLocale().getLanguage());
            return name;
        }
        return null;
    }
View Full Code Here


        return null;
    }
    private static void addNames(List<Name> names, InternationalString iname) throws JAXRException {
        for (Object o : iname.getLocalizedStrings()) {
            LocalizedString locName = (LocalizedString) o;
            Name name = objectFactory.createName();
            name.setValue(locName.getValue());
            name.setLang(locName.getLocale().getLanguage());
            names.add(name);
        }
    }
View Full Code Here

        Name[] result = new Name[namePatterns.size()];
        int currLoc = 0;
        for (Iterator i = namePatterns.iterator(); i.hasNext();)
        {
            Object obj = i.next();
            Name name = objectFactory.createName();
            if (obj instanceof String) {
                name.setValue((String)obj);
            } else if (obj instanceof LocalizedString) {
                LocalizedString ls = (LocalizedString)obj;
                name.setValue(ls.getValue());
                name.setLang(ls.getLocale().getLanguage());
            }
            result[currLoc] = name;
            currLoc++;
        }
        return result;
View Full Code Here

      return false;
    }
  }

  public void setConnectionValues(Google google, ConnectionValues values) {
    Person profile = google.plusOperations().getGoogleProfile();
    values.setProviderUserId(profile.getId());
    values.setDisplayName(profile.getDisplayName());
    values.setProfileUrl(profile.getUrl());
    values.setImageUrl(profile.getImageUrl());
  }
View Full Code Here

    values.setProfileUrl(profile.getUrl());
    values.setImageUrl(profile.getImageUrl());
  }

  public UserProfile fetchUserProfile(Google google) {
    Person profile = google.plusOperations().getGoogleProfile();
    return new UserProfileBuilder().setUsername(profile.getId())
        .setEmail(profile.getAccountEmail())
        .setName(profile.getDisplayName())
        .setFirstName(profile.getGivenName())
        .setLastName(profile.getFamilyName()).build();
  }
View Full Code Here

  public void fetchProfile() {

    PlusOperations plusOperations = Mockito.mock(PlusOperations.class);
    Mockito.when(google.plusOperations()).thenReturn(plusOperations);

    Person person = Mockito.mock(Person.class);
    Mockito.when(person.getDisplayName()).thenReturn("Gabriel Axel");
    Mockito.when(person.getGivenName()).thenReturn("Gabriel");
    Mockito.when(person.getFamilyName()).thenReturn("Axel");
    Mockito.when(person.getAccountEmail()).thenReturn("guznik@gmail.com");
    Mockito.when(person.getId()).thenReturn("114863353858610846998");

    Mockito.when(plusOperations.getGoogleProfile()).thenReturn(person);
    UserProfile profile = apiAdapter.fetchUserProfile(google);
    assertEquals("Gabriel Axel", profile.getName());
    assertEquals("Gabriel", profile.getFirstName());
View Full Code Here

      for (String string : findQualifyers) {
        findQualifiers.getFindQualifier().add(string);
      }
      findBusiness.setFindQualifiers(findQualifiers);

      Name name = new Name();
      name.setValue(nameStr);
      findBusiness.getName().add(name);


      logger.debug("FindBusiness " + findBusiness + " sending findBusinesses request..");
      List<Business> businesses = new ArrayList<Business>();
View Full Code Here

    }
    assertEquals(names1.size(), names2.size());
    Iterator<Name> names1Itr = names1.iterator();
    Iterator<Name> names2Itr = names2.iterator();
    while (names1Itr.hasNext()) {
      Name name1 = names1Itr.next();
      Name name2 = names2Itr.next();
      assertEquals(name1.getLang(), name2.getLang());
      assertEquals(name1.getValue(), name2.getValue());
    }
  }
View Full Code Here

      //service
      String lang = "en"; //default to english
      if (uddiService.lang()!=null) {
        lang = uddiService.lang();
      }
      Name name = new Name();
      name.setLang(lang);
      service.setBusinessKey(TokenResolver.replaceTokens(uddiService.businessKey(),properties));
      service.setServiceKey(TokenResolver.replaceTokens(uddiService.serviceKey(),properties));
      if (!"".equals(uddiService.serviceName())) {
        name.setValue(TokenResolver.replaceTokens(uddiService.serviceName(),properties));
      } else if (webServiceAnnotation!=null && !"".equals(webServiceAnnotation.serviceName())) {
        name.setValue(webServiceAnnotation.serviceName());
      } else {
        name.setValue(clazz.getSimpleName());
      }
      service.getName().add(name);
      Description description = new Description();
      description.setLang(lang);
      description.setValue(TokenResolver.replaceTokens(uddiService.description(),properties));
View Full Code Here

  @Override
  protected void execute() throws Exception {

    //Name of business were looking for in English.
    int max = 5;
    Name q = new Name();
    q.setLang("en");
    q.setValue(businessName);

    //Optional qualifiers that will modify the search.
    FindQualifiers findQualifiers = new FindQualifiers();
    findQualifiers.getFindQualifier().add("sortByNameDesc");
    findQualifiers.getFindQualifier().add("approximateMatch");

    //The FindBusiness object that is submitted via the inquiry service.
    FindBusiness findBusiness = new FindBusiness();
    findBusiness.setAuthInfo(authenticationToken.getAuthInfo());
    findBusiness.getName().add(q);
    findBusiness.setFindQualifiers(findQualifiers);
    findBusiness.setMaxRows(max);

    BusinessList businessList = inquiryService.findBusiness(findBusiness);
    businessInfos = businessList.getBusinessInfos();

    //Print out the names of the returned businesses
    for (BusinessInfo bi : businessInfos.getBusinessInfo()) {
      if (businessInfo == null) {
        businessInfo = bi;
      }
      Name _name = bi.getName().get(0);
      System.out.println("BusinessInfo: " + _name.getValue());
    }

   
  }
View Full Code Here

TOP

Related Classes of org.springframework.social.google.api.plus.Person$Name

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.