|
|
Choosing A Webhost: |
svn commit: r193068 - in /lenya/trunk/src/java/org/apache/lenya: cms/reposi: msg#00238cms.lenya.cvs
Author: chestnut Date: Wed Jun 22 21:01:58 2005 New Revision: 193068 URL: http://svn.apache.org/viewcvs?rev=193068&view=rev Log: Allows a user to checkout an object, execute multiple usecases on the object, and checkin the object 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 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=193068&r1=193067&r2=193068&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 Wed Jun 22 21:01:58 2005 @@ -117,19 +117,17 @@ /** * @see org.apache.lenya.transaction.Transactionable#canCheckOut() */ - public boolean canCheckOut() throws TransactionException { + public boolean isCheckedOutByUser() throws TransactionException { try { - RCMLEntry entry = getRevisionController().getRCML(getRCPath()).getLatestEntry(); - if(!isCheckedOut()) - return true; - else if(entry.getIdentity().equals(getUserId())) + RCMLEntry entry = getRevisionController().getRCML(getRCPath()).getLatestEntry(); + if(entry.getIdentity().equals(getUserId())) return true; - else - return false; + else + return false; } catch (TransactionException e) { - throw e; + throw e; } catch (Exception e) { - throw new TransactionException(e); + throw new TransactionException(e); } } @@ -306,7 +304,7 @@ * @see org.apache.lenya.transaction.Transactionable#lock() */ public void lock() throws TransactionException { - if (!canCheckOut()) { + if (isCheckedOut() && !isCheckedOutByUser()) { throw new TransactionException("Cannot lock [" + this + "]: node is checked out."); } if (getLogger().isDebugEnabled()) { 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=193068&r1=193067&r2=193068&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 Wed Jun 22 21:01:58 2005 @@ -642,8 +642,8 @@ boolean canExecute = true; for (int i = 0; i < objects.length; i++) { - if(!objects[i].canCheckOut()) { - if (getLogger().isDebugEnabled()) + if (objects[i].isCheckedOut() && !objects[i].isCheckedOutByUser()) { + if (getLogger().isDebugEnabled()) getLogger() .debug("AbstractUsecase::lockInvolvedObjects() can not execute, object [" + objects[i] + "] is already checked out"); @@ -659,7 +659,7 @@ + objects[i]); objects[i].lock(); - if (!isOptimistic()) { + if (!isOptimistic() && !objects[i].isCheckedOutByUser()) { objects[i].checkout(); } } 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=193068&r1=193067&r2=193068&view=diff ============================================================================== --- lenya/trunk/src/java/org/apache/lenya/transaction/Versionable.java (original) +++ lenya/trunk/src/java/org/apache/lenya/transaction/Versionable.java Wed Jun 22 21:01:58 2005 @@ -42,10 +42,10 @@ boolean isCheckedOut() throws TransactionException; /** - * @return if the object can be checked out + * @return if the object is checked out by the current user. * @throws TransactionException if an error occurs. */ - boolean canCheckOut() throws TransactionException; + boolean isCheckedOutByUser() throws TransactionException; /** * Checks if the object has been changed since it has been locked.
|
|
| <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 |