cmis 0.2.1-java → 0.2.2-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -468,6 +468,18 @@ rescue StandardError => e
468
468
  end
469
469
  ```
470
470
 
471
+ ## Change log
472
+ Many CMIS repositories has support to log changes in the repository:
473
+
474
+ ```ruby
475
+ latest_token = @session.repository_info.get_latest_change_log_token
476
+ changes = @session.get_content_changes(latest_token, true, 1000)
477
+
478
+ changes.get_change_events.each do |ce|
479
+ puts "ID: " + ce.get_object_id.to_s + " Change Type: " + ce.get_change_type.to_s
480
+ end
481
+ ```
482
+
471
483
  ## Contributing
472
484
 
473
485
  1. Fork it
data/cmis.gemspec CHANGED
@@ -5,7 +5,7 @@ require 'cmis/version'
5
5
 
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "cmis"
8
- gem.version = Cmis::VERSION
8
+ gem.version = CMIS::VERSION
9
9
  gem.authors = ["Richard Nyström"]
10
10
  gem.email = ["ricny046@gmail.com"]
11
11
  gem.description = %q{A thin JRuby wrapper for the Apache Chemistry OpenCMIS client.}
data/lib/cmis/version.rb CHANGED
@@ -1,3 +1,3 @@
1
- module Cmis
2
- VERSION = "0.2.1"
1
+ module CMIS
2
+ VERSION = "0.2.2"
3
3
  end
data/lib/cmis.rb CHANGED
@@ -47,6 +47,10 @@ module CMIS
47
47
  FolderImpl = org.apache.chemistry.opencmis.client.runtime.FolderImpl
48
48
  DocumentImpl = org.apache.chemistry.opencmis.client.runtime.DocumentImpl
49
49
 
50
+ # Explanation: https://github.com/jruby/jruby/wiki/Persistence
51
+ DocumentImpl.__persistent__ = true
52
+ FolderImpl.__persistent__ = true
53
+
50
54
  class DocumentImpl
51
55
  def download(destination_path)
52
56
  FileUtils.download(self, destination_path)
@@ -56,7 +60,7 @@ module CMIS
56
60
  self.allowable_actions.allowable_actions.to_a
57
61
  end
58
62
  end
59
-
63
+
60
64
  class FolderImpl
61
65
  def create_cmis_folder(name, props = nil)
62
66
  folder_props = { PropertyIds::OBJECT_TYPE_ID => "cmis:folder", PropertyIds::NAME => name }
@@ -83,7 +87,7 @@ module CMIS
83
87
  self.allowable_actions.allowable_actions.to_a
84
88
  end
85
89
  end
86
-
90
+
87
91
  def self.create_session(url, user, password, repo_id = nil)
88
92
  session_factory = SessionFactoryImpl.new_instance
89
93
  repo_id = self.repositories(url, user, password)[0].id if repo_id == nil
data/spec/cmis_spec.rb CHANGED
@@ -304,6 +304,24 @@ describe "CMIS" do
304
304
  rel.target.id.should == target_doc.id
305
305
  end
306
306
  end
307
+
308
+ # audit.cmischangelog.enabled=true required for Alfresco
309
+ describe "Content changes" do
310
+ it "should be possible to get content changes" do
311
+ latest_token = @session.repository_info.get_latest_change_log_token
312
+ @test_folder.create_cmis_folder(random_name)
313
+ changes = @session.get_content_changes(latest_token, true, 1000)
314
+ changes.get_change_events.should_not be_empty
315
+ end
316
+
317
+ it "should not change token if nothing is changed" do
318
+ latest_token = @session.repository_info.get_latest_change_log_token
319
+ #Do nothing
320
+ changes = @session.get_content_changes(latest_token, true, 1000);
321
+ new_token = changes.get_latest_change_log_token
322
+ new_token.should == latest_token
323
+ end
324
+ end
307
325
  end
308
326
 
309
327
  describe "Local Alfresco" do
data/spec/spec_helper.rb CHANGED
@@ -1,12 +1,12 @@
1
1
  require 'cmis'
2
2
  require 'tmpdir'
3
+
3
4
  def file_path( *paths )
4
5
  File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', *paths))
5
6
  end
6
7
 
7
-
8
8
  def random_name
9
- rand(16**16).to_s(16)
9
+ rand(16**16).to_s(16) + "-" + rand(16**16).to_s(16)
10
10
  end
11
11
 
12
12
  def create_random_doc(parent)
@@ -14,7 +14,7 @@ def create_random_doc(parent)
14
14
  file_name = random_name + ".txt"
15
15
  id = parent.create_cmis_document(file_name, file)
16
16
 
17
- parent.session.get_object(id)
17
+ parent.session.get_object(id)
18
18
  end
19
19
 
20
20
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cmis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: java
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-15 00:00:00.000000000 Z
12
+ date: 2013-02-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec