chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1167076 - /chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/VersionTable.java
Date Fri, 09 Sep 2011 10:19:15 GMT
Author: fmui
Date: Fri Sep  9 10:19:14 2011
New Revision: 1167076

URL: http://svn.apache.org/viewvc?rev=1167076&view=rev
Log:
Workbench: Added a check if the document has the canGetAllVersions allowable action before
calling getAllVersions()

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/VersionTable.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/VersionTable.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/VersionTable.java?rev=1167076&r1=1167075&r2=1167076&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/VersionTable.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/VersionTable.java
Fri Sep  9 10:19:14 2011
@@ -28,6 +28,7 @@ import javax.swing.SwingUtilities;
 
 import org.apache.chemistry.opencmis.client.api.Document;
 import org.apache.chemistry.opencmis.client.api.ObjectId;
+import org.apache.chemistry.opencmis.commons.enums.Action;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
 import org.apache.chemistry.opencmis.workbench.ClientHelper;
 import org.apache.chemistry.opencmis.workbench.model.ClientModel;
@@ -63,30 +64,32 @@ public class VersionTable extends Abstra
         if (getObject() instanceof Document) {
             final Document doc = (Document) getObject();
 
-            SwingUtilities.invokeLater(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-                        List<Document> newVersions = doc.getAllVersions(getClientModel().getClientSession()
-                                .geVersionOperationContext());
-
-                        lock.writeLock().lock();
+            if (doc.getAllowableActions().getAllowableActions().contains(Action.CAN_GET_ALL_VERSIONS))
{
+                SwingUtilities.invokeLater(new Runnable() {
+                    @Override
+                    public void run() {
                         try {
-                            versions = newVersions;
+                            setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+                            List<Document> newVersions = doc.getAllVersions(getClientModel().getClientSession()
+                                    .geVersionOperationContext());
+
+                            lock.writeLock().lock();
+                            try {
+                                versions = newVersions;
+                            } finally {
+                                lock.writeLock().unlock();
+                            }
+                        } catch (Exception ex) {
+                            if (!(ex instanceof CmisNotSupportedException)) {
+                                ClientHelper.showError(null, ex);
+                            }
                         } finally {
-                            lock.writeLock().unlock();
-                        }
-                    } catch (Exception ex) {
-                        if (!(ex instanceof CmisNotSupportedException)) {
-                            ClientHelper.showError(null, ex);
+                            setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                         }
-                    } finally {
-                        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+                        ((DetailsTableModel) getModel()).fireTableDataChanged();
                     }
-                    ((DetailsTableModel) getModel()).fireTableDataChanged();
-                }
-            });
+                });
+            }
         }
 
         super.objectLoaded(event);



Mime
View raw message