/**
* Provides the basic record structure for job listings
*/
package us.deans.zinc;
import java.util.regex.Pattern;
// Data Structure for Job Postings
public class ZnJobRecord {
// Fields
private String jobTitle = "";
private String jobLink = "";
private String jobLocation = "";
private String jobCompany = "";
private String jobDescription = "";
private String jobKeywords = "";
// Compiled Patterns
private Pattern regx;
ZnJobRecord(){
}
public void setJobTitle(String title){
this.jobTitle = title;
}
public String getJobTitle(){
return this.jobTitle;
}
public void setJobLink(String link){
this.jobLink = link;
}
public String getJobLink(){
return this.jobLink;
}
public void setJobDescription(String input){
// the rss feed puts multiple items in the single description field. This code breaks it into seperate fields.
String[] breaker;
String str1;
String str2;
input = input.trim(); // trim the input
breaker = input.split("(SyndContentImpl.(value|interface)=)|
Job description:");
str1 = breaker[1];
str1 = str1.replaceAll("\\n", "");
str2 = breaker[2];
if (str2.length()>255) str2 = str2.substring(0, 254);
str2 = str2.replaceAll("\\n", "");
this.jobCompany = str1;
this.jobDescription = str2;
}
public String getJobDescription(){
return this.jobDescription;
}
public String getJobLocation() {
return this.jobLocation;
}
public void setJobLocation(String input){
this.jobLocation = input;
}
public void setJobCompany(String input){
this.jobCompany = input;
}
public String getJobCompany(){
return this.jobCompany;
}
public String getJobKeywords(){
return this.jobKeywords;
}
public void setJobKeywords(String keywords){
this.jobKeywords = keywords;
}
public void generateKeywords(){
regx = Pattern.compile("\\W"); // compile regular expression
String strJobDescription = getJobDescription();
String[] tokens = regx.split(strJobDescription); // parse subject
}
}