yaccl 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/examples/create_type_manual.rb +1 -1
- data/lib/yaccl/model/object.rb +14 -0
- data/lib/yaccl/model/property_definition.rb +41 -0
- data/lib/yaccl/model/repository.rb +0 -8
- data/lib/yaccl/model/type.rb +31 -2
- data/lib/yaccl/model.rb +1 -0
- data/lib/yaccl/version.rb +1 -1
- data/spec/model/repository_spec.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZmE5ZDI1MGRlMjMwMjczOGY3MzY3MjkyMzEzMzk0NjExNWVhNWQ3NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzA4NjM3YTAxYTA2MGI1MjIzODY0ZDEwNjQ5ZjU0MTEzYTk4NjEyNA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NWMxYmQ1ODFmMjAxM2JmNTE4NGI3Y2E2MDdmNmMzM2ZiOWMwMGQxM2M5M2Fl
|
10
|
+
ZTQ1NDc2ZjhiZmUyMzcxNDMzYTY2ZTYzNzU5MGY3MzdkYzQ5NjA2NTMwZDY5
|
11
|
+
MWI5ZTY5OWQ0ODg4MWQ5YzhiMDQ2MDdiZDY5YzFkMGMxNTc5Nzc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWRhOGJjMzkwZjY5ODNmYzBiNTlkODQ4NGM3N2Y2MDNkNDQ1NTBlYTEzYzI3
|
14
|
+
OTY0MDg3M2RmOTMzZWEyMDZhZGIyYzY0YzZiNjFlOWY2ZGFmNjNiYTY5NjMx
|
15
|
+
OGY5NzVmNzYzZDRlNmU5NGEzMTJmOWUxYWRkYTYyNDQwNGUyOGI=
|
data/lib/yaccl/model/object.rb
CHANGED
@@ -97,6 +97,20 @@ module YACCL
|
|
97
97
|
object_id.nil?
|
98
98
|
end
|
99
99
|
|
100
|
+
# utility
|
101
|
+
|
102
|
+
def can_be_deleted?
|
103
|
+
allowable_actions[:canDeleteObject]
|
104
|
+
end
|
105
|
+
|
106
|
+
def can_get_parents?
|
107
|
+
allowable_actions[:canGetObjectParents]
|
108
|
+
end
|
109
|
+
|
110
|
+
def can_update_properties
|
111
|
+
allowable_actions[:canUpdateProperties]
|
112
|
+
end
|
113
|
+
|
100
114
|
private
|
101
115
|
|
102
116
|
def get_properties_map(raw)
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module YACCL
|
2
|
+
module Model
|
3
|
+
class PropertyDefinition
|
4
|
+
|
5
|
+
attr_accessor :id, :local_name, :query_name, :inherited,
|
6
|
+
:open_choise, :orderable, :property_type, :updatability,
|
7
|
+
:display_name, :required, :cardinality, :queryable
|
8
|
+
|
9
|
+
def initialize(hash={})
|
10
|
+
@id = hash[:id]
|
11
|
+
@local_name = hash[:localName]
|
12
|
+
@query_name = hash[:queryName]
|
13
|
+
@inherited = hash[:inherited]
|
14
|
+
@open_choice = hash[:openChoice]
|
15
|
+
@orderable = hash[:orderable]
|
16
|
+
@property_type = hash[:propertyType]
|
17
|
+
@updatability = hash[:updatability]
|
18
|
+
@display_name = hash[:displayName]
|
19
|
+
@required = hash[:required]
|
20
|
+
@cardinality = hash[:cardinality]
|
21
|
+
@queryable = hash[:queryable]
|
22
|
+
end
|
23
|
+
|
24
|
+
def readonly?
|
25
|
+
updatability == 'readonly'
|
26
|
+
end
|
27
|
+
|
28
|
+
def oncreate?
|
29
|
+
updatability == 'oncreate'
|
30
|
+
end
|
31
|
+
|
32
|
+
def readwrite?
|
33
|
+
updatability == 'readwrite'
|
34
|
+
end
|
35
|
+
|
36
|
+
def to_hash
|
37
|
+
# TODO (Needed for updating type?)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -83,14 +83,6 @@ module YACCL
|
|
83
83
|
Type.create(id, Services.create_type(id, type.to_hash))
|
84
84
|
end
|
85
85
|
|
86
|
-
def update_type(type)
|
87
|
-
Type.create(id, Services.update_type(id, type.to_hash))
|
88
|
-
end
|
89
|
-
|
90
|
-
def delete_type(type_id)
|
91
|
-
Services.delete_type(id, type_id)
|
92
|
-
end
|
93
|
-
|
94
86
|
# relationship
|
95
87
|
|
96
88
|
def create(object)
|
data/lib/yaccl/model/type.rb
CHANGED
@@ -46,8 +46,9 @@ module YACCL
|
|
46
46
|
@controllable_policy = hash[:controllablePolicy]
|
47
47
|
@controllable_acl = hash[:controllableACL]
|
48
48
|
@fulltext_indexed = hash[:fulltextIndexed]
|
49
|
-
@included_in_supertype_query = hash[:
|
49
|
+
@included_in_supertype_query = hash[:includedInSupertypeQuery]
|
50
50
|
@property_definitions = hash[:propertyDefinitions] || {}
|
51
|
+
@property_definitions.each { |k, v| @property_definitions[k] = PropertyDefinition.new(v) }
|
51
52
|
# document type
|
52
53
|
@versionable = hash[:versionable]
|
53
54
|
@content_stream_allowed = hash[:contentStreamAllowed]
|
@@ -60,6 +61,14 @@ module YACCL
|
|
60
61
|
@property_definitions[property[:id]] = property
|
61
62
|
end
|
62
63
|
|
64
|
+
def save
|
65
|
+
Type.create(repository_id, Services.update_type(repository_id, to_hash))
|
66
|
+
end
|
67
|
+
|
68
|
+
def delete
|
69
|
+
Services.delete_type(repository_id, id)
|
70
|
+
end
|
71
|
+
|
63
72
|
def new_object
|
64
73
|
object = case base_id
|
65
74
|
when 'cmis:document'
|
@@ -79,6 +88,26 @@ module YACCL
|
|
79
88
|
object
|
80
89
|
end
|
81
90
|
|
91
|
+
def document_type?
|
92
|
+
base_id == 'cmis:document'
|
93
|
+
end
|
94
|
+
|
95
|
+
def folder_type?
|
96
|
+
base_id == 'cmis:folder'
|
97
|
+
end
|
98
|
+
|
99
|
+
def relationship_type?
|
100
|
+
base_id == 'cmis:relationship'
|
101
|
+
end
|
102
|
+
|
103
|
+
def policy_type?
|
104
|
+
base_id == 'cmis:policy'
|
105
|
+
end
|
106
|
+
|
107
|
+
def item_type?
|
108
|
+
base_id == 'cmis:item'
|
109
|
+
end
|
110
|
+
|
82
111
|
def to_hash
|
83
112
|
hash = {}
|
84
113
|
hash[:id] = id
|
@@ -96,7 +125,7 @@ module YACCL
|
|
96
125
|
hash[:controllableACL]= controllable_acl
|
97
126
|
hash[:fulltextIndexed]= fulltext_indexed
|
98
127
|
hash[:includedInSupertypeQuery]= included_in_supertype_query
|
99
|
-
hash[:propertyDefinitions]= property_definitions
|
128
|
+
hash[:propertyDefinitions]= property_definitions.to_hash
|
100
129
|
# document type
|
101
130
|
hash[:versionable] = versionable unless versionable.nil?
|
102
131
|
hash[:contentStreamAllowed] = content_stream_allowed unless content_stream_allowed.nil?
|
data/lib/yaccl/model.rb
CHANGED
data/lib/yaccl/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaccl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenneth Geerts
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -87,6 +87,7 @@ files:
|
|
87
87
|
- lib/yaccl/model/object.rb
|
88
88
|
- lib/yaccl/model/object_factory.rb
|
89
89
|
- lib/yaccl/model/policy.rb
|
90
|
+
- lib/yaccl/model/property_definition.rb
|
90
91
|
- lib/yaccl/model/relationship.rb
|
91
92
|
- lib/yaccl/model/repository.rb
|
92
93
|
- lib/yaccl/model/server.rb
|