@@ -504,7 +504,8 @@ public Relationship convertAndStore(org.spdx.library.model.v2.Relationship fromR
504504 }
505505 toRelationship .setCompleteness (completeness );
506506 if (relatedSpdxElement .isPresent () &&
507- !(relatedSpdxElement .get () instanceof org .spdx .library .model .v2 .SpdxNoneElement )) {
507+ !((relatedSpdxElement .get () instanceof org .spdx .library .model .v2 .SpdxNoneElement ) ||
508+ (relatedSpdxElement .get () instanceof org .spdx .library .model .v2 .SpdxNoAssertionElement ))) {
508509 if (SWAP_TO_FROM_REL_TYPES .contains (fromRelationshipType )) {
509510 toRelationship .setFrom (convertAndStore (relatedSpdxElement .get ()));
510511 } else {
@@ -541,17 +542,12 @@ public Annotation convertAndStore(org.spdx.library.model.v2.Annotation fromAnnot
541542 toAnnotation .setAnnotationType (ANNOTATION_TYPE_MAP .get (fromAnnotation .getAnnotationType ()));
542543 toAnnotation .setStatement (fromAnnotation .getComment ());
543544 toAnnotation .setSubject (toElement );
544- String fromAnnotationDate = fromAnnotation .getAnnotationDate ();
545- CreationInfo creationInfo = defaultCreationInfo ;
546- if (Objects .nonNull (fromAnnotationDate ) &&
547- !Objects .equals (fromAnnotationDate , defaultCreationInfo .getCreated ())) {
548- // Create a new creation info with the annotation date
549- creationInfo = toAnnotation .createCreationInfo (toModelStore .getNextId (IdType .Anonymous ))
550- .setCreated (fromAnnotationDate )
551- .addAllCreatedBy (defaultCreationInfo .getCreatedBys ())
552- .addAllCreatedUsing (defaultCreationInfo .getCreatedUsings ())
553- .build ();
554- }
545+ CreationInfo creationInfo = new CreationInfo .CreationInfoBuilder (toModelStore , toModelStore .getNextId (IdType .Anonymous ), null )
546+ .setCreated (fromAnnotation .getAnnotationDate ())
547+ .setSpecVersion (SpdxConstantsV3 .MODEL_SPEC_VERSION )
548+ .addAllCreatedUsing (defaultCreationInfo .getCreatedUsings ())
549+ .build ();
550+ creationInfo .getCreatedBys ().add (stringToAgent (fromAnnotation .getAnnotator (), creationInfo ));
555551 toAnnotation .setCreationInfo (creationInfo );
556552 return toAnnotation ;
557553 }
@@ -780,6 +776,8 @@ public ListedLicense convertAndStore(org.spdx.library.model.v2.license.SpdxListe
780776 toListedLicense .setStandardLicenseHeader (fromSpdxListedLicense .getStandardLicenseHeader ());
781777 // fromSpdxListedLicense.getStandardLicenseHeaderTemplate(); - no equivalent in SPDX version 3.X
782778 toListedLicense .setStandardLicenseTemplate (fromSpdxListedLicense .getStandardLicenseTemplate ());
779+ toListedLicense .setIsDeprecatedLicenseId (fromSpdxListedLicense .isDeprecated ());
780+ toListedLicense .setIsOsiApproved (fromSpdxListedLicense .isOsiApproved ());
783781 return toListedLicense ;
784782 }
785783
@@ -881,7 +879,8 @@ public ListedLicenseException convertAndStore(org.spdx.library.model.v2.license.
881879 ListedLicenseException toListedException = (ListedLicenseException )SpdxModelClassFactoryV3 .getModelObject (toModelStore ,
882880 fromException .getObjectUri (), SpdxConstantsV3 .EXPANDED_LICENSING_LISTED_LICENSE_EXCEPTION , copyManager , true , defaultUriPrefix );
883881 convertLicenseAdditionProperties (fromException , toListedException );
884- toListedException .setDeprecatedVersion (fromException .getDeprecatedVersion ());
882+ toListedException .setDeprecatedVersion (fromException .getDeprecatedVersion ());
883+ toListedException .setIsDeprecatedAdditionId (fromException .isDeprecated ());
885884 // fromException.getExample(); - no SPDX spec version 3 equivalent
886885 // fromException.getExceptionTextHtml(); - no SPDX spec version 3 equivalent
887886 return toListedException ;
@@ -1163,13 +1162,6 @@ public SpdxPackage convertAndStore(org.spdx.library.model.v2.SpdxPackage spdxPac
11631162 toPackage .setPrimaryPurpose (PURPOSE_MAP .get (primaryPurpose .get ()));
11641163 }
11651164 toPackage .setReleaseTime (spdxPackage .getReleaseDate ().orElse (null ));
1166- String sha1 = spdxPackage .getSha1 ();
1167- if (Objects .nonNull (sha1 )) {
1168- toPackage .getVerifiedUsings ().add (toPackage .createHash (toModelStore .getNextId (IdType .Anonymous ))
1169- .setAlgorithm (HashAlgorithm .SHA1 )
1170- .setHashValue (sha1 )
1171- .build ());
1172- }
11731165 toPackage .setSourceInfo (spdxPackage .getSourceInfo ().orElse (null ));
11741166 toPackage .setSummary (spdxPackage .getSummary ().orElse (null ));
11751167 Optional <String > supplier = spdxPackage .getSupplier ();
@@ -1316,6 +1308,7 @@ public Snippet convertAndStore(org.spdx.library.model.v2.SpdxSnippet fromSnippet
13161308 .setEndIntegerRange (((org .spdx .library .model .v2 .pointer .LineCharPointer )fromLineRange .get ().getEndPointer ()).getLineNumber ())
13171309 .build ());
13181310 }
1311+ toSnippet .setSnippetFromFile (convertAndStore (fromSnippet .getSnippetFromFile ()));
13191312 return toSnippet ;
13201313 }
13211314}
0 commit comments