@@ -252,6 +252,8 @@ public Response createComponent(@PathParam("uuid") String uuid, Component jsonCo
252
252
validator .validateProperty (jsonComponent , "group" ),
253
253
validator .validateProperty (jsonComponent , "description" ),
254
254
validator .validateProperty (jsonComponent , "license" ),
255
+ validator .validateProperty (jsonComponent , "licenseExpression" ),
256
+ validator .validateProperty (jsonComponent , "licenseUrl" ),
255
257
validator .validateProperty (jsonComponent , "filename" ),
256
258
validator .validateProperty (jsonComponent , "classifier" ),
257
259
validator .validateProperty (jsonComponent , "cpe" ),
@@ -305,12 +307,20 @@ public Response createComponent(@PathParam("uuid") String uuid, Component jsonCo
305
307
component .setSha3_512 (StringUtils .trimToNull (jsonComponent .getSha3_512 ()));
306
308
if (resolvedLicense != null ) {
307
309
component .setLicense (null );
310
+ component .setLicenseExpression (null );
311
+ component .setLicenseUrl (StringUtils .trimToNull (jsonComponent .getLicenseUrl ()));
308
312
component .setResolvedLicense (resolvedLicense );
309
- } else {
310
- component .setLicense (StringUtils .trimToNull (jsonComponent .getLicense ()));
313
+ } else if (StringUtils .trimToNull (jsonComponent .getLicense ()) != null ) {
314
+ component .setLicense (StringUtils .trim (jsonComponent .getLicense ()));
315
+ component .setLicenseExpression (null );
316
+ component .setLicenseUrl (StringUtils .trimToNull (jsonComponent .getLicenseUrl ()));
317
+ component .setResolvedLicense (null );
318
+ } else if (StringUtils .trimToNull (jsonComponent .getLicenseExpression ()) != null ) {
319
+ component .setLicense (null );
320
+ component .setLicenseExpression (StringUtils .trim (jsonComponent .getLicenseExpression ()));
321
+ component .setLicenseUrl (null );
311
322
component .setResolvedLicense (null );
312
323
}
313
- component .setLicenseUrl (StringUtils .trimToNull (jsonComponent .getLicenseUrl ()));
314
324
component .setParent (parent );
315
325
component .setNotes (StringUtils .trimToNull (jsonComponent .getNotes ()));
316
326
@@ -347,6 +357,7 @@ public Response updateComponent(Component jsonComponent) {
347
357
validator .validateProperty (jsonComponent , "group" ),
348
358
validator .validateProperty (jsonComponent , "description" ),
349
359
validator .validateProperty (jsonComponent , "license" ),
360
+ validator .validateProperty (jsonComponent , "licenseExpression" ),
350
361
validator .validateProperty (jsonComponent , "licenseUrl" ),
351
362
validator .validateProperty (jsonComponent , "filename" ),
352
363
validator .validateProperty (jsonComponent , "classifier" ),
@@ -395,12 +406,25 @@ public Response updateComponent(Component jsonComponent) {
395
406
final License resolvedLicense = qm .getLicense (jsonComponent .getLicense ());
396
407
if (resolvedLicense != null ) {
397
408
component .setLicense (null );
409
+ component .setLicenseExpression (null );
410
+ component .setLicenseUrl (StringUtils .trimToNull (jsonComponent .getLicenseUrl ()));
398
411
component .setResolvedLicense (resolvedLicense );
412
+ } else if (StringUtils .trimToNull (jsonComponent .getLicense ()) != null ) {
413
+ component .setLicense (StringUtils .trim (jsonComponent .getLicense ()));
414
+ component .setLicenseExpression (null );
415
+ component .setLicenseUrl (StringUtils .trimToNull (jsonComponent .getLicenseUrl ()));
416
+ component .setResolvedLicense (null );
417
+ } else if (StringUtils .trimToNull (jsonComponent .getLicenseExpression ()) != null ) {
418
+ component .setLicense (null );
419
+ component .setLicenseExpression (StringUtils .trim (jsonComponent .getLicenseExpression ()));
420
+ component .setLicenseUrl (null );
421
+ component .setResolvedLicense (null );
399
422
} else {
400
- component .setLicense (StringUtils .trimToNull (jsonComponent .getLicense ()));
423
+ component .setLicense (null );
424
+ component .setLicenseExpression (null );
425
+ component .setLicenseUrl (null );
401
426
component .setResolvedLicense (null );
402
427
}
403
- component .setLicenseUrl (StringUtils .trimToNull (jsonComponent .getLicenseUrl ()));
404
428
component .setNotes (StringUtils .trimToNull (jsonComponent .getNotes ()));
405
429
406
430
component = qm .updateComponent (component , true );
0 commit comments