-
Notifications
You must be signed in to change notification settings - Fork 96
/
licenses.thrift
349 lines (283 loc) · 10.8 KB
/
licenses.thrift
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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
/*
* Copyright Siemens AG, 2014-2017. Part of the SW360 Portal Project.
* With contributions by Bosch Software Innovations GmbH, 2016.
* With contributions by TOSHIBA CORPORATION, 2021.
* With contributions by Toshiba Software Development (Vietnam) Co., Ltd., 2021.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
include "users.thrift"
include "sw360.thrift"
namespace java org.eclipse.sw360.datahandler.thrift.licenses
namespace php sw360.thrift.licenses
typedef users.User User
typedef users.RequestedAction RequestedAction
typedef sw360.RequestStatus RequestStatus
typedef sw360.DocumentState DocumentState
typedef sw360.CustomProperties CustomProperties
typedef sw360.RequestSummary RequestSummary
typedef sw360.Quadratic Quadratic
typedef sw360.SW360Exception SW360Exception
typedef i32 int
enum ObligationLevel {
ORGANISATION_OBLIGATION = 0,
PROJECT_OBLIGATION = 1,
COMPONENT_OBLIGATION = 2,
LICENSE_OBLIGATION = 3,
}
enum ObligationType {
PERMISSION = 0,
RISK = 1,
EXCEPTION = 2,
RESTRICTION = 3,
OBLIGATION = 4
}
enum ObligationElementStatus {
UPDATED = 0,
DEFINED = 1
UNDEFINED = 2
}
struct Obligation {
1: optional string id,
2: optional string revision,
3: optional string type = "obligation",
4: required string text,
5: optional set<string> whitelist,
6: optional bool development,
7: optional bool distribution,
10: optional string title,
11: optional map<string, string> customPropertyToValue,
// These two are a quick fix to receiving booleans in PHP not working at the moment
15: optional string developmentString,
16: optional string distributionString,
// information from external data sources
19: optional map<string, string> externalIds,
21: optional string comments,
22: optional ObligationLevel obligationLevel,
23: optional ObligationType obligationType,
300: optional map<string, string> additionalData,
97: optional string node,
}
struct LicenseType {
1: optional string id,
2: optional string revision,
3: optional string type = "licenseType",
5: required i32 licenseTypeId,
6: required string licenseType;
}
struct ObligationNode {
1: optional string id,
2: optional string revision,
3: optional string type = "obligationNode",
4: optional string nodeType,
5: optional string nodeText,
6: optional string oblElementId
}
struct ObligationElement {
1: optional string id,
2: optional string revision,
3: optional string type = "obligationElement",
4: required string langElement,
5: required string action,
6: required string object,
7: optional ObligationElementStatus status
}
struct License {
1: optional string id,
2: optional string revision,
3: optional string type = "license",
4: optional string shortname, // Short name of the license
5: required string fullname,
6: optional LicenseType licenseType,
7: optional string licenseTypeDatabaseId,
8: optional string externalLicenseLink,
// information from external data sources
9: optional map<string, string> externalIds,
300: optional map<string, string> additionalData,
// Additional informations
12: optional string reviewdate,
17: optional Quadratic OSIApproved = sw360.Quadratic.NA,
18: optional Quadratic FSFLibre = sw360.Quadratic.NA,
20: optional list<Obligation> obligations,
21: optional set<string> obligationDatabaseIds,
25: optional string text,
30: optional bool checked = true;
90: optional DocumentState documentState,
200: optional map<RequestedAction, bool> permissions
}
service LicenseService {
/**
* Get a single license by providing its ID, filled with license type, risks and obligations containing obligations and whitelists
* filtered for the given organisation
**/
License getByID(1:string id, 2: string organisation) throws (1: SW360Exception exp);
/**
* Get a single license by providing its ID, filled with license type and obligations containing obligations and whitelists
* filtered for the given organisation, risks are not set,
* user's moderation request with status pending or in progress applied
**/
License getByIDWithOwnModerationRequests(1:string id, 2: string organisation, 3: User user);
/**
* get licenses for ids filled with license types, risks and obligations containing obligations
* whitelists filtered for organisation
**/
list<License> getByIds(1:set<string> ids, 2: string organisation);
/**
* Add a new obligation object to database, return id
**/
string addObligations(1:Obligation obligations, 2: User user);
/**
* Update a existed obligation object to database, return id
**/
string updateObligation(1:Obligation obligation, 2: User user);
/**
* Add an existing obligation to a license or generate moderation request if user has no permission
**/
RequestStatus addObligationsToLicense(1: set<Obligation> obligations, 2: License license, 3: User user);
/**
* Add a new license type object to database
**/
RequestStatus addLicenseType(1:LicenseType licenseType, 2: User user);
/**
* Update given license,
* user is used to check permissions, requesting user's department is used to set whitelists
**/
RequestStatus updateLicense(1: License license, 2: User user, 3: User requestingUser);
/**
* update license in database if user has permissions, additions and deletions are the parts of the moderation request
* that specify which properties to add to and which to delete from license
**/
RequestStatus updateLicenseFromModerationRequest(1: License additions, 2: License deletions, 3: User user, 4: User requestingUser);
/**
* Update the whitelisted obligations for an organisation, generate moderation request if user has no permissions
**/
RequestStatus updateWhitelist(1: string licenseId, 2: set<string> obligationsDatabaseIds, 3: User user);
/**
* delete license from database if user has permissions,
* otherwise create moderation request
**/
RequestStatus deleteLicense(1: string licenseId, 2: User user);
/**
* Get a list of summaries filled with license types for all licenses
**/
list<License> getLicenseSummary();
/**
* Get a list of export summaries for all licenses
**/
list<License> getLicenseSummaryForExport();
/**
* get a list of all full license documents filled with obligations, risks and license types,
* obligations and risks themselves are not filled
**/
list<License> getDetailedLicenseSummaryForExport(1: string organisation);
/**
* get a list of full documents with ids in identifiers, filled with obligations, risks and license types,
* obligations and risks themselves are also filled, obligation whitelists are filtered for organisation
**/
list<License> getDetailedLicenseSummary(1: string organisation, 2: list<string> identifiers);
/**
* bulk add for import of license archive, returns input license types if successful, null otherwise
**/
list<LicenseType> addLicenseTypes(1: list <LicenseType> licenseTypes, 2: User user);
/**
* bulk add for import of license archive, returns input licenses if successful, null otherwise
**/
list<License> addLicenses(1: list <License> licenses, 2: User user);
/**
* bulk add for import of license archive, returns input licenses if successful, null otherwise
**/
list<License> addOrOverwriteLicenses(1: list <License> licenses, 2: User user);
/**
* bulk add for import of license archive, returns input obligations if successful, null otherwise
**/
list<Obligation> addListOfObligations(1: list <Obligation> obligations, 2: User user);
/**
* get complete list of license types
**/
list<LicenseType> getLicenseTypes();
/**
* get complete list of licenses, completely filled
**/
list<License> getLicenses();
/**
* get complete list of filled obligations
**/
list<Obligation> getObligations();
/**
* get license types with id in ids
**/
list<LicenseType> getLicenseTypesByIds( 1: list<string> ids);
/**
* get filled obligations with id in ids
**/
list<Obligation> getObligationsByIds( 1: list<string> ids);
LicenseType getLicenseTypeById( 1: string id);
/**
* return filled obligation
**/
Obligation getObligationsById( 1: string id);
list<CustomProperties> getCustomProperties(1: string documentType);
RequestStatus updateCustomProperties(1: CustomProperties customProperties, 2: User user );
/**
* removes all licenses, license types, obligations, obligations, risks, risk categories from db
**/
RequestSummary deleteAllLicenseInformation(1: User user);
RequestSummary importAllSpdxLicenses(1: User user);
RequestSummary importAllOSADLLicenses(1: User user);
/**
* delete obligation from database if user has permissions
**/
RequestStatus deleteObligations(1: string id, 2: User user);
/**
* delete license type from database if user has permissions
**/
RequestStatus deleteLicenseType(1: string id, 2: User user);
/**
* Check license type is in using by license
**/
int checkLicenseTypeInUse(1: string id);
/* Add a new Obligation Element object to database, return id
**/
string addObligationElements(1:ObligationElement obligationElement, 2: User user);
/**
* get complete list of filled obligation elements
**/
list<ObligationElement> getObligationElements();
/**
* Add a new Obligation Node object to database, return id
**/
string addObligationNodes(1:ObligationNode obligationNode, 2: User user);
/**
* get complete list of filled obligation nodes
**/
list<ObligationNode> getObligationNodes();
/**
* get ObligationNode by id
**/
ObligationNode getObligationNodeById( 1: string id);
/**
* get ObligationElement by id
**/
ObligationElement getObligationElementById( 1: string id);
/**
* add ObligationNode from jsonString input
**/
string addNodes(1:string jsonString, 2: User user)
/**
* build obligation text after addNodes
**/
string buildObligationText(1: string nodes, 2: string level)
// Search functions
/**
* global search function to list obligation elements which match the text argument
*/
list<ObligationElement> searchObligationElement(1: string text);
/**
* convert Text to Node in obligation
**/
string convertTextToNode(1:Obligation Obligation, 2: User user);
}