+ public void expireArticleLock(String anId, String aUserId) {
+ if (!MirGlobal.isUserLoggedIn(anId)) {
+ unlockArticle(anId, aUserId, false);
+ }
+ }
+
+ /**
+ * Locks an article. Forced (that is, without checking wether it's already locked)
+ * if necessary.
+ *
+ * @param anId The article number
+ * @param aUserId The locking user
+ * @param aForce Should it e forced?
+ * @return
+ */
+ public boolean lockArticle(String anId, String aUserId, boolean aForce) {
+ try {
+ String query =
+ "update content set to_locking_user=" + JDBCStringRoutines.escapeStringLiteral(aUserId) +
+ " where id = " + JDBCStringRoutines.escapeStringLiteral(anId);
+
+ if (!aForce)
+ query = query + " and to_locking_user is null";
+
+ return storage.executeUpdate(query) > 0;
+ }
+ catch (Throwable t) {
+ return false;
+ }
+ }
+
+ /**
+ * Unlocks an article. Forced (that is, without checking wether it's locked by
+ * the person that unlocks it) if necessary.
+ *
+ * @param anId The article number
+ * @param aUserId The user that unlocks
+ * @param aForce Should it e forced?
+ * @return <code>true</code> if successfull, <code>false</code> if not
+ */
+ public boolean unlockArticle(String anId, String aUserId, boolean aForce) {