Skip to content

Commit

Permalink
Add AboutMe model into import api
Browse files Browse the repository at this point in the history
  • Loading branch information
khoa-nd committed Feb 11, 2015
1 parent 350c642 commit 71d4a5c
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package com.techlooper.entity.userimport;

import com.techlooper.model.SocialProvider;

import java.util.ArrayList;
import java.util.List;

/**
* Created by NguyenDangKhoa on 2/11/15.
*/
public class AboutMeUserImportProfile implements UserImportProfile {

private String profile;

private String bio;

private String username;

private String email;

private String fullName;

private SocialProvider crawlerSource;

public String getProfile() {
return profile;
}

public void setProfile(String profile) {
this.profile = profile;
}

public String getBio() {
return bio;
}

public void setBio(String bio) {
this.bio = bio;
}

public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

public SocialProvider getCrawlerSource() {
return crawlerSource;
}

public void setCrawlerSource(SocialProvider crawlerSource) {
this.crawlerSource = crawlerSource;
}

public String getFullName() {
return fullName;
}

public void setFullName(String fullName) {
this.fullName = fullName;
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package com.techlooper.entity.userimport;

import com.techlooper.model.SocialProvider;

import java.util.Date;

/**
* Created by NguyenDangKhoa on 2/11/15.
*/
public class VietnamworksUserImportProfile implements UserImportProfile {

private SocialProvider crawlerSource;

private Long resumeId;

private int languageId;
Expand Down Expand Up @@ -536,4 +540,12 @@ public String getUserPathPictureFile() {
public void setUserPathPictureFile(String userPathPictureFile) {
this.userPathPictureFile = userPathPictureFile;
}

public SocialProvider getCrawlerSource() {
return crawlerSource;
}

public void setCrawlerSource(SocialProvider crawlerSource) {
this.crawlerSource = crawlerSource;
}
}
3 changes: 2 additions & 1 deletion src/main/java/com/techlooper/model/SocialProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
*/
public enum SocialProvider {

LINKEDIN("linkedin"), FACEBOOK("facebook"), GITHUB("github"), GOOGLE("google"), TWITTER("twitter"), VIETNAMWORKS("vietnamworks");
LINKEDIN("linkedin"), FACEBOOK("facebook"), GITHUB("github"), GOOGLE("google"), TWITTER("twitter"), VIETNAMWORKS("vietnamworks"),
ABOUTME("aboutme"), STACKOVERFLOW("stackoverflow");

private String provider;

Expand Down
22 changes: 22 additions & 0 deletions src/main/java/com/techlooper/model/UserImportData.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ public class UserImportData {
@JsonProperty("userpathpicturefile")
private String userPathPictureFile;

@JsonProperty("profile")
private String profile;

@JsonProperty("bio")
private String bio;

private List<String> skills = new ArrayList<>();

private int numberOfRepositories;
Expand Down Expand Up @@ -854,4 +860,20 @@ public String getEmailAddress() {
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}

public String getProfile() {
return profile;
}

public void setProfile(String profile) {
this.profile = profile;
}

public String getBio() {
return bio;
}

public void setBio(String bio) {
this.bio = bio;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.techlooper.service.impl;

import com.techlooper.entity.userimport.AboutMeUserImportProfile;
import com.techlooper.entity.userimport.UserImportEntity;
import com.techlooper.model.UserImportData;
import com.techlooper.service.UserImportDataProcessor;
import org.dozer.Mapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
* Created by NguyenDangKhoa on 02/11/15.
*/
@Service("ABOUTMEUserImportDataProcessor")
public class AboutMeUserImportDataProcessor implements UserImportDataProcessor {

@Resource
private Mapper dozerMapper;

public List<UserImportEntity> process(List<UserImportData> users) {
List<UserImportEntity> userImportEntities = new ArrayList<>();
for (UserImportData user : users) {
UserImportEntity userImportEntity = dozerMapper.map(user, UserImportEntity.class);
userImportEntity.withProfile(user.getCrawlerSource(), dozerMapper.map(user, AboutMeUserImportProfile.class));
userImportEntities.add(userImportEntity);
}
return userImportEntities;
}

}

0 comments on commit 71d4a5c

Please sign in to comment.