kuali-rice 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +18 -0
- data/Gemfile.lock +27 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +59 -0
- data/VERSION +1 -0
- data/kuali-rice.gemspec +90 -0
- data/lib/kuali-rice.rb +34 -0
- data/lib/kuali-rice/KualiRESTInterface.rb +3 -0
- data/lib/kuali-rice/KualiRESTInterface/DocumentActions.rb +120 -0
- data/lib/kuali-rice/KualiRESTInterface/PersonInterface.rb +24 -0
- data/lib/kuali-rice/KualiRESTInterface/RestAPI.rb +28 -0
- data/lib/kuali-rice/Responses.rb +5 -0
- data/lib/kuali-rice/Responses/ActionItem.rb +48 -0
- data/lib/kuali-rice/Responses/DocumentResponse.rb +36 -0
- data/lib/kuali-rice/Responses/ErrorResponse.rb +9 -0
- data/lib/kuali-rice/Responses/Person.rb +81 -0
- data/lib/kuali-rice/Responses/StandardResponse.rb +35 -0
- data/support/DocumentFinalFYIRouting.xml +10 -0
- data/support/RiceWSDocType.xml +80 -0
- data/test/helper.rb +18 -0
- data/test/test_kuali-rice.rb +253 -0
- data/test/test_person_interface.rb +28 -0
- metadata +208 -0
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
gem "xml-simple", ">= 0"
|
7
|
+
|
8
|
+
# Add dependencies to develop your gem here.
|
9
|
+
# Include everything needed to run rake, tests, features, etc.
|
10
|
+
group :development do
|
11
|
+
gem "shoulda", ">= 0"
|
12
|
+
gem "bundler", "~> 1.0.0"
|
13
|
+
gem "jeweler", "~> 1.5.2"
|
14
|
+
gem "rcov", ">= 0"
|
15
|
+
gem "xml-simple", ">= 0"
|
16
|
+
gem 'ci_reporter', ">= 0"
|
17
|
+
gem 'builder', ">= 0"
|
18
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
builder (2.1.2)
|
5
|
+
ci_reporter (1.6.2)
|
6
|
+
builder (>= 2.1.2)
|
7
|
+
git (1.2.5)
|
8
|
+
jeweler (1.5.2)
|
9
|
+
bundler (~> 1.0.0)
|
10
|
+
git (>= 1.2.5)
|
11
|
+
rake
|
12
|
+
rake (0.8.7)
|
13
|
+
rcov (0.9.9)
|
14
|
+
shoulda (2.11.3)
|
15
|
+
xml-simple (1.0.12)
|
16
|
+
|
17
|
+
PLATFORMS
|
18
|
+
ruby
|
19
|
+
|
20
|
+
DEPENDENCIES
|
21
|
+
builder
|
22
|
+
bundler (~> 1.0.0)
|
23
|
+
ci_reporter
|
24
|
+
jeweler (~> 1.5.2)
|
25
|
+
rcov
|
26
|
+
shoulda
|
27
|
+
xml-simple
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Shawn Bower
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= kuali-rice
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to kuali-rice
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
9
|
+
* Fork the project
|
10
|
+
* Start a feature/bugfix branch
|
11
|
+
* Commit and push until you are happy with your contribution
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2010 Shawn Bower. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
|
4
|
+
gem 'ci_reporter'
|
5
|
+
|
6
|
+
require 'ci/reporter/rake/test_unit'
|
7
|
+
|
8
|
+
begin
|
9
|
+
Bundler.setup(:default, :development)
|
10
|
+
rescue Bundler::BundlerError => e
|
11
|
+
$stderr.puts e.message
|
12
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
13
|
+
exit e.status_code
|
14
|
+
end
|
15
|
+
require 'rake'
|
16
|
+
|
17
|
+
require 'jeweler'
|
18
|
+
Jeweler::Tasks.new do |gem|
|
19
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
20
|
+
gem.name = "kuali-rice"
|
21
|
+
gem.homepage = "http://github.com/sbower/kuali-rice"
|
22
|
+
gem.license = "MIT"
|
23
|
+
gem.summary = %Q{This gem is used to interface with a RICE install via REST services}
|
24
|
+
gem.description = %Q{This gem is used to interface with a RICE install via REST services}
|
25
|
+
gem.email = "shawn.bower@gmail.com"
|
26
|
+
gem.authors = ["Shawn Bower"]
|
27
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
28
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
29
|
+
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
30
|
+
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
31
|
+
end
|
32
|
+
Jeweler::RubygemsDotOrgTasks.new
|
33
|
+
|
34
|
+
require 'rake/testtask'
|
35
|
+
Rake::TestTask.new(:test) do |test|
|
36
|
+
test.libs << 'lib' << 'test'
|
37
|
+
test.pattern = 'test/**/test_*.rb'
|
38
|
+
test.verbose = true
|
39
|
+
end
|
40
|
+
|
41
|
+
require 'rcov/rcovtask'
|
42
|
+
Rcov::RcovTask.new do |test|
|
43
|
+
test.libs << 'test'
|
44
|
+
test.pattern = 'test/**/test_*.rb'
|
45
|
+
test.verbose = true
|
46
|
+
test.rcov_opts << '--exclude "gems/*"'
|
47
|
+
end
|
48
|
+
|
49
|
+
task :default => :test
|
50
|
+
|
51
|
+
require 'rake/rdoctask'
|
52
|
+
Rake::RDocTask.new do |rdoc|
|
53
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
54
|
+
|
55
|
+
rdoc.rdoc_dir = 'rdoc'
|
56
|
+
rdoc.title = "kuali-rice #{version}"
|
57
|
+
rdoc.rdoc_files.include('README*')
|
58
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
59
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/kuali-rice.gemspec
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{kuali-rice}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Shawn Bower"]
|
12
|
+
s.date = %q{2010-12-28}
|
13
|
+
s.description = %q{This gem is used to interface with a RICE install via REST services}
|
14
|
+
s.email = %q{shawn.bower@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"kuali-rice.gemspec",
|
28
|
+
"lib/kuali-rice.rb",
|
29
|
+
"lib/kuali-rice/KualiRESTInterface.rb",
|
30
|
+
"lib/kuali-rice/KualiRESTInterface/DocumentActions.rb",
|
31
|
+
"lib/kuali-rice/KualiRESTInterface/PersonInterface.rb",
|
32
|
+
"lib/kuali-rice/KualiRESTInterface/RestAPI.rb",
|
33
|
+
"lib/kuali-rice/Responses.rb",
|
34
|
+
"lib/kuali-rice/Responses/ActionItem.rb",
|
35
|
+
"lib/kuali-rice/Responses/DocumentResponse.rb",
|
36
|
+
"lib/kuali-rice/Responses/ErrorResponse.rb",
|
37
|
+
"lib/kuali-rice/Responses/Person.rb",
|
38
|
+
"lib/kuali-rice/Responses/StandardResponse.rb",
|
39
|
+
"support/DocumentFinalFYIRouting.xml",
|
40
|
+
"support/RiceWSDocType.xml",
|
41
|
+
"test/helper.rb",
|
42
|
+
"test/test_kuali-rice.rb",
|
43
|
+
"test/test_person_interface.rb"
|
44
|
+
]
|
45
|
+
s.homepage = %q{http://github.com/sbower/kuali-rice}
|
46
|
+
s.licenses = ["MIT"]
|
47
|
+
s.require_paths = ["lib"]
|
48
|
+
s.rubygems_version = %q{1.3.7}
|
49
|
+
s.summary = %q{This gem is used to interface with a RICE install via REST services}
|
50
|
+
s.test_files = [
|
51
|
+
"test/helper.rb",
|
52
|
+
"test/test_kuali-rice.rb",
|
53
|
+
"test/test_person_interface.rb"
|
54
|
+
]
|
55
|
+
|
56
|
+
if s.respond_to? :specification_version then
|
57
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
58
|
+
s.specification_version = 3
|
59
|
+
|
60
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
61
|
+
s.add_runtime_dependency(%q<xml-simple>, [">= 0"])
|
62
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
63
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
64
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
65
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
66
|
+
s.add_development_dependency(%q<xml-simple>, [">= 0"])
|
67
|
+
s.add_development_dependency(%q<ci_reporter>, [">= 0"])
|
68
|
+
s.add_development_dependency(%q<builder>, [">= 0"])
|
69
|
+
else
|
70
|
+
s.add_dependency(%q<xml-simple>, [">= 0"])
|
71
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
72
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
73
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
74
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
75
|
+
s.add_dependency(%q<xml-simple>, [">= 0"])
|
76
|
+
s.add_dependency(%q<ci_reporter>, [">= 0"])
|
77
|
+
s.add_dependency(%q<builder>, [">= 0"])
|
78
|
+
end
|
79
|
+
else
|
80
|
+
s.add_dependency(%q<xml-simple>, [">= 0"])
|
81
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
82
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
83
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
84
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
85
|
+
s.add_dependency(%q<xml-simple>, [">= 0"])
|
86
|
+
s.add_dependency(%q<ci_reporter>, [">= 0"])
|
87
|
+
s.add_dependency(%q<builder>, [">= 0"])
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
data/lib/kuali-rice.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'net/https'
|
3
|
+
|
4
|
+
# openssl is required to support signed_request
|
5
|
+
require 'openssl'
|
6
|
+
|
7
|
+
require 'rubygems'
|
8
|
+
require 'xmlsimple'
|
9
|
+
|
10
|
+
def require_local(suffix)
|
11
|
+
require(File.expand_path(File.join(File.dirname(__FILE__), suffix)))
|
12
|
+
end
|
13
|
+
|
14
|
+
module KualiRice
|
15
|
+
|
16
|
+
REMOTING_PATH = "/kr-dev/remoting"
|
17
|
+
|
18
|
+
attr_accessor :server
|
19
|
+
attr_accessor :use_ssl
|
20
|
+
attr_accessor :port
|
21
|
+
|
22
|
+
def initialize(server = "localhost")
|
23
|
+
@server = server
|
24
|
+
@use_ssl = false
|
25
|
+
@port = "8080"
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
require_local("/kuali-rice/KualiRESTInterface")
|
31
|
+
require_local("/kuali-rice/Responses")
|
32
|
+
|
33
|
+
|
34
|
+
|
@@ -0,0 +1,120 @@
|
|
1
|
+
module KualiRice
|
2
|
+
|
3
|
+
class KualiRESTInterface
|
4
|
+
include KualiRice
|
5
|
+
|
6
|
+
def ping
|
7
|
+
rest_call("/simpleDocAction/ping")
|
8
|
+
end
|
9
|
+
|
10
|
+
def getDocument(docid, userid)
|
11
|
+
DocumentResponse.new(rest_call("/simpleDocAction/doc/getdocument/userID/#{userid}/docid/#{docid}"))
|
12
|
+
end
|
13
|
+
|
14
|
+
def create(initiatorId, appDocId, docType, docTitle)
|
15
|
+
DocumentResponse.new(rest_call("/simpleDocAction/doc/create/initiatorID/#{initiatorId}/appid/#{appDocId}/type/#{docType}/title/#{docTitle}", :post))
|
16
|
+
end
|
17
|
+
|
18
|
+
def save(docid, userID, docTitle, annotation)
|
19
|
+
StandardResponse.new(rest_call("/simpleDocAction/doc/save/userID/#{userID}/docid/#{docid}/title/#{docTitle}/annotation/#{annotation}", :post))
|
20
|
+
end
|
21
|
+
|
22
|
+
def acknowledge(docid, userID, annotation)
|
23
|
+
StandardResponse.new(rest_call("/simpleDocAction/doc/acknowledge/userID/#{userID}/docid/#{docid}/annotation/#{annotation}", :post))
|
24
|
+
end
|
25
|
+
|
26
|
+
def approve(docid, userID, docTitle, annotation)
|
27
|
+
StandardResponse.new(rest_call("/simpleDocAction/doc/approve/userID/#{userID}/docid/#{docid}/title/#{docTitle}/annotation/#{annotation}", :post))
|
28
|
+
end
|
29
|
+
|
30
|
+
def blanketApprove(docid, userID, docTitle, annotation)
|
31
|
+
StandardResponse.new(rest_call("/simpleDocAction/doc/blanketApprove/userID/#{userID}/docid/#{docid}/title/#{docTitle}/annotation/#{annotation}", :post))
|
32
|
+
end
|
33
|
+
|
34
|
+
def cancel(docid, userID, annotation)
|
35
|
+
StandardResponse.new(rest_call("/simpleDocAction/doc/cancel/userID/#{userID}/docid/#{docid}/annotation/#{annotation}", :post))
|
36
|
+
end
|
37
|
+
|
38
|
+
def disapprove(docid, userID, annotation)
|
39
|
+
StandardResponse.new(rest_call("/simpleDocAction/doc/disapprove/userID/#{userID}/docid/#{docid}/annotation/#{annotation}", :post))
|
40
|
+
end
|
41
|
+
|
42
|
+
def fyi(docid, userID)
|
43
|
+
StandardResponse.new(rest_call("/simpleDocAction/doc/fyi/userID/#{userID}/docid/#{docid}", :post))
|
44
|
+
end
|
45
|
+
|
46
|
+
def route(docid, userID, docTitle, annotation)
|
47
|
+
StandardResponse.new(rest_call("/simpleDocAction/doc/route/userID/#{userID}/docid/#{docid}/title/#{docTitle}/annotation/#{annotation}", :post))
|
48
|
+
end
|
49
|
+
|
50
|
+
def requestAdHocAckToGroup(docid, userID, recipientGroupId, annotation)
|
51
|
+
StandardResponse.new(rest_call("/simpleDocAction/doc/requestAdHocAckToGroup/userID/#{userID}/docid/#{docid}/recipientgroupid/#{recipientGroupId}/annotation/#{annotation}", :post))
|
52
|
+
end
|
53
|
+
|
54
|
+
def requestAdHocAckToUser(docid, userID, recipientId, annotation)
|
55
|
+
StandardResponse.new(rest_call("/simpleDocAction/doc/requestAdHocAckToUser/userID/#{userID}/docid/#{docid}/recipientid/#{recipientId}/annotation/#{annotation}", :post))
|
56
|
+
end
|
57
|
+
|
58
|
+
def requestAdHocApproveToGroup(docid, userID, recipientGroupId, annotation)
|
59
|
+
StandardResponse.new(rest_call("/simpleDocAction/doc/requestAdHocApproveToGroup/userID/#{userID}/docid/#{docid}/recipientgroupid/#{recipientGroupId}/annotation/#{annotation}", :post))
|
60
|
+
end
|
61
|
+
|
62
|
+
def requestAdHocApproveToUser(docid, userID, recipientId, annotation)
|
63
|
+
StandardResponse.new(rest_call("/simpleDocAction/doc/requestAdHocApproveToUser/userID/#{userID}/docid/#{docid}/recipientid/#{recipientId}/annotation/#{annotation}", :post))
|
64
|
+
end
|
65
|
+
|
66
|
+
def requestAdHocFyiToGroup(docid, userID, recipientGroupId, annotation)
|
67
|
+
StandardResponse.new(rest_call("/simpleDocAction/doc/requestAdHocFyiToGroup/userID/#{userID}/docid/#{docid}/recipientgroupid/#{recipientGroupId}/annotation/#{annotation}", :post))
|
68
|
+
end
|
69
|
+
|
70
|
+
def requestAdHocFyiToUser(docid, userID, recipientId, annotation)
|
71
|
+
StandardResponse.new(rest_call("/simpleDocAction/doc/requestAdHocFyiToUser/userID/#{userID}/docid/#{docid}/recipientid/#{recipientId}/annotation/#{annotation}", :post))
|
72
|
+
end
|
73
|
+
|
74
|
+
def isUserInRouteLog(docid, userID)
|
75
|
+
xmldata = rest_call("/simpleDocAction/doc/isUserInRouteLog/userID/#{userID}/docid/#{docid}")
|
76
|
+
parseddata = XmlSimple.xml_in(xmldata)
|
77
|
+
|
78
|
+
if(parseddata['isUserInRouteLog'][0].eql?("true")) then
|
79
|
+
return true
|
80
|
+
end
|
81
|
+
|
82
|
+
return false
|
83
|
+
end
|
84
|
+
|
85
|
+
def getUserInbox(userID)
|
86
|
+
createActionList(rest_call("/simpleDocAction/actionitems/getinbox/#{userID}"))
|
87
|
+
end
|
88
|
+
|
89
|
+
def countUserInboxItems(userID)
|
90
|
+
rest_call("/simpleDocAction/actionitems/countinbox/#{userID}")
|
91
|
+
end
|
92
|
+
|
93
|
+
def findByRouteHeaderId(routeHeaderIdStr)
|
94
|
+
createActionList(rest_call("/simpleDocAction/actionitems/findbyrouteheader/#{routeHeaderIdStr}"))
|
95
|
+
end
|
96
|
+
|
97
|
+
def sendNotification(message)
|
98
|
+
rest_call("/simpleDocAction/notification/send/", :post, message)
|
99
|
+
end
|
100
|
+
|
101
|
+
private
|
102
|
+
|
103
|
+
def createActionList(xmldata)
|
104
|
+
parseddata = XmlSimple.xml_in(xmldata)
|
105
|
+
actionItems = Array.new
|
106
|
+
|
107
|
+
if !parseddata['ActionItem'].nil? then
|
108
|
+
parseddata['ActionItem'].each do |item|
|
109
|
+
newactionitem = ActionItem.new(XmlSimple.xml_out(item))
|
110
|
+
actionItems.push(newactionitem)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
actionItems
|
115
|
+
end
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module KualiRice
|
2
|
+
|
3
|
+
class KualiRESTInterface
|
4
|
+
include KualiRice
|
5
|
+
|
6
|
+
def getPersonByPrincipalName(prncpl_nm)
|
7
|
+
Person.new(rest_call("/personServiceREST/Person/byprincipalname/#{prncpl_nm}"))
|
8
|
+
end
|
9
|
+
|
10
|
+
def getPersonByEmployeeId(emplid)
|
11
|
+
Person.new(rest_call("/personServiceREST/Person/byemployeeid/#{emplid}"))
|
12
|
+
end
|
13
|
+
|
14
|
+
def getPersonByPrincipalID(prncpl_id)
|
15
|
+
Person.new(rest_call("/personServiceREST/Person/byprincipalid/#{prncpl_id}"))
|
16
|
+
end
|
17
|
+
|
18
|
+
def getPersonByExternalIdentifier(type, id)
|
19
|
+
Person.new(rest_call("/personServiceREST/Person/byexternalid/type/#{type}/id/#{id}"))
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module KualiRice
|
2
|
+
|
3
|
+
class KualiRESTInterface
|
4
|
+
include KualiRice
|
5
|
+
|
6
|
+
def rest_call (path, verb = "get", post_data = "")
|
7
|
+
|
8
|
+
http = Net::HTTP.new(@server, @use_ssl ? 443 : @port)
|
9
|
+
http.use_ssl = true if @use_ssl
|
10
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
11
|
+
|
12
|
+
path = REMOTING_PATH + path
|
13
|
+
path = URI.escape(path)
|
14
|
+
|
15
|
+
result = http.start { |http|
|
16
|
+
response, body = (verb.eql?(:post) ? http.post(path, encode_params(post_data)) : http.get(path))
|
17
|
+
body
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
protected
|
22
|
+
def encode_params(param_hash)
|
23
|
+
param_hash
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module KualiRice
|
2
|
+
|
3
|
+
class ActionItem
|
4
|
+
attr_accessor :delegatorName
|
5
|
+
attr_accessor :isInitialized
|
6
|
+
attr_accessor :actionItemId
|
7
|
+
attr_accessor :principalId
|
8
|
+
attr_accessor :dateAssigned
|
9
|
+
attr_accessor :actionRequestCd
|
10
|
+
attr_accessor :actionRequestId
|
11
|
+
attr_accessor :routeHeaderId
|
12
|
+
attr_accessor :docTitle
|
13
|
+
attr_accessor :docLabel
|
14
|
+
attr_accessor :docHandlerURL
|
15
|
+
attr_accessor :lockVerNbr
|
16
|
+
attr_accessor :docName
|
17
|
+
attr_accessor :responsibilityId
|
18
|
+
attr_accessor :customActions
|
19
|
+
|
20
|
+
def initialize(xmldata="")
|
21
|
+
setActionItem(xmldata)
|
22
|
+
end
|
23
|
+
|
24
|
+
def setActionItem(xmldata)
|
25
|
+
if not xmldata.eql?("") then
|
26
|
+
parseddata = XmlSimple.xml_in(xmldata)
|
27
|
+
|
28
|
+
@delegatorName = parseddata['delegatorName'][0] if !parseddata['delegatorName'].nil?
|
29
|
+
@isInitialized = parseddata['isInitialized'][0] if !parseddata['isInitialized'].nil?
|
30
|
+
@actionItemId = parseddata['actionItemId'][0] if !parseddata['actionItemId'].nil?
|
31
|
+
@principalId = parseddata['principalId'][0] if !parseddata['principalId'].nil?
|
32
|
+
@dateAssigned = parseddata['dateAssigned'][0] if !parseddata['dateAssigned'].nil?
|
33
|
+
@actionRequestCd = parseddata['actionRequestCd'][0] if !parseddata['actionRequestCd'].nil?
|
34
|
+
@actionRequestId = parseddata['actionRequestId'][0] if !parseddata['actionRequestId'].nil?
|
35
|
+
@routeHeaderId = parseddata['routeHeaderId'][0] if !parseddata['routeHeaderId'].nil?
|
36
|
+
@docTitle = parseddata['docTitle'][0] if !parseddata['docTitle'].nil?
|
37
|
+
@docLabel = parseddata['docLabel'][0] if !parseddata['docLabel'].nil?
|
38
|
+
@docHandlerURL = parseddata['docHandlerURL'][0] if !parseddata['docHandlerURL'].nil?
|
39
|
+
@lockVerNbr = parseddata['lockVerNbr'][0] if !parseddata['lockVerNbr'].nil?
|
40
|
+
@docName = parseddata['docName'][0] if !parseddata['docName'].nil?
|
41
|
+
@responsibilityId = parseddata['responsibilityId'][0] if !parseddata['responsibilityId'].nil?
|
42
|
+
@customActions = parseddata['customActions'][0] if !parseddata['customActions'].nil?
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module KualiRice
|
2
|
+
|
3
|
+
class DocumentResponse < StandardResponse
|
4
|
+
|
5
|
+
attr_accessor :docId
|
6
|
+
attr_accessor :docContent
|
7
|
+
attr_accessor :title
|
8
|
+
attr_accessor :notes
|
9
|
+
attr_accessor :actionRequested
|
10
|
+
|
11
|
+
def initialize(xmldata="")
|
12
|
+
setDocumentResponse(xmldata)
|
13
|
+
end
|
14
|
+
|
15
|
+
def setDocumentResponse(xmldata)
|
16
|
+
if not xmldata.eql?("") then
|
17
|
+
parseddata = XmlSimple.xml_in(xmldata)
|
18
|
+
|
19
|
+
@docId = parseddata['docId'][0] if !parseddata['docId'].nil?
|
20
|
+
@docContent = parseddata['docContent'][0] if !parseddata['docContent'].nil?
|
21
|
+
@title = parseddata['title'][0] if !parseddata['title'].nil?
|
22
|
+
@actionRequested = parseddata['actionRequested'][0] if !parseddata['actionRequested'].nil?
|
23
|
+
@docStatus = parseddata['docStatus'][0] if !parseddata['docStatus'].nil?
|
24
|
+
@createDate = parseddata['createDate'][0] if !parseddata['createDate'].nil?
|
25
|
+
@initiatorPrincipalId = parseddata['initiatorPrincipalId'][0] if !parseddata['initiatorPrincipalId'].nil?
|
26
|
+
@routedByPrincipalId = parseddata['routedByPrincipalId'][0] if !parseddata['routedByPrincipalId'].nil?
|
27
|
+
@routedByUserName = parseddata['routedByUserName'][0] if !parseddata['routedByUserName'].nil?
|
28
|
+
@appDocId = parseddata['appDocId'][0] if !parseddata['appDocId'].nil?
|
29
|
+
@initiatorName = parseddata['initiatorName'][0] if !parseddata['initiatorName'].nil?
|
30
|
+
@errorMessage = parseddata['errorMessage'][0] if !parseddata['errorMessage'].nil?
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
module KualiRice
|
2
|
+
|
3
|
+
class Person
|
4
|
+
|
5
|
+
attr_accessor :principalId
|
6
|
+
attr_accessor :principalName
|
7
|
+
attr_accessor :entityId
|
8
|
+
attr_accessor :entityTypeCode
|
9
|
+
attr_accessor :firstName
|
10
|
+
attr_accessor :middleName
|
11
|
+
attr_accessor :lastName
|
12
|
+
attr_accessor :name
|
13
|
+
attr_accessor :addressLine1
|
14
|
+
attr_accessor :addressLine2
|
15
|
+
attr_accessor :addressLine3
|
16
|
+
attr_accessor :addressCityName
|
17
|
+
attr_accessor :addressStateCode
|
18
|
+
attr_accessor :addressPostalCode
|
19
|
+
attr_accessor :addressCountryCode
|
20
|
+
attr_accessor :emailAddress
|
21
|
+
attr_accessor :phoneNumber
|
22
|
+
attr_accessor :suppressName
|
23
|
+
attr_accessor :suppressAddress
|
24
|
+
attr_accessor :suppressPhone
|
25
|
+
attr_accessor :suppressPersonal
|
26
|
+
attr_accessor :suppressEmail
|
27
|
+
attr_accessor :campusCode
|
28
|
+
attr_accessor :employeeStatusCode
|
29
|
+
attr_accessor :employeeTypeCode
|
30
|
+
attr_accessor :primaryDepartmentCode
|
31
|
+
attr_accessor :employeeId
|
32
|
+
attr_accessor :baseSalaryAmount
|
33
|
+
attr_accessor :active
|
34
|
+
|
35
|
+
#figure out what to do with affiliations and external identifiers
|
36
|
+
#protected List<? extends KimEntityAffiliation> affiliations
|
37
|
+
#protected Map<String,String> externalIdentifiers = null
|
38
|
+
|
39
|
+
def initialize(xmldata="")
|
40
|
+
setPerson(xmldata)
|
41
|
+
end
|
42
|
+
|
43
|
+
def setPerson(xmldata)
|
44
|
+
if not xmldata.eql?("") then
|
45
|
+
parseddata = XmlSimple.xml_in(xmldata)
|
46
|
+
|
47
|
+
@principalId = parseddata['principalId'][0] if !parseddata['principalId'].nil?
|
48
|
+
@principalName = parseddata['principalName'][0] if !parseddata['principalName'].nil?
|
49
|
+
@entityId = parseddata['entityId'][0] if !parseddata['entityId'].nil?
|
50
|
+
@entityTypeCode = parseddata['entityTypeCode'][0] if !parseddata['entityTypeCode'].nil?
|
51
|
+
@firstName = parseddata['firstName'][0] if !parseddata['firstName'].nil?
|
52
|
+
@middleName = parseddata['middleName'][0] if !parseddata['middleName'].nil?
|
53
|
+
@lastName = parseddata['lastName'][0] if !parseddata['lastName'].nil?
|
54
|
+
@name = parseddata['name'][0] if !parseddata['name'].nil?
|
55
|
+
@addressLine1 = parseddata['addressLine1'][0] if !parseddata['addressLine1'].nil?
|
56
|
+
@addressLine2 = parseddata['addressLine2'][0] if !parseddata['addressLine2'].nil?
|
57
|
+
@addressLine3 = parseddata['addressLine3'][0] if !parseddata['addressLine3'].nil?
|
58
|
+
@addressCityName = parseddata['addressCityName'][0] if !parseddata['addressCityName'].nil?
|
59
|
+
@addressStateCode = parseddata['addressStateCode'][0] if !parseddata['addressStateCode'].nil?
|
60
|
+
@addressPostalCode = parseddata['addressPostalCode'][0] if !parseddata['addressPostalCode'].nil?
|
61
|
+
@addressCountryCode = parseddata['addressCountryCode'][0] if !parseddata['addressCountryCode'].nil?
|
62
|
+
@emailAddress = parseddata['emailAddress'][0] if !parseddata['emailAddress'].nil?
|
63
|
+
@phoneNumber = parseddata['phoneNumber'][0] if !parseddata['phoneNumber'].nil?
|
64
|
+
@suppressName = parseddata['suppressName'][0] if !parseddata['suppressName'].nil?
|
65
|
+
@suppressAddress = parseddata['suppressAddress'][0] if !parseddata['suppressAddress'].nil?
|
66
|
+
@suppressPhone = parseddata['suppressPersonal'][0] if !parseddata['suppressPersonal'].nil?
|
67
|
+
@suppressPersonal = parseddata['suppressPersonal'][0] if !parseddata['suppressPersonal'].nil?
|
68
|
+
@suppressEmail = parseddata['suppressEmail'][0] if !parseddata['suppressEmail'].nil?
|
69
|
+
@campusCode = parseddata['campusCode'][0] if !parseddata['campusCode'].nil?
|
70
|
+
@employeeStatusCode = parseddata['employeeStatusCode'][0] if !parseddata['employeeStatusCode'].nil?
|
71
|
+
@employeeTypeCode = parseddata['employeeTypeCode'][0] if !parseddata['employeeTypeCode'].nil?
|
72
|
+
@primaryDepartmentCode = parseddata['primaryDepartmentCode'][0] if !parseddata['primaryDepartmentCode'].nil?
|
73
|
+
@employeeId= parseddata['employeeId'][0] if !parseddata['employeeId'].nil?
|
74
|
+
@baseSalaryAmount = parseddata['baseSalaryAmount'][0]['value'][0] if !parseddata['baseSalaryAmount'].nil?
|
75
|
+
@active = parseddata['active'][0] if !parseddata['active'].nil?
|
76
|
+
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module KualiRice
|
2
|
+
|
3
|
+
class StandardResponse < ErrorResponse
|
4
|
+
|
5
|
+
attr_accessor :docStatus
|
6
|
+
attr_accessor :createDate
|
7
|
+
attr_accessor :initiatorPrincipalId
|
8
|
+
attr_accessor :routedByPrincipalId
|
9
|
+
attr_accessor :routedByUserName
|
10
|
+
attr_accessor :appDocId
|
11
|
+
attr_accessor :initiatorName
|
12
|
+
|
13
|
+
def initialize(xmldata="")
|
14
|
+
setStandardResponse(xmldata)
|
15
|
+
end
|
16
|
+
|
17
|
+
def setStandardResponse(xmldata)
|
18
|
+
if not xmldata.eql?("") then
|
19
|
+
parseddata = XmlSimple.xml_in(xmldata)
|
20
|
+
|
21
|
+
@docStatus = parseddata['docStatus'][0] if !parseddata['docStatus'].nil?
|
22
|
+
@createDate = parseddata['createDate'][0] if !parseddata['createDate'].nil?
|
23
|
+
@initiatorPrincipalId = parseddata['initiatorPrincipalId'][0] if !parseddata['initiatorPrincipalId'].nil?
|
24
|
+
@routedByPrincipalId = parseddata['routedByPrincipalId'][0] if !parseddata['routedByPrincipalId'].nil?
|
25
|
+
@routedByUserName = parseddata['routedByUserName'][0] if !parseddata['routedByUserName'].nil?
|
26
|
+
@appDocId = parseddata['appDocId'][0] if !parseddata['appDocId'].nil?
|
27
|
+
@initiatorName = parseddata['initiatorName'][0] if !parseddata['initiatorName'].nil?
|
28
|
+
@errorMessage = parseddata['errorMessage'][0] if !parseddata['errorMessage'].nil?
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<data xmlns="ns:workflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="ns:workflow resource:WorkflowData">
|
3
|
+
<ruleTemplates xmlns="ns:workflow/RuleTemplate" xsi:schemaLocation="ns:workflow/RuleTemplate resource:RuleTemplate">
|
4
|
+
<ruleTemplate>
|
5
|
+
<name>DocumentFinalFYIRouting</name>
|
6
|
+
<description>Send out FYIs to multiple places because the document is final.</description>
|
7
|
+
</ruleTemplate>
|
8
|
+
</ruleTemplates>
|
9
|
+
</data>
|
10
|
+
|
@@ -0,0 +1,80 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<data xmlns="ns:workflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="ns:workflow resource:WorkflowData">
|
3
|
+
<documentTypes xmlns="ns:workflow/DocumentType" xsi:schemaLocation="ns:workflow/DocumentType resource:DocumentType">
|
4
|
+
<documentType>
|
5
|
+
<name>RiceWSTest</name>
|
6
|
+
<parent>RiceDocument</parent>
|
7
|
+
<description>Used for testing the Rice rest based webservies</description>
|
8
|
+
<label>RiceWS Test</label>
|
9
|
+
<superUserWorkgroupName>KUALI:eDoc.Example1.SuperUsers</superUserWorkgroupName>
|
10
|
+
<blanketApproveWorkgroupName>WorkflowAdmin</blanketApproveWorkgroupName>
|
11
|
+
<defaultExceptionWorkgroupName>WorkflowAdmin</defaultExceptionWorkgroupName>
|
12
|
+
<postProcessorName></postProcessorName>
|
13
|
+
<docHandler>http://localhost:8080/kr-dev</docHandler>
|
14
|
+
<active>true</active>
|
15
|
+
<policies>
|
16
|
+
<policy>
|
17
|
+
<name>DISAPPROVE</name>
|
18
|
+
<value>true</value>
|
19
|
+
</policy>
|
20
|
+
<policy>
|
21
|
+
<name>INITIATOR_MUST_BLANKET_APPROVE</name>
|
22
|
+
<value>false</value>
|
23
|
+
</policy>
|
24
|
+
</policies>
|
25
|
+
<routingVersion>1</routingVersion>
|
26
|
+
<routePaths>
|
27
|
+
<routePath>
|
28
|
+
<start name="Adhoc Routing" nextNode="RiceWSTestRuleNode"/>
|
29
|
+
<requests name="RiceWSTestRuleNode" nextNode="InitiatorRoutingRuleNode"/>
|
30
|
+
<requests name="InitiatorRoutingRuleNode"/>
|
31
|
+
</routePath>
|
32
|
+
</routePaths>
|
33
|
+
<routeNodes>
|
34
|
+
<start name="Adhoc Routing">
|
35
|
+
<activationType>S</activationType>
|
36
|
+
<mandatoryRoute>false</mandatoryRoute>
|
37
|
+
<finalApproval>false</finalApproval>
|
38
|
+
</start>
|
39
|
+
<requests name="RiceWSTestRuleNode">
|
40
|
+
<activationType>P</activationType>
|
41
|
+
<mandatoryRoute>false</mandatoryRoute>
|
42
|
+
<finalApproval>false</finalApproval>
|
43
|
+
<ruleSelector>Named</ruleSelector>
|
44
|
+
<ruleName>RiceWSTestAddnlRouting</ruleName>
|
45
|
+
</requests>
|
46
|
+
<requests name="InitiatorRoutingRuleNode">
|
47
|
+
<activationType>S</activationType>
|
48
|
+
<ruleTemplate>DocumentFinalFYIRouting</ruleTemplate>
|
49
|
+
</requests>
|
50
|
+
</routeNodes>
|
51
|
+
</documentType>
|
52
|
+
</documentTypes>
|
53
|
+
|
54
|
+
<rules xmlns="ns:workflow/Rule" xsi:schemaLocation="ns:workflow/Rule resource:Rule">
|
55
|
+
<rule>
|
56
|
+
<name>RiceWSTestAddnlRouting</name>
|
57
|
+
<documentType>RiceWSTest</documentType>
|
58
|
+
<description>Additional Rule for Testing Routing</description>
|
59
|
+
<responsibilities>
|
60
|
+
<responsibility>
|
61
|
+
<workgroup>KUALI:Group0</workgroup>
|
62
|
+
<actionRequested>A</actionRequested>
|
63
|
+
<priority>1</priority>
|
64
|
+
</responsibility>
|
65
|
+
</responsibilities>
|
66
|
+
</rule>
|
67
|
+
<rule>
|
68
|
+
<name>InitiatorRoutingRule</name>
|
69
|
+
<documentType>RiceWSTest</documentType>
|
70
|
+
<description>Dynamic initiator routing determination</description>
|
71
|
+
<responsibilities>
|
72
|
+
<responsibility>
|
73
|
+
<role>org.kuali.rice.kew.rule.InitiatorRoleAttribute!INITIATOR</role>
|
74
|
+
<actionRequested>F</actionRequested>
|
75
|
+
</responsibility>
|
76
|
+
</responsibilities>
|
77
|
+
</rule>
|
78
|
+
</rules>
|
79
|
+
|
80
|
+
</data>
|
data/test/helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
require 'shoulda'
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
require 'kuali-rice'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
end
|
@@ -0,0 +1,253 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestKualiRice < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@ricews = KualiRice::KualiRESTInterface.new
|
7
|
+
|
8
|
+
document = @ricews.create("user4", "0", "RiceWSTest", "TestTitle")
|
9
|
+
|
10
|
+
@createdDocId = document.docId
|
11
|
+
end
|
12
|
+
|
13
|
+
should "create new interface object" do
|
14
|
+
assert_equal @ricews.use_ssl, false
|
15
|
+
end
|
16
|
+
|
17
|
+
should "ping server" do
|
18
|
+
ping = @ricews.ping
|
19
|
+
assert_equal "PING: kr-dev", ping
|
20
|
+
end
|
21
|
+
|
22
|
+
should "create document" do
|
23
|
+
document = @ricews.create("user1", "1", "eDoc.Example1Doctype", "TestTitle")
|
24
|
+
assert_equal "TestTitle", document.title
|
25
|
+
assert_equal "One, User", document.initiatorName
|
26
|
+
assert_equal "1", document.appDocId
|
27
|
+
end
|
28
|
+
|
29
|
+
should "get document" do
|
30
|
+
document = @ricews.getDocument( @createdDocId, "user4")
|
31
|
+
assert_equal "TestTitle", document.title
|
32
|
+
assert_equal "I", document.docStatus
|
33
|
+
end
|
34
|
+
|
35
|
+
should "save document" do
|
36
|
+
document = @ricews.save(@createdDocId, "user4", "TestTitle", "SavingDoc")
|
37
|
+
assert_equal "S", document.docStatus
|
38
|
+
assert_equal "user4, user4", document.initiatorName
|
39
|
+
end
|
40
|
+
|
41
|
+
should "cancel document" do
|
42
|
+
document = @ricews.cancel(@createdDocId, "user4", "CancelDoc")
|
43
|
+
assert_equal "X", document.docStatus
|
44
|
+
assert_equal "user4, user4", document.initiatorName
|
45
|
+
end
|
46
|
+
|
47
|
+
should "fyi document" do
|
48
|
+
document = @ricews.fyi(@createdDocId, "user3")
|
49
|
+
document = @ricews.route(@createdDocId, "user4", "TestTitle", "RouteDoc ")
|
50
|
+
|
51
|
+
#assert_equal "X", document.docStatus
|
52
|
+
assert_equal "user4, user4", document.initiatorName
|
53
|
+
end
|
54
|
+
|
55
|
+
should "route document" do
|
56
|
+
document = @ricews.route(@createdDocId, "user4", "TestTitle", "RouteDoc")
|
57
|
+
assert_equal "R", document.docStatus
|
58
|
+
assert_equal "user4, user4", document.initiatorName
|
59
|
+
|
60
|
+
sleep(1)
|
61
|
+
document = @ricews.getDocument( @createdDocId, "user2")
|
62
|
+
assert_equal "APPROVE", document.actionRequested
|
63
|
+
end
|
64
|
+
|
65
|
+
should "approve document, should go final" do
|
66
|
+
@ricews.save(@createdDocId, "user4", "TestTitle", "SavingDoc")
|
67
|
+
@ricews.route(@createdDocId, "user4", "TestTitle", "SavingDoc")
|
68
|
+
@ricews.approve(@createdDocId, "user2", "TestTitle", "ApproveDoc")
|
69
|
+
|
70
|
+
sleep(1)
|
71
|
+
document = @ricews.getDocument( @createdDocId, "user4")
|
72
|
+
assert_equal "F", document.docStatus
|
73
|
+
assert_not_same "APPROVE", document.actionRequested
|
74
|
+
end
|
75
|
+
|
76
|
+
should "disapprove document, should go final" do
|
77
|
+
@ricews.save(@createdDocId, "user4", "TestTitle", "SavingDoc")
|
78
|
+
@ricews.route(@createdDocId, "user4", "TestTitle", "SavingDoc")
|
79
|
+
@ricews.disapprove(@createdDocId, "user2", "ApproveDoc")
|
80
|
+
|
81
|
+
sleep(1)
|
82
|
+
document = @ricews.getDocument( @createdDocId, "user4")
|
83
|
+
assert_equal "D", document.docStatus
|
84
|
+
assert_not_same "APPROVE", document.actionRequested
|
85
|
+
end
|
86
|
+
|
87
|
+
should "set ad hoc route to user2" do
|
88
|
+
@ricews.requestAdHocApproveToUser(@createdDocId, "user4", "user2", "AdHocDoc")
|
89
|
+
@ricews.save(@createdDocId, "user4", "TestTitle", "SavingDoc")
|
90
|
+
|
91
|
+
document = @ricews.getDocument( @createdDocId, "user2")
|
92
|
+
assert_not_same "APPROVE", document.actionRequested
|
93
|
+
assert_equal "S", document.docStatus
|
94
|
+
|
95
|
+
@ricews.approve(@createdDocId, "user1", "TestTitle", "ApproveDoc")
|
96
|
+
|
97
|
+
document = @ricews.getDocument( @createdDocId, "user2")
|
98
|
+
assert_equal "APPROVE", document.actionRequested
|
99
|
+
assert_equal "R", document.docStatus
|
100
|
+
end
|
101
|
+
|
102
|
+
should "set ad hoc route to WorkflowAdmin" do
|
103
|
+
@ricews.requestAdHocApproveToGroup(@createdDocId, "user4", "1", "AdHocDoc")
|
104
|
+
@ricews.save(@createdDocId, "user4", "TestTitle", "SavingDoc")
|
105
|
+
|
106
|
+
document = @ricews.getDocument( @createdDocId, "admin")
|
107
|
+
assert_not_same "APPROVE", document.actionRequested
|
108
|
+
assert_equal "S", document.docStatus
|
109
|
+
|
110
|
+
@ricews.approve(@createdDocId, "user1", "TestTitle", "ApproveDoc")
|
111
|
+
|
112
|
+
document = @ricews.getDocument( @createdDocId, "admin")
|
113
|
+
assert_equal "APPROVE", document.actionRequested
|
114
|
+
assert_equal "R", document.docStatus
|
115
|
+
end
|
116
|
+
|
117
|
+
should "send adhoc fyi to user3" do
|
118
|
+
@ricews.requestAdHocFyiToUser(@createdDocId, "user4", "user3", "FYI")
|
119
|
+
@ricews.route(@createdDocId, "user4", "TestTitle", "SavingDoc")
|
120
|
+
|
121
|
+
sleep(1)
|
122
|
+
document = @ricews.getDocument( @createdDocId, "user3")
|
123
|
+
assert_equal "FYI", document.actionRequested
|
124
|
+
assert_equal "R", document.docStatus
|
125
|
+
|
126
|
+
document = @ricews.fyi( @createdDocId, "user3")
|
127
|
+
document = @ricews.getDocument( @createdDocId, "user3")
|
128
|
+
|
129
|
+
assert_not_same "FYI", document.actionRequested
|
130
|
+
assert_equal "R", document.docStatus
|
131
|
+
end
|
132
|
+
|
133
|
+
should "send adhoc fyi to WorkflowAdmin" do
|
134
|
+
@ricews.requestAdHocFyiToGroup(@createdDocId, "user4", "1", "FYI")
|
135
|
+
@ricews.route(@createdDocId, "user4", "TestTitle", "SavingDoc")
|
136
|
+
|
137
|
+
sleep(1)
|
138
|
+
document = @ricews.getDocument( @createdDocId, "admin")
|
139
|
+
assert_equal "FYI", document.actionRequested
|
140
|
+
assert_equal "R", document.docStatus
|
141
|
+
|
142
|
+
document = @ricews.fyi( @createdDocId, "admin")
|
143
|
+
document = @ricews.getDocument( @createdDocId, "admin")
|
144
|
+
|
145
|
+
assert_not_same "FYI", document.actionRequested
|
146
|
+
assert_equal "R", document.docStatus
|
147
|
+
end
|
148
|
+
|
149
|
+
should "send adhoc acknowledge to user3" do
|
150
|
+
@ricews.requestAdHocAckToUser(@createdDocId, "user4", "user3", "ACK")
|
151
|
+
@ricews.route(@createdDocId, "user4", "TestTitle", "RouteDoc")
|
152
|
+
|
153
|
+
sleep(1)
|
154
|
+
document = @ricews.getDocument( @createdDocId, "user3")
|
155
|
+
assert_equal "ACKNOWLEDGE", document.actionRequested
|
156
|
+
assert_equal "R", document.docStatus
|
157
|
+
|
158
|
+
@ricews.acknowledge(@createdDocId, "user3", "ACK")
|
159
|
+
document = @ricews.getDocument( @createdDocId, "user3")
|
160
|
+
|
161
|
+
assert_not_same "ACKNOWLEDGE", document.actionRequested
|
162
|
+
assert_equal "R", document.docStatus
|
163
|
+
end
|
164
|
+
|
165
|
+
should "send adhoc acknowledge to group WorkflowAdmin" do
|
166
|
+
@ricews.requestAdHocAckToGroup(@createdDocId, "user4", "1", "ACK")
|
167
|
+
@ricews.route(@createdDocId, "user4", "TestTitle", "RouteDoc")
|
168
|
+
|
169
|
+
sleep(1)
|
170
|
+
document = @ricews.getDocument( @createdDocId, "admin")
|
171
|
+
assert_equal "ACKNOWLEDGE", document.actionRequested
|
172
|
+
assert_equal "R", document.docStatus
|
173
|
+
|
174
|
+
@ricews.acknowledge(@createdDocId, "admin", "ACK")
|
175
|
+
document = @ricews.getDocument( @createdDocId, "admin")
|
176
|
+
|
177
|
+
assert_not_same "ACKNOWLEDGE", document.actionRequested
|
178
|
+
assert_equal "R", document.docStatus
|
179
|
+
end
|
180
|
+
|
181
|
+
should "blanket approve document, should go PROCESSED awaiting ack from user1, user2" do
|
182
|
+
@ricews.requestAdHocApproveToUser(@createdDocId, "user1", "user2", "AdHocDoc")
|
183
|
+
@ricews.requestAdHocApproveToUser(@createdDocId, "user1", "admin", "AdHocDoc")
|
184
|
+
@ricews.save(@createdDocId, "user1", "TestTitle", "SavingDoc")
|
185
|
+
|
186
|
+
document = @ricews.blanketApprove(@createdDocId, "user1", "TestTitle", "ApproveDoc")
|
187
|
+
assert_equal "Workflow Error: User is not authorized to BlanketApprove document", document.errorMessage
|
188
|
+
|
189
|
+
@ricews.blanketApprove(@createdDocId, "admin", "TestTitle", "ApproveDoc")
|
190
|
+
|
191
|
+
document = @ricews.getDocument( @createdDocId, "admin")
|
192
|
+
assert_match /[R|P]/, document.docStatus
|
193
|
+
assert_not_same "APPROVE", document.actionRequested
|
194
|
+
end
|
195
|
+
|
196
|
+
should "chack to see if user is in route log" do
|
197
|
+
document = @ricews.route(@createdDocId, "user4", "TestTitle", "RouteDoc")
|
198
|
+
assert_equal "R", document.docStatus
|
199
|
+
assert_equal "user4, user4", document.initiatorName
|
200
|
+
|
201
|
+
assert(@ricews.isUserInRouteLog(@createdDocId, "user2"))
|
202
|
+
assert_equal false, @ricews.isUserInRouteLog(@createdDocId, "user3")
|
203
|
+
end
|
204
|
+
|
205
|
+
should "get user's inbox" do
|
206
|
+
action_list = @ricews.getUserInbox("admin")
|
207
|
+
|
208
|
+
action_list.each do |actionItem|
|
209
|
+
assert_equal "admin", actionItem.principalId
|
210
|
+
end
|
211
|
+
|
212
|
+
end
|
213
|
+
|
214
|
+
should "action list by route header" do
|
215
|
+
@ricews.requestAdHocAckToUser(@createdDocId, "user4", "user3", "ACK")
|
216
|
+
@ricews.route(@createdDocId, "user4", "TestTitle", "RouteDoc")
|
217
|
+
|
218
|
+
sleep(1)
|
219
|
+
action_list = @ricews.findByRouteHeaderId(@createdDocId)
|
220
|
+
num = 0
|
221
|
+
|
222
|
+
action_list.each do |actionItem|
|
223
|
+
num += 1
|
224
|
+
|
225
|
+
if actionItem.principalId.eql?("user3") then
|
226
|
+
assert_equal "K", actionItem.actionRequestCd
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
assert_equal 4, num
|
231
|
+
|
232
|
+
end
|
233
|
+
|
234
|
+
should "get user's inbox action Item count" do
|
235
|
+
action_list = @ricews.getUserInbox("admin")
|
236
|
+
num = 0
|
237
|
+
|
238
|
+
action_list.each do |actionItem|
|
239
|
+
num += 1
|
240
|
+
end
|
241
|
+
|
242
|
+
count = @ricews.countUserInboxItems("admin")
|
243
|
+
assert_equal num, count.to_i
|
244
|
+
|
245
|
+
end
|
246
|
+
|
247
|
+
should "Create a long annotation with spaces" do
|
248
|
+
document = @ricews.save(@createdDocId, "user4", "TestTitle", "This is a long annotation with many awesome spaces")
|
249
|
+
assert_equal "S", document.docStatus
|
250
|
+
assert_equal "user4, user4", document.initiatorName
|
251
|
+
end
|
252
|
+
|
253
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestPersonInterface < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@ricews = KualiRice::KualiRESTInterface.new
|
7
|
+
end
|
8
|
+
|
9
|
+
should "retrieve a person object by principal name" do
|
10
|
+
person = @ricews.getPersonByPrincipalName("admin")
|
11
|
+
assert_equal 1100, person.entityId.to_i
|
12
|
+
end
|
13
|
+
|
14
|
+
should "retrieve a person object by principal id" do
|
15
|
+
person = @ricews.getPersonByPrincipalID("admin")
|
16
|
+
assert_equal 1100, person.entityId.to_i
|
17
|
+
assert_equal "test@email.edu", person.emailAddress
|
18
|
+
end
|
19
|
+
|
20
|
+
should "retrieve a person object by emplid" do
|
21
|
+
person = @ricews.getPersonByEmployeeId("admin")
|
22
|
+
end
|
23
|
+
|
24
|
+
should "retrieve a person object by external id" do
|
25
|
+
person = @ricews.getPersonByExternalIdentifier("admin", 1100)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,208 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kuali-rice
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Shawn Bower
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-12-28 00:00:00 -05:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 3
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
type: :runtime
|
32
|
+
name: xml-simple
|
33
|
+
prerelease: false
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
hash: 3
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
version: "0"
|
45
|
+
type: :development
|
46
|
+
name: shoulda
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 23
|
56
|
+
segments:
|
57
|
+
- 1
|
58
|
+
- 0
|
59
|
+
- 0
|
60
|
+
version: 1.0.0
|
61
|
+
type: :development
|
62
|
+
name: bundler
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ~>
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 7
|
72
|
+
segments:
|
73
|
+
- 1
|
74
|
+
- 5
|
75
|
+
- 2
|
76
|
+
version: 1.5.2
|
77
|
+
type: :development
|
78
|
+
name: jeweler
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: *id004
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
hash: 3
|
88
|
+
segments:
|
89
|
+
- 0
|
90
|
+
version: "0"
|
91
|
+
type: :development
|
92
|
+
name: rcov
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: *id005
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
hash: 3
|
102
|
+
segments:
|
103
|
+
- 0
|
104
|
+
version: "0"
|
105
|
+
type: :development
|
106
|
+
name: xml-simple
|
107
|
+
prerelease: false
|
108
|
+
version_requirements: *id006
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
hash: 3
|
116
|
+
segments:
|
117
|
+
- 0
|
118
|
+
version: "0"
|
119
|
+
type: :development
|
120
|
+
name: ci_reporter
|
121
|
+
prerelease: false
|
122
|
+
version_requirements: *id007
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
hash: 3
|
130
|
+
segments:
|
131
|
+
- 0
|
132
|
+
version: "0"
|
133
|
+
type: :development
|
134
|
+
name: builder
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: *id008
|
137
|
+
description: This gem is used to interface with a RICE install via REST services
|
138
|
+
email: shawn.bower@gmail.com
|
139
|
+
executables: []
|
140
|
+
|
141
|
+
extensions: []
|
142
|
+
|
143
|
+
extra_rdoc_files:
|
144
|
+
- LICENSE.txt
|
145
|
+
- README.rdoc
|
146
|
+
files:
|
147
|
+
- .document
|
148
|
+
- Gemfile
|
149
|
+
- Gemfile.lock
|
150
|
+
- LICENSE.txt
|
151
|
+
- README.rdoc
|
152
|
+
- Rakefile
|
153
|
+
- VERSION
|
154
|
+
- kuali-rice.gemspec
|
155
|
+
- lib/kuali-rice.rb
|
156
|
+
- lib/kuali-rice/KualiRESTInterface.rb
|
157
|
+
- lib/kuali-rice/KualiRESTInterface/DocumentActions.rb
|
158
|
+
- lib/kuali-rice/KualiRESTInterface/PersonInterface.rb
|
159
|
+
- lib/kuali-rice/KualiRESTInterface/RestAPI.rb
|
160
|
+
- lib/kuali-rice/Responses.rb
|
161
|
+
- lib/kuali-rice/Responses/ActionItem.rb
|
162
|
+
- lib/kuali-rice/Responses/DocumentResponse.rb
|
163
|
+
- lib/kuali-rice/Responses/ErrorResponse.rb
|
164
|
+
- lib/kuali-rice/Responses/Person.rb
|
165
|
+
- lib/kuali-rice/Responses/StandardResponse.rb
|
166
|
+
- support/DocumentFinalFYIRouting.xml
|
167
|
+
- support/RiceWSDocType.xml
|
168
|
+
- test/helper.rb
|
169
|
+
- test/test_kuali-rice.rb
|
170
|
+
- test/test_person_interface.rb
|
171
|
+
has_rdoc: true
|
172
|
+
homepage: http://github.com/sbower/kuali-rice
|
173
|
+
licenses:
|
174
|
+
- MIT
|
175
|
+
post_install_message:
|
176
|
+
rdoc_options: []
|
177
|
+
|
178
|
+
require_paths:
|
179
|
+
- lib
|
180
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
181
|
+
none: false
|
182
|
+
requirements:
|
183
|
+
- - ">="
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
hash: 3
|
186
|
+
segments:
|
187
|
+
- 0
|
188
|
+
version: "0"
|
189
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
|
+
none: false
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
hash: 3
|
195
|
+
segments:
|
196
|
+
- 0
|
197
|
+
version: "0"
|
198
|
+
requirements: []
|
199
|
+
|
200
|
+
rubyforge_project:
|
201
|
+
rubygems_version: 1.3.7
|
202
|
+
signing_key:
|
203
|
+
specification_version: 3
|
204
|
+
summary: This gem is used to interface with a RICE install via REST services
|
205
|
+
test_files:
|
206
|
+
- test/helper.rb
|
207
|
+
- test/test_kuali-rice.rb
|
208
|
+
- test/test_person_interface.rb
|