// Checkin document public static void checkin(MSOpenKMCore.bean.OKMDocument oKMDocument, String host, String username, String password) { String token = ""; MSOpenKMCore.ws.OKMAuth authService = null; MSOpenKMCore.ws.OKMDocument documentService = null; try { // Init services SSL.init(host); authService = new MSOpenKMCore.ws.OKMAuth(host); documentService = new MSOpenKMCore.ws.OKMDocument(host); // OpenKM authentication token = authService.login(username, password); // Checkin document //documentService.setContent(token, oKMDocument.getPath(), FileUtil.readFile(oKMDocument.getLocalFilename())); //documentService.checkin(token, oKMDocument.getPath(), ""); // Logout OpenKM authService.logout(token); token = ""; } catch (Exception e) { if (!token.Equals("")) { // Logout OpenKM authService.logout(token); token = ""; } String errorMSG = "DocumentLogic (checkin)\n" + e.Message + "\n\n" + e.StackTrace; throw new OKMException(errorMSG); } }
// cancel checkout document public static void cancelCheckout(MSOpenKMCore.bean.OKMDocument oKMDocument, String host, String username, String password) { String token = ""; OKMAuth authService = null; MSOpenKMCore.ws.OKMDocument documentService = null; try { // Init services SSL.init(host); authService = new MSOpenKMCore.ws.OKMAuth(host); documentService = new MSOpenKMCore.ws.OKMDocument(host); // OpenKM authentication token = authService.login(username, password); // Cancelling checkout documentService.cancelCheckout(token, oKMDocument.getPath()); // Logout OpenKM authService.logout(token); token = ""; } catch (Exception e) { if (!token.Equals("")) { // Logout OpenKM authService.logout(token); token = ""; } String errorMSG = "DocumentLogic (cancelCheckout)\n" + e.Message + "\n\n" + e.StackTrace; throw new OKMException(errorMSG); } }