1 | jsx3.util.Logger.getLogger("org.isocat").info("Loading class[org.isocat.data.Shared]"); |
---|
2 | |
---|
3 | /** |
---|
4 | * The Shared class |
---|
5 | * @author Menzo.Windhouwer@mpi.nl |
---|
6 | */ |
---|
7 | jsx3.lang.Class.defineClass("org.isocat.data.Shared", org.isocat.data.DCS, [], function(Shared, Shared_prototype) { |
---|
8 | |
---|
9 | /** |
---|
10 | * The class logger |
---|
11 | */ |
---|
12 | Shared.log = jsx3.util.Logger.getLogger("org.isocat.data.Shared"); |
---|
13 | |
---|
14 | /** |
---|
15 | * The Shared key |
---|
16 | */ |
---|
17 | Shared_prototype._key; |
---|
18 | |
---|
19 | /** |
---|
20 | * The user who has access to these shared DCs |
---|
21 | */ |
---|
22 | Shared_prototype._user; |
---|
23 | |
---|
24 | /** |
---|
25 | * The Shared meta CDF record |
---|
26 | */ |
---|
27 | Shared_prototype._meta; |
---|
28 | |
---|
29 | /** |
---|
30 | * The Shared data CDF record list |
---|
31 | */ |
---|
32 | Shared_prototype._data; |
---|
33 | |
---|
34 | /** |
---|
35 | * Constructor |
---|
36 | */ |
---|
37 | Shared_prototype.init = function(user) { |
---|
38 | org.isocat.data.Shared.log.info("initialize Shared["+this+"]"); |
---|
39 | |
---|
40 | this._key = jsx3.xml.CDF.getKey(); |
---|
41 | org.isocat.data.Shared.log.info("- key["+this._key+"]"); |
---|
42 | |
---|
43 | this._user = user; |
---|
44 | org.isocat.data.Shared.log.info("- user["+this._user+"]"); |
---|
45 | |
---|
46 | this._meta = null; |
---|
47 | org.isocat.data.Shared.log.info("- metadata["+this._meta+"]"); |
---|
48 | |
---|
49 | this._data = null; |
---|
50 | org.isocat.data.Shared.log.info("- data["+this._data+"]"); |
---|
51 | |
---|
52 | org.isocat.data.Shared.log.info("initialized Shared["+this+"]"); |
---|
53 | |
---|
54 | // create message |
---|
55 | var message = { |
---|
56 | jss: "org.pagebus.msg.Message", |
---|
57 | jssv: "1.0.0", |
---|
58 | header: { }, |
---|
59 | body: this |
---|
60 | }; |
---|
61 | |
---|
62 | // publish the message using PageBus |
---|
63 | window.PageBus.publish("org.isocat.data.Shared.init", message); |
---|
64 | }; |
---|
65 | |
---|
66 | Shared_prototype.meta = function() { |
---|
67 | return this._meta; |
---|
68 | } |
---|
69 | |
---|
70 | Shared_prototype.type = function() { |
---|
71 | return "Shared"; |
---|
72 | } |
---|
73 | |
---|
74 | Shared_prototype.key = function() { |
---|
75 | return this._key; |
---|
76 | } |
---|
77 | |
---|
78 | Shared_prototype.id = function() { |
---|
79 | return "id:" + this.type() + "-" + this.key(); |
---|
80 | } |
---|
81 | |
---|
82 | Shared_prototype.name = function() { |
---|
83 | if (this._user == org.isocat.profile.user()) { |
---|
84 | return "Shared Data Categories"; |
---|
85 | } else { |
---|
86 | return "Shared Data Categories of '"+this._user+"'"; |
---|
87 | } |
---|
88 | } |
---|
89 | |
---|
90 | Shared_prototype.mode = function() { |
---|
91 | return "r"; |
---|
92 | } |
---|
93 | |
---|
94 | Shared_prototype.editable = function() { |
---|
95 | return false; |
---|
96 | } |
---|
97 | |
---|
98 | Shared_prototype.persistent = function() { |
---|
99 | return true; |
---|
100 | } |
---|
101 | |
---|
102 | Shared_prototype.cacheId = function() { |
---|
103 | return this.type() + "-" + this.key(); |
---|
104 | } |
---|
105 | |
---|
106 | Shared_prototype.uri = function(format) { |
---|
107 | return "http://localhost:8080/isocat/rest/user/"+this._user+"/shared"+format; |
---|
108 | } |
---|
109 | |
---|
110 | }); |
---|