Merge branch 'master' into 1971-show-image-thumbnails
[arvados.git] / apps / workbench / app / models / collection.rb
index 94a2b959164200e874869a8f15b6e9724e04b7c3..5460e9a6e01641192b2ee0c9c0c12d9773e293e3 100644 (file)
@@ -1,4 +1,12 @@
 class Collection < ArvadosBase
+
+  MD5_EMPTY = 'd41d8cd98f00b204e9800998ecf8427e'
+
+  # Return true if the given string is the locator of a zero-length blob
+  def self.is_empty_blob_locator? locator
+    !!locator.to_s.match("^#{MD5_EMPTY}(\\+.*)?\$")
+  end
+
   def total_bytes
     if files
       tot = 0
@@ -13,7 +21,16 @@ class Collection < ArvadosBase
     false
   end
 
+  def self.creatable?
+    false
+  end
+
   def provenance
     $arvados_api_client.api "collections/#{self.uuid}/", "provenance"
   end
+
+  def used_by
+    $arvados_api_client.api "collections/#{self.uuid}/", "used_by"
+  end
+
 end