String time = xPath.evaluate(String.format(dateExpression, i),
root);
Date date = new Date(Long.valueOf(time));
boolean isSet = true;
Feed feed = new Feed();
feed.setId(id);
feed.setCreatedAt(date);
feed.setFrom(name);
if ("CONN".equals(type)) {
String cfname = xPath.evaluate(
String.format(cfnameExpression, i), root);
String clname = xPath.evaluate(
String.format(clnameExpression, i), root);
feed.setMessage(name + UPDATE_TYPES.get("CONN") + cfname
+ " " + clname);
} else if ("NCON".equals(type)) {
feed.setMessage(name + UPDATE_TYPES.get("NCON"));
} else if ("CCEM".equals(type)) {
feed.setMessage(name + UPDATE_TYPES.get("CCEM"));
} else if ("SHAR".equals(type)) {
String comment = xPath.evaluate(
String.format(shareCommentExpression, i), root);
feed.setMessage(name + UPDATE_TYPES.get("SHAR") + comment);
} else if ("STAT".equals(type)) {
String status = xPath.evaluate(
String.format(statusExpression, i), root);
feed.setMessage(name + UPDATE_TYPES.get("STAT") + status);
} else if ("JOBP".equals(type)) {
String jpFname = xPath.evaluate(
String.format(jobPosterFnameExpression, i), root);
String jpLname = xPath.evaluate(
String.format(jobPosterLnameExpression, i), root);
String jpId = xPath.evaluate(
String.format(jobPosterIdExpression, i), root);
String position = xPath.evaluate(
String.format(jobPositionExpression, i), root);
String company = xPath.evaluate(
String.format(jobCompanyExpression, i), root);
feed.setFrom(jpFname + " " + jpLname);
feed.setId(jpId);
feed.setMessage(jpFname + " " + jpLname
+ UPDATE_TYPES.get("JOBP") + position + " at "
+ company);
} else if ("JGRP".equals(type)) {
String groupName = xPath.evaluate(
String.format(groupNameExpression, i), root);
feed.setMessage(name + UPDATE_TYPES.get("JGRP") + groupName);
} else if ("PREC".equals(type)) {
double count = (Double) xPath.evaluate(String.format(
recommendationGivenCountExpression, i), root,
XPathConstants.NUMBER);
String message = "";
if (count > 0) {
String recommendation = xPath.evaluate(
String.format(recommendationExpression, i),
root);
String recommendeeFname = xPath.evaluate(
String.format(recommendeeFnameExpression, i),
root);
String recommendeeLname = xPath.evaluate(
String.format(recommendeeLnameExpression, i),
root);
message = name + UPDATE_TYPES.get("PREC_GIVEN")
+ recommendeeFname + " " + recommendeeLname;
if (recommendation != null
&& recommendation.length() > 0) {
message += " :'" + recommendation + "'";
}
} else {
String recommendeeFname = xPath.evaluate(
String.format(recommenderFnameExpression, i),
root);
String recommendeeLname = xPath.evaluate(
String.format(recommenderLnameExpression, i),
root);
message = name + UPDATE_TYPES.get("PREC_RECEIVED")
+ recommendeeFname + " " + recommendeeLname;
}
feed.setMessage(message);
} else if ("PROF".equals(type)) {
feed.setMessage(name + UPDATE_TYPES.get("PROF"));
} else if ("APPM".equals(type)) {
String update = xPath.evaluate(
String.format(appUpdateExpression, i), root);
feed.setMessage(name + UPDATE_TYPES.get("APPM") + update);
} else if ("MSFC".equals(type)) {
String company = xPath.evaluate(
String.format(companyExpression, i), root);
String pfname = xPath.evaluate(
String.format(companyPersonFnameExpression, i),
root);
String plname = xPath.evaluate(
String.format(companyPersonLnameExpression, i),
root);
String pid = xPath.evaluate(
String.format(companyPersonIdExpression, i), root);
feed.setMessage(pfname + " " + plname
+ UPDATE_TYPES.get("MSFC") + company);
feed.setFrom(pfname + " " + pfname);
feed.setId(pid);
list.add(feed);
} else if ("PICU".equals(type)) {
feed.setMessage(name + UPDATE_TYPES.get("PICU"));
} else {
isSet = false;
}
if (isSet) {