// Get the parameters in order to check some preconditions (e.g.
// is the document relly checked out).
String step = parameters.getParameter("step");
Session session = request.getSession(false);
RCML rcml = getRc().getRCML(getFilename());
Identity identity = (Identity) session.getAttribute(Identity.class
.getName());
if (step.equals("checkit")) {
if (rcml.getLatestEntry().getType() != RCML.ci) {
CheckOutEntry coe = rcml.getLatestCheckOutEntry();
actionMap.put("user", coe.getIdentity());
Date checkOutDate = new Date(coe.getTime());
actionMap.put("date", checkOutDate.toString());
actionMap.put("message", "lenya.rc.checkedoutalready");
actionMap.put("state", "co");
} else {
CheckInEntry cie = rcml.getLatestCheckInEntry();
actionMap.put("user", cie.getIdentity());
Date checkInDate = new Date(cie.getTime());
actionMap.put("date", checkInDate.toString());
actionMap.put("message", "The resource has already been checked in by");
actionMap.put("state", "ci");
}
return actionMap;
}
rcml.checkOutIn(RCML.ci, identity.getUser().getId(), new Date().getTime(),
false);
return null;
}