* @throws IOException DOCUMENT ME!
* @throws Exception DOCUMENT ME!
*/
public void checkOutIn(short type, String identity, long time)
throws IOException, Exception {
DOMParserFactory dpf = new DOMParserFactory();
Element identityElement = dpf.newElementNode(document, "Identity");
identityElement.appendChild(dpf.newTextNode(document, identity));
Element timeElement = dpf.newElementNode(document, "Time");
timeElement.appendChild(dpf.newTextNode(document, "" + time));
Element checkOutElement = null;
if (type == co) {
checkOutElement = dpf.newElementNode(document, "CheckOut");
} else if (type == ci) {
checkOutElement = dpf.newElementNode(document, "CheckIn");
} else {
log.error("ERROR: " + this.getClass().getName() + ".checkOutIn(): No such type");
return;
}
checkOutElement.appendChild(identityElement);
checkOutElement.appendChild(timeElement);
Element root = document.getDocumentElement();
root.insertBefore(dpf.newTextNode(document, "\n"), root.getFirstChild());
root.insertBefore(checkOutElement, root.getFirstChild());
root.insertBefore(dpf.newTextNode(document, "\n"), root.getFirstChild());
setDirty();
// If this is a checkout, we write back the changed state
// to the file immediately because otherwise another