|
|
Choosing A Webhost: |
svn commit: r191734 - in /lenya/trunk/src: java/org/apache/lenya/cms/reposi: msg#00237cms.lenya.cvs
Author: chestnut Date: Tue Jun 21 15:03:52 2005 New Revision: 191734 URL: http://svn.apache.org/viewcvs?rev=191734&view=rev Log: fixed problem of not allowing owner of lock on objects to lock again Modified: lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java lenya/trunk/src/java/org/apache/lenya/transaction/Versionable.java lenya/trunk/src/webapp/lenya/pubs/default/lenya/usecases/webdav/sitemap.xmap Modified: lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java?rev=191734&r1=191733&r2=191734&view=diff ============================================================================== --- lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java (original) +++ lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java Tue Jun 21 15:03:52 2005 @@ -40,6 +40,7 @@ import org.apache.lenya.transaction.IdentityMap; import org.apache.lenya.transaction.Lock; import org.apache.lenya.transaction.TransactionException; +import org.apache.lenya.cms.rc.RCMLEntry; /** * A repository node. @@ -114,6 +115,25 @@ } /** + * @see org.apache.lenya.transaction.Transactionable#canCheckOut() + */ + public boolean canCheckOut() throws TransactionException { + try { + RCMLEntry entry = getRevisionController().getRCML(getRCPath()).getLatestEntry(); + if(!isCheckedOut()) + return true; + else if(entry.getIdentity().equals(getUserId())) + return true; + else + return false; + } catch (TransactionException e) { + throw e; + } catch (Exception e) { + throw new TransactionException(e); + } + } + + /** * @see org.apache.lenya.transaction.Transactionable#checkout() */ public void checkout() throws TransactionException { @@ -286,8 +306,8 @@ * @see org.apache.lenya.transaction.Transactionable#lock() */ public void lock() throws TransactionException { - if (isCheckedOut()) { - throw new TransactionException("Cannot lock [" + this + "]: node is checked out."); + if (!canCheckOut()) { + throw new TransactionException("Cannot lock [" + this + "]: node is checked out."); } if (getLogger().isDebugEnabled()) { getLogger().debug("Locking [" + this + "]"); Modified: lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java?rev=191734&r1=191733&r2=191734&view=diff ============================================================================== --- lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java (original) +++ lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java Tue Jun 21 15:03:52 2005 @@ -642,8 +642,8 @@ boolean canExecute = true; for (int i = 0; i < objects.length; i++) { - if (objects[i].isCheckedOut()) { - if (getLogger().isDebugEnabled()) + if(!objects[i].canCheckOut()) { + if (getLogger().isDebugEnabled()) getLogger() .debug("AbstractUsecase::lockInvolvedObjects() can not execute, object [" + objects[i] + "] is already checked out"); Modified: lenya/trunk/src/java/org/apache/lenya/transaction/Versionable.java URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/transaction/Versionable.java?rev=191734&r1=191733&r2=191734&view=diff ============================================================================== --- lenya/trunk/src/java/org/apache/lenya/transaction/Versionable.java (original) +++ lenya/trunk/src/java/org/apache/lenya/transaction/Versionable.java Tue Jun 21 15:03:52 2005 @@ -19,7 +19,7 @@ /** * A versionable object. * - * @version $Id:$ + * @version $Id$ */ public interface Versionable extends Lockable { @@ -40,6 +40,12 @@ * @throws TransactionException if an error occurs. */ boolean isCheckedOut() throws TransactionException; + + /** + * @return if the object can be checked out + * @throws TransactionException if an error occurs. + */ + boolean canCheckOut() throws TransactionException; /** * Checks if the object has been changed since it has been locked. Modified: lenya/trunk/src/webapp/lenya/pubs/default/lenya/usecases/webdav/sitemap.xmap URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/lenya/usecases/webdav/sitemap.xmap?rev=191734&r1=191733&r2=191734&view=diff ============================================================================== --- lenya/trunk/src/webapp/lenya/pubs/default/lenya/usecases/webdav/sitemap.xmap (original) +++ lenya/trunk/src/webapp/lenya/pubs/default/lenya/usecases/webdav/sitemap.xmap Tue Jun 21 15:03:52 2005 @@ -222,10 +222,6 @@ </map:match> <map:match pattern="PUT/**_*.html"> - <!--fixme: Have to checkin or we get "can not lock error" trying to put when file is already checked out--> - <map:act type="reserved-checkin"> - <map:call function="put" /> - </map:act> <map:call function="put" /> </map:match>
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |