Example usage for org.springframework.social.facebook.api ImageType NORMAL

List of usage examples for org.springframework.social.facebook.api ImageType NORMAL

Introduction

In this page you can find the example usage for org.springframework.social.facebook.api ImageType NORMAL.

Prototype

ImageType NORMAL

To view the source code for org.springframework.social.facebook.api ImageType NORMAL.

Click Source Link

Usage

From source file:org.springframework.social.facebook.api.impl.UserTemplate.java

public byte[] getUserProfileImage() {
    requireAuthorization();
    return getUserProfileImage("me", ImageType.NORMAL);
}

From source file:org.springframework.social.facebook.api.impl.UserTemplate.java

public byte[] getUserProfileImage(String userId) {
    return getUserProfileImage(userId, ImageType.NORMAL);
}

From source file:org.meruvian.yama.social.facebook.FacebookService.java

@Override
public User createUser(Connection<?> connection) {
    Facebook facebook = (Facebook) connection.getApi();
    org.springframework.social.facebook.api.User profile = facebook.userOperations().getUserProfile();

    String randomUsername = RandomStringUtils.randomAlphanumeric(6);

    User user = new User();
    user.setUsername(StringUtils.join(profile.getFirstName(), profile.getLastName(), randomUsername));
    user.getName().setFirst(profile.getFirstName());
    user.getName().setLast(profile.getLastName());
    user.getName().setMiddle(profile.getMiddleName());
    user.setEmail(profile.getEmail());/*from  w ww. j av a2  s.co m*/

    if (StringUtils.isBlank(profile.getEmail())) {
        user.setEmail(StringUtils.join(profile.getId(), "@facebook.com"));
    }

    user.setPassword(RandomStringUtils.randomAlphanumeric(8));

    FileInfo fileInfo = new FileInfo();
    fileInfo.setDataBlob(
            new ByteArrayInputStream(facebook.userOperations().getUserProfileImage(ImageType.NORMAL)));
    user.setFileInfo(fileInfo);

    return user;
}