-
Notifications
You must be signed in to change notification settings - Fork 0
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
d2army
committed
Jul 24, 2012
0 parents
commit 56d320c
Showing
99 changed files
with
1,655 additions
and
0 deletions.
There are no files selected for viewing
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,5 @@ | ||
This project was built using the Play Framework version 2.0.2 and using JDK 1.7. | ||
It is a work in progress and is an experiment with machine learning using Play, Java and the LinkedIn-J API library | ||
|
||
Do note that to run this project properly, make sure your system's JRE and JDK are both the same versions(i.e. either both 1.6 or 1.7). | ||
|
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,15 @@ | ||
package analyzer.group; | ||
|
||
import analyzer.single.Analyzer; | ||
|
||
abstract public class CategoryAnalyzer extends Analyzer { | ||
protected String categoryName_ = ""; | ||
|
||
public CategoryAnalyzer(){ | ||
|
||
} | ||
|
||
public void process(){ | ||
|
||
} | ||
} |
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,29 @@ | ||
package analyzer.group; | ||
|
||
import java.util.EnumSet; | ||
|
||
import analyzer.single.Analyzer; | ||
import analyzer.single.PersonAnalyzer; | ||
|
||
import com.google.code.linkedinapi.client.enumeration.ProfileField; | ||
import com.google.code.linkedinapi.schema.Connections; | ||
import com.google.code.linkedinapi.schema.Person; | ||
import com.google.code.linkedinapi.schema.Position; | ||
import com.google.code.linkedinapi.schema.Positions; | ||
|
||
|
||
public class ConnectionsAnalyzer extends Analyzer{ | ||
private Connections connections_; | ||
|
||
public ConnectionsAnalyzer(Connections connections, String keyword){ | ||
this.connections_ = connections; | ||
this.keyword_ = keyword; | ||
} | ||
|
||
public void process(){ | ||
for (Person person : this.connections_.getPersonList()) { | ||
PersonAnalyzer pa = new PersonAnalyzer(person,this.keyword_); | ||
pa.process(); | ||
} | ||
} | ||
} |
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,14 @@ | ||
package analyzer.group; | ||
|
||
import com.google.code.linkedinapi.schema.Educations; | ||
|
||
public class EducationsAnalyzer extends CategoryAnalyzer { | ||
|
||
public EducationsAnalyzer(Educations educations){ | ||
this.categoryName_ = "Education"; | ||
} | ||
|
||
public void process(){ | ||
|
||
} | ||
} |
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,15 @@ | ||
package analyzer.group; | ||
|
||
import analyzer.single.Analyzer; | ||
|
||
|
||
public class HonorsAnalyzer extends CategoryAnalyzer { | ||
|
||
public HonorsAnalyzer(String honors){ | ||
this.categoryName_ = "Honors"; | ||
} | ||
|
||
public void process(){ | ||
|
||
} | ||
} |
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,15 @@ | ||
package analyzer.group; | ||
|
||
import analyzer.single.Analyzer; | ||
|
||
|
||
public class InterestsAnalyzer extends CategoryAnalyzer { | ||
|
||
public InterestsAnalyzer(String interests){ | ||
this.categoryName_ = "Interests"; | ||
} | ||
|
||
public void process(){ | ||
|
||
} | ||
} |
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,40 @@ | ||
package analyzer.group; | ||
|
||
import java.util.EnumSet; | ||
|
||
import analyzer.single.Analyzer; | ||
|
||
import com.google.code.linkedinapi.client.LinkedInApiClient; | ||
import com.google.code.linkedinapi.client.enumeration.ProfileField; | ||
import com.google.code.linkedinapi.schema.Connections; | ||
|
||
public class MasterAnalyzer extends Analyzer { | ||
final private static EnumSet<ProfileField> FIELDS_TO_GRAB = EnumSet.of( | ||
ProfileField.FIRST_NAME, | ||
ProfileField.LAST_NAME, | ||
ProfileField.SPECIALTIES, | ||
ProfileField.POSITIONS, | ||
ProfileField.EDUCATIONS, | ||
ProfileField.SKILLS, | ||
ProfileField.INTERESTS, | ||
ProfileField.HONORS, | ||
ProfileField.RECOMMENDATIONS_RECEIVED | ||
); | ||
private LinkedInApiClient client_; | ||
|
||
public MasterAnalyzer(LinkedInApiClient client, String keyword){ | ||
this.client_ = client; | ||
this.keyword_ = keyword; | ||
} | ||
|
||
public void setKeyword(String keyword){ | ||
this.keyword_ = keyword; | ||
} | ||
|
||
public void process() { | ||
Connections connections = this.client_.getConnectionsForCurrentUser(MasterAnalyzer.FIELDS_TO_GRAB); | ||
ConnectionsAnalyzer ca = new ConnectionsAnalyzer(connections, this.keyword_); | ||
ca.process(); | ||
} | ||
|
||
} |
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,26 @@ | ||
package analyzer.group; | ||
|
||
import analyzer.single.PositionAnalyzer; | ||
|
||
import com.google.code.linkedinapi.schema.Position; | ||
import com.google.code.linkedinapi.schema.Positions; | ||
|
||
public class PositionsAnalyzer extends CategoryAnalyzer { | ||
private Positions positions_; | ||
|
||
public PositionsAnalyzer(Positions positions, String keyword){ | ||
this.positions_ = positions; | ||
this.categoryName_ = "Positions"; | ||
this.keyword_ = keyword; | ||
} | ||
|
||
public void process(){ | ||
if (this.positions_ != null){ | ||
for(Position position : this.positions_.getPositionList()){ | ||
PositionAnalyzer pa = new PositionAnalyzer(position,this.keyword_); | ||
pa.process(); | ||
} | ||
} | ||
} | ||
} | ||
|
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,17 @@ | ||
package analyzer.group; | ||
|
||
import analyzer.single.Analyzer; | ||
|
||
import com.google.code.linkedinapi.schema.RecommendationsReceived; | ||
|
||
|
||
public class RecommendationsReceivedAnalyzer extends CategoryAnalyzer { | ||
|
||
public RecommendationsReceivedAnalyzer(RecommendationsReceived rr){ | ||
this.categoryName_ = "RecommendationsReceived"; | ||
} | ||
|
||
public void process(){ | ||
|
||
} | ||
} |
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,16 @@ | ||
package analyzer.group; | ||
|
||
import analyzer.single.Analyzer; | ||
|
||
import com.google.code.linkedinapi.schema.Skills; | ||
|
||
public class SkillsAnalyzer extends CategoryAnalyzer { | ||
|
||
public SkillsAnalyzer(Skills skills){ | ||
this.categoryName_ = "Skills"; | ||
} | ||
|
||
public void process(){ | ||
|
||
} | ||
} |
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,27 @@ | ||
package analyzer.single; | ||
|
||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
import utility.StringManip; | ||
|
||
abstract public class Analyzer { | ||
protected static String finalResults_ = ""; | ||
|
||
|
||
|
||
//keyword to search for | ||
protected String keyword_ = ""; | ||
abstract public void process(); | ||
|
||
public String getFinalResults(){ | ||
return Analyzer.finalResults_; | ||
} | ||
|
||
protected static void addData(String value){ | ||
Analyzer.finalResults_ = Analyzer.finalResults_.concat(value); | ||
} | ||
|
||
|
||
|
||
} |
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,73 @@ | ||
package analyzer.single; | ||
|
||
import java.util.List; | ||
|
||
import models.PersonModel; | ||
import analyzer.group.EducationsAnalyzer; | ||
import analyzer.group.HonorsAnalyzer; | ||
import analyzer.group.InterestsAnalyzer; | ||
import analyzer.group.PositionsAnalyzer; | ||
import analyzer.group.RecommendationsReceivedAnalyzer; | ||
import analyzer.group.SkillsAnalyzer; | ||
|
||
import com.google.code.linkedinapi.schema.Educations; | ||
import com.google.code.linkedinapi.schema.Person; | ||
import com.google.code.linkedinapi.schema.Positions; | ||
import com.google.code.linkedinapi.schema.RecommendationsReceived; | ||
import com.google.code.linkedinapi.schema.Skills; | ||
|
||
public class PersonAnalyzer extends Analyzer { | ||
private Person person_; | ||
|
||
public PersonAnalyzer(Person person, String keyword){ | ||
this.person_ = person; | ||
this.keyword_ = keyword; | ||
} | ||
|
||
/** | ||
* init | ||
* | ||
* Is this Person already in the database | ||
*/ | ||
private void init(){ | ||
String fullName = this.person_.getFirstName()+" "+this.person_.getLastName(); | ||
boolean alreadyExists = PersonModel.exists(fullName); | ||
|
||
if(alreadyExists == true){ | ||
|
||
} else { | ||
//need to create person | ||
PersonModel pm = new PersonModel(fullName); | ||
pm.save(); | ||
} | ||
|
||
} | ||
|
||
|
||
public void process(){ | ||
this.init(); | ||
|
||
Positions positionList = this.person_.getPositions(); | ||
PositionsAnalyzer pa = new PositionsAnalyzer(positionList, this.keyword_); | ||
pa.process(); | ||
|
||
Educations educationList = this.person_.getEducations(); | ||
EducationsAnalyzer ea = new EducationsAnalyzer(educationList); | ||
|
||
Skills skillsList = this.person_.getSkills(); | ||
SkillsAnalyzer sa = new SkillsAnalyzer(skillsList); | ||
|
||
String specialties = this.person_.getSpecialties(); | ||
SpecialtiesAnalyzer spa = new SpecialtiesAnalyzer(specialties); | ||
|
||
String interestList = this.person_.getInterests(); | ||
InterestsAnalyzer ia = new InterestsAnalyzer(interestList); | ||
|
||
String honorsList = this.person_.getHonors(); | ||
HonorsAnalyzer ha = new HonorsAnalyzer(honorsList); | ||
|
||
RecommendationsReceived recommendationsList = this.person_.getRecommendationsReceived(); | ||
RecommendationsReceivedAnalyzer rra = new RecommendationsReceivedAnalyzer(recommendationsList); | ||
|
||
} | ||
} |
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,23 @@ | ||
package analyzer.single; | ||
|
||
import com.google.code.linkedinapi.schema.Position; | ||
|
||
|
||
public class PositionAnalyzer extends Analyzer { | ||
private Position position_; | ||
|
||
public PositionAnalyzer(Position position,String keyword){ | ||
this.position_ = position; | ||
this.keyword_ = keyword; | ||
} | ||
|
||
/** | ||
* Do the counting of the frequency items | ||
*/ | ||
public void process(){ | ||
//how many times does the word actually show up in this position | ||
|
||
//look at the titkle | ||
//this.position_.getTitle(); | ||
} | ||
} |
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,14 @@ | ||
package analyzer.single; | ||
|
||
|
||
|
||
|
||
public class SpecialtiesAnalyzer extends Analyzer { | ||
|
||
public SpecialtiesAnalyzer(String specialties){ | ||
|
||
} | ||
public void process(){ | ||
|
||
} | ||
} |
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,45 @@ | ||
package api; | ||
|
||
import java.util.EnumSet; | ||
|
||
import play.cache.Cache; | ||
|
||
import com.google.code.linkedinapi.client.LinkedInApiClient; | ||
import com.google.code.linkedinapi.client.LinkedInApiClientFactory; | ||
import com.google.code.linkedinapi.client.enumeration.ProfileField; | ||
import com.google.code.linkedinapi.client.oauth.LinkedInAccessToken; | ||
import com.google.code.linkedinapi.client.oauth.LinkedInOAuthService; | ||
import com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceFactory; | ||
import com.google.code.linkedinapi.client.oauth.LinkedInRequestToken; | ||
|
||
public class LinkedInConnection { | ||
private static String API_KEY = "j4lvn0lsmybt"; | ||
private static String API_SECRET = "AEhrcvtdFeaNNXz0"; | ||
|
||
final private static String REDIRECT_URL = "http://localhost:9000/complete"; | ||
|
||
private String authUrl_; | ||
private LinkedInRequestToken requestToken_; | ||
private LinkedInOAuthService oauthService_; | ||
|
||
|
||
public LinkedInConnection() { | ||
this.oauthService_ = LinkedInOAuthServiceFactory.getInstance().createLinkedInOAuthService(API_KEY,API_SECRET); | ||
this.requestToken_ = oauthService_.getOAuthRequestToken(LinkedInConnection.REDIRECT_URL); | ||
|
||
this.authUrl_ = this.requestToken_.getAuthorizationUrl(); | ||
} | ||
|
||
public String getAuthUrl(){ | ||
return this.authUrl_; | ||
} | ||
|
||
public LinkedInApiClient completeAuthentication(String oauthVerifier) { | ||
|
||
LinkedInAccessToken accessToken = this.oauthService_.getOAuthAccessToken(this.requestToken_, oauthVerifier); | ||
LinkedInApiClientFactory factory = LinkedInApiClientFactory.newInstance(API_KEY, API_SECRET); | ||
LinkedInApiClient client = factory.createLinkedInApiClient(accessToken); | ||
|
||
return client; | ||
} | ||
} |
Oops, something went wrong.