public void after(EntityView view, HttpServletRequest req, HttpServletResponse res) {
}
public UserRequestParams refreshParams(Context context) {
UserRequestParams uparam = new UserRequestParams();
try {
user = reqStor.getStoredValue("user").toString();
} catch (NullPointerException ex) {
user = "";
}
try {
pass = reqStor.getStoredValue("pass").toString();
} catch (NullPointerException ex) {
pass = "";
}
try {
if (!(userc.isEmpty() && passc.isEmpty())) {
user = userc;
pass = passc;
}
} catch (Exception ex) {
ex.printStackTrace();
} // now try to login user
loggedUser = "anonymous";
try {
EPerson eUser = EPerson.findByEmail(context, user);
if ((eUser.canLogIn()) && (eUser.checkPassword(pass))) {
context.setCurrentUser(eUser);
loggedUser = eUser.getName();
} else {
throw new EntityException("Bad username or password", user, 403);
}
} catch (SQLException sql) {
// System.out.println(sql.toString());
sql.printStackTrace();
} catch (AuthorizeException auth) {
throw new EntityException("Unauthorised", user, 401);
} catch (NullPointerException ne) {
if (!(user.equals("") && pass.equals(""))) {
throw new EntityException("Bad username or password", user, 403);
}
}
this.collections = "true".equals(reqStor.getStoredValue("collections"));
uparam.setCollections(this.collections);
this.trim = "true".equals(reqStor.getStoredValue("trim"));
uparam.setTrim(this.trim);
this.parents = "true".equals(reqStor.getStoredValue("parents"));
uparam.setParents(this.parents);
this.children = "true".equals(reqStor.getStoredValue("children"));
uparam.setChildren(this.children);
this.groups = "true".equals(reqStor.getStoredValue("groups"));
uparam.setGroups(this.groups);
this.replies = "true".equals(reqStor.getStoredValue("replies"));
uparam.setReplies(this.replies);
// try {
// action = reqStor.getStoredValue("action").toString();
// uparam.setAction(action);
// } catch (NullPointerException ex) {
// action = "";
// }
try {
query = reqStor.getStoredValue("query").toString();
uparam.setQuery(query);
} catch (NullPointerException ex) {
query = "";
}
try {
Object o = reqStor.getStoredValue("fields");
if (o instanceof String) {
fields = new String[]{o.toString()};
} else if (o instanceof String[]) {
fields = (String[]) o;
} else if (o == null) {
fields = null;
}
uparam.setFields(fields);
} catch (NullPointerException ex) {
fields = null;
}
try {
status = reqStor.getStoredValue("status").toString();
uparam.setStatus(status);
} catch (NullPointerException ex) {
status = "";
}
try {
submitter = reqStor.getStoredValue("submitter").toString();
uparam.setSubmitter(submitter);
} catch (NullPointerException ex) {
submitter = "";
}
try {
reviewer = reqStor.getStoredValue("reviewer").toString();
uparam.setReviewer(reviewer);
} catch (NullPointerException ex) {
reviewer = "";
}
try {
String bundleStr = reqStor.getStoredValue("type").toString();
uparam.setType(bundleStr.split(","));
} catch (NullPointerException ex) {
type = null;
}
try {
_order = reqStor.getStoredValue("order").toString();
uparam.setOrder(_order);
} catch (NullPointerException ex) {
_order = "";
}
try {
_sort = reqStor.getStoredValue("sort").toString();
uparam.setSort(_sort);
} catch (NullPointerException ex) {
_sort = "";
} // both parameters are used according to requirements
if (_order.length() > 0 && _sort.equals("")) {
_sort = _order;
}
try {
_start = Integer.parseInt(reqStor.getStoredValue("start").toString());
uparam.setStart(_start);
} catch (NullPointerException ex) {
_start = 0;
}
try {
_limit = Integer.parseInt(reqStor.getStoredValue("limit").toString());
uparam.setLimit(_limit);
} catch (NullPointerException ex) {
_limit = 0;
} // some checking for invalid values
if (_limit < 0) {