// :: Find Recommendation
int id = -1;
try {
id = Integer.parseInt(id_raw);
} catch(Exception e) {}
Recommendation recm = dao.findRecommendationById(id);
if(recm == null) {
result.setMessage("Recommendation not found");
result.setStatus(-3);
out.print(result);
out.flush();
out.close();
return;
}
// :: Check ownership
if(recm.getAssignedTo().getId() != user.getId()) {
result.setMessage("You are not owner");
result.setStatus(-4);
} else {
// Return object
result.setMessage("Success");
result.setStatus(recm.getStatus());
String answer = recm.getAnswer();
if(answer == null) {
answer = "";
}
result.setAnswer(answer);
String link = recm.getLink();
if(link == null) {
link = "";
}
result.setLink(link);
}