This repository has been archived by the owner on Jan 23, 2021. It is now read-only.
forked from hyperledger-archives/composer
-
Notifications
You must be signed in to change notification settings - Fork 29
/
org.hyperledger.composer.system.cto
315 lines (280 loc) · 9.17 KB
/
org.hyperledger.composer.system.cto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace org.hyperledger.composer.system
/**
* Abstract system asset that all assets extend.
* Has no properties, and is soley used as a basis to model other assets.
*/
@docs('asset.md')
abstract asset Asset { }
/**
* Abstract system participant that all participants extend.
* Has no properties, and is soley used as a basis to model other assets.
*/
@docs('participant.md')
abstract participant Participant { }
/**
* Abstract transaction that all transactions, including system ones, extend.
*
* Has two properties that are used set and are accessible in all transactions.
*
*
* @param {String} transactionId Identifier for this transaction
* @param {DateTime} timestamp Timestamp for this transaction
*/
@docs('transaction.md')
abstract transaction Transaction identified by transactionId {
o String transactionId
o DateTime timestamp
}
/**
* Abstract event that all events, including system ones, extend.
*
* Has two properties that are used set and are accessible in all transactions.
*
* @param {String} eventId Identifier for this event
* @param {DateTime} timestamp Timestamp for this event
*/
@docs('event.md')
abstract event Event identified by eventId {
o String eventId
o DateTime timestamp
}
/**
* Abstract Registry asset, that is used as the basis for all types of registries.
*
* @param {String} registryId identity
* @param {String} name Name of the registry
* @param {String} type type of the registry
* @param {Boolean} system Is this a system registry?
*/
@docs('registry.md')
abstract asset Registry identified by registryId {
o String registryId
o String name
o String type
o Boolean system
}
/**
* AssetRegistry extends the Registry to define the type that of all registries
* that are primarily intended for storing Assets.
*
*/
@docs('assetRegistry.md')
asset AssetRegistry extends Registry { }
/**
* ParticipantRegistry extends the Registry to define the type that of all registries
* that are primarily intended for storing Participants
*/
@docs('participantRegistry.md')
asset ParticipantRegistry extends Registry { }
/**
* TransactionRegistry extends the Registry to define the type that of all registries
* that are primarily intended for storing Transactions
*/
@docs('transactionRegistry.md')
asset TransactionRegistry extends Registry { }
/**
* Asset to represent the idea of a Business Network.
* All actions will require participants to have access to this Asset. Failure to have at least *READ* access
* will mean that participants are unable to access the network.
*
* Participants who are authorized administrators, can be granted *UPDATE* and/or *DELETE* permissions
* @param {String} networkId of the business network
*/
@docs('network.md')
asset Network identified by networkId {
o String networkId
o String runtimeVersion
}
/**
* A predefined participant that can be given the authority to adiminister the Business Network
*
* @param {String} participantId Identifier fields of the participant
*/
@docs('networkAdmin.md')
participant NetworkAdmin identified by participantId {
o String participantId
}
// -----------------------------------------------------------------------------
// Historian
/**
* Asset to represent each historian registry entry
*
* @param {String} transactionId Using the transaction id as the uuid
* @param {Transaction} transactionInvoked Relationship to transaction
* @param {Participant} participantInvoking Participant who invoked this transaction
* @param {Identity} identityUsed The identity that was used by the participant
* @param {Event[]} eventsEmitted The events that were emitted by this transactionId
* @param {DateTime} transactionTimestamp Use the transaction's timestamp
*/
@docs('historian.md')
@docsuri('Composer Documentation','../business-network/historian')
asset HistorianRecord identified by transactionId {
o String transactionId
o String transactionType
--> Transaction transactionInvoked
--> Participant participantInvoking optional
--> Identity identityUsed optional
o Event[] eventsEmitted optional
o DateTime transactionTimestamp
}
// -----------------------------------------------------------------------------
// System transactions that act on Registries of any type
/**
* An abstract definition of a transaction that affects a registry in some way
* @param {Registry} targetRegistry Registry that will be manipulated
*/
@docs('registryTransaction.md')
abstract transaction RegistryTransaction {
--> Registry targetRegistry
}
/**
* An abstract definition of a transaction that affects assets in a registry in some way
* @param {Asset[]} resources Resources that will be manipulated
*/
@docs('assetTransaction.md')
abstract transaction AssetTransaction extends RegistryTransaction {
o Asset[] resources
}
/**
* An abstract definition of a transaction that affects participants in a registry in some way
* @param {Participant[]} resources participants that will be manipulated
*/
@docs('participantTransaction.md')
abstract transaction ParticipantTransaction extends RegistryTransaction {
o Participant[] resources
}
/**
* Transaction that will add asset(s) to a registry
*/
transaction AddAsset extends AssetTransaction { }
/**
* Transaction that will update asset(s) in a registry
*/
transaction UpdateAsset extends AssetTransaction { }
/**
* Transaction that will remove asset(s) from a registry
* @param {String[]} resourceIds Identifiers of the assets to remove
*/
transaction RemoveAsset extends AssetTransaction {
o String[] resourceIds
}
/**
* Transaction that will add participants(s) to a registry
*/
transaction AddParticipant extends ParticipantTransaction { }
/**
* Transaction that will update participants(s) in a registry
*/
transaction UpdateParticipant extends ParticipantTransaction { }
/**
* Transaction that will remove participants(s) from a registry
* @param {String[]} resourceIds Identifiers of the participants to remove
*/
transaction RemoveParticipant extends ParticipantTransaction {
o String[] resourceIds
}
// -----------------------------------------------------------------------------
// Identity
/** The valid states of an identity
* @enum {ISSUED} identity has been issued
* @enum {BOUND} identity has been bound to a participant
* @enum {ACTIVATED} identity has been activated
* @enum {REVOKED} identity has been revoked
*/
@docs('identityState.md')
enum IdentityState {
o ISSUED
o BOUND
o ACTIVATED
o REVOKED
}
/**
* Asset representing the idea of an Identity
*
* @param {String} identityId Unique Identifiers
* @param {String} name Name given to this identity
* @param {String} issuer The issuer
* @param {String} certificate The certificate
* @param {IdentityState} state State the identity is in
* @param {Participant} participant Associated participant
*/
@docs('identity.md')
asset Identity identified by identityId {
o String identityId
o String name
o String issuer
o String certificate
o IdentityState state
--> Participant participant
}
/**
* Transaction that will issue the identity
* @param {Participant} participant to issue the identity to
* @param {String} identityName name to use for this identity
*/
@docs('issueIdentity.md')
transaction IssueIdentity {
--> Participant participant
o String identityName
}
/**
* Transaction that will bind the identity
* @param {Participant} participant to issue bind identity to
* @param {String} certificate to use
*/
@docs('bindIdentity.md')
transaction BindIdentity {
--> Participant participant
o String certificate
}
/**
* Transaction that will activate the current the identity
*/
@docs('activateIdentity.md')
transaction ActivateCurrentIdentity { }
/**
* Transaction that will revoke the identity
* @param {Identity} identity to revoke
*/
@docs('revokeIdentity.md')
transaction RevokeIdentity {
--> Identity identity
}
/**
* Transaction that will Start a business network
* @param {Transaction[]} [bootstrapTransactions] optional transactions to use to bootstrap the network
* @param {String} [logLevel] Log level to use optionally
*
*/
@docs('startBusinessNetwork.md')
transaction StartBusinessNetwork {
o String logLevel optional
o Transaction[] bootstrapTransactions optional
}
/**
* Transaction that will Reset a business network. This removes all the data but leaves the structure of the business network intact
*/
@docs('resetBusinessNetwork.md')
transaction ResetBusinessNetwork {
}
/**
* Sets the log level of the Business Network runtime to that specified
* @param {String} newLogLevel a valid debug string
*/
@docs('setLogLevel.md')
transaction SetLogLevel {
o String newLogLevel
}