-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
141 additions
and
1 deletion.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
src/main/java/com/techlooper/entity/userimport/AboutMeUserImportProfile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/main/java/com/techlooper/service/impl/AboutMeUserImportDataProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
} |