lims-core 3.2.3
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.
- checksums.yaml +15 -0
- data/.gitignore +5 -0
- data/.rspec +1 -0
- data/.rvmrc +2 -0
- data/.travis.yml +2 -0
- data/.vimrc +27 -0
- data/.yard_templates/default/layout/html/footer.erb +0 -0
- data/.yardopts +1 -0
- data/Gemfile +54 -0
- data/Gemfile.lock +197 -0
- data/Guardfile +21 -0
- data/Guardfile.tmux +28 -0
- data/README.markdown +67 -0
- data/Rakefile +16 -0
- data/config/database.yml +16 -0
- data/doc/Array.html +116 -0
- data/doc/Array/ArrayLoggerPersistor.html +152 -0
- data/doc/Lims.html +114 -0
- data/doc/Lims/Core.html +178 -0
- data/doc/Lims/Core/Action.html +91 -0
- data/doc/Lims/Core/Actions.html +116 -0
- data/doc/Lims/Core/Actions/Action.html +216 -0
- data/doc/Lims/Core/Actions/Action/AfterEval.html +853 -0
- data/doc/Lims/Core/Actions/Action/InvalidParameters.html +268 -0
- data/doc/Lims/Core/Actions/ActionGroup.html +196 -0
- data/doc/Lims/Core/Actions/ActionGroup/AfterEval.html +315 -0
- data/doc/Lims/Core/Actions/BulkAction.html +224 -0
- data/doc/Lims/Core/Actions/BulkAction/AfterEval.html +253 -0
- data/doc/Lims/Core/Actions/TestActionGroup.html +101 -0
- data/doc/Lims/Core/Actions/TestActionGroup/Action.html +133 -0
- data/doc/Lims/Core/Actions/TestActionGroup/ActionGroup.html +127 -0
- data/doc/Lims/Core/Base.html +287 -0
- data/doc/Lims/Core/Base/AccessibleViaSuper.html +252 -0
- data/doc/Lims/Core/Base/ClassMethod.html +177 -0
- data/doc/Lims/Core/Base/HashString.html +177 -0
- data/doc/Lims/Core/Base/IsArrayOf.html +606 -0
- data/doc/Lims/Core/Base/State.html +130 -0
- data/doc/Lims/Core/Organization.html +113 -0
- data/doc/Lims/Core/Organization/Batch.html +106 -0
- data/doc/Lims/Core/Persistence.html +267 -0
- data/doc/Lims/Core/Persistence/ComparisonFilter.html +318 -0
- data/doc/Lims/Core/Persistence/Filter.html +252 -0
- data/doc/Lims/Core/Persistence/IdentityMap.html +409 -0
- data/doc/Lims/Core/Persistence/IdentityMap/Class.html +144 -0
- data/doc/Lims/Core/Persistence/IdentityMap/DuplicateError.html +126 -0
- data/doc/Lims/Core/Persistence/IdentityMap/DuplicateIdError.html +136 -0
- data/doc/Lims/Core/Persistence/IdentityMap/DuplicateObjectError.html +136 -0
- data/doc/Lims/Core/Persistence/IdentityMapClass.html +133 -0
- data/doc/Lims/Core/Persistence/Logger.html +105 -0
- data/doc/Lims/Core/Persistence/Logger/Persistor.html +334 -0
- data/doc/Lims/Core/Persistence/Logger/Session.html +452 -0
- data/doc/Lims/Core/Persistence/Logger/Store.html +470 -0
- data/doc/Lims/Core/Persistence/MessageBus.html +871 -0
- data/doc/Lims/Core/Persistence/MessageBus/ConnectionError.html +123 -0
- data/doc/Lims/Core/Persistence/MessageBus/InvalidSettingsError.html +122 -0
- data/doc/Lims/Core/Persistence/MultiCriteriaFilter.html +293 -0
- data/doc/Lims/Core/Persistence/PersistAssociationTrait.html +91 -0
- data/doc/Lims/Core/Persistence/PersistableTrait.html +91 -0
- data/doc/Lims/Core/Persistence/Persistor.html +3072 -0
- data/doc/Lims/Core/Persistence/Persistor/DuplicateError.html +205 -0
- data/doc/Lims/Core/Persistence/Persistor/DuplicateIdError.html +147 -0
- data/doc/Lims/Core/Persistence/Persistor/DuplicateObjectError.html +147 -0
- data/doc/Lims/Core/Persistence/PersistorTrait.html +91 -0
- data/doc/Lims/Core/Persistence/ResourceState.html +1738 -0
- data/doc/Lims/Core/Persistence/Search.html +269 -0
- data/doc/Lims/Core/Persistence/Search/CreateSearch.html +251 -0
- data/doc/Lims/Core/Persistence/Search/SearchPersistor.html +240 -0
- data/doc/Lims/Core/Persistence/Search/SearchSequelPersistor.html +396 -0
- data/doc/Lims/Core/Persistence/Sequel.html +117 -0
- data/doc/Lims/Core/Persistence/Sequel/Filters.html +462 -0
- data/doc/Lims/Core/Persistence/Sequel/ForTest.html +101 -0
- data/doc/Lims/Core/Persistence/Sequel/ForTest/Name.html +137 -0
- data/doc/Lims/Core/Persistence/Sequel/ForTest/Name/NamePersitor.html +143 -0
- data/doc/Lims/Core/Persistence/Sequel/Migrations.html +266 -0
- data/doc/Lims/Core/Persistence/Sequel/Persistor.html +665 -0
- data/doc/Lims/Core/Persistence/Sequel/Session.html +501 -0
- data/doc/Lims/Core/Persistence/Sequel/Store.html +417 -0
- data/doc/Lims/Core/Persistence/Session.html +2751 -0
- data/doc/Lims/Core/Persistence/Session/UnmanagedObjectError.html +111 -0
- data/doc/Lims/Core/Persistence/StateGroup.html +696 -0
- data/doc/Lims/Core/Persistence/StateList.html +498 -0
- data/doc/Lims/Core/Persistence/Store.html +695 -0
- data/doc/Lims/Core/Persistence/UuidResource.html +1044 -0
- data/doc/Lims/Core/Persistence/UuidResource/InvalidUuidError.html +111 -0
- data/doc/Lims/Core/Persistence/UuidResource/UuidResourcePersistor.html +337 -0
- data/doc/Lims/Core/Persistence/Uuidable.html +799 -0
- data/doc/Lims/Core/Persistor.html +320 -0
- data/doc/Lims/Core/Resource.html +165 -0
- data/doc/Object.html +228 -0
- data/doc/SessionSpec.html +101 -0
- data/doc/SessionSpec/Model.html +279 -0
- data/doc/SessionSpec/Model/ModelPersistor.html +327 -0
- data/doc/_index.html +732 -0
- data/doc/class_list.html +47 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +55 -0
- data/doc/css/style.css +322 -0
- data/doc/file.README.html +127 -0
- data/doc/file_list.html +49 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +127 -0
- data/doc/js/app.js +205 -0
- data/doc/js/full_list.js +167 -0
- data/doc/js/jquery.js +16 -0
- data/doc/method_list.html +1894 -0
- data/doc/top-level-namespace.html +100 -0
- data/lib/common.rb +18 -0
- data/lib/lims-core.rb +29 -0
- data/lib/lims-core/actions.rb +10 -0
- data/lib/lims-core/actions/action.rb +185 -0
- data/lib/lims-core/actions/action_group.rb +54 -0
- data/lib/lims-core/actions/bulk_action.rb +65 -0
- data/lib/lims-core/base.rb +132 -0
- data/lib/lims-core/helpers.rb +41 -0
- data/lib/lims-core/persistence.rb +15 -0
- data/lib/lims-core/persistence/comparison_filter.rb +54 -0
- data/lib/lims-core/persistence/filter.rb +23 -0
- data/lib/lims-core/persistence/identity_map.rb +55 -0
- data/lib/lims-core/persistence/logger/all.rb +5 -0
- data/lib/lims-core/persistence/logger/persistor.rb +35 -0
- data/lib/lims-core/persistence/logger/session.rb +30 -0
- data/lib/lims-core/persistence/logger/store.rb +37 -0
- data/lib/lims-core/persistence/message_bus.rb +131 -0
- data/lib/lims-core/persistence/multi_criteria_filter.rb +50 -0
- data/lib/lims-core/persistence/persist_association_trait.rb +96 -0
- data/lib/lims-core/persistence/persistable_trait.rb +150 -0
- data/lib/lims-core/persistence/persistor.rb +495 -0
- data/lib/lims-core/persistence/resource_state.rb +157 -0
- data/lib/lims-core/persistence/search.rb +3 -0
- data/lib/lims-core/persistence/search/all.rb +3 -0
- data/lib/lims-core/persistence/search/create_search.rb +55 -0
- data/lib/lims-core/persistence/search/search_persistor.rb +45 -0
- data/lib/lims-core/persistence/search/search_sequel_persistor.rb +40 -0
- data/lib/lims-core/persistence/sequel.rb +14 -0
- data/lib/lims-core/persistence/sequel/filters.rb +106 -0
- data/lib/lims-core/persistence/sequel/migrations.rb +14 -0
- data/lib/lims-core/persistence/sequel/migrations/add_audit_tables.rb +147 -0
- data/lib/lims-core/persistence/sequel/migrations/initial.rb +156 -0
- data/lib/lims-core/persistence/sequel/persistor.rb +200 -0
- data/lib/lims-core/persistence/sequel/session.rb +136 -0
- data/lib/lims-core/persistence/sequel/store.rb +37 -0
- data/lib/lims-core/persistence/session.rb +409 -0
- data/lib/lims-core/persistence/state_group.rb +97 -0
- data/lib/lims-core/persistence/state_list.rb +56 -0
- data/lib/lims-core/persistence/store.rb +73 -0
- data/lib/lims-core/persistence/uuid_resource.rb +115 -0
- data/lib/lims-core/persistence/uuid_resource_persistor.rb +43 -0
- data/lib/lims-core/persistence/uuidable.rb +107 -0
- data/lib/lims-core/resource.rb +21 -0
- data/lib/lims-core/subclass_tracker.rb +30 -0
- data/lib/lims-core/version.rb +5 -0
- data/lims-core.gemspec +40 -0
- data/makefile +52 -0
- data/showoff/core-2012-06-11/core/01_slide.md +237 -0
- data/showoff/core-2012-06-11/core/02_slide.md +110 -0
- data/showoff/core-2012-06-11/custom.css +44 -0
- data/showoff/core-2012-06-11/main/01_slide.md +53 -0
- data/showoff/core-2012-06-11/showoff.json +10 -0
- data/showoff/core-2012-06-11/tp1.tpl +1 -0
- data/spec/actions/action_group_spec.rb +39 -0
- data/spec/actions/spec_helper.rb +1 -0
- data/spec/persistence/identity_map_spec.rb +55 -0
- data/spec/persistence/logger/spec_helper.rb +7 -0
- data/spec/persistence/logger/store_spec.rb +48 -0
- data/spec/persistence/message_bus_spec.rb +76 -0
- data/spec/persistence/sequel/session_spec.rb +125 -0
- data/spec/persistence/sequel/spec_helper.rb +39 -0
- data/spec/persistence/sequel/store_shared.rb +25 -0
- data/spec/persistence/sequel/store_spec.rb +22 -0
- data/spec/persistence/session_spec.rb +199 -0
- data/spec/persistence/spec_helper.rb +2 -0
- data/spec/persistence/uuid_resource_spec.rb +80 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/subclass_tracker_sperc.rb +62 -0
- data/utils/constant_tree.rb +29 -0
- data/utils/stack.rb +48 -0
- metadata +402 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
6
|
+
<title>
|
|
7
|
+
Module: Lims::Core::Persistence::PersistAssociationTrait
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.7.3
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="../../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="../../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
|
18
|
+
relpath = '../../..';
|
|
19
|
+
if (relpath != '') relpath += '/';
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<script type="text/javascript" charset="utf-8" src="../../../js/jquery.js"></script>
|
|
23
|
+
|
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../../js/app.js"></script>
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</head>
|
|
28
|
+
<body>
|
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<div id="header">
|
|
34
|
+
<div id="menu">
|
|
35
|
+
|
|
36
|
+
<a href="../../../_index.html">Index (P)</a> »
|
|
37
|
+
<span class='title'><span class='object_link'><a href="../../../Lims.html" title="Lims (module)">Lims</a></span></span> » <span class='title'><span class='object_link'><a href="../../Core.html" title="Lims::Core (module)">Core</a></span></span> » <span class='title'><span class='object_link'><a href="../Persistence.html" title="Lims::Core::Persistence (module)">Persistence</a></span></span>
|
|
38
|
+
»
|
|
39
|
+
<span class="title">PersistAssociationTrait</span>
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<div id="search">
|
|
46
|
+
|
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
|
48
|
+
|
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
|
50
|
+
|
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
<div class="clear"></div>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<iframe id="search_frame"></iframe>
|
|
58
|
+
|
|
59
|
+
<div id="content"><h1>Module: Lims::Core::Persistence::PersistAssociationTrait
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
</h1>
|
|
64
|
+
|
|
65
|
+
<dl class="box">
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
<dt class="r1 last">Defined in:</dt>
|
|
75
|
+
<dd class="r1 last">lib/lims-core/persistence/persist_association_trait.rb</dd>
|
|
76
|
+
|
|
77
|
+
</dl>
|
|
78
|
+
<div class="clear"></div>
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
</body>
|
|
91
|
+
</html>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
6
|
+
<title>
|
|
7
|
+
Module: Lims::Core::Persistence::PersistableTrait
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.7.3
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="../../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="../../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
|
18
|
+
relpath = '../../..';
|
|
19
|
+
if (relpath != '') relpath += '/';
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<script type="text/javascript" charset="utf-8" src="../../../js/jquery.js"></script>
|
|
23
|
+
|
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../../js/app.js"></script>
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</head>
|
|
28
|
+
<body>
|
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<div id="header">
|
|
34
|
+
<div id="menu">
|
|
35
|
+
|
|
36
|
+
<a href="../../../_index.html">Index (P)</a> »
|
|
37
|
+
<span class='title'><span class='object_link'><a href="../../../Lims.html" title="Lims (module)">Lims</a></span></span> » <span class='title'><span class='object_link'><a href="../../Core.html" title="Lims::Core (module)">Core</a></span></span> » <span class='title'><span class='object_link'><a href="../Persistence.html" title="Lims::Core::Persistence (module)">Persistence</a></span></span>
|
|
38
|
+
»
|
|
39
|
+
<span class="title">PersistableTrait</span>
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<div id="search">
|
|
46
|
+
|
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
|
48
|
+
|
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
|
50
|
+
|
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
<div class="clear"></div>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<iframe id="search_frame"></iframe>
|
|
58
|
+
|
|
59
|
+
<div id="content"><h1>Module: Lims::Core::Persistence::PersistableTrait
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
</h1>
|
|
64
|
+
|
|
65
|
+
<dl class="box">
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
<dt class="r1 last">Defined in:</dt>
|
|
75
|
+
<dd class="r1 last">lib/lims-core/persistence/persistable_trait.rb</dd>
|
|
76
|
+
|
|
77
|
+
</dl>
|
|
78
|
+
<div class="clear"></div>
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
</body>
|
|
91
|
+
</html>
|
|
@@ -0,0 +1,3072 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
6
|
+
<title>
|
|
7
|
+
Class: Lims::Core::Persistence::Persistor
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.7.3
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="../../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="../../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
|
18
|
+
relpath = '../../..';
|
|
19
|
+
if (relpath != '') relpath += '/';
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<script type="text/javascript" charset="utf-8" src="../../../js/jquery.js"></script>
|
|
23
|
+
|
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../../js/app.js"></script>
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</head>
|
|
28
|
+
<body>
|
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<div id="header">
|
|
34
|
+
<div id="menu">
|
|
35
|
+
|
|
36
|
+
<a href="../../../_index.html">Index (P)</a> »
|
|
37
|
+
<span class='title'><span class='object_link'><a href="../../../Lims.html" title="Lims (module)">Lims</a></span></span> » <span class='title'><span class='object_link'><a href="../../Core.html" title="Lims::Core (module)">Core</a></span></span> » <span class='title'><span class='object_link'><a href="../Persistence.html" title="Lims::Core::Persistence (module)">Persistence</a></span></span>
|
|
38
|
+
»
|
|
39
|
+
<span class="title">Persistor</span>
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<div id="search">
|
|
46
|
+
|
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
|
48
|
+
|
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
|
50
|
+
|
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
<div class="clear"></div>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<iframe id="search_frame"></iframe>
|
|
58
|
+
|
|
59
|
+
<div id="content"><h1>Class: Lims::Core::Persistence::Persistor
|
|
60
|
+
<span class="abstract note title">Abstract</span>
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
</h1>
|
|
64
|
+
|
|
65
|
+
<dl class="box">
|
|
66
|
+
|
|
67
|
+
<dt class="r1">Inherits:</dt>
|
|
68
|
+
<dd class="r1">
|
|
69
|
+
<span class="inheritName"><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></span>
|
|
70
|
+
|
|
71
|
+
<ul class="fullTree">
|
|
72
|
+
<li><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></li>
|
|
73
|
+
|
|
74
|
+
<li class="next">Lims::Core::Persistence::Persistor</li>
|
|
75
|
+
|
|
76
|
+
</ul>
|
|
77
|
+
<a href="#" class="inheritanceTree">show all</a>
|
|
78
|
+
|
|
79
|
+
</dd>
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
<dt class="r2 last">Defined in:</dt>
|
|
90
|
+
<dd class="r2 last">lib/lims-core/persistence/persistor.rb</dd>
|
|
91
|
+
|
|
92
|
+
</dl>
|
|
93
|
+
<div class="clear"></div>
|
|
94
|
+
|
|
95
|
+
<h2>Overview</h2><div class="docstring">
|
|
96
|
+
<div class="discussion">
|
|
97
|
+
<div class="note abstract">
|
|
98
|
+
<strong>This class is abstract.</strong>
|
|
99
|
+
<div class='inline'>
|
|
100
|
+
<p>Base class for all the persistors, needs to implements a `self.model`</p>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
<p>returning the class to persist. A persistor , is used to save and load it's
|
|
105
|
+
cousin class. The specific code of a persistor should be extended by
|
|
106
|
+
writting a persistor class within the class to persist and module
|
|
107
|
+
corresponding to the store. The common Persistor architecture would be like
|
|
108
|
+
this (let's consider we have a Plate class and a Sequel Persistor). module
|
|
109
|
+
SequelPersistor end Class Plate</p>
|
|
110
|
+
|
|
111
|
+
<pre class="code"><span class='const'>Common</span> <span class='id to'>to</span> <span class='id all'>all</span> <span class='id store'>store</span>
|
|
112
|
+
<span class='kw'>class</span> <span class='const'>PlatePersistor</span> <span class='op'><</span> <span class='const'>Persistence</span><span class='op'>::</span><span class='const'>Persistor</span>
|
|
113
|
+
<span class='kw'>end</span>
|
|
114
|
+
|
|
115
|
+
<span class='kw'>class</span> <span class='const'>PlateSequelPersistor</span> <span class='op'><</span> <span class='const'>PlatePersistor</span>
|
|
116
|
+
<span class='id include'>include</span> <span class='const'>SequelPersistor</span>
|
|
117
|
+
<span class='kw'>end</span></pre>
|
|
118
|
+
|
|
119
|
+
<p>end if a base persistor exists for a class but not the store specific one
|
|
120
|
+
(PlatePersistor exists but PlateSequelPersistor not). If there is a store
|
|
121
|
+
pecific Persistor module (like SequelPersistor). The equivalent of
|
|
122
|
+
PlateSequelPersistor will be generated on the fly by deriving the base one
|
|
123
|
+
and including the mixin. Persistor needs to be registered to be accessible
|
|
124
|
+
form the session. However, if NO_AUTO_REGISTRATION is not enabled
|
|
125
|
+
persistors will register themselves. In that case, they will need to be
|
|
126
|
+
defined in class to persist see <span class='object_link'><a href="#register_model-class_method" title="Lims::Core::Persistence::Persistor.register_model (method)">register_model</a></span>. If a base peristor for
|
|
127
|
+
exists for a class but there is no Each instance can get an identity map,
|
|
128
|
+
and or parameter specific to a session/thread.</p>
|
|
129
|
+
<ul><li>
|
|
130
|
+
<p>Methods relative to store are</p>
|
|
131
|
+
</li><li>
|
|
132
|
+
<p>insert : a new object to the store</p>
|
|
133
|
+
</li><li>
|
|
134
|
+
<p>delete : remove an object fromt the store</p>
|
|
135
|
+
</li><li>
|
|
136
|
+
<p>update : modify an existing object from the store.</p>
|
|
137
|
+
</li><li>
|
|
138
|
+
<p>retrieve : get an object from the store.</p>
|
|
139
|
+
</li><li>
|
|
140
|
+
<p>bulk_<method> vs <method> refers to method acting on a list of
|
|
141
|
+
states</p>
|
|
142
|
+
</li></ul>
|
|
143
|
+
|
|
144
|
+
<p>instead of an individual object. Althoug only one version needs to be
|
|
145
|
+
implemted , the bulk version is prefered for performance reason.</p>
|
|
146
|
+
<ul><li>
|
|
147
|
+
<p>raw_<method_ refers when exists to the physical action done to the store</p>
|
|
148
|
+
</li></ul>
|
|
149
|
+
|
|
150
|
+
<p>without any side effect on the Session or Persistor. They should not
|
|
151
|
+
normally be called.</p>
|
|
152
|
+
<ul><li>
|
|
153
|
+
<p>Methods relative to parents/children</p>
|
|
154
|
+
</li><li>
|
|
155
|
+
<p>parents : resources needed to be saved BEFORE the resource itself.</p>
|
|
156
|
+
</li><li>
|
|
157
|
+
<p>children : resources needed to be save AFTER the resource itself.</p>
|
|
158
|
+
</li><li>
|
|
159
|
+
<p>deletable_children : resources which needs to be deleted BEFORE the
|
|
160
|
+
resource itself.</p>
|
|
161
|
+
</li><li>
|
|
162
|
+
<p>deletable_parent : resources which needs to be deleted AFTER the resource
|
|
163
|
+
itself.</p>
|
|
164
|
+
</li></ul>
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
<div class="tags">
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
</div><div id="subclasses">
|
|
173
|
+
<h2>Direct Known Subclasses</h2>
|
|
174
|
+
<p class="children"><span class='object_link'><a href="../../../Array/ArrayLoggerPersistor.html" title="Array::ArrayLoggerPersistor (class)">Array::ArrayLoggerPersistor</a></span>, <span class='object_link'><a href="Search/SearchPersistor.html" title="Lims::Core::Persistence::Search::SearchPersistor (class)">Search::SearchPersistor</a></span>, <span class='object_link'><a href="Sequel/ForTest/Name/NamePersitor.html" title="Lims::Core::Persistence::Sequel::ForTest::Name::NamePersitor (class)">Sequel::ForTest::Name::NamePersitor</a></span>, <span class='object_link'><a href="UuidResource/UuidResourcePersistor.html" title="Lims::Core::Persistence::UuidResource::UuidResourcePersistor (class)">UuidResource::UuidResourcePersistor</a></span>, <span class='object_link'><a href="../../../SessionSpec/Model/ModelPersistor.html" title="SessionSpec::Model::ModelPersistor (class)">SessionSpec::Model::ModelPersistor</a></span></p>
|
|
175
|
+
</div>
|
|
176
|
+
<h2>Defined Under Namespace</h2>
|
|
177
|
+
<p class="children">
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Persistor/DuplicateError.html" title="Lims::Core::Persistence::Persistor::DuplicateError (class)">DuplicateError</a></span>, <span class='object_link'><a href="Persistor/DuplicateIdError.html" title="Lims::Core::Persistence::Persistor::DuplicateIdError (class)">DuplicateIdError</a></span>, <span class='object_link'><a href="Persistor/DuplicateObjectError.html" title="Lims::Core::Persistence::Persistor::DuplicateObjectError (class)">DuplicateObjectError</a></span>
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
</p>
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
<h2>
|
|
193
|
+
Class Method Summary
|
|
194
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
|
195
|
+
</h2>
|
|
196
|
+
|
|
197
|
+
<ul class="summary">
|
|
198
|
+
|
|
199
|
+
<li class="public ">
|
|
200
|
+
<span class="summary_signature">
|
|
201
|
+
|
|
202
|
+
<a href="#inherited-class_method" title="inherited (class method)">+ (Object) <strong>inherited</strong>(subclass) </a>
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
</span>
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
<span class="summary_desc"><div class='inline'>
|
|
216
|
+
<p>Performs an autoregistration if needed.</p>
|
|
217
|
+
</div></span>
|
|
218
|
+
|
|
219
|
+
</li>
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
<li class="public ">
|
|
223
|
+
<span class="summary_signature">
|
|
224
|
+
|
|
225
|
+
<a href="#register_model-class_method" title="register_model (class method)">+ (Object) <strong>register_model</strong>(subclass) </a>
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
</span>
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
<span class="summary_desc"><div class='inline'>
|
|
239
|
+
<p>Register a sub-persistor to the <span class='object_link'><a href="Session.html" title="Lims::Core::Persistence::Session (class)">Session</a></span>.</p>
|
|
240
|
+
</div></span>
|
|
241
|
+
|
|
242
|
+
</li>
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
</ul>
|
|
246
|
+
|
|
247
|
+
<h2>
|
|
248
|
+
Instance Method Summary
|
|
249
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
|
250
|
+
</h2>
|
|
251
|
+
|
|
252
|
+
<ul class="summary">
|
|
253
|
+
|
|
254
|
+
<li class="public ">
|
|
255
|
+
<span class="summary_signature">
|
|
256
|
+
|
|
257
|
+
<a href="#%5B%5D-instance_method" title="#[] (instance method)">- (Object<sup>?</sup>) <strong>[]</strong>(id) </a>
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
</span>
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
<span class="summary_desc"><div class='inline'>
|
|
271
|
+
<p>Load a model by different criteria.</p>
|
|
272
|
+
</div></span>
|
|
273
|
+
|
|
274
|
+
</li>
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
<li class="public ">
|
|
278
|
+
<span class="summary_signature">
|
|
279
|
+
|
|
280
|
+
<a href="#bind_state_to_id-instance_method" title="#bind_state_to_id (instance method)">- (Object) <strong>bind_state_to_id</strong>(state) </a>
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
</span>
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
<span class="summary_desc"><div class='inline'>
|
|
294
|
+
<p>Updates the cache so id_to_state reflects state.id.</p>
|
|
295
|
+
</div></span>
|
|
296
|
+
|
|
297
|
+
</li>
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
<li class="public ">
|
|
301
|
+
<span class="summary_signature">
|
|
302
|
+
|
|
303
|
+
<a href="#bind_state_to_resource-instance_method" title="#bind_state_to_resource (instance method)">- (Object) <strong>bind_state_to_resource</strong>(state) </a>
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
</span>
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
<span class="summary_desc"><div class='inline'>
|
|
317
|
+
<p>Update the cache.</p>
|
|
318
|
+
</div></span>
|
|
319
|
+
|
|
320
|
+
</li>
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
<li class="public ">
|
|
324
|
+
<span class="summary_signature">
|
|
325
|
+
|
|
326
|
+
<a href="#bulk_delete-instance_method" title="#bulk_delete (instance method)">- (Object) <strong>bulk_delete</strong>(states, *params) </a>
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
</span>
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
<span class="summary_desc"><div class='inline'>
|
|
340
|
+
<p>Remove object form the underlying store and Manages them.</p>
|
|
341
|
+
</div></span>
|
|
342
|
+
|
|
343
|
+
</li>
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
<li class="public ">
|
|
347
|
+
<span class="summary_signature">
|
|
348
|
+
|
|
349
|
+
<a href="#bulk_delete_raw-instance_method" title="#bulk_delete_raw (instance method)">- (Object) <strong>bulk_delete_raw</strong>(states, *params) </a>
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
</span>
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
<span class="abstract note title">Abstract</span>
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
<span class="summary_desc"><div class='inline'>
|
|
363
|
+
<p>Physically remove objects from a store.</p>
|
|
364
|
+
</div></span>
|
|
365
|
+
|
|
366
|
+
</li>
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
<li class="public ">
|
|
370
|
+
<span class="summary_signature">
|
|
371
|
+
|
|
372
|
+
<a href="#bulk_insert-instance_method" title="#bulk_insert (instance method)">- (Object) <strong>bulk_insert</strong>(states, *params) </a>
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
</span>
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
<span class="summary_desc"><div class='inline'>
|
|
386
|
+
<p>Inserts objects in the underlying store AND manages them.</p>
|
|
387
|
+
</div></span>
|
|
388
|
+
|
|
389
|
+
</li>
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
<li class="public ">
|
|
393
|
+
<span class="summary_signature">
|
|
394
|
+
|
|
395
|
+
<a href="#bulk_retrieve-instance_method" title="#bulk_retrieve (instance method)">- (Array<Object]) <strong>bulk_retrieve</strong>(ids, *params) </a>
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
</span>
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
<span class="summary_desc"><div class='inline'>
|
|
409
|
+
<p>Retreives a list of objects .</p>
|
|
410
|
+
</div></span>
|
|
411
|
+
|
|
412
|
+
</li>
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
<li class="public ">
|
|
416
|
+
<span class="summary_signature">
|
|
417
|
+
|
|
418
|
+
<a href="#bulk_update-instance_method" title="#bulk_update (instance method)">- (Object) <strong>bulk_update</strong>(states, *params) </a>
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
</span>
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
<span class="summary_desc"><div class='inline'>
|
|
432
|
+
<p>Updates the store and manages object.</p>
|
|
433
|
+
</div></span>
|
|
434
|
+
|
|
435
|
+
</li>
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
<li class="public ">
|
|
439
|
+
<span class="summary_signature">
|
|
440
|
+
|
|
441
|
+
<a href="#children-instance_method" title="#children (instance method)">- (Array<Resource>) <strong>children</strong>(resource) </a>
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
</span>
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
<span class="summary_desc"><div class='inline'>
|
|
455
|
+
<p>List of children , i.e, object which need to be saved AFTER it.</p>
|
|
456
|
+
</div></span>
|
|
457
|
+
|
|
458
|
+
</li>
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
<li class="public ">
|
|
462
|
+
<span class="summary_signature">
|
|
463
|
+
|
|
464
|
+
<a href="#count-instance_method" title="#count (instance method)">- (Fixnum) <strong>count</strong> </a>
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
</span>
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
<span class="abstract note title">Abstract</span>
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
<span class="summary_desc"><div class='inline'>
|
|
478
|
+
<p>Returns the number of object in the store.</p>
|
|
479
|
+
</div></span>
|
|
480
|
+
|
|
481
|
+
</li>
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
<li class="public ">
|
|
485
|
+
<span class="summary_signature">
|
|
486
|
+
|
|
487
|
+
<a href="#deletable_children-instance_method" title="#deletable_children (instance method)">- (Object) <strong>deletable_children</strong>(resource) </a>
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
</span>
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
501
|
+
|
|
502
|
+
</li>
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
<li class="public ">
|
|
506
|
+
<span class="summary_signature">
|
|
507
|
+
|
|
508
|
+
<a href="#deletable_parents-instance_method" title="#deletable_parents (instance method)">- (Object) <strong>deletable_parents</strong>(resource) </a>
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
</span>
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
522
|
+
|
|
523
|
+
</li>
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
<li class="public ">
|
|
527
|
+
<span class="summary_signature">
|
|
528
|
+
|
|
529
|
+
<a href="#dirty_key_for-instance_method" title="#dirty_key_for (instance method)">- (Object) <strong>dirty_key_for</strong>(resource) </a>
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
</span>
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
<span class="summary_desc"><div class='inline'>
|
|
543
|
+
<p>Computes "dirty_key" of an object.</p>
|
|
544
|
+
</div></span>
|
|
545
|
+
|
|
546
|
+
</li>
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
<li class="public ">
|
|
550
|
+
<span class="summary_signature">
|
|
551
|
+
|
|
552
|
+
<a href="#for_each_in_slice-instance_method" title="#for_each_in_slice (instance method)">- (Object) <strong>for_each_in_slice</strong>(start, length) {|key, attributes| ... }</a>
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
</span>
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
<span class="abstract note title">Abstract</span>
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
<span class="summary_desc"><div class='inline'>
|
|
566
|
+
<p>Load a slice.</p>
|
|
567
|
+
</div></span>
|
|
568
|
+
|
|
569
|
+
</li>
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
<li class="public ">
|
|
573
|
+
<span class="summary_signature">
|
|
574
|
+
|
|
575
|
+
<a href="#id_for-instance_method" title="#id_for (instance method)">- (Id, Nil) <strong>id_for</strong>(object) </a>
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
</span>
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
<span class="summary_desc"><div class='inline'>
|
|
589
|
+
<p>Get the id from an object from the cache.</p>
|
|
590
|
+
</div></span>
|
|
591
|
+
|
|
592
|
+
</li>
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
<li class="public ">
|
|
596
|
+
<span class="summary_signature">
|
|
597
|
+
|
|
598
|
+
<a href="#ids_for-instance_method" title="#ids_for (instance method)">- (Array<Id>) <strong>ids_for</strong>(criteria) </a>
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
</span>
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
<span class="summary_desc"><div class='inline'>
|
|
612
|
+
<p>compute a list of ids matching the criteria.</p>
|
|
613
|
+
</div></span>
|
|
614
|
+
|
|
615
|
+
</li>
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
<li class="public ">
|
|
619
|
+
<span class="summary_signature">
|
|
620
|
+
|
|
621
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Persistor) <strong>initialize</strong>(session, *args, &block) </a>
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
</span>
|
|
626
|
+
|
|
627
|
+
<span class="note title constructor">constructor</span>
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
<span class="summary_desc"><div class='inline'>
|
|
637
|
+
<p>A new instance of Persistor.</p>
|
|
638
|
+
</div></span>
|
|
639
|
+
|
|
640
|
+
</li>
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
<li class="public ">
|
|
644
|
+
<span class="summary_signature">
|
|
645
|
+
|
|
646
|
+
<a href="#invalid_resource%3F-instance_method" title="#invalid_resource? (instance method)">- (Boolean) <strong>invalid_resource?</strong>(resource) </a>
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
</span>
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
<span class="summary_desc"><div class='inline'>
|
|
660
|
+
<p>if a resource is invalid and need to be deleted.</p>
|
|
661
|
+
</div></span>
|
|
662
|
+
|
|
663
|
+
</li>
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
<li class="public ">
|
|
667
|
+
<span class="summary_signature">
|
|
668
|
+
|
|
669
|
+
<a href="#load_children-instance_method" title="#load_children (instance method)">- (Object) <strong>load_children</strong>(states, *params) </a>
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
</span>
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
683
|
+
|
|
684
|
+
</li>
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
<li class="public ">
|
|
688
|
+
<span class="summary_signature">
|
|
689
|
+
|
|
690
|
+
<a href="#model-instance_method" title="#model (instance method)">- (Class) <strong>model</strong> </a>
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
|
|
694
|
+
</span>
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
<span class="summary_desc"><div class='inline'>
|
|
704
|
+
<p>Associate class (without persistence).</p>
|
|
705
|
+
</div></span>
|
|
706
|
+
|
|
707
|
+
</li>
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
<li class="public ">
|
|
711
|
+
<span class="summary_signature">
|
|
712
|
+
|
|
713
|
+
<a href="#new_from_attributes-instance_method" title="#new_from_attributes (instance method)">- (Object) <strong>new_from_attributes</strong>(attributes) </a>
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
</span>
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
727
|
+
|
|
728
|
+
</li>
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
<li class="public ">
|
|
732
|
+
<span class="summary_signature">
|
|
733
|
+
|
|
734
|
+
<a href="#new_object-instance_method" title="#new_object (instance method)">- (Resource) <strong>new_object</strong>(id, attributes) </a>
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
</span>
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
<span class="summary_desc"><div class='inline'>
|
|
748
|
+
<p>Creates a new object from a Hash and associate it to its id.</p>
|
|
749
|
+
</div></span>
|
|
750
|
+
|
|
751
|
+
</li>
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
<li class="public ">
|
|
755
|
+
<span class="summary_signature">
|
|
756
|
+
|
|
757
|
+
<a href="#object_for-instance_method" title="#object_for (instance method)">- (Resourec, Nil) <strong>object_for</strong>(id) </a>
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
</span>
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
<span class="summary_desc"><div class='inline'>
|
|
771
|
+
<p>Get the object from a given id.</p>
|
|
772
|
+
</div></span>
|
|
773
|
+
|
|
774
|
+
</li>
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
<li class="public ">
|
|
778
|
+
<span class="summary_signature">
|
|
779
|
+
|
|
780
|
+
<a href="#on_object_load-instance_method" title="#on_object_load (instance method)">- (Object) <strong>on_object_load</strong>(state) </a>
|
|
781
|
+
|
|
782
|
+
|
|
783
|
+
|
|
784
|
+
</span>
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
<span class="summary_desc"><div class='inline'>
|
|
794
|
+
<p>Called by Persistor to inform the session about the loading of an object.</p>
|
|
795
|
+
</div></span>
|
|
796
|
+
|
|
797
|
+
</li>
|
|
798
|
+
|
|
799
|
+
|
|
800
|
+
<li class="public ">
|
|
801
|
+
<span class="summary_signature">
|
|
802
|
+
|
|
803
|
+
<a href="#parents-instance_method" title="#parents (instance method)">- (Array<Resource>) <strong>parents</strong>(resource) </a>
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
</span>
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
<span class="summary_desc"><div class='inline'>
|
|
817
|
+
<p>List of parents of object, i.e.</p>
|
|
818
|
+
</div></span>
|
|
819
|
+
|
|
820
|
+
</li>
|
|
821
|
+
|
|
822
|
+
|
|
823
|
+
<li class="public ">
|
|
824
|
+
<span class="summary_signature">
|
|
825
|
+
|
|
826
|
+
<a href="#parents_for_attributes-instance_method" title="#parents_for_attributes (instance method)">- (Object) <strong>parents_for_attributes</strong>(attributes) </a>
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
</span>
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
840
|
+
|
|
841
|
+
</li>
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
<li class="public ">
|
|
845
|
+
<span class="summary_signature">
|
|
846
|
+
|
|
847
|
+
<a href="#purge_invalid_object-instance_method" title="#purge_invalid_object (instance method)">- (Object) <strong>purge_invalid_object</strong> </a>
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
</span>
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
|
|
860
|
+
<span class="summary_desc"><div class='inline'>
|
|
861
|
+
<p>Delete all invalid object loaded by a persistor.</p>
|
|
862
|
+
</div></span>
|
|
863
|
+
|
|
864
|
+
</li>
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
<li class="public ">
|
|
868
|
+
<span class="summary_signature">
|
|
869
|
+
|
|
870
|
+
<a href="#retrieve-instance_method" title="#retrieve (instance method)">- (Object<sup>?</sup>) <strong>retrieve</strong>(id, *params) </a>
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
</span>
|
|
875
|
+
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
<span class="summary_desc"><div class='inline'>
|
|
884
|
+
<p>Retrieves an object from it's id.</p>
|
|
885
|
+
</div></span>
|
|
886
|
+
|
|
887
|
+
</li>
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
<li class="public ">
|
|
891
|
+
<span class="summary_signature">
|
|
892
|
+
|
|
893
|
+
<a href="#slice-instance_method" title="#slice (instance method)">- (Enumerable<Hash>) <strong>slice</strong>(start, length) </a>
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
</span>
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
|
|
903
|
+
|
|
904
|
+
|
|
905
|
+
|
|
906
|
+
<span class="summary_desc"><div class='inline'>
|
|
907
|
+
<p>Get a slice of object by offset, length.</p>
|
|
908
|
+
</div></span>
|
|
909
|
+
|
|
910
|
+
</li>
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
<li class="public ">
|
|
914
|
+
<span class="summary_signature">
|
|
915
|
+
|
|
916
|
+
<a href="#state_for-instance_method" title="#state_for (instance method)">- (ResourceState) <strong>state_for</strong>(object) </a>
|
|
917
|
+
|
|
918
|
+
|
|
919
|
+
|
|
920
|
+
</span>
|
|
921
|
+
|
|
922
|
+
|
|
923
|
+
|
|
924
|
+
|
|
925
|
+
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
<span class="summary_desc"><div class='inline'>
|
|
930
|
+
<p>Returns the state proxy of an object.</p>
|
|
931
|
+
</div></span>
|
|
932
|
+
|
|
933
|
+
</li>
|
|
934
|
+
|
|
935
|
+
|
|
936
|
+
<li class="public ">
|
|
937
|
+
<span class="summary_signature">
|
|
938
|
+
|
|
939
|
+
<a href="#state_for_id-instance_method" title="#state_for_id (instance method)">- (ResourceState) <strong>state_for_id</strong>(id) </a>
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
</span>
|
|
944
|
+
|
|
945
|
+
|
|
946
|
+
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
<span class="summary_desc"><div class='inline'>
|
|
953
|
+
<p>Returns the state proxy of an object fromt its id (in cache).</p>
|
|
954
|
+
</div></span>
|
|
955
|
+
|
|
956
|
+
</li>
|
|
957
|
+
|
|
958
|
+
|
|
959
|
+
</ul>
|
|
960
|
+
|
|
961
|
+
|
|
962
|
+
<div id="constructor_details" class="method_details_list">
|
|
963
|
+
<h2>Constructor Details</h2>
|
|
964
|
+
|
|
965
|
+
<div class="method_details first">
|
|
966
|
+
<p class="signature first" id="initialize-instance_method">
|
|
967
|
+
|
|
968
|
+
- (<tt><span class='object_link'><a href="" title="Lims::Core::Persistence::Persistor (class)">Persistor</a></span></tt>) <strong>initialize</strong>(session, *args, &block)
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
</p><div class="docstring">
|
|
973
|
+
<div class="discussion">
|
|
974
|
+
|
|
975
|
+
<p>A new instance of Persistor</p>
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
</div>
|
|
979
|
+
</div>
|
|
980
|
+
<div class="tags">
|
|
981
|
+
|
|
982
|
+
|
|
983
|
+
</div><table class="source_code">
|
|
984
|
+
<tr>
|
|
985
|
+
<td>
|
|
986
|
+
<pre class="lines">
|
|
987
|
+
|
|
988
|
+
|
|
989
|
+
92
|
|
990
|
+
93
|
|
991
|
+
94
|
|
992
|
+
95
|
|
993
|
+
96
|
|
994
|
+
97</pre>
|
|
995
|
+
</td>
|
|
996
|
+
<td>
|
|
997
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 92</span>
|
|
998
|
+
|
|
999
|
+
<span class='kw'>def</span> <span class='id initialize'>initialize</span> <span class='lparen'>(</span><span class='id session'>session</span><span class='comma'>,</span> <span class='op'>*</span><span class='id args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id block'>block</span><span class='rparen'>)</span>
|
|
1000
|
+
<span class='ivar'>@session</span> <span class='op'>=</span> <span class='id session'>session</span>
|
|
1001
|
+
<span class='ivar'>@id_to_state</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='period'>.</span><span class='id new'>new</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id h'>h</span><span class='comma'>,</span><span class='id k'>k</span><span class='op'>|</span> <span class='id h'>h</span><span class='lbracket'>[</span><span class='id k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='const'>ResourceState</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='kw'>self</span><span class='comma'>,</span> <span class='id k'>k</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
|
1002
|
+
<span class='ivar'>@object_to_state</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='period'>.</span><span class='id new'>new</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id h'>h</span><span class='comma'>,</span><span class='id k'>k</span><span class='op'>|</span> <span class='id h'>h</span><span class='lbracket'>[</span><span class='id k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='const'>ResourceState</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id k'>k</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
|
1003
|
+
<span class='kw'>super</span><span class='lparen'>(</span><span class='op'>*</span><span class='id args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id block'>block</span><span class='rparen'>)</span>
|
|
1004
|
+
<span class='kw'>end</span></pre>
|
|
1005
|
+
</td>
|
|
1006
|
+
</tr>
|
|
1007
|
+
</table>
|
|
1008
|
+
</div>
|
|
1009
|
+
|
|
1010
|
+
</div>
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
<div id="class_method_details" class="method_details_list">
|
|
1014
|
+
<h2>Class Method Details</h2>
|
|
1015
|
+
|
|
1016
|
+
|
|
1017
|
+
<div class="method_details first">
|
|
1018
|
+
<p class="signature first" id="inherited-class_method">
|
|
1019
|
+
|
|
1020
|
+
+ (<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt>) <strong>inherited</strong>(subclass)
|
|
1021
|
+
|
|
1022
|
+
|
|
1023
|
+
|
|
1024
|
+
</p><div class="docstring">
|
|
1025
|
+
<div class="discussion">
|
|
1026
|
+
|
|
1027
|
+
<p>Performs an autoregistration if needed. Autoregistration can be skipped by
|
|
1028
|
+
defined NO_AUTO_REGISTRATION on the model class. See
|
|
1029
|
+
Persistor::register_model.</p>
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
</div>
|
|
1033
|
+
</div>
|
|
1034
|
+
<div class="tags">
|
|
1035
|
+
|
|
1036
|
+
|
|
1037
|
+
</div><table class="source_code">
|
|
1038
|
+
<tr>
|
|
1039
|
+
<td>
|
|
1040
|
+
<pre class="lines">
|
|
1041
|
+
|
|
1042
|
+
|
|
1043
|
+
69
|
|
1044
|
+
70
|
|
1045
|
+
71</pre>
|
|
1046
|
+
</td>
|
|
1047
|
+
<td>
|
|
1048
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 69</span>
|
|
1049
|
+
|
|
1050
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id inherited'>inherited</span><span class='lparen'>(</span><span class='id subclass'>subclass</span><span class='rparen'>)</span>
|
|
1051
|
+
<span class='id register_model'>register_model</span><span class='lparen'>(</span><span class='id subclass'>subclass</span><span class='rparen'>)</span>
|
|
1052
|
+
<span class='kw'>end</span></pre>
|
|
1053
|
+
</td>
|
|
1054
|
+
</tr>
|
|
1055
|
+
</table>
|
|
1056
|
+
</div>
|
|
1057
|
+
|
|
1058
|
+
<div class="method_details ">
|
|
1059
|
+
<p class="signature " id="register_model-class_method">
|
|
1060
|
+
|
|
1061
|
+
+ (<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt>) <strong>register_model</strong>(subclass)
|
|
1062
|
+
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
</p><div class="docstring">
|
|
1066
|
+
<div class="discussion">
|
|
1067
|
+
|
|
1068
|
+
<p>Register a sub-persistor to the <span class='object_link'><a href="Session.html" title="Lims::Core::Persistence::Session (class)">Session</a></span>. The name used to register the
|
|
1069
|
+
persistor would be either the name of the model (parent) class or if
|
|
1070
|
+
SESSION_NAME is specified on the model : SESSION_NAME</p>
|
|
1071
|
+
|
|
1072
|
+
|
|
1073
|
+
</div>
|
|
1074
|
+
</div>
|
|
1075
|
+
<div class="tags">
|
|
1076
|
+
<h3>Parameters:</h3>
|
|
1077
|
+
<ul class="param">
|
|
1078
|
+
|
|
1079
|
+
<li>
|
|
1080
|
+
|
|
1081
|
+
<span class='name'>subclass</span>
|
|
1082
|
+
|
|
1083
|
+
|
|
1084
|
+
<span class='type'>(<tt>Class</tt>)</span>
|
|
1085
|
+
|
|
1086
|
+
|
|
1087
|
+
|
|
1088
|
+
</li>
|
|
1089
|
+
|
|
1090
|
+
</ul>
|
|
1091
|
+
|
|
1092
|
+
|
|
1093
|
+
</div><table class="source_code">
|
|
1094
|
+
<tr>
|
|
1095
|
+
<td>
|
|
1096
|
+
<pre class="lines">
|
|
1097
|
+
|
|
1098
|
+
|
|
1099
|
+
78
|
|
1100
|
+
79
|
|
1101
|
+
80
|
|
1102
|
+
81
|
|
1103
|
+
82
|
|
1104
|
+
83
|
|
1105
|
+
84
|
|
1106
|
+
85
|
|
1107
|
+
86
|
|
1108
|
+
87
|
|
1109
|
+
88
|
|
1110
|
+
89
|
|
1111
|
+
90</pre>
|
|
1112
|
+
</td>
|
|
1113
|
+
<td>
|
|
1114
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 78</span>
|
|
1115
|
+
|
|
1116
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id register_model'>register_model</span><span class='lparen'>(</span><span class='id subclass'>subclass</span><span class='rparen'>)</span>
|
|
1117
|
+
<span class='id model'>model</span> <span class='op'>=</span> <span class='id subclass'>subclass</span><span class='period'>.</span><span class='id parent_scope'>parent_scope</span>
|
|
1118
|
+
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id model'>model</span><span class='op'>::</span><span class='id const_defined?'>const_defined?</span> <span class='symbol'>:NO_AUTO_REGISTRATION</span>
|
|
1119
|
+
|
|
1120
|
+
<span class='id name'>name</span> <span class='op'>=</span>\
|
|
1121
|
+
<span class='kw'>if</span> <span class='id model'>model</span><span class='op'>::</span><span class='id const_defined?'>const_defined?</span> <span class='symbol'>:SESSION_NAME</span>
|
|
1122
|
+
<span class='id model'>model</span><span class='op'>::</span><span class='const'>SESSION_NAME</span>
|
|
1123
|
+
<span class='kw'>else</span>
|
|
1124
|
+
<span class='id name'>name</span> <span class='op'>=</span> <span class='id model'>model</span><span class='period'>.</span><span class='id name'>name</span><span class='period'>.</span><span class='id split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>::</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id pop'>pop</span>
|
|
1125
|
+
<span class='kw'>end</span>
|
|
1126
|
+
|
|
1127
|
+
<span class='const'>Session</span><span class='op'>::</span><span class='id register_model'>register_model</span><span class='lparen'>(</span><span class='id name'>name</span><span class='comma'>,</span> <span class='id model'>model</span><span class='rparen'>)</span>
|
|
1128
|
+
<span class='kw'>end</span></pre>
|
|
1129
|
+
</td>
|
|
1130
|
+
</tr>
|
|
1131
|
+
</table>
|
|
1132
|
+
</div>
|
|
1133
|
+
|
|
1134
|
+
</div>
|
|
1135
|
+
|
|
1136
|
+
<div id="instance_method_details" class="method_details_list">
|
|
1137
|
+
<h2>Instance Method Details</h2>
|
|
1138
|
+
|
|
1139
|
+
|
|
1140
|
+
<div class="method_details first">
|
|
1141
|
+
<p class="signature first" id="[]-instance_method">
|
|
1142
|
+
|
|
1143
|
+
- (<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt><sup>?</sup>) <strong>[]</strong>(id)
|
|
1144
|
+
|
|
1145
|
+
|
|
1146
|
+
|
|
1147
|
+
</p><div class="docstring">
|
|
1148
|
+
<div class="discussion">
|
|
1149
|
+
|
|
1150
|
+
<p>Load a model by different criteria. Could be either :</p>
|
|
1151
|
+
<ul><li>
|
|
1152
|
+
<p>an Id</p>
|
|
1153
|
+
</li><li>
|
|
1154
|
+
<p>a Hash</p>
|
|
1155
|
+
</li><li>
|
|
1156
|
+
<p>a list of Ids</p>
|
|
1157
|
+
</li></ul>
|
|
1158
|
+
|
|
1159
|
+
<p>This method will return either a single object or a list of object,
|
|
1160
|
+
depending of the parameter. Note that loaded object are automatically
|
|
1161
|
+
<em>added</em> to the session.</p>
|
|
1162
|
+
|
|
1163
|
+
|
|
1164
|
+
</div>
|
|
1165
|
+
</div>
|
|
1166
|
+
<div class="tags">
|
|
1167
|
+
<h3>Parameters:</h3>
|
|
1168
|
+
<ul class="param">
|
|
1169
|
+
|
|
1170
|
+
<li>
|
|
1171
|
+
|
|
1172
|
+
<span class='name'>id</span>
|
|
1173
|
+
|
|
1174
|
+
|
|
1175
|
+
<span class='type'>(<tt>Fixnum</tt>, <tt>Hash</tt>)</span>
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
|
|
1179
|
+
—
|
|
1180
|
+
<div class='inline'>
|
|
1181
|
+
<p>the id in the database</p>
|
|
1182
|
+
</div>
|
|
1183
|
+
|
|
1184
|
+
</li>
|
|
1185
|
+
|
|
1186
|
+
</ul>
|
|
1187
|
+
|
|
1188
|
+
<h3>Returns:</h3>
|
|
1189
|
+
<ul class="return">
|
|
1190
|
+
|
|
1191
|
+
<li>
|
|
1192
|
+
|
|
1193
|
+
|
|
1194
|
+
<span class='type'>(<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt>, <tt>nil</tt>)</span>
|
|
1195
|
+
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
—
|
|
1199
|
+
<div class='inline'>
|
|
1200
|
+
<p>nil if object not found.</p>
|
|
1201
|
+
</div>
|
|
1202
|
+
|
|
1203
|
+
</li>
|
|
1204
|
+
|
|
1205
|
+
</ul>
|
|
1206
|
+
|
|
1207
|
+
</div><table class="source_code">
|
|
1208
|
+
<tr>
|
|
1209
|
+
<td>
|
|
1210
|
+
<pre class="lines">
|
|
1211
|
+
|
|
1212
|
+
|
|
1213
|
+
114
|
|
1214
|
+
115
|
|
1215
|
+
116
|
|
1216
|
+
117
|
|
1217
|
+
118
|
|
1218
|
+
119
|
|
1219
|
+
120</pre>
|
|
1220
|
+
</td>
|
|
1221
|
+
<td>
|
|
1222
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 114</span>
|
|
1223
|
+
|
|
1224
|
+
<span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span><span class='id id'>id</span><span class='rparen'>)</span>
|
|
1225
|
+
<span class='kw'>case</span> <span class='id id'>id</span>
|
|
1226
|
+
<span class='kw'>when</span> <span class='const'>Fixnum</span> <span class='kw'>then</span> <span class='id retrieve'>retrieve</span><span class='lparen'>(</span><span class='id id'>id</span><span class='rparen'>)</span>
|
|
1227
|
+
<span class='kw'>when</span> <span class='const'>Hash</span> <span class='kw'>then</span> <span class='id find_by'>find_by</span><span class='lparen'>(</span><span class='id filter_attributes_on_save'>filter_attributes_on_save</span><span class='lparen'>(</span><span class='id id'>id</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='symbol'>:single</span> <span class='op'>=></span> <span class='kw'>true</span><span class='rparen'>)</span>
|
|
1228
|
+
<span class='kw'>when</span> <span class='const'>Array</span><span class='comma'>,</span> <span class='const'>Enumerable</span> <span class='kw'>then</span> <span class='id bulk_retrieve'>bulk_retrieve</span><span class='lparen'>(</span><span class='id id'>id</span><span class='rparen'>)</span>
|
|
1229
|
+
<span class='kw'>end</span>
|
|
1230
|
+
<span class='kw'>end</span></pre>
|
|
1231
|
+
</td>
|
|
1232
|
+
</tr>
|
|
1233
|
+
</table>
|
|
1234
|
+
</div>
|
|
1235
|
+
|
|
1236
|
+
<div class="method_details ">
|
|
1237
|
+
<p class="signature " id="bind_state_to_id-instance_method">
|
|
1238
|
+
|
|
1239
|
+
- (<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt>) <strong>bind_state_to_id</strong>(state)
|
|
1240
|
+
|
|
1241
|
+
|
|
1242
|
+
|
|
1243
|
+
</p><div class="docstring">
|
|
1244
|
+
<div class="discussion">
|
|
1245
|
+
|
|
1246
|
+
<p>Updates the cache so id_to_state reflects state.id</p>
|
|
1247
|
+
|
|
1248
|
+
|
|
1249
|
+
</div>
|
|
1250
|
+
</div>
|
|
1251
|
+
<div class="tags">
|
|
1252
|
+
<h3>Parameters:</h3>
|
|
1253
|
+
<ul class="param">
|
|
1254
|
+
|
|
1255
|
+
<li>
|
|
1256
|
+
|
|
1257
|
+
<span class='name'></span>
|
|
1258
|
+
|
|
1259
|
+
|
|
1260
|
+
<span class='type'>(<tt><span class='object_link'><a href="ResourceState.html" title="Lims::Core::Persistence::ResourceState (class)">ResourceState</a></span></tt>)</span>
|
|
1261
|
+
|
|
1262
|
+
|
|
1263
|
+
|
|
1264
|
+
</li>
|
|
1265
|
+
|
|
1266
|
+
</ul>
|
|
1267
|
+
|
|
1268
|
+
<h3>Raises:</h3>
|
|
1269
|
+
<ul class="raise">
|
|
1270
|
+
|
|
1271
|
+
<li>
|
|
1272
|
+
|
|
1273
|
+
|
|
1274
|
+
<span class='type'>(<tt>RuntimeError</tt>)</span>
|
|
1275
|
+
|
|
1276
|
+
|
|
1277
|
+
|
|
1278
|
+
</li>
|
|
1279
|
+
|
|
1280
|
+
</ul>
|
|
1281
|
+
|
|
1282
|
+
</div><table class="source_code">
|
|
1283
|
+
<tr>
|
|
1284
|
+
<td>
|
|
1285
|
+
<pre class="lines">
|
|
1286
|
+
|
|
1287
|
+
|
|
1288
|
+
156
|
|
1289
|
+
157
|
|
1290
|
+
158
|
|
1291
|
+
159
|
|
1292
|
+
160
|
|
1293
|
+
161</pre>
|
|
1294
|
+
</td>
|
|
1295
|
+
<td>
|
|
1296
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 156</span>
|
|
1297
|
+
|
|
1298
|
+
<span class='kw'>def</span> <span class='id bind_state_to_id'>bind_state_to_id</span><span class='lparen'>(</span><span class='id state'>state</span><span class='rparen'>)</span>
|
|
1299
|
+
<span class='id raise'>raise</span> <span class='const'>RuntimeError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Invalid state</span><span class='tstring_end'>'</span></span> <span class='kw'>if</span> <span class='id state'>state</span><span class='period'>.</span><span class='id persistor'>persistor</span> <span class='op'>!=</span> <span class='kw'>self</span>
|
|
1300
|
+
<span class='id raise'>raise</span> <span class='const'>DuplicateIdError</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id state'>state</span><span class='period'>.</span><span class='id id'>id</span><span class='rparen'>)</span><span class='kw'>if</span> <span class='ivar'>@id_to_state</span><span class='period'>.</span><span class='id include?'>include?</span><span class='lparen'>(</span><span class='id state'>state</span><span class='period'>.</span><span class='id id'>id</span><span class='rparen'>)</span>
|
|
1301
|
+
<span class='id on_object_load'>on_object_load</span><span class='lparen'>(</span><span class='id state'>state</span><span class='rparen'>)</span>
|
|
1302
|
+
<span class='ivar'>@id_to_state</span><span class='lbracket'>[</span><span class='id state'>state</span><span class='period'>.</span><span class='id id'>id</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id state'>state</span>
|
|
1303
|
+
<span class='kw'>end</span></pre>
|
|
1304
|
+
</td>
|
|
1305
|
+
</tr>
|
|
1306
|
+
</table>
|
|
1307
|
+
</div>
|
|
1308
|
+
|
|
1309
|
+
<div class="method_details ">
|
|
1310
|
+
<p class="signature " id="bind_state_to_resource-instance_method">
|
|
1311
|
+
|
|
1312
|
+
- (<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt>) <strong>bind_state_to_resource</strong>(state)
|
|
1313
|
+
|
|
1314
|
+
|
|
1315
|
+
|
|
1316
|
+
</p><div class="docstring">
|
|
1317
|
+
<div class="discussion">
|
|
1318
|
+
|
|
1319
|
+
<p>Update the cache</p>
|
|
1320
|
+
|
|
1321
|
+
|
|
1322
|
+
</div>
|
|
1323
|
+
</div>
|
|
1324
|
+
<div class="tags">
|
|
1325
|
+
|
|
1326
|
+
<h3>Raises:</h3>
|
|
1327
|
+
<ul class="raise">
|
|
1328
|
+
|
|
1329
|
+
<li>
|
|
1330
|
+
|
|
1331
|
+
|
|
1332
|
+
<span class='type'>(<tt>RuntimeError</tt>)</span>
|
|
1333
|
+
|
|
1334
|
+
|
|
1335
|
+
|
|
1336
|
+
</li>
|
|
1337
|
+
|
|
1338
|
+
</ul>
|
|
1339
|
+
|
|
1340
|
+
</div><table class="source_code">
|
|
1341
|
+
<tr>
|
|
1342
|
+
<td>
|
|
1343
|
+
<pre class="lines">
|
|
1344
|
+
|
|
1345
|
+
|
|
1346
|
+
172
|
|
1347
|
+
173
|
|
1348
|
+
174
|
|
1349
|
+
175
|
|
1350
|
+
176</pre>
|
|
1351
|
+
</td>
|
|
1352
|
+
<td>
|
|
1353
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 172</span>
|
|
1354
|
+
|
|
1355
|
+
<span class='kw'>def</span> <span class='id bind_state_to_resource'>bind_state_to_resource</span><span class='lparen'>(</span><span class='id state'>state</span><span class='rparen'>)</span>
|
|
1356
|
+
<span class='id raise'>raise</span> <span class='const'>RuntimeError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Invalobject state</span><span class='tstring_end'>'</span></span> <span class='kw'>if</span> <span class='id state'>state</span><span class='period'>.</span><span class='id persistor'>persistor</span> <span class='op'>!=</span> <span class='kw'>self</span>
|
|
1357
|
+
<span class='id raise'>raise</span> <span class='const'>DuplicateIdError</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id state'>state</span><span class='period'>.</span><span class='id resource'>resource</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@object_to_state</span><span class='period'>.</span><span class='id include?'>include?</span><span class='lparen'>(</span><span class='id state'>state</span><span class='period'>.</span><span class='id resource'>resource</span><span class='rparen'>)</span>
|
|
1358
|
+
<span class='ivar'>@object_to_state</span><span class='lbracket'>[</span><span class='id state'>state</span><span class='period'>.</span><span class='id resource'>resource</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id state'>state</span>
|
|
1359
|
+
<span class='kw'>end</span></pre>
|
|
1360
|
+
</td>
|
|
1361
|
+
</tr>
|
|
1362
|
+
</table>
|
|
1363
|
+
</div>
|
|
1364
|
+
|
|
1365
|
+
<div class="method_details ">
|
|
1366
|
+
<p class="signature " id="bulk_delete-instance_method">
|
|
1367
|
+
|
|
1368
|
+
- (<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt>) <strong>bulk_delete</strong>(states, *params)
|
|
1369
|
+
|
|
1370
|
+
|
|
1371
|
+
|
|
1372
|
+
</p><div class="docstring">
|
|
1373
|
+
<div class="discussion">
|
|
1374
|
+
|
|
1375
|
+
<p>Remove object form the underlying store and Manages them. This method only
|
|
1376
|
+
care about the objects themselves not about theirs parents or children.</p>
|
|
1377
|
+
|
|
1378
|
+
|
|
1379
|
+
</div>
|
|
1380
|
+
</div>
|
|
1381
|
+
<div class="tags">
|
|
1382
|
+
|
|
1383
|
+
|
|
1384
|
+
</div><table class="source_code">
|
|
1385
|
+
<tr>
|
|
1386
|
+
<td>
|
|
1387
|
+
<pre class="lines">
|
|
1388
|
+
|
|
1389
|
+
|
|
1390
|
+
279
|
|
1391
|
+
280
|
|
1392
|
+
281
|
|
1393
|
+
282
|
|
1394
|
+
283
|
|
1395
|
+
284
|
|
1396
|
+
285
|
|
1397
|
+
286
|
|
1398
|
+
287</pre>
|
|
1399
|
+
</td>
|
|
1400
|
+
<td>
|
|
1401
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 279</span>
|
|
1402
|
+
|
|
1403
|
+
<span class='kw'>def</span> <span class='id bulk_delete'>bulk_delete</span><span class='lparen'>(</span><span class='id states'>states</span><span class='comma'>,</span> <span class='op'>*</span><span class='id params'>params</span><span class='rparen'>)</span>
|
|
1404
|
+
<span class='comment'># delete theme but leave them in cache
|
|
1405
|
+
</span> <span class='comment'># in case they need to be displayed.
|
|
1406
|
+
</span> <span class='id states'>states</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id state'>state</span><span class='op'>|</span>
|
|
1407
|
+
<span class='id state'>state</span><span class='period'>.</span><span class='id id'>id</span><span class='period'>.</span><span class='id andtap'>andtap</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id id'>id</span><span class='op'>|</span> <span class='ivar'>@id_to_state</span><span class='period'>.</span><span class='id delete'>delete</span><span class='lparen'>(</span><span class='id id'>id</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
|
1408
|
+
<span class='id state'>state</span><span class='period'>.</span><span class='id resource'>resource</span> <span class='comment'>#.andtap { |object| @object_to_state.delete(object) }
|
|
1409
|
+
</span> <span class='kw'>end</span>
|
|
1410
|
+
<span class='id bulk_delete_raw'>bulk_delete_raw</span><span class='lparen'>(</span><span class='id states'>states</span><span class='period'>.</span><span class='id map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:id</span><span class='rparen'>)</span><span class='period'>.</span><span class='id compact'>compact</span><span class='comma'>,</span> <span class='op'>*</span><span class='id params'>params</span><span class='rparen'>)</span>
|
|
1411
|
+
<span class='kw'>end</span></pre>
|
|
1412
|
+
</td>
|
|
1413
|
+
</tr>
|
|
1414
|
+
</table>
|
|
1415
|
+
</div>
|
|
1416
|
+
|
|
1417
|
+
<div class="method_details ">
|
|
1418
|
+
<p class="signature " id="bulk_delete_raw-instance_method">
|
|
1419
|
+
|
|
1420
|
+
- (<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt>) <strong>bulk_delete_raw</strong>(states, *params)
|
|
1421
|
+
|
|
1422
|
+
|
|
1423
|
+
|
|
1424
|
+
</p><div class="docstring">
|
|
1425
|
+
<div class="discussion">
|
|
1426
|
+
<div class="note abstract">
|
|
1427
|
+
<strong>This method is abstract.</strong>
|
|
1428
|
+
<div class='inline'></div>
|
|
1429
|
+
</div>
|
|
1430
|
+
|
|
1431
|
+
<p>Physically remove objects from a store.</p>
|
|
1432
|
+
|
|
1433
|
+
|
|
1434
|
+
</div>
|
|
1435
|
+
</div>
|
|
1436
|
+
<div class="tags">
|
|
1437
|
+
|
|
1438
|
+
<h3>Raises:</h3>
|
|
1439
|
+
<ul class="raise">
|
|
1440
|
+
|
|
1441
|
+
<li>
|
|
1442
|
+
|
|
1443
|
+
|
|
1444
|
+
<span class='type'>(<tt>NotImplementedError</tt>)</span>
|
|
1445
|
+
|
|
1446
|
+
|
|
1447
|
+
|
|
1448
|
+
</li>
|
|
1449
|
+
|
|
1450
|
+
</ul>
|
|
1451
|
+
|
|
1452
|
+
</div><table class="source_code">
|
|
1453
|
+
<tr>
|
|
1454
|
+
<td>
|
|
1455
|
+
<pre class="lines">
|
|
1456
|
+
|
|
1457
|
+
|
|
1458
|
+
291
|
|
1459
|
+
292
|
|
1460
|
+
293</pre>
|
|
1461
|
+
</td>
|
|
1462
|
+
<td>
|
|
1463
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 291</span>
|
|
1464
|
+
|
|
1465
|
+
<span class='kw'>def</span> <span class='id bulk_delete_raw'>bulk_delete_raw</span><span class='lparen'>(</span><span class='id states'>states</span><span class='comma'>,</span> <span class='op'>*</span><span class='id params'>params</span><span class='rparen'>)</span>
|
|
1466
|
+
<span class='id raise'>raise</span> <span class='const'>NotImplementedError</span>
|
|
1467
|
+
<span class='kw'>end</span></pre>
|
|
1468
|
+
</td>
|
|
1469
|
+
</tr>
|
|
1470
|
+
</table>
|
|
1471
|
+
</div>
|
|
1472
|
+
|
|
1473
|
+
<div class="method_details ">
|
|
1474
|
+
<p class="signature " id="bulk_insert-instance_method">
|
|
1475
|
+
|
|
1476
|
+
- (<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt>) <strong>bulk_insert</strong>(states, *params)
|
|
1477
|
+
|
|
1478
|
+
|
|
1479
|
+
|
|
1480
|
+
</p><div class="docstring">
|
|
1481
|
+
<div class="discussion">
|
|
1482
|
+
|
|
1483
|
+
<p>Inserts objects in the underlying store AND manages them. This method only
|
|
1484
|
+
care about the objects themselves not about theirs parents or children. The
|
|
1485
|
+
physical insert in the store must be specified for each store.</p>
|
|
1486
|
+
|
|
1487
|
+
|
|
1488
|
+
</div>
|
|
1489
|
+
</div>
|
|
1490
|
+
<div class="tags">
|
|
1491
|
+
|
|
1492
|
+
|
|
1493
|
+
</div><table class="source_code">
|
|
1494
|
+
<tr>
|
|
1495
|
+
<td>
|
|
1496
|
+
<pre class="lines">
|
|
1497
|
+
|
|
1498
|
+
|
|
1499
|
+
272
|
|
1500
|
+
273
|
|
1501
|
+
274</pre>
|
|
1502
|
+
</td>
|
|
1503
|
+
<td>
|
|
1504
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 272</span>
|
|
1505
|
+
|
|
1506
|
+
<span class='kw'>def</span> <span class='id bulk_insert'>bulk_insert</span><span class='lparen'>(</span><span class='id states'>states</span><span class='comma'>,</span> <span class='op'>*</span><span class='id params'>params</span><span class='rparen'>)</span>
|
|
1507
|
+
<span class='id states'>states</span><span class='period'>.</span><span class='id map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id state'>state</span><span class='op'>|</span> <span class='id insert'>insert</span><span class='lparen'>(</span><span class='id state'>state</span><span class='comma'>,</span> <span class='op'>*</span><span class='id params'>params</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
|
1508
|
+
<span class='kw'>end</span></pre>
|
|
1509
|
+
</td>
|
|
1510
|
+
</tr>
|
|
1511
|
+
</table>
|
|
1512
|
+
</div>
|
|
1513
|
+
|
|
1514
|
+
<div class="method_details ">
|
|
1515
|
+
<p class="signature " id="bulk_retrieve-instance_method">
|
|
1516
|
+
|
|
1517
|
+
- (<tt><span class='object_link'><a href="../../../Array.html" title="Array (class)">Array</a></span><<span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span>]</tt>) <strong>bulk_retrieve</strong>(ids, *params)
|
|
1518
|
+
|
|
1519
|
+
|
|
1520
|
+
|
|
1521
|
+
</p><div class="docstring">
|
|
1522
|
+
<div class="discussion">
|
|
1523
|
+
|
|
1524
|
+
<p>Retreives a list of objects . @<a href="http://Array<Id>">param</a> ids</p>
|
|
1525
|
+
|
|
1526
|
+
|
|
1527
|
+
</div>
|
|
1528
|
+
</div>
|
|
1529
|
+
<div class="tags">
|
|
1530
|
+
|
|
1531
|
+
<h3>Returns:</h3>
|
|
1532
|
+
<ul class="return">
|
|
1533
|
+
|
|
1534
|
+
<li>
|
|
1535
|
+
|
|
1536
|
+
|
|
1537
|
+
<span class='type'>(<tt><span class='object_link'><a href="../../../Array.html" title="Array (class)">Array</a></span><<span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span>]</tt>)</span>
|
|
1538
|
+
|
|
1539
|
+
|
|
1540
|
+
|
|
1541
|
+
—
|
|
1542
|
+
<div class='inline'>
|
|
1543
|
+
<p>Array<Object]</p>
|
|
1544
|
+
</div>
|
|
1545
|
+
|
|
1546
|
+
</li>
|
|
1547
|
+
|
|
1548
|
+
</ul>
|
|
1549
|
+
|
|
1550
|
+
</div><table class="source_code">
|
|
1551
|
+
<tr>
|
|
1552
|
+
<td>
|
|
1553
|
+
<pre class="lines">
|
|
1554
|
+
|
|
1555
|
+
|
|
1556
|
+
324
|
|
1557
|
+
325
|
|
1558
|
+
326
|
|
1559
|
+
327
|
|
1560
|
+
328
|
|
1561
|
+
329
|
|
1562
|
+
330
|
|
1563
|
+
331
|
|
1564
|
+
332
|
|
1565
|
+
333
|
|
1566
|
+
334
|
|
1567
|
+
335
|
|
1568
|
+
336
|
|
1569
|
+
337
|
|
1570
|
+
338
|
|
1571
|
+
339
|
|
1572
|
+
340
|
|
1573
|
+
341
|
|
1574
|
+
342
|
|
1575
|
+
343
|
|
1576
|
+
344
|
|
1577
|
+
345
|
|
1578
|
+
346</pre>
|
|
1579
|
+
</td>
|
|
1580
|
+
<td>
|
|
1581
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 324</span>
|
|
1582
|
+
|
|
1583
|
+
<span class='kw'>def</span> <span class='id bulk_retrieve'>bulk_retrieve</span><span class='lparen'>(</span><span class='id ids'>ids</span><span class='comma'>,</span> <span class='op'>*</span><span class='id params'>params</span><span class='rparen'>)</span>
|
|
1584
|
+
<span class='comment'># create a list of states and load them
|
|
1585
|
+
</span> <span class='id states'>states</span> <span class='op'>=</span> <span class='const'>StateGroup</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id ids'>ids</span><span class='period'>.</span><span class='id map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id id'>id</span><span class='op'>|</span>
|
|
1586
|
+
<span class='ivar'>@id_to_state</span><span class='lbracket'>[</span><span class='id id'>id</span><span class='rbracket'>]</span>
|
|
1587
|
+
<span class='kw'>end</span><span class='rparen'>)</span>
|
|
1588
|
+
|
|
1589
|
+
<span class='id states'>states</span><span class='period'>.</span><span class='id load'>load</span>
|
|
1590
|
+
<span class='kw'>return</span> <span class='const'>StateList</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id states'>states</span><span class='period'>.</span><span class='id map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id state'>state</span><span class='op'>|</span> <span class='id state'>state</span><span class='period'>.</span><span class='id resource'>resource</span> <span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
1591
|
+
|
|
1592
|
+
<span class='comment'># we need to separate object which need to be loaded
|
|
1593
|
+
</span> <span class='comment'># from the one which are already in cache
|
|
1594
|
+
</span> <span class='id to_load'>to_load</span> <span class='op'>=</span> <span class='id ids'>ids</span><span class='period'>.</span><span class='id reject'>reject</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id id'>id</span><span class='op'>|</span> <span class='id id'>id</span> <span class='op'>==</span> <span class='kw'>nil</span> <span class='op'>||</span> <span class='ivar'>@id_to_state</span><span class='period'>.</span><span class='id include?'>include?</span><span class='lparen'>(</span><span class='id id'>id</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
|
1595
|
+
<span class='id loaded_states'>loaded_states</span> <span class='op'>=</span> <span class='id bulk_load_raw_attributes'>bulk_load_raw_attributes</span><span class='lparen'>(</span><span class='id to_load'>to_load</span><span class='comma'>,</span> <span class='op'>*</span><span class='id params'>params</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id att'>att</span><span class='op'>|</span>
|
|
1596
|
+
<span class='id id'>id</span> <span class='op'>=</span> <span class='id att'>att</span><span class='period'>.</span><span class='id delete'>delete</span><span class='lparen'>(</span><span class='id primary_key'>primary_key</span><span class='rparen'>)</span>
|
|
1597
|
+
<span class='id new_state_for_attribute'>new_state_for_attribute</span><span class='lparen'>(</span><span class='id id'>id</span><span class='comma'>,</span> <span class='id att'>att</span><span class='rparen'>)</span><span class='period'>.</span><span class='id resource'>resource</span>
|
|
1598
|
+
<span class='kw'>end</span>
|
|
1599
|
+
|
|
1600
|
+
<span class='id bulk_retrieve_children'>bulk_retrieve_children</span><span class='lparen'>(</span><span class='id new_states'>new_states</span><span class='comma'>,</span> <span class='op'>*</span><span class='id params'>params</span><span class='rparen'>)</span>
|
|
1601
|
+
<span class='comment'>#bulk_retrieve_parent(new_states, *params)
|
|
1602
|
+
</span>
|
|
1603
|
+
|
|
1604
|
+
<span class='id ids'>ids</span><span class='period'>.</span><span class='id map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id id'>id</span><span class='op'>|</span> <span class='id object_for'>object_for</span><span class='lparen'>(</span><span class='id id'>id</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
|
1605
|
+
<span class='kw'>end</span></pre>
|
|
1606
|
+
</td>
|
|
1607
|
+
</tr>
|
|
1608
|
+
</table>
|
|
1609
|
+
</div>
|
|
1610
|
+
|
|
1611
|
+
<div class="method_details ">
|
|
1612
|
+
<p class="signature " id="bulk_update-instance_method">
|
|
1613
|
+
|
|
1614
|
+
- (<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt>) <strong>bulk_update</strong>(states, *params)
|
|
1615
|
+
|
|
1616
|
+
|
|
1617
|
+
|
|
1618
|
+
</p><div class="docstring">
|
|
1619
|
+
<div class="discussion">
|
|
1620
|
+
|
|
1621
|
+
<p>Updates the store and manages object. Doesn't care of children or parents.</p>
|
|
1622
|
+
|
|
1623
|
+
|
|
1624
|
+
</div>
|
|
1625
|
+
</div>
|
|
1626
|
+
<div class="tags">
|
|
1627
|
+
<h3>Parameters:</h3>
|
|
1628
|
+
<ul class="param">
|
|
1629
|
+
|
|
1630
|
+
<li>
|
|
1631
|
+
|
|
1632
|
+
<span class='name'>Array<ResourceState]</span>
|
|
1633
|
+
|
|
1634
|
+
|
|
1635
|
+
<span class='type'>(<tt><span class='object_link'><a href="../../../Array.html" title="Array (class)">Array</a></span><<span class='object_link'><a href="ResourceState.html" title="Lims::Core::Persistence::ResourceState (class)">ResourceState</a></span>] states</tt>)</span>
|
|
1636
|
+
|
|
1637
|
+
|
|
1638
|
+
|
|
1639
|
+
—
|
|
1640
|
+
<div class='inline'>
|
|
1641
|
+
<p>states</p>
|
|
1642
|
+
</div>
|
|
1643
|
+
|
|
1644
|
+
</li>
|
|
1645
|
+
|
|
1646
|
+
</ul>
|
|
1647
|
+
|
|
1648
|
+
|
|
1649
|
+
</div><table class="source_code">
|
|
1650
|
+
<tr>
|
|
1651
|
+
<td>
|
|
1652
|
+
<pre class="lines">
|
|
1653
|
+
|
|
1654
|
+
|
|
1655
|
+
351
|
|
1656
|
+
352
|
|
1657
|
+
353
|
|
1658
|
+
354
|
|
1659
|
+
355
|
|
1660
|
+
356
|
|
1661
|
+
357
|
|
1662
|
+
358
|
|
1663
|
+
359</pre>
|
|
1664
|
+
</td>
|
|
1665
|
+
<td>
|
|
1666
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 351</span>
|
|
1667
|
+
|
|
1668
|
+
<span class='kw'>def</span> <span class='id bulk_update'>bulk_update</span><span class='lparen'>(</span><span class='id states'>states</span><span class='comma'>,</span> <span class='op'>*</span><span class='id params'>params</span><span class='rparen'>)</span>
|
|
1669
|
+
<span class='id attributes'>attributes</span> <span class='op'>=</span> <span class='id states'>states</span><span class='period'>.</span><span class='id map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id state'>state</span><span class='op'>|</span>
|
|
1670
|
+
<span class='id filter_attributes_on_save'>filter_attributes_on_save</span><span class='lparen'>(</span><span class='id state'>state</span><span class='period'>.</span><span class='id resource'>resource</span><span class='period'>.</span><span class='id attributes'>attributes</span><span class='rparen'>)</span><span class='period'>.</span><span class='id merge'>merge</span><span class='lparen'>(</span><span class='id primary_key'>primary_key</span> <span class='op'>=></span> <span class='id state'>state</span><span class='period'>.</span><span class='id id'>id</span><span class='rparen'>)</span>
|
|
1671
|
+
<span class='kw'>end</span>
|
|
1672
|
+
<span class='id bulk_update_raw_attributes'>bulk_update_raw_attributes</span><span class='lparen'>(</span><span class='id attributes'>attributes</span><span class='comma'>,</span> <span class='op'>*</span><span class='id params'>params</span><span class='rparen'>)</span>
|
|
1673
|
+
<span class='id states'>states</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id state'>state</span><span class='op'>|</span>
|
|
1674
|
+
<span class='id state'>state</span><span class='period'>.</span><span class='id updated'>updated</span>
|
|
1675
|
+
<span class='kw'>end</span>
|
|
1676
|
+
<span class='kw'>end</span></pre>
|
|
1677
|
+
</td>
|
|
1678
|
+
</tr>
|
|
1679
|
+
</table>
|
|
1680
|
+
</div>
|
|
1681
|
+
|
|
1682
|
+
<div class="method_details ">
|
|
1683
|
+
<p class="signature " id="children-instance_method">
|
|
1684
|
+
|
|
1685
|
+
- (<tt><span class='object_link'><a href="../../../Array.html" title="Array (class)">Array</a></span><<span class='object_link'><a href="../Resource.html" title="Lims::Core::Resource (module)">Resource</a></span>></tt>) <strong>children</strong>(resource)
|
|
1686
|
+
|
|
1687
|
+
|
|
1688
|
+
|
|
1689
|
+
</p><div class="docstring">
|
|
1690
|
+
<div class="discussion">
|
|
1691
|
+
|
|
1692
|
+
<p>List of children , i.e, object which need to be saved AFTER it.</p>
|
|
1693
|
+
|
|
1694
|
+
|
|
1695
|
+
</div>
|
|
1696
|
+
</div>
|
|
1697
|
+
<div class="tags">
|
|
1698
|
+
<h3>Parameters:</h3>
|
|
1699
|
+
<ul class="param">
|
|
1700
|
+
|
|
1701
|
+
<li>
|
|
1702
|
+
|
|
1703
|
+
<span class='name'>resource</span>
|
|
1704
|
+
|
|
1705
|
+
|
|
1706
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Resource.html" title="Lims::Core::Resource (module)">Resource</a></span></tt>)</span>
|
|
1707
|
+
|
|
1708
|
+
|
|
1709
|
+
|
|
1710
|
+
</li>
|
|
1711
|
+
|
|
1712
|
+
</ul>
|
|
1713
|
+
|
|
1714
|
+
<h3>Returns:</h3>
|
|
1715
|
+
<ul class="return">
|
|
1716
|
+
|
|
1717
|
+
<li>
|
|
1718
|
+
|
|
1719
|
+
|
|
1720
|
+
<span class='type'>(<tt><span class='object_link'><a href="../../../Array.html" title="Array (class)">Array</a></span><<span class='object_link'><a href="../Resource.html" title="Lims::Core::Resource (module)">Resource</a></span>></tt>)</span>
|
|
1721
|
+
|
|
1722
|
+
|
|
1723
|
+
|
|
1724
|
+
</li>
|
|
1725
|
+
|
|
1726
|
+
</ul>
|
|
1727
|
+
|
|
1728
|
+
</div><table class="source_code">
|
|
1729
|
+
<tr>
|
|
1730
|
+
<td>
|
|
1731
|
+
<pre class="lines">
|
|
1732
|
+
|
|
1733
|
+
|
|
1734
|
+
381
|
|
1735
|
+
382
|
|
1736
|
+
383</pre>
|
|
1737
|
+
</td>
|
|
1738
|
+
<td>
|
|
1739
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 381</span>
|
|
1740
|
+
|
|
1741
|
+
<span class='kw'>def</span> <span class='id children'>children</span><span class='lparen'>(</span><span class='id resource'>resource</span><span class='rparen'>)</span>
|
|
1742
|
+
<span class='lbracket'>[</span><span class='rbracket'>]</span>
|
|
1743
|
+
<span class='kw'>end</span></pre>
|
|
1744
|
+
</td>
|
|
1745
|
+
</tr>
|
|
1746
|
+
</table>
|
|
1747
|
+
</div>
|
|
1748
|
+
|
|
1749
|
+
<div class="method_details ">
|
|
1750
|
+
<p class="signature " id="count-instance_method">
|
|
1751
|
+
|
|
1752
|
+
- (<tt>Fixnum</tt>) <strong>count</strong>
|
|
1753
|
+
|
|
1754
|
+
|
|
1755
|
+
|
|
1756
|
+
</p><div class="docstring">
|
|
1757
|
+
<div class="discussion">
|
|
1758
|
+
<div class="note abstract">
|
|
1759
|
+
<strong>This method is abstract.</strong>
|
|
1760
|
+
<div class='inline'></div>
|
|
1761
|
+
</div>
|
|
1762
|
+
|
|
1763
|
+
<p>Returns the number of object in the store</p>
|
|
1764
|
+
|
|
1765
|
+
|
|
1766
|
+
</div>
|
|
1767
|
+
</div>
|
|
1768
|
+
<div class="tags">
|
|
1769
|
+
|
|
1770
|
+
<h3>Returns:</h3>
|
|
1771
|
+
<ul class="return">
|
|
1772
|
+
|
|
1773
|
+
<li>
|
|
1774
|
+
|
|
1775
|
+
|
|
1776
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
|
1777
|
+
|
|
1778
|
+
|
|
1779
|
+
|
|
1780
|
+
</li>
|
|
1781
|
+
|
|
1782
|
+
</ul>
|
|
1783
|
+
<h3>Raises:</h3>
|
|
1784
|
+
<ul class="raise">
|
|
1785
|
+
|
|
1786
|
+
<li>
|
|
1787
|
+
|
|
1788
|
+
|
|
1789
|
+
<span class='type'>(<tt>NotImplementedError</tt>)</span>
|
|
1790
|
+
|
|
1791
|
+
|
|
1792
|
+
|
|
1793
|
+
</li>
|
|
1794
|
+
|
|
1795
|
+
</ul>
|
|
1796
|
+
|
|
1797
|
+
</div><table class="source_code">
|
|
1798
|
+
<tr>
|
|
1799
|
+
<td>
|
|
1800
|
+
<pre class="lines">
|
|
1801
|
+
|
|
1802
|
+
|
|
1803
|
+
240
|
|
1804
|
+
241
|
|
1805
|
+
242</pre>
|
|
1806
|
+
</td>
|
|
1807
|
+
<td>
|
|
1808
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 240</span>
|
|
1809
|
+
|
|
1810
|
+
<span class='kw'>def</span> <span class='id count'>count</span>
|
|
1811
|
+
<span class='id raise'>raise</span> <span class='const'>NotImplementedError</span>
|
|
1812
|
+
<span class='kw'>end</span></pre>
|
|
1813
|
+
</td>
|
|
1814
|
+
</tr>
|
|
1815
|
+
</table>
|
|
1816
|
+
</div>
|
|
1817
|
+
|
|
1818
|
+
<div class="method_details ">
|
|
1819
|
+
<p class="signature " id="deletable_children-instance_method">
|
|
1820
|
+
|
|
1821
|
+
- (<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt>) <strong>deletable_children</strong>(resource)
|
|
1822
|
+
|
|
1823
|
+
|
|
1824
|
+
|
|
1825
|
+
</p><div class="docstring">
|
|
1826
|
+
<div class="discussion">
|
|
1827
|
+
|
|
1828
|
+
<div class="note todo">
|
|
1829
|
+
<strong>TODO:</strong>
|
|
1830
|
+
<div class='inline'></div>
|
|
1831
|
+
</div>
|
|
1832
|
+
|
|
1833
|
+
|
|
1834
|
+
|
|
1835
|
+
</div>
|
|
1836
|
+
</div>
|
|
1837
|
+
<div class="tags">
|
|
1838
|
+
|
|
1839
|
+
|
|
1840
|
+
</div><table class="source_code">
|
|
1841
|
+
<tr>
|
|
1842
|
+
<td>
|
|
1843
|
+
<pre class="lines">
|
|
1844
|
+
|
|
1845
|
+
|
|
1846
|
+
386
|
|
1847
|
+
387
|
|
1848
|
+
388</pre>
|
|
1849
|
+
</td>
|
|
1850
|
+
<td>
|
|
1851
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 386</span>
|
|
1852
|
+
|
|
1853
|
+
<span class='kw'>def</span> <span class='id deletable_children'>deletable_children</span><span class='lparen'>(</span><span class='id resource'>resource</span><span class='rparen'>)</span>
|
|
1854
|
+
<span class='lbracket'>[</span><span class='rbracket'>]</span>
|
|
1855
|
+
<span class='kw'>end</span></pre>
|
|
1856
|
+
</td>
|
|
1857
|
+
</tr>
|
|
1858
|
+
</table>
|
|
1859
|
+
</div>
|
|
1860
|
+
|
|
1861
|
+
<div class="method_details ">
|
|
1862
|
+
<p class="signature " id="deletable_parents-instance_method">
|
|
1863
|
+
|
|
1864
|
+
- (<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt>) <strong>deletable_parents</strong>(resource)
|
|
1865
|
+
|
|
1866
|
+
|
|
1867
|
+
|
|
1868
|
+
</p><table class="source_code">
|
|
1869
|
+
<tr>
|
|
1870
|
+
<td>
|
|
1871
|
+
<pre class="lines">
|
|
1872
|
+
|
|
1873
|
+
|
|
1874
|
+
390
|
|
1875
|
+
391
|
|
1876
|
+
392</pre>
|
|
1877
|
+
</td>
|
|
1878
|
+
<td>
|
|
1879
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 390</span>
|
|
1880
|
+
|
|
1881
|
+
<span class='kw'>def</span> <span class='id deletable_parents'>deletable_parents</span><span class='lparen'>(</span><span class='id resource'>resource</span><span class='rparen'>)</span>
|
|
1882
|
+
<span class='lbracket'>[</span><span class='rbracket'>]</span>
|
|
1883
|
+
<span class='kw'>end</span></pre>
|
|
1884
|
+
</td>
|
|
1885
|
+
</tr>
|
|
1886
|
+
</table>
|
|
1887
|
+
</div>
|
|
1888
|
+
|
|
1889
|
+
<div class="method_details ">
|
|
1890
|
+
<p class="signature " id="dirty_key_for-instance_method">
|
|
1891
|
+
|
|
1892
|
+
- (<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt>) <strong>dirty_key_for</strong>(resource)
|
|
1893
|
+
|
|
1894
|
+
|
|
1895
|
+
|
|
1896
|
+
</p><div class="docstring">
|
|
1897
|
+
<div class="discussion">
|
|
1898
|
+
|
|
1899
|
+
<p>Computes "dirty_key" of an object. The dirty key is used to decide if an
|
|
1900
|
+
object has been modified or not.</p>
|
|
1901
|
+
|
|
1902
|
+
|
|
1903
|
+
</div>
|
|
1904
|
+
</div>
|
|
1905
|
+
<div class="tags">
|
|
1906
|
+
<h3>Parameters:</h3>
|
|
1907
|
+
<ul class="param">
|
|
1908
|
+
|
|
1909
|
+
<li>
|
|
1910
|
+
|
|
1911
|
+
<span class='name'></span>
|
|
1912
|
+
|
|
1913
|
+
|
|
1914
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Resource.html" title="Lims::Core::Resource (module)">Resource</a></span></tt>)</span>
|
|
1915
|
+
|
|
1916
|
+
|
|
1917
|
+
|
|
1918
|
+
</li>
|
|
1919
|
+
|
|
1920
|
+
</ul>
|
|
1921
|
+
|
|
1922
|
+
<h3>Returns:</h3>
|
|
1923
|
+
<ul class="return">
|
|
1924
|
+
|
|
1925
|
+
<li>
|
|
1926
|
+
|
|
1927
|
+
|
|
1928
|
+
<span class='type'>(<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt>)</span>
|
|
1929
|
+
|
|
1930
|
+
|
|
1931
|
+
|
|
1932
|
+
</li>
|
|
1933
|
+
|
|
1934
|
+
</ul>
|
|
1935
|
+
|
|
1936
|
+
</div><table class="source_code">
|
|
1937
|
+
<tr>
|
|
1938
|
+
<td>
|
|
1939
|
+
<pre class="lines">
|
|
1940
|
+
|
|
1941
|
+
|
|
1942
|
+
195
|
|
1943
|
+
196
|
|
1944
|
+
197
|
|
1945
|
+
198
|
|
1946
|
+
199</pre>
|
|
1947
|
+
</td>
|
|
1948
|
+
<td>
|
|
1949
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 195</span>
|
|
1950
|
+
|
|
1951
|
+
<span class='kw'>def</span> <span class='id dirty_key_for'>dirty_key_for</span><span class='lparen'>(</span><span class='id resource'>resource</span><span class='rparen'>)</span>
|
|
1952
|
+
<span class='kw'>if</span> <span class='id resource'>resource</span> <span class='op'>&&</span> <span class='ivar'>@session</span><span class='period'>.</span><span class='id dirty_attribute_strategy'>dirty_attribute_strategy</span>
|
|
1953
|
+
<span class='ivar'>@session</span><span class='period'>.</span><span class='id dirty_key_for'>dirty_key_for</span><span class='lparen'>(</span><span class='id filter_attributes_on_save'>filter_attributes_on_save</span><span class='lparen'>(</span><span class='id resource'>resource</span><span class='period'>.</span><span class='id attributes_for_dirty'>attributes_for_dirty</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
|
1954
|
+
<span class='kw'>end</span>
|
|
1955
|
+
<span class='kw'>end</span></pre>
|
|
1956
|
+
</td>
|
|
1957
|
+
</tr>
|
|
1958
|
+
</table>
|
|
1959
|
+
</div>
|
|
1960
|
+
|
|
1961
|
+
<div class="method_details ">
|
|
1962
|
+
<p class="signature " id="for_each_in_slice-instance_method">
|
|
1963
|
+
|
|
1964
|
+
- (<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt>) <strong>for_each_in_slice</strong>(start, length) {|key, attributes| ... }
|
|
1965
|
+
|
|
1966
|
+
|
|
1967
|
+
|
|
1968
|
+
</p><div class="docstring">
|
|
1969
|
+
<div class="discussion">
|
|
1970
|
+
<div class="note abstract">
|
|
1971
|
+
<strong>This method is abstract.</strong>
|
|
1972
|
+
<div class='inline'></div>
|
|
1973
|
+
</div>
|
|
1974
|
+
|
|
1975
|
+
<p>Load a slice. Doesn't return an object but a hash allowing to build it.</p>
|
|
1976
|
+
|
|
1977
|
+
|
|
1978
|
+
</div>
|
|
1979
|
+
</div>
|
|
1980
|
+
<div class="tags">
|
|
1981
|
+
<h3>Parameters:</h3>
|
|
1982
|
+
<ul class="param">
|
|
1983
|
+
|
|
1984
|
+
<li>
|
|
1985
|
+
|
|
1986
|
+
<span class='name'>start</span>
|
|
1987
|
+
|
|
1988
|
+
|
|
1989
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
|
1990
|
+
|
|
1991
|
+
|
|
1992
|
+
|
|
1993
|
+
—
|
|
1994
|
+
<div class='inline'>
|
|
1995
|
+
<p>(0 based)</p>
|
|
1996
|
+
</div>
|
|
1997
|
+
|
|
1998
|
+
</li>
|
|
1999
|
+
|
|
2000
|
+
<li>
|
|
2001
|
+
|
|
2002
|
+
<span class='name'>length</span>
|
|
2003
|
+
|
|
2004
|
+
|
|
2005
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
|
2006
|
+
|
|
2007
|
+
|
|
2008
|
+
|
|
2009
|
+
</li>
|
|
2010
|
+
|
|
2011
|
+
</ul>
|
|
2012
|
+
|
|
2013
|
+
<h3>Yield Parameters:</h3>
|
|
2014
|
+
<ul class="yieldparam">
|
|
2015
|
+
|
|
2016
|
+
<li>
|
|
2017
|
+
|
|
2018
|
+
<span class='name'>key</span>
|
|
2019
|
+
|
|
2020
|
+
|
|
2021
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
|
2022
|
+
|
|
2023
|
+
|
|
2024
|
+
|
|
2025
|
+
</li>
|
|
2026
|
+
|
|
2027
|
+
<li>
|
|
2028
|
+
|
|
2029
|
+
<span class='name'>attributes</span>
|
|
2030
|
+
|
|
2031
|
+
|
|
2032
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
2033
|
+
|
|
2034
|
+
|
|
2035
|
+
|
|
2036
|
+
—
|
|
2037
|
+
<div class='inline'>
|
|
2038
|
+
<p>of the object</p>
|
|
2039
|
+
</div>
|
|
2040
|
+
|
|
2041
|
+
</li>
|
|
2042
|
+
|
|
2043
|
+
</ul>
|
|
2044
|
+
<h3>Raises:</h3>
|
|
2045
|
+
<ul class="raise">
|
|
2046
|
+
|
|
2047
|
+
<li>
|
|
2048
|
+
|
|
2049
|
+
|
|
2050
|
+
<span class='type'>(<tt>NotImplementedError</tt>)</span>
|
|
2051
|
+
|
|
2052
|
+
|
|
2053
|
+
|
|
2054
|
+
</li>
|
|
2055
|
+
|
|
2056
|
+
</ul>
|
|
2057
|
+
|
|
2058
|
+
</div><table class="source_code">
|
|
2059
|
+
<tr>
|
|
2060
|
+
<td>
|
|
2061
|
+
<pre class="lines">
|
|
2062
|
+
|
|
2063
|
+
|
|
2064
|
+
251
|
|
2065
|
+
252
|
|
2066
|
+
253</pre>
|
|
2067
|
+
</td>
|
|
2068
|
+
<td>
|
|
2069
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 251</span>
|
|
2070
|
+
|
|
2071
|
+
<span class='kw'>def</span> <span class='id for_each_in_slice'>for_each_in_slice</span><span class='lparen'>(</span><span class='id start'>start</span><span class='comma'>,</span> <span class='id length'>length</span><span class='rparen'>)</span>
|
|
2072
|
+
<span class='id raise'>raise</span> <span class='const'>NotImplementedError</span>
|
|
2073
|
+
<span class='kw'>end</span></pre>
|
|
2074
|
+
</td>
|
|
2075
|
+
</tr>
|
|
2076
|
+
</table>
|
|
2077
|
+
</div>
|
|
2078
|
+
|
|
2079
|
+
<div class="method_details ">
|
|
2080
|
+
<p class="signature " id="id_for-instance_method">
|
|
2081
|
+
|
|
2082
|
+
- (<tt>Id</tt>, <tt>Nil</tt>) <strong>id_for</strong>(object)
|
|
2083
|
+
|
|
2084
|
+
|
|
2085
|
+
|
|
2086
|
+
</p><div class="docstring">
|
|
2087
|
+
<div class="discussion">
|
|
2088
|
+
|
|
2089
|
+
<p>Get the id from an object from the cache.</p>
|
|
2090
|
+
|
|
2091
|
+
|
|
2092
|
+
</div>
|
|
2093
|
+
</div>
|
|
2094
|
+
<div class="tags">
|
|
2095
|
+
<h3>Parameters:</h3>
|
|
2096
|
+
<ul class="param">
|
|
2097
|
+
|
|
2098
|
+
<li>
|
|
2099
|
+
|
|
2100
|
+
<span class='name'>object</span>
|
|
2101
|
+
|
|
2102
|
+
|
|
2103
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Resource.html" title="Lims::Core::Resource (module)">Resource</a></span></tt>)</span>
|
|
2104
|
+
|
|
2105
|
+
|
|
2106
|
+
|
|
2107
|
+
—
|
|
2108
|
+
<div class='inline'>
|
|
2109
|
+
<p>object to find the id for.</p>
|
|
2110
|
+
</div>
|
|
2111
|
+
|
|
2112
|
+
</li>
|
|
2113
|
+
|
|
2114
|
+
</ul>
|
|
2115
|
+
|
|
2116
|
+
<h3>Returns:</h3>
|
|
2117
|
+
<ul class="return">
|
|
2118
|
+
|
|
2119
|
+
<li>
|
|
2120
|
+
|
|
2121
|
+
|
|
2122
|
+
<span class='type'>(<tt>Id</tt>, <tt>Nil</tt>)</span>
|
|
2123
|
+
|
|
2124
|
+
|
|
2125
|
+
|
|
2126
|
+
</li>
|
|
2127
|
+
|
|
2128
|
+
</ul>
|
|
2129
|
+
|
|
2130
|
+
</div><table class="source_code">
|
|
2131
|
+
<tr>
|
|
2132
|
+
<td>
|
|
2133
|
+
<pre class="lines">
|
|
2134
|
+
|
|
2135
|
+
|
|
2136
|
+
125
|
|
2137
|
+
126
|
|
2138
|
+
127</pre>
|
|
2139
|
+
</td>
|
|
2140
|
+
<td>
|
|
2141
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 125</span>
|
|
2142
|
+
|
|
2143
|
+
<span class='kw'>def</span> <span class='id id_for'>id_for</span><span class='lparen'>(</span><span class='id object'>object</span><span class='rparen'>)</span>
|
|
2144
|
+
<span class='id state_for'>state_for</span><span class='lparen'>(</span><span class='id object'>object</span><span class='rparen'>)</span><span class='period'>.</span><span class='id andtap'>andtap</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id state'>state</span><span class='op'>|</span> <span class='id state'>state</span><span class='period'>.</span><span class='id id'>id</span> <span class='rbrace'>}</span>
|
|
2145
|
+
<span class='kw'>end</span></pre>
|
|
2146
|
+
</td>
|
|
2147
|
+
</tr>
|
|
2148
|
+
</table>
|
|
2149
|
+
</div>
|
|
2150
|
+
|
|
2151
|
+
<div class="method_details ">
|
|
2152
|
+
<p class="signature " id="ids_for-instance_method">
|
|
2153
|
+
|
|
2154
|
+
- (<tt><span class='object_link'><a href="../../../Array.html" title="Array (class)">Array</a></span><Id></tt>) <strong>ids_for</strong>(criteria)
|
|
2155
|
+
|
|
2156
|
+
|
|
2157
|
+
|
|
2158
|
+
</p><div class="docstring">
|
|
2159
|
+
<div class="discussion">
|
|
2160
|
+
|
|
2161
|
+
<p>compute a list of ids matching the criteria</p>
|
|
2162
|
+
|
|
2163
|
+
|
|
2164
|
+
</div>
|
|
2165
|
+
</div>
|
|
2166
|
+
<div class="tags">
|
|
2167
|
+
<h3>Parameters:</h3>
|
|
2168
|
+
<ul class="param">
|
|
2169
|
+
|
|
2170
|
+
<li>
|
|
2171
|
+
|
|
2172
|
+
<span class='name'>criteria</span>
|
|
2173
|
+
|
|
2174
|
+
|
|
2175
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
2176
|
+
|
|
2177
|
+
|
|
2178
|
+
|
|
2179
|
+
—
|
|
2180
|
+
<div class='inline'>
|
|
2181
|
+
<p>list of attribute/value pais</p>
|
|
2182
|
+
</div>
|
|
2183
|
+
|
|
2184
|
+
</li>
|
|
2185
|
+
|
|
2186
|
+
</ul>
|
|
2187
|
+
|
|
2188
|
+
<h3>Returns:</h3>
|
|
2189
|
+
<ul class="return">
|
|
2190
|
+
|
|
2191
|
+
<li>
|
|
2192
|
+
|
|
2193
|
+
|
|
2194
|
+
<span class='type'>(<tt><span class='object_link'><a href="../../../Array.html" title="Array (class)">Array</a></span><Id></tt>)</span>
|
|
2195
|
+
|
|
2196
|
+
|
|
2197
|
+
|
|
2198
|
+
</li>
|
|
2199
|
+
|
|
2200
|
+
</ul>
|
|
2201
|
+
<h3>Raises:</h3>
|
|
2202
|
+
<ul class="raise">
|
|
2203
|
+
|
|
2204
|
+
<li>
|
|
2205
|
+
|
|
2206
|
+
|
|
2207
|
+
<span class='type'>(<tt>NotImplementedError</tt>)</span>
|
|
2208
|
+
|
|
2209
|
+
|
|
2210
|
+
|
|
2211
|
+
</li>
|
|
2212
|
+
|
|
2213
|
+
</ul>
|
|
2214
|
+
|
|
2215
|
+
</div><table class="source_code">
|
|
2216
|
+
<tr>
|
|
2217
|
+
<td>
|
|
2218
|
+
<pre class="lines">
|
|
2219
|
+
|
|
2220
|
+
|
|
2221
|
+
233
|
|
2222
|
+
234
|
|
2223
|
+
235</pre>
|
|
2224
|
+
</td>
|
|
2225
|
+
<td>
|
|
2226
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 233</span>
|
|
2227
|
+
|
|
2228
|
+
<span class='kw'>def</span> <span class='id ids_for'>ids_for</span><span class='lparen'>(</span><span class='id criteria'>criteria</span><span class='rparen'>)</span>
|
|
2229
|
+
<span class='id raise'>raise</span> <span class='const'>NotImplementedError</span>
|
|
2230
|
+
<span class='kw'>end</span></pre>
|
|
2231
|
+
</td>
|
|
2232
|
+
</tr>
|
|
2233
|
+
</table>
|
|
2234
|
+
</div>
|
|
2235
|
+
|
|
2236
|
+
<div class="method_details ">
|
|
2237
|
+
<p class="signature " id="invalid_resource?-instance_method">
|
|
2238
|
+
|
|
2239
|
+
- (<tt>Boolean</tt>) <strong>invalid_resource?</strong>(resource)
|
|
2240
|
+
|
|
2241
|
+
|
|
2242
|
+
|
|
2243
|
+
</p><div class="docstring">
|
|
2244
|
+
<div class="discussion">
|
|
2245
|
+
|
|
2246
|
+
<p>if a resource is invalid and need to be deleted. For example an association
|
|
2247
|
+
proxy corresponding to an old relation.</p>
|
|
2248
|
+
|
|
2249
|
+
|
|
2250
|
+
</div>
|
|
2251
|
+
</div>
|
|
2252
|
+
<div class="tags">
|
|
2253
|
+
|
|
2254
|
+
<h3>Returns:</h3>
|
|
2255
|
+
<ul class="return">
|
|
2256
|
+
|
|
2257
|
+
<li>
|
|
2258
|
+
|
|
2259
|
+
|
|
2260
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
2261
|
+
|
|
2262
|
+
|
|
2263
|
+
|
|
2264
|
+
</li>
|
|
2265
|
+
|
|
2266
|
+
</ul>
|
|
2267
|
+
|
|
2268
|
+
</div><table class="source_code">
|
|
2269
|
+
<tr>
|
|
2270
|
+
<td>
|
|
2271
|
+
<pre class="lines">
|
|
2272
|
+
|
|
2273
|
+
|
|
2274
|
+
397
|
|
2275
|
+
398
|
|
2276
|
+
399</pre>
|
|
2277
|
+
</td>
|
|
2278
|
+
<td>
|
|
2279
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 397</span>
|
|
2280
|
+
|
|
2281
|
+
<span class='kw'>def</span> <span class='id invalid_resource?'>invalid_resource?</span><span class='lparen'>(</span><span class='id resource'>resource</span><span class='rparen'>)</span>
|
|
2282
|
+
<span class='id resource'>resource</span><span class='period'>.</span><span class='id respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:invalid?</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id resource'>resource</span><span class='period'>.</span><span class='id invalid?'>invalid?</span>
|
|
2283
|
+
<span class='kw'>end</span></pre>
|
|
2284
|
+
</td>
|
|
2285
|
+
</tr>
|
|
2286
|
+
</table>
|
|
2287
|
+
</div>
|
|
2288
|
+
|
|
2289
|
+
<div class="method_details ">
|
|
2290
|
+
<p class="signature " id="load_children-instance_method">
|
|
2291
|
+
|
|
2292
|
+
- (<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt>) <strong>load_children</strong>(states, *params)
|
|
2293
|
+
|
|
2294
|
+
|
|
2295
|
+
|
|
2296
|
+
</p><table class="source_code">
|
|
2297
|
+
<tr>
|
|
2298
|
+
<td>
|
|
2299
|
+
<pre class="lines">
|
|
2300
|
+
|
|
2301
|
+
|
|
2302
|
+
430
|
|
2303
|
+
431
|
|
2304
|
+
432</pre>
|
|
2305
|
+
</td>
|
|
2306
|
+
<td>
|
|
2307
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 430</span>
|
|
2308
|
+
|
|
2309
|
+
<span class='kw'>def</span> <span class='id load_children'>load_children</span><span class='lparen'>(</span><span class='id states'>states</span><span class='comma'>,</span> <span class='op'>*</span><span class='id params'>params</span><span class='rparen'>)</span>
|
|
2310
|
+
<span class='lbracket'>[</span><span class='rbracket'>]</span>
|
|
2311
|
+
<span class='kw'>end</span></pre>
|
|
2312
|
+
</td>
|
|
2313
|
+
</tr>
|
|
2314
|
+
</table>
|
|
2315
|
+
</div>
|
|
2316
|
+
|
|
2317
|
+
<div class="method_details ">
|
|
2318
|
+
<p class="signature " id="model-instance_method">
|
|
2319
|
+
|
|
2320
|
+
- (<tt>Class</tt>) <strong>model</strong>
|
|
2321
|
+
|
|
2322
|
+
|
|
2323
|
+
|
|
2324
|
+
</p><div class="docstring">
|
|
2325
|
+
<div class="discussion">
|
|
2326
|
+
|
|
2327
|
+
<p>Associate class (without persistence).</p>
|
|
2328
|
+
|
|
2329
|
+
|
|
2330
|
+
</div>
|
|
2331
|
+
</div>
|
|
2332
|
+
<div class="tags">
|
|
2333
|
+
|
|
2334
|
+
<h3>Returns:</h3>
|
|
2335
|
+
<ul class="return">
|
|
2336
|
+
|
|
2337
|
+
<li>
|
|
2338
|
+
|
|
2339
|
+
|
|
2340
|
+
<span class='type'>(<tt>Class</tt>)</span>
|
|
2341
|
+
|
|
2342
|
+
|
|
2343
|
+
|
|
2344
|
+
</li>
|
|
2345
|
+
|
|
2346
|
+
</ul>
|
|
2347
|
+
|
|
2348
|
+
</div><table class="source_code">
|
|
2349
|
+
<tr>
|
|
2350
|
+
<td>
|
|
2351
|
+
<pre class="lines">
|
|
2352
|
+
|
|
2353
|
+
|
|
2354
|
+
101
|
|
2355
|
+
102
|
|
2356
|
+
103</pre>
|
|
2357
|
+
</td>
|
|
2358
|
+
<td>
|
|
2359
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 101</span>
|
|
2360
|
+
|
|
2361
|
+
<span class='kw'>def</span> <span class='id model'>model</span>
|
|
2362
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id class'>class</span><span class='op'>::</span><span class='const'>Model</span>
|
|
2363
|
+
<span class='kw'>end</span></pre>
|
|
2364
|
+
</td>
|
|
2365
|
+
</tr>
|
|
2366
|
+
</table>
|
|
2367
|
+
</div>
|
|
2368
|
+
|
|
2369
|
+
<div class="method_details ">
|
|
2370
|
+
<p class="signature " id="new_from_attributes-instance_method">
|
|
2371
|
+
|
|
2372
|
+
- (<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt>) <strong>new_from_attributes</strong>(attributes)
|
|
2373
|
+
|
|
2374
|
+
|
|
2375
|
+
|
|
2376
|
+
</p><table class="source_code">
|
|
2377
|
+
<tr>
|
|
2378
|
+
<td>
|
|
2379
|
+
<pre class="lines">
|
|
2380
|
+
|
|
2381
|
+
|
|
2382
|
+
435
|
|
2383
|
+
436
|
|
2384
|
+
437
|
|
2385
|
+
438
|
|
2386
|
+
439</pre>
|
|
2387
|
+
</td>
|
|
2388
|
+
<td>
|
|
2389
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 435</span>
|
|
2390
|
+
|
|
2391
|
+
<span class='kw'>def</span> <span class='id new_from_attributes'>new_from_attributes</span><span class='lparen'>(</span><span class='id attributes'>attributes</span><span class='rparen'>)</span>
|
|
2392
|
+
<span class='id id'>id</span> <span class='op'>=</span> <span class='id attributes'>attributes</span><span class='period'>.</span><span class='id delete'>delete</span><span class='lparen'>(</span><span class='id primary_key'>primary_key</span><span class='rparen'>)</span>
|
|
2393
|
+
<span class='id resource'>resource</span> <span class='op'>=</span> <span class='id block_given?'>block_given?</span> <span class='op'>?</span> <span class='kw'>yield</span><span class='lparen'>(</span><span class='id attributes'>attributes</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id model'>model</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id filter_attributes_on_load'>filter_attributes_on_load</span><span class='lparen'>(</span><span class='id attributes'>attributes</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
|
2394
|
+
<span class='id state_for_id'>state_for_id</span><span class='lparen'>(</span><span class='id id'>id</span><span class='rparen'>)</span><span class='period'>.</span><span class='id tap'>tap</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id state'>state</span><span class='op'>|</span> <span class='id state'>state</span><span class='period'>.</span><span class='id resource'>resource</span> <span class='op'>=</span> <span class='id resource'>resource</span> <span class='rbrace'>}</span>
|
|
2395
|
+
<span class='kw'>end</span></pre>
|
|
2396
|
+
</td>
|
|
2397
|
+
</tr>
|
|
2398
|
+
</table>
|
|
2399
|
+
</div>
|
|
2400
|
+
|
|
2401
|
+
<div class="method_details ">
|
|
2402
|
+
<p class="signature " id="new_object-instance_method">
|
|
2403
|
+
|
|
2404
|
+
- (<tt><span class='object_link'><a href="../Resource.html" title="Lims::Core::Resource (module)">Resource</a></span></tt>) <strong>new_object</strong>(id, attributes)
|
|
2405
|
+
|
|
2406
|
+
|
|
2407
|
+
|
|
2408
|
+
</p><div class="docstring">
|
|
2409
|
+
<div class="discussion">
|
|
2410
|
+
|
|
2411
|
+
<p>Creates a new object from a Hash and associate it to its id</p>
|
|
2412
|
+
|
|
2413
|
+
|
|
2414
|
+
</div>
|
|
2415
|
+
</div>
|
|
2416
|
+
<div class="tags">
|
|
2417
|
+
<h3>Parameters:</h3>
|
|
2418
|
+
<ul class="param">
|
|
2419
|
+
|
|
2420
|
+
<li>
|
|
2421
|
+
|
|
2422
|
+
<span class='name'>id</span>
|
|
2423
|
+
|
|
2424
|
+
|
|
2425
|
+
<span class='type'>(<tt>Id</tt>)</span>
|
|
2426
|
+
|
|
2427
|
+
|
|
2428
|
+
|
|
2429
|
+
—
|
|
2430
|
+
<div class='inline'>
|
|
2431
|
+
<p>id of the new object</p>
|
|
2432
|
+
</div>
|
|
2433
|
+
|
|
2434
|
+
</li>
|
|
2435
|
+
|
|
2436
|
+
<li>
|
|
2437
|
+
|
|
2438
|
+
<span class='name'>attributes</span>
|
|
2439
|
+
|
|
2440
|
+
|
|
2441
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
2442
|
+
|
|
2443
|
+
|
|
2444
|
+
|
|
2445
|
+
—
|
|
2446
|
+
<div class='inline'>
|
|
2447
|
+
<p>of the new object.</p>
|
|
2448
|
+
</div>
|
|
2449
|
+
|
|
2450
|
+
</li>
|
|
2451
|
+
|
|
2452
|
+
</ul>
|
|
2453
|
+
|
|
2454
|
+
<h3>Returns:</h3>
|
|
2455
|
+
<ul class="return">
|
|
2456
|
+
|
|
2457
|
+
<li>
|
|
2458
|
+
|
|
2459
|
+
|
|
2460
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Resource.html" title="Lims::Core::Resource (module)">Resource</a></span></tt>)</span>
|
|
2461
|
+
|
|
2462
|
+
|
|
2463
|
+
|
|
2464
|
+
</li>
|
|
2465
|
+
|
|
2466
|
+
</ul>
|
|
2467
|
+
|
|
2468
|
+
</div><table class="source_code">
|
|
2469
|
+
<tr>
|
|
2470
|
+
<td>
|
|
2471
|
+
<pre class="lines">
|
|
2472
|
+
|
|
2473
|
+
|
|
2474
|
+
182
|
|
2475
|
+
183
|
|
2476
|
+
184
|
|
2477
|
+
185
|
|
2478
|
+
186
|
|
2479
|
+
187
|
|
2480
|
+
188</pre>
|
|
2481
|
+
</td>
|
|
2482
|
+
<td>
|
|
2483
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 182</span>
|
|
2484
|
+
|
|
2485
|
+
<span class='kw'>def</span> <span class='id new_object'>new_object</span><span class='lparen'>(</span><span class='id id'>id</span><span class='comma'>,</span> <span class='id attributes'>attributes</span><span class='rparen'>)</span>
|
|
2486
|
+
<span class='id id'>id</span> <span class='op'>=</span> <span class='id attributes'>attributes</span><span class='period'>.</span><span class='id delete'>delete</span><span class='lparen'>(</span><span class='id primary_key'>primary_key</span><span class='rparen'>)</span>
|
|
2487
|
+
<span class='id model'>model</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id filter_attributes_on_load'>filter_attributes_on_load</span><span class='lparen'>(</span><span class='id attributes'>attributes</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id tap'>tap</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id resource'>resource</span><span class='op'>|</span>
|
|
2488
|
+
<span class='id state'>state</span> <span class='op'>=</span> <span class='id state_for_id'>state_for_id</span><span class='lparen'>(</span><span class='id id'>id</span><span class='rparen'>)</span>
|
|
2489
|
+
<span class='id state'>state</span><span class='period'>.</span><span class='id resource'>resource</span> <span class='op'>=</span> <span class='id resource'>resource</span>
|
|
2490
|
+
<span class='kw'>end</span>
|
|
2491
|
+
<span class='kw'>end</span></pre>
|
|
2492
|
+
</td>
|
|
2493
|
+
</tr>
|
|
2494
|
+
</table>
|
|
2495
|
+
</div>
|
|
2496
|
+
|
|
2497
|
+
<div class="method_details ">
|
|
2498
|
+
<p class="signature " id="object_for-instance_method">
|
|
2499
|
+
|
|
2500
|
+
- (<tt>Resourec</tt>, <tt>Nil</tt>) <strong>object_for</strong>(id)
|
|
2501
|
+
|
|
2502
|
+
|
|
2503
|
+
|
|
2504
|
+
</p><div class="docstring">
|
|
2505
|
+
<div class="discussion">
|
|
2506
|
+
|
|
2507
|
+
<p>Get the object from a given id.</p>
|
|
2508
|
+
|
|
2509
|
+
|
|
2510
|
+
</div>
|
|
2511
|
+
</div>
|
|
2512
|
+
<div class="tags">
|
|
2513
|
+
<h3>Parameters:</h3>
|
|
2514
|
+
<ul class="param">
|
|
2515
|
+
|
|
2516
|
+
<li>
|
|
2517
|
+
|
|
2518
|
+
<span class='name'>id</span>
|
|
2519
|
+
|
|
2520
|
+
|
|
2521
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
|
2522
|
+
|
|
2523
|
+
|
|
2524
|
+
|
|
2525
|
+
</li>
|
|
2526
|
+
|
|
2527
|
+
</ul>
|
|
2528
|
+
|
|
2529
|
+
<h3>Returns:</h3>
|
|
2530
|
+
<ul class="return">
|
|
2531
|
+
|
|
2532
|
+
<li>
|
|
2533
|
+
|
|
2534
|
+
|
|
2535
|
+
<span class='type'>(<tt>Resourec</tt>, <tt>Nil</tt>)</span>
|
|
2536
|
+
|
|
2537
|
+
|
|
2538
|
+
|
|
2539
|
+
</li>
|
|
2540
|
+
|
|
2541
|
+
</ul>
|
|
2542
|
+
|
|
2543
|
+
</div><table class="source_code">
|
|
2544
|
+
<tr>
|
|
2545
|
+
<td>
|
|
2546
|
+
<pre class="lines">
|
|
2547
|
+
|
|
2548
|
+
|
|
2549
|
+
132
|
|
2550
|
+
133
|
|
2551
|
+
134</pre>
|
|
2552
|
+
</td>
|
|
2553
|
+
<td>
|
|
2554
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 132</span>
|
|
2555
|
+
|
|
2556
|
+
<span class='kw'>def</span> <span class='id object_for'>object_for</span><span class='lparen'>(</span><span class='id id'>id</span><span class='rparen'>)</span>
|
|
2557
|
+
<span class='ivar'>@id_to_state</span><span class='lbracket'>[</span><span class='id id'>id</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id andtap'>andtap</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:resource</span><span class='rparen'>)</span>
|
|
2558
|
+
<span class='kw'>end</span></pre>
|
|
2559
|
+
</td>
|
|
2560
|
+
</tr>
|
|
2561
|
+
</table>
|
|
2562
|
+
</div>
|
|
2563
|
+
|
|
2564
|
+
<div class="method_details ">
|
|
2565
|
+
<p class="signature " id="on_object_load-instance_method">
|
|
2566
|
+
|
|
2567
|
+
- (<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt>) <strong>on_object_load</strong>(state)
|
|
2568
|
+
|
|
2569
|
+
|
|
2570
|
+
|
|
2571
|
+
</p><div class="docstring">
|
|
2572
|
+
<div class="discussion">
|
|
2573
|
+
|
|
2574
|
+
<p>Called by Persistor to inform the session about the loading of an object.
|
|
2575
|
+
MUST be called by persistors creating Resources.</p>
|
|
2576
|
+
|
|
2577
|
+
|
|
2578
|
+
</div>
|
|
2579
|
+
</div>
|
|
2580
|
+
<div class="tags">
|
|
2581
|
+
<h3>Parameters:</h3>
|
|
2582
|
+
<ul class="param">
|
|
2583
|
+
|
|
2584
|
+
<li>
|
|
2585
|
+
|
|
2586
|
+
<span class='name'></span>
|
|
2587
|
+
|
|
2588
|
+
|
|
2589
|
+
<span class='type'>(<tt><span class='object_link'><a href="ResourceState.html" title="Lims::Core::Persistence::ResourceState (class)">ResourceState</a></span></tt>)</span>
|
|
2590
|
+
|
|
2591
|
+
|
|
2592
|
+
|
|
2593
|
+
</li>
|
|
2594
|
+
|
|
2595
|
+
</ul>
|
|
2596
|
+
|
|
2597
|
+
|
|
2598
|
+
</div><table class="source_code">
|
|
2599
|
+
<tr>
|
|
2600
|
+
<td>
|
|
2601
|
+
<pre class="lines">
|
|
2602
|
+
|
|
2603
|
+
|
|
2604
|
+
167
|
|
2605
|
+
168
|
|
2606
|
+
169</pre>
|
|
2607
|
+
</td>
|
|
2608
|
+
<td>
|
|
2609
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 167</span>
|
|
2610
|
+
|
|
2611
|
+
<span class='kw'>def</span> <span class='id on_object_load'>on_object_load</span><span class='lparen'>(</span><span class='id state'>state</span><span class='rparen'>)</span>
|
|
2612
|
+
<span class='ivar'>@session</span><span class='period'>.</span><span class='id manage_state'>manage_state</span><span class='lparen'>(</span><span class='id state'>state</span><span class='rparen'>)</span>
|
|
2613
|
+
<span class='kw'>end</span></pre>
|
|
2614
|
+
</td>
|
|
2615
|
+
</tr>
|
|
2616
|
+
</table>
|
|
2617
|
+
</div>
|
|
2618
|
+
|
|
2619
|
+
<div class="method_details ">
|
|
2620
|
+
<p class="signature " id="parents-instance_method">
|
|
2621
|
+
|
|
2622
|
+
- (<tt><span class='object_link'><a href="../../../Array.html" title="Array (class)">Array</a></span><<span class='object_link'><a href="../Resource.html" title="Lims::Core::Resource (module)">Resource</a></span>></tt>) <strong>parents</strong>(resource)
|
|
2623
|
+
|
|
2624
|
+
|
|
2625
|
+
|
|
2626
|
+
</p><div class="docstring">
|
|
2627
|
+
<div class="discussion">
|
|
2628
|
+
|
|
2629
|
+
<p>List of parents of object, i.e. object which need to be saved BEFORE it.
|
|
2630
|
+
Default implementation get all Resource attributes.</p>
|
|
2631
|
+
|
|
2632
|
+
|
|
2633
|
+
</div>
|
|
2634
|
+
</div>
|
|
2635
|
+
<div class="tags">
|
|
2636
|
+
<h3>Parameters:</h3>
|
|
2637
|
+
<ul class="param">
|
|
2638
|
+
|
|
2639
|
+
<li>
|
|
2640
|
+
|
|
2641
|
+
<span class='name'>resource</span>
|
|
2642
|
+
|
|
2643
|
+
|
|
2644
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Resource.html" title="Lims::Core::Resource (module)">Resource</a></span></tt>)</span>
|
|
2645
|
+
|
|
2646
|
+
|
|
2647
|
+
|
|
2648
|
+
</li>
|
|
2649
|
+
|
|
2650
|
+
</ul>
|
|
2651
|
+
|
|
2652
|
+
<h3>Returns:</h3>
|
|
2653
|
+
<ul class="return">
|
|
2654
|
+
|
|
2655
|
+
<li>
|
|
2656
|
+
|
|
2657
|
+
|
|
2658
|
+
<span class='type'>(<tt><span class='object_link'><a href="../../../Array.html" title="Array (class)">Array</a></span><<span class='object_link'><a href="../Resource.html" title="Lims::Core::Resource (module)">Resource</a></span>></tt>)</span>
|
|
2659
|
+
|
|
2660
|
+
|
|
2661
|
+
|
|
2662
|
+
</li>
|
|
2663
|
+
|
|
2664
|
+
</ul>
|
|
2665
|
+
|
|
2666
|
+
</div><table class="source_code">
|
|
2667
|
+
<tr>
|
|
2668
|
+
<td>
|
|
2669
|
+
<pre class="lines">
|
|
2670
|
+
|
|
2671
|
+
|
|
2672
|
+
374
|
|
2673
|
+
375
|
|
2674
|
+
376</pre>
|
|
2675
|
+
</td>
|
|
2676
|
+
<td>
|
|
2677
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 374</span>
|
|
2678
|
+
|
|
2679
|
+
<span class='kw'>def</span> <span class='id parents'>parents</span><span class='lparen'>(</span><span class='id resource'>resource</span><span class='rparen'>)</span>
|
|
2680
|
+
<span class='id resource'>resource</span><span class='period'>.</span><span class='id attributes'>attributes</span><span class='period'>.</span><span class='id values'>values</span><span class='period'>.</span><span class='id select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id v'>v</span><span class='op'>|</span> <span class='id v'>v</span><span class='period'>.</span><span class='id is_a?'>is_a?</span> <span class='const'>Resource</span> <span class='rbrace'>}</span>
|
|
2681
|
+
<span class='kw'>end</span></pre>
|
|
2682
|
+
</td>
|
|
2683
|
+
</tr>
|
|
2684
|
+
</table>
|
|
2685
|
+
</div>
|
|
2686
|
+
|
|
2687
|
+
<div class="method_details ">
|
|
2688
|
+
<p class="signature " id="parents_for_attributes-instance_method">
|
|
2689
|
+
|
|
2690
|
+
- (<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt>) <strong>parents_for_attributes</strong>(attributes)
|
|
2691
|
+
|
|
2692
|
+
|
|
2693
|
+
|
|
2694
|
+
</p><table class="source_code">
|
|
2695
|
+
<tr>
|
|
2696
|
+
<td>
|
|
2697
|
+
<pre class="lines">
|
|
2698
|
+
|
|
2699
|
+
|
|
2700
|
+
425
|
|
2701
|
+
426
|
|
2702
|
+
427</pre>
|
|
2703
|
+
</td>
|
|
2704
|
+
<td>
|
|
2705
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 425</span>
|
|
2706
|
+
|
|
2707
|
+
<span class='kw'>def</span> <span class='id parents_for_attributes'>parents_for_attributes</span><span class='lparen'>(</span><span class='id attributes'>attributes</span><span class='rparen'>)</span>
|
|
2708
|
+
<span class='lbracket'>[</span><span class='rbracket'>]</span>
|
|
2709
|
+
<span class='kw'>end</span></pre>
|
|
2710
|
+
</td>
|
|
2711
|
+
</tr>
|
|
2712
|
+
</table>
|
|
2713
|
+
</div>
|
|
2714
|
+
|
|
2715
|
+
<div class="method_details ">
|
|
2716
|
+
<p class="signature " id="purge_invalid_object-instance_method">
|
|
2717
|
+
|
|
2718
|
+
- (<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt>) <strong>purge_invalid_object</strong>
|
|
2719
|
+
|
|
2720
|
+
|
|
2721
|
+
|
|
2722
|
+
</p><div class="docstring">
|
|
2723
|
+
<div class="discussion">
|
|
2724
|
+
|
|
2725
|
+
<p>Delete all invalid object loaded by a persistor. Typically invalid object
|
|
2726
|
+
are association which doesn't exist anymore</p>
|
|
2727
|
+
|
|
2728
|
+
|
|
2729
|
+
</div>
|
|
2730
|
+
</div>
|
|
2731
|
+
<div class="tags">
|
|
2732
|
+
|
|
2733
|
+
|
|
2734
|
+
</div><table class="source_code">
|
|
2735
|
+
<tr>
|
|
2736
|
+
<td>
|
|
2737
|
+
<pre class="lines">
|
|
2738
|
+
|
|
2739
|
+
|
|
2740
|
+
203
|
|
2741
|
+
204
|
|
2742
|
+
205
|
|
2743
|
+
206
|
|
2744
|
+
207
|
|
2745
|
+
208
|
|
2746
|
+
209
|
|
2747
|
+
210</pre>
|
|
2748
|
+
</td>
|
|
2749
|
+
<td>
|
|
2750
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 203</span>
|
|
2751
|
+
|
|
2752
|
+
<span class='kw'>def</span> <span class='id purge_invalid_object'>purge_invalid_object</span>
|
|
2753
|
+
<span class='id to_delete'>to_delete</span> <span class='op'>=</span> <span class='const'>StateGroup</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
|
2754
|
+
<span class='ivar'>@object_to_state</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id object'>object</span><span class='comma'>,</span> <span class='id state'>state</span><span class='op'>|</span>
|
|
2755
|
+
<span class='id to_delete'>to_delete</span> <span class='op'><<</span> <span class='id state'>state</span> <span class='kw'>if</span> <span class='id invalid_resource?'>invalid_resource?</span><span class='lparen'>(</span><span class='id object'>object</span><span class='rparen'>)</span>
|
|
2756
|
+
<span class='kw'>end</span>
|
|
2757
|
+
|
|
2758
|
+
<span class='id to_delete'>to_delete</span><span class='period'>.</span><span class='id destroy'>destroy</span>
|
|
2759
|
+
<span class='kw'>end</span></pre>
|
|
2760
|
+
</td>
|
|
2761
|
+
</tr>
|
|
2762
|
+
</table>
|
|
2763
|
+
</div>
|
|
2764
|
+
|
|
2765
|
+
<div class="method_details ">
|
|
2766
|
+
<p class="signature " id="retrieve-instance_method">
|
|
2767
|
+
|
|
2768
|
+
- (<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt><sup>?</sup>) <strong>retrieve</strong>(id, *params)
|
|
2769
|
+
|
|
2770
|
+
|
|
2771
|
+
|
|
2772
|
+
</p><div class="docstring">
|
|
2773
|
+
<div class="discussion">
|
|
2774
|
+
|
|
2775
|
+
<p>Retrieves an object from it's id. Doesn't load it if it's been alreday
|
|
2776
|
+
loaded.</p>
|
|
2777
|
+
|
|
2778
|
+
|
|
2779
|
+
</div>
|
|
2780
|
+
</div>
|
|
2781
|
+
<div class="tags">
|
|
2782
|
+
<h3>Parameters:</h3>
|
|
2783
|
+
<ul class="param">
|
|
2784
|
+
|
|
2785
|
+
<li>
|
|
2786
|
+
|
|
2787
|
+
<span class='name'>id</span>
|
|
2788
|
+
|
|
2789
|
+
|
|
2790
|
+
<span class='type'>(<tt>Id</tt>)</span>
|
|
2791
|
+
|
|
2792
|
+
|
|
2793
|
+
|
|
2794
|
+
</li>
|
|
2795
|
+
|
|
2796
|
+
</ul>
|
|
2797
|
+
|
|
2798
|
+
<h3>Returns:</h3>
|
|
2799
|
+
<ul class="return">
|
|
2800
|
+
|
|
2801
|
+
<li>
|
|
2802
|
+
|
|
2803
|
+
|
|
2804
|
+
<span class='type'>(<tt><span class='object_link'><a href="../../../Object.html" title="Object (class)">Object</a></span></tt>, <tt>nil</tt>)</span>
|
|
2805
|
+
|
|
2806
|
+
|
|
2807
|
+
|
|
2808
|
+
</li>
|
|
2809
|
+
|
|
2810
|
+
</ul>
|
|
2811
|
+
|
|
2812
|
+
</div><table class="source_code">
|
|
2813
|
+
<tr>
|
|
2814
|
+
<td>
|
|
2815
|
+
<pre class="lines">
|
|
2816
|
+
|
|
2817
|
+
|
|
2818
|
+
314
|
|
2819
|
+
315
|
|
2820
|
+
316
|
|
2821
|
+
317
|
|
2822
|
+
318
|
|
2823
|
+
319</pre>
|
|
2824
|
+
</td>
|
|
2825
|
+
<td>
|
|
2826
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 314</span>
|
|
2827
|
+
|
|
2828
|
+
<span class='kw'>def</span> <span class='id retrieve'>retrieve</span><span class='lparen'>(</span><span class='id id'>id</span><span class='comma'>,</span> <span class='op'>*</span><span class='id params'>params</span><span class='rparen'>)</span>
|
|
2829
|
+
<span class='id object_for'>object_for</span><span class='lparen'>(</span><span class='id id'>id</span><span class='rparen'>)</span><span class='period'>.</span><span class='id andtap'>andtap</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id o'>o</span><span class='op'>|</span> <span class='kw'>return</span> <span class='id o'>o</span> <span class='rbrace'>}</span>
|
|
2830
|
+
<span class='id objects'>objects</span> <span class='op'>=</span> <span class='id bulk_retrieve'>bulk_retrieve</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='id id'>id</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='op'>*</span><span class='id params'>params</span><span class='rparen'>)</span>
|
|
2831
|
+
<span class='kw'>return</span> <span class='id objects'>objects</span><span class='period'>.</span><span class='id first'>first</span> <span class='kw'>if</span> <span class='id objects'>objects</span> <span class='op'>&&</span> <span class='id objects'>objects</span><span class='period'>.</span><span class='id size'>size</span> <span class='op'>==</span> <span class='int'>1</span>
|
|
2832
|
+
|
|
2833
|
+
<span class='kw'>end</span></pre>
|
|
2834
|
+
</td>
|
|
2835
|
+
</tr>
|
|
2836
|
+
</table>
|
|
2837
|
+
</div>
|
|
2838
|
+
|
|
2839
|
+
<div class="method_details ">
|
|
2840
|
+
<p class="signature " id="slice-instance_method">
|
|
2841
|
+
|
|
2842
|
+
- (<tt>Enumerable<Hash></tt>) <strong>slice</strong>(start, length)
|
|
2843
|
+
|
|
2844
|
+
|
|
2845
|
+
|
|
2846
|
+
</p><div class="docstring">
|
|
2847
|
+
<div class="discussion">
|
|
2848
|
+
|
|
2849
|
+
<p>Get a slice of object by offset, length. <tt>start</tt> here is an offset
|
|
2850
|
+
(starting at 0) not an Id.</p>
|
|
2851
|
+
|
|
2852
|
+
|
|
2853
|
+
</div>
|
|
2854
|
+
</div>
|
|
2855
|
+
<div class="tags">
|
|
2856
|
+
<h3>Parameters:</h3>
|
|
2857
|
+
<ul class="param">
|
|
2858
|
+
|
|
2859
|
+
<li>
|
|
2860
|
+
|
|
2861
|
+
<span class='name'>start</span>
|
|
2862
|
+
|
|
2863
|
+
|
|
2864
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
|
2865
|
+
|
|
2866
|
+
|
|
2867
|
+
|
|
2868
|
+
—
|
|
2869
|
+
<div class='inline'>
|
|
2870
|
+
<p>(0 based)</p>
|
|
2871
|
+
</div>
|
|
2872
|
+
|
|
2873
|
+
</li>
|
|
2874
|
+
|
|
2875
|
+
<li>
|
|
2876
|
+
|
|
2877
|
+
<span class='name'>length</span>
|
|
2878
|
+
|
|
2879
|
+
|
|
2880
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
|
2881
|
+
|
|
2882
|
+
|
|
2883
|
+
|
|
2884
|
+
</li>
|
|
2885
|
+
|
|
2886
|
+
</ul>
|
|
2887
|
+
|
|
2888
|
+
<h3>Returns:</h3>
|
|
2889
|
+
<ul class="return">
|
|
2890
|
+
|
|
2891
|
+
<li>
|
|
2892
|
+
|
|
2893
|
+
|
|
2894
|
+
<span class='type'>(<tt>Enumerable<Hash></tt>)</span>
|
|
2895
|
+
|
|
2896
|
+
|
|
2897
|
+
|
|
2898
|
+
</li>
|
|
2899
|
+
|
|
2900
|
+
</ul>
|
|
2901
|
+
|
|
2902
|
+
</div><table class="source_code">
|
|
2903
|
+
<tr>
|
|
2904
|
+
<td>
|
|
2905
|
+
<pre class="lines">
|
|
2906
|
+
|
|
2907
|
+
|
|
2908
|
+
260
|
|
2909
|
+
261
|
|
2910
|
+
262
|
|
2911
|
+
263
|
|
2912
|
+
264
|
|
2913
|
+
265
|
|
2914
|
+
266</pre>
|
|
2915
|
+
</td>
|
|
2916
|
+
<td>
|
|
2917
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 260</span>
|
|
2918
|
+
|
|
2919
|
+
<span class='kw'>def</span> <span class='id slice'>slice</span><span class='lparen'>(</span><span class='id start'>start</span><span class='comma'>,</span> <span class='id length'>length</span><span class='rparen'>)</span>
|
|
2920
|
+
<span class='id to_load'>to_load</span> <span class='op'>=</span> <span class='const'>StateGroup</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
|
2921
|
+
<span class='id for_each_in_slice'>for_each_in_slice</span><span class='lparen'>(</span><span class='id start'>start</span><span class='comma'>,</span> <span class='id length'>length</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id att'>att</span><span class='op'>|</span>
|
|
2922
|
+
<span class='id to_load'>to_load</span> <span class='op'><<</span> <span class='id new_from_attributes'>new_from_attributes</span><span class='lparen'>(</span><span class='id att'>att</span><span class='rparen'>)</span>
|
|
2923
|
+
<span class='kw'>end</span>
|
|
2924
|
+
<span class='id to_load'>to_load</span><span class='period'>.</span><span class='id load'>load</span><span class='period'>.</span><span class='id map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:resource</span><span class='rparen'>)</span>
|
|
2925
|
+
<span class='kw'>end</span></pre>
|
|
2926
|
+
</td>
|
|
2927
|
+
</tr>
|
|
2928
|
+
</table>
|
|
2929
|
+
</div>
|
|
2930
|
+
|
|
2931
|
+
<div class="method_details ">
|
|
2932
|
+
<p class="signature " id="state_for-instance_method">
|
|
2933
|
+
|
|
2934
|
+
- (<tt><span class='object_link'><a href="ResourceState.html" title="Lims::Core::Persistence::ResourceState (class)">ResourceState</a></span></tt>) <strong>state_for</strong>(object)
|
|
2935
|
+
|
|
2936
|
+
|
|
2937
|
+
|
|
2938
|
+
</p><div class="docstring">
|
|
2939
|
+
<div class="discussion">
|
|
2940
|
+
|
|
2941
|
+
<p>Returns the state proxy of an object. Creates it if needed.</p>
|
|
2942
|
+
|
|
2943
|
+
|
|
2944
|
+
</div>
|
|
2945
|
+
</div>
|
|
2946
|
+
<div class="tags">
|
|
2947
|
+
<h3>Parameters:</h3>
|
|
2948
|
+
<ul class="param">
|
|
2949
|
+
|
|
2950
|
+
<li>
|
|
2951
|
+
|
|
2952
|
+
<span class='name'>object</span>
|
|
2953
|
+
|
|
2954
|
+
|
|
2955
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Resource.html" title="Lims::Core::Resource (module)">Resource</a></span></tt>)</span>
|
|
2956
|
+
|
|
2957
|
+
|
|
2958
|
+
|
|
2959
|
+
</li>
|
|
2960
|
+
|
|
2961
|
+
</ul>
|
|
2962
|
+
|
|
2963
|
+
<h3>Returns:</h3>
|
|
2964
|
+
<ul class="return">
|
|
2965
|
+
|
|
2966
|
+
<li>
|
|
2967
|
+
|
|
2968
|
+
|
|
2969
|
+
<span class='type'>(<tt><span class='object_link'><a href="ResourceState.html" title="Lims::Core::Persistence::ResourceState (class)">ResourceState</a></span></tt>)</span>
|
|
2970
|
+
|
|
2971
|
+
|
|
2972
|
+
|
|
2973
|
+
</li>
|
|
2974
|
+
|
|
2975
|
+
</ul>
|
|
2976
|
+
|
|
2977
|
+
</div><table class="source_code">
|
|
2978
|
+
<tr>
|
|
2979
|
+
<td>
|
|
2980
|
+
<pre class="lines">
|
|
2981
|
+
|
|
2982
|
+
|
|
2983
|
+
141
|
|
2984
|
+
142
|
|
2985
|
+
143</pre>
|
|
2986
|
+
</td>
|
|
2987
|
+
<td>
|
|
2988
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 141</span>
|
|
2989
|
+
|
|
2990
|
+
<span class='kw'>def</span> <span class='id state_for'>state_for</span><span class='lparen'>(</span><span class='id object'>object</span><span class='rparen'>)</span>
|
|
2991
|
+
<span class='ivar'>@object_to_state</span><span class='lbracket'>[</span><span class='id object'>object</span><span class='rbracket'>]</span>
|
|
2992
|
+
<span class='kw'>end</span></pre>
|
|
2993
|
+
</td>
|
|
2994
|
+
</tr>
|
|
2995
|
+
</table>
|
|
2996
|
+
</div>
|
|
2997
|
+
|
|
2998
|
+
<div class="method_details ">
|
|
2999
|
+
<p class="signature " id="state_for_id-instance_method">
|
|
3000
|
+
|
|
3001
|
+
- (<tt><span class='object_link'><a href="ResourceState.html" title="Lims::Core::Persistence::ResourceState (class)">ResourceState</a></span></tt>) <strong>state_for_id</strong>(id)
|
|
3002
|
+
|
|
3003
|
+
|
|
3004
|
+
|
|
3005
|
+
</p><div class="docstring">
|
|
3006
|
+
<div class="discussion">
|
|
3007
|
+
|
|
3008
|
+
<p>Returns the state proxy of an object fromt its id (in cache). Creates the
|
|
3009
|
+
state if needed.</p>
|
|
3010
|
+
|
|
3011
|
+
|
|
3012
|
+
</div>
|
|
3013
|
+
</div>
|
|
3014
|
+
<div class="tags">
|
|
3015
|
+
<h3>Parameters:</h3>
|
|
3016
|
+
<ul class="param">
|
|
3017
|
+
|
|
3018
|
+
<li>
|
|
3019
|
+
|
|
3020
|
+
<span class='name'>object</span>
|
|
3021
|
+
|
|
3022
|
+
|
|
3023
|
+
<span class='type'>(<tt>Id</tt>)</span>
|
|
3024
|
+
|
|
3025
|
+
|
|
3026
|
+
|
|
3027
|
+
</li>
|
|
3028
|
+
|
|
3029
|
+
</ul>
|
|
3030
|
+
|
|
3031
|
+
<h3>Returns:</h3>
|
|
3032
|
+
<ul class="return">
|
|
3033
|
+
|
|
3034
|
+
<li>
|
|
3035
|
+
|
|
3036
|
+
|
|
3037
|
+
<span class='type'>(<tt><span class='object_link'><a href="ResourceState.html" title="Lims::Core::Persistence::ResourceState (class)">ResourceState</a></span></tt>)</span>
|
|
3038
|
+
|
|
3039
|
+
|
|
3040
|
+
|
|
3041
|
+
</li>
|
|
3042
|
+
|
|
3043
|
+
</ul>
|
|
3044
|
+
|
|
3045
|
+
</div><table class="source_code">
|
|
3046
|
+
<tr>
|
|
3047
|
+
<td>
|
|
3048
|
+
<pre class="lines">
|
|
3049
|
+
|
|
3050
|
+
|
|
3051
|
+
149
|
|
3052
|
+
150
|
|
3053
|
+
151</pre>
|
|
3054
|
+
</td>
|
|
3055
|
+
<td>
|
|
3056
|
+
<pre class="code"><span class="info file"># File 'lib/lims-core/persistence/persistor.rb', line 149</span>
|
|
3057
|
+
|
|
3058
|
+
<span class='kw'>def</span> <span class='id state_for_id'>state_for_id</span><span class='lparen'>(</span><span class='id id'>id</span><span class='rparen'>)</span>
|
|
3059
|
+
<span class='ivar'>@id_to_state</span><span class='lbracket'>[</span><span class='id id'>id</span><span class='rbracket'>]</span>
|
|
3060
|
+
<span class='kw'>end</span></pre>
|
|
3061
|
+
</td>
|
|
3062
|
+
</tr>
|
|
3063
|
+
</table>
|
|
3064
|
+
</div>
|
|
3065
|
+
|
|
3066
|
+
</div>
|
|
3067
|
+
|
|
3068
|
+
</div>
|
|
3069
|
+
|
|
3070
|
+
|
|
3071
|
+
</body>
|
|
3072
|
+
</html>
|