Skip to content

Commit d01ec70

Browse files
committed
shorter SPDX 3 property and class names
Signed-off-by: Gary O'Neall <gary@sourceauditor.com>
1 parent 1a511f9 commit d01ec70

22 files changed

Lines changed: 709 additions & 741 deletions

src/main/java/org/spdx/library/LicenseInfoFactory.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,13 @@
2929
import org.spdx.core.DefaultStoreNotInitialized;
3030
import org.spdx.core.IModelCopyManager;
3131
import org.spdx.core.InvalidSPDXAnalysisException;
32-
import org.spdx.library.model.v2.license.AnyLicenseInfo;
3332
import org.spdx.library.model.v2.license.InvalidLicenseStringException;
3433
import org.spdx.library.model.v2.license.LicenseParserException;
35-
import org.spdx.library.model.v2.license.ListedLicenseException;
3634
import org.spdx.library.model.v2.license.SpdxListedLicense;
3735
import org.spdx.library.model.v3.core.SpdxDocument;
38-
import org.spdx.library.model.v3.expandedlicensing.ExpandedLicensingListedLicense;
39-
import org.spdx.library.model.v3.expandedlicensing.ExpandedLicensingListedLicenseException;
40-
import org.spdx.library.model.v3.simplelicensing.SimpleLicensingAnyLicenseInfo;
36+
import org.spdx.library.model.v3.expandedlicensing.ListedLicense;
37+
import org.spdx.library.model.v3.expandedlicensing.ListedLicenseException;
38+
import org.spdx.library.model.v3.simplelicensing.AnyLicenseInfo;
4139
import org.spdx.storage.IModelStore;
4240
import org.spdx.utility.license.LicenseExpressionParser;
4341

@@ -57,7 +55,7 @@ public class LicenseInfoFactory {
5755
* @return SPDX listed license or null if the ID is not in the SPDX license list
5856
* @throws InvalidSPDXAnalysisException
5957
*/
60-
public static ExpandedLicensingListedLicense getListedLicenseById(String licenseId)throws InvalidSPDXAnalysisException {
58+
public static ListedLicense getListedLicenseById(String licenseId)throws InvalidSPDXAnalysisException {
6159
return ListedLicenses.getListedLicenses().getListedLicenseById(licenseId);
6260
}
6361

@@ -92,7 +90,7 @@ public static SpdxListedLicense getListedLicenseByIdCompatV2(String licenseId)th
9290
* @throws InvalidLicenseStringException
9391
* @throws DefaultStoreNotInitialized
9492
*/
95-
public static AnyLicenseInfo parseSPDXLicenseStringCompatV2(String licenseString, @Nullable IModelStore store,
93+
public static org.spdx.library.model.v2.license.AnyLicenseInfo parseSPDXLicenseStringCompatV2(String licenseString, @Nullable IModelStore store,
9694
@Nullable String documentUri, @Nullable IModelCopyManager copyManager) throws InvalidLicenseStringException, DefaultStoreNotInitialized {
9795
if (Objects.isNull(store)) {
9896
store = DefaultModelStore.getDefaultModelStore();
@@ -136,7 +134,7 @@ public static AnyLicenseInfo parseSPDXLicenseStringCompatV2(String licenseString
136134
* @throws InvalidLicenseStringException
137135
* @throws DefaultStoreNotInitialized
138136
*/
139-
public static SimpleLicensingAnyLicenseInfo parseSPDXLicenseString(String licenseString, @Nullable IModelStore store,
137+
public static AnyLicenseInfo parseSPDXLicenseString(String licenseString, @Nullable IModelStore store,
140138
@Nullable String customLicensePrefix, @Nullable IModelCopyManager copyManager,
141139
@Nullable SpdxDocument spdxDocument) throws InvalidLicenseStringException, DefaultStoreNotInitialized {
142140
if (Objects.isNull(store)) {
@@ -175,7 +173,7 @@ public static SimpleLicensingAnyLicenseInfo parseSPDXLicenseString(String licens
175173
* @throws InvalidLicenseStringException
176174
* @throws DefaultStoreNotInitialized
177175
*/
178-
public static SimpleLicensingAnyLicenseInfo parseSPDXLicenseString(String licenseString) throws InvalidLicenseStringException, DefaultStoreNotInitialized {
176+
public static AnyLicenseInfo parseSPDXLicenseString(String licenseString) throws InvalidLicenseStringException, DefaultStoreNotInitialized {
179177
return parseSPDXLicenseString(licenseString, null, null, null, null);
180178
}
181179

@@ -196,7 +194,7 @@ public static SimpleLicensingAnyLicenseInfo parseSPDXLicenseString(String licens
196194
* @throws InvalidLicenseStringException
197195
* @throws DefaultStoreNotInitialized
198196
*/
199-
public static AnyLicenseInfo parseSPDXLicenseStringCompatV2(String licenseString) throws InvalidLicenseStringException, DefaultStoreNotInitialized {
197+
public static org.spdx.library.model.v2.license.AnyLicenseInfo parseSPDXLicenseStringCompatV2(String licenseString) throws InvalidLicenseStringException, DefaultStoreNotInitialized {
200198
return parseSPDXLicenseStringCompatV2(licenseString, null, null, null);
201199
}
202200

@@ -237,7 +235,7 @@ public static boolean isSpdxListedExceptionId(String id) {
237235
* @return the standard SPDX license exception or null if the ID is not in the SPDX license list
238236
* @throws InvalidSPDXAnalysisException
239237
*/
240-
public static ExpandedLicensingListedLicenseException getListedExceptionById(String id) throws InvalidSPDXAnalysisException {
238+
public static ListedLicenseException getListedExceptionById(String id) throws InvalidSPDXAnalysisException {
241239
return ListedLicenses.getListedLicenses().getListedExceptionById(id);
242240
}
243241

@@ -246,7 +244,7 @@ public static ExpandedLicensingListedLicenseException getListedExceptionById(Str
246244
* @return the standard SPDX license exception in SPDX Spec V2.X format or null if the ID is not in the SPDX license list
247245
* @throws InvalidSPDXAnalysisException
248246
*/
249-
public static ListedLicenseException getListedExceptionV2ById(String id) throws InvalidSPDXAnalysisException {
247+
public static org.spdx.library.model.v2.license.ListedLicenseException getListedExceptionV2ById(String id) throws InvalidSPDXAnalysisException {
250248
return ListedLicenses.getListedLicenses().getListedExceptionByIdCompatV2(id);
251249
}
252250

src/main/java/org/spdx/library/ListedLicenses.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@
3131
import org.spdx.core.InvalidSPDXAnalysisException;
3232
import org.spdx.library.model.v2.SpdxConstantsCompatV2;
3333
import org.spdx.library.model.v2.SpdxModelFactory;
34-
import org.spdx.library.model.v2.license.ListedLicenseException;
3534
import org.spdx.library.model.v2.license.SpdxListedLicense;
36-
import org.spdx.library.model.v3.expandedlicensing.ExpandedLicensingListedLicense;
37-
import org.spdx.library.model.v3.expandedlicensing.ExpandedLicensingListedLicenseException;
35+
import org.spdx.library.model.v3.expandedlicensing.ListedLicense;
36+
import org.spdx.library.model.v3.expandedlicensing.ListedLicenseException;
3837
import org.spdx.storage.IModelStore;
3938
import org.spdx.storage.listedlicense.IListedLicenseStore;
4039
import org.spdx.storage.listedlicense.SpdxListedLicenseLocalStore;
@@ -208,22 +207,22 @@ public SpdxListedLicense getListedLicenseByIdCompatV2(String licenseId) throws I
208207
* @return an SPDX spec version 2 SPDX listed license exception or null if the ID is not in the SPDX license list
209208
* @throws InvalidSPDXAnalysisException
210209
*/
211-
public ListedLicenseException getListedExceptionByIdCompatV2(String exceptionId) throws InvalidSPDXAnalysisException {
212-
return (ListedLicenseException)SpdxModelFactory.createModelObjectV2(this.licenseStoreV2, SpdxConstantsCompatV2.LISTED_LICENSE_NAMESPACE_PREFIX, exceptionId, SpdxConstantsCompatV2.CLASS_SPDX_LISTED_LICENSE_EXCEPTION, null);
210+
public org.spdx.library.model.v2.license.ListedLicenseException getListedExceptionByIdCompatV2(String exceptionId) throws InvalidSPDXAnalysisException {
211+
return (org.spdx.library.model.v2.license.ListedLicenseException)SpdxModelFactory.createModelObjectV2(this.licenseStoreV2, SpdxConstantsCompatV2.LISTED_LICENSE_NAMESPACE_PREFIX, exceptionId, SpdxConstantsCompatV2.CLASS_SPDX_LISTED_LICENSE_EXCEPTION, null);
213212
}
214213

215214
/**
216215
* @param licenseId SPDX Listed License ID
217216
* @return SPDX listed license or null if the ID is not in the SPDX license list
218217
* @throws InvalidSPDXAnalysisException
219218
*/
220-
public ExpandedLicensingListedLicense getListedLicenseById(String licenseId) throws InvalidSPDXAnalysisException {
221-
return new ExpandedLicensingListedLicense(this.licenseStoreV3, SpdxListedLicenseModelStore.licenseOrExceptionIdToObjectUri(licenseId), null,
219+
public ListedLicense getListedLicenseById(String licenseId) throws InvalidSPDXAnalysisException {
220+
return new ListedLicense(this.licenseStoreV3, SpdxListedLicenseModelStore.licenseOrExceptionIdToObjectUri(licenseId), null,
222221
true, SpdxConstantsCompatV2.LISTED_LICENSE_NAMESPACE_PREFIX);
223222
}
224223

225-
public ExpandedLicensingListedLicenseException getListedExceptionById(String exceptionId) throws InvalidSPDXAnalysisException {
226-
return new ExpandedLicensingListedLicenseException(this.licenseStoreV3, SpdxListedLicenseModelStore.licenseOrExceptionIdToObjectUri(exceptionId), null,
224+
public ListedLicenseException getListedExceptionById(String exceptionId) throws InvalidSPDXAnalysisException {
225+
return new ListedLicenseException(this.licenseStoreV3, SpdxListedLicenseModelStore.licenseOrExceptionIdToObjectUri(exceptionId), null,
227226
true, SpdxConstantsCompatV2.LISTED_LICENSE_NAMESPACE_PREFIX);
228227
}
229228

src/main/java/org/spdx/library/SpdxModelFactory.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.spdx.core.ModelRegistryException;
3333
import org.spdx.library.model.v2.SpdxModelInfoV2_X;
3434
import org.spdx.library.model.v3.SpdxModelInfoV3_0;
35-
import org.spdx.library.model.v3.simplelicensing.SimpleLicensingAnyLicenseInfo;
3635
import org.spdx.storage.IModelStore;
3736

3837
/**
@@ -228,20 +227,4 @@ public static Stream<?> getSpdxObjects(IModelStore store, @Nullable IModelCopyMa
228227
}
229228
});
230229
}
231-
232-
/**
233-
* @param store
234-
* @param string
235-
* @param copyManager
236-
* @param latestSpecVersion
237-
* @return
238-
*/
239-
public static SimpleLicensingAnyLicenseInfo getExternalAnyLicenseInfo(
240-
IModelStore store, String string, IModelCopyManager copyManager,
241-
String specVersion) {
242-
// TODO Figure out how to implement
243-
// TODO Auto-generated method stub
244-
return null;
245-
}
246-
247230
}

src/main/java/org/spdx/storage/listedlicense/ExceptionJson.java

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@
3030
import org.spdx.core.InvalidSPDXAnalysisException;
3131
import org.spdx.core.InvalidSpdxPropertyException;
3232
import org.spdx.library.model.v2.SpdxConstantsCompatV2;
33-
import org.spdx.library.model.v2.license.ListedLicenseException;
3433
import org.spdx.library.model.v3.SpdxConstantsV3;
35-
import org.spdx.library.model.v3.expandedlicensing.ExpandedLicensingListedLicenseException;
34+
import org.spdx.library.model.v3.expandedlicensing.ListedLicenseException;
3635
import org.spdx.storage.PropertyDescriptor;
3736

3837

@@ -53,30 +52,30 @@ public class ExceptionJson {
5352
static {
5453
Map<PropertyDescriptor, String> descriptorsToValue = new HashMap<>();
5554
Set<PropertyDescriptor> collectionProperties = new HashSet<>();
56-
descriptorsToValue.put(SpdxConstantsV3.PROP_EXPANDED_LICENSING_ADDITION_TEXT, "licenseExceptionText");
55+
descriptorsToValue.put(SpdxConstantsV3.PROP_ADDITION_TEXT, "licenseExceptionText");
5756
descriptorsToValue.put(SpdxConstantsCompatV2.PROP_EXCEPTION_TEXT, "licenseExceptionText");
5857
descriptorsToValue.put(SpdxConstantsCompatV2.PROP_EXCEPTION_TEXT_HTML, "exceptionTextHtml");
5958
descriptorsToValue.put(SpdxConstantsV3.PROP_NAME, "name");
6059
descriptorsToValue.put(SpdxConstantsCompatV2.PROP_NAME, "name");
6160
descriptorsToValue.put(SpdxConstantsCompatV2.PROP_LICENSE_EXCEPTION_ID, "licenseExceptionId");
62-
descriptorsToValue.put(SpdxConstantsV3.PROP_EXPANDED_LICENSING_STANDARD_ADDITION_TEMPLATE, "licenseExceptionTemplate");
61+
descriptorsToValue.put(SpdxConstantsV3.PROP_STANDARD_ADDITION_TEMPLATE, "licenseExceptionTemplate");
6362
descriptorsToValue.put(SpdxConstantsCompatV2.PROP_EXCEPTION_TEMPLATE, "licenseExceptionTemplate");
6463
descriptorsToValue.put(SpdxConstantsCompatV2.PROP_EXAMPLE, "example");
65-
descriptorsToValue.put(SpdxConstantsV3.PROP_EXPANDED_LICENSING_IS_DEPRECATED_ADDITION_ID, "isDeprecatedLicenseId");
64+
descriptorsToValue.put(SpdxConstantsV3.PROP_IS_DEPRECATED_ADDITION_ID, "isDeprecatedLicenseId");
6665
descriptorsToValue.put(SpdxConstantsCompatV2.PROP_LIC_ID_DEPRECATED, "isDeprecatedLicenseId");
67-
descriptorsToValue.put(SpdxConstantsV3.PROP_EXPANDED_LICENSING_DEPRECATED_VERSION, "deprecatedVersion");
66+
descriptorsToValue.put(SpdxConstantsV3.PROP_DEPRECATED_VERSION, "deprecatedVersion");
6867
descriptorsToValue.put(SpdxConstantsCompatV2.PROP_LIC_DEPRECATED_VERSION, "deprecatedVersion");
6968
descriptorsToValue.put(SpdxConstantsV3.PROP_COMMENT, "comment");
7069
descriptorsToValue.put(SpdxConstantsCompatV2.RDFS_PROP_COMMENT, "comment");
7170
descriptorsToValue.put(SpdxConstantsCompatV2.PROP_LICENSE_EXCEPTION_ID, "licenseExceptionId");
72-
descriptorsToValue.put(SpdxConstantsV3.PROP_EXPANDED_LICENSING_SEE_ALSO, "seeAlso");
73-
collectionProperties.add(SpdxConstantsV3.PROP_EXPANDED_LICENSING_SEE_ALSO);
71+
descriptorsToValue.put(SpdxConstantsV3.PROP_SEE_ALSO, "seeAlso");
72+
collectionProperties.add(SpdxConstantsV3.PROP_SEE_ALSO);
7473
descriptorsToValue.put(SpdxConstantsCompatV2.RDFS_PROP_SEE_ALSO, "seeAlso");
7574
collectionProperties.add(SpdxConstantsCompatV2.RDFS_PROP_SEE_ALSO);
7675

77-
descriptorsToValue.put(SpdxConstantsV3.PROP_EXPANDED_LICENSING_LICENSE_XML, "licenseXml");
78-
descriptorsToValue.put(SpdxConstantsV3.PROP_EXPANDED_LICENSING_OBSOLETED_BY, "obsoletedBy");
79-
descriptorsToValue.put(SpdxConstantsV3.PROP_EXPANDED_LICENSING_LIST_VERSION_ADDED, "listVersionAdded");
76+
descriptorsToValue.put(SpdxConstantsV3.PROP_LICENSE_XML, "licenseXml");
77+
descriptorsToValue.put(SpdxConstantsV3.PROP_OBSOLETED_BY, "obsoletedBy");
78+
descriptorsToValue.put(SpdxConstantsV3.PROP_LIST_VERSION_ADDED, "listVersionAdded");
8079

8180
// The following are not implemented in the JSON - they are added so there is no errors when creating V3 object classes
8281
descriptorsToValue.put(SpdxConstantsV3.PROP_EXTERNAL_REF, "externalRef");
@@ -289,23 +288,23 @@ public void removeProperty(PropertyDescriptor propertyDescriptor) throws Invalid
289288

290289
}
291290

292-
public void copyFrom(ExpandedLicensingListedLicenseException fromException) throws InvalidSPDXAnalysisException {
291+
public void copyFrom(ListedLicenseException fromException) throws InvalidSPDXAnalysisException {
293292
Optional<String> comment = fromException.getComment();
294293
this.comment = comment.orElse(null);
295-
this.deprecatedVersion = fromException.getExpandedLicensingDeprecatedVersion().orElse(null);
296-
this.isDeprecatedLicenseId = fromException.getExpandedLicensingIsDeprecatedAdditionId().orElse(false);
294+
this.deprecatedVersion = fromException.getDeprecatedVersion().orElse(null);
295+
this.isDeprecatedLicenseId = fromException.getIsDeprecatedAdditionId().orElse(false);
297296
this.licenseExceptionId = SpdxListedLicenseModelStore.objectUriToLicenseOrExceptionId(fromException.getObjectUri());
298-
this.licenseExceptionTemplate = fromException.getExpandedLicensingStandardAdditionTemplate().orElse(null);
299-
this.licenseExceptionText = fromException.getExpandedLicensingAdditionText();
297+
this.licenseExceptionTemplate = fromException.getStandardAdditionTemplate().orElse(null);
298+
this.licenseExceptionText = fromException.getAdditionText();
300299
this.name = fromException.getName().orElse(null);
301-
this.seeAlso = new ArrayList<String>(fromException.getExpandedLicensingSeeAlsos());
302-
this.obsoletedBy = fromException.getExpandedLicensingObsoletedBy().orElse(null);
303-
this.listVersionAdded = fromException.getExpandedLicensingListVersionAdded().orElse(null);
304-
this.licenseXml = fromException.getExpandedLicensingLicenseXml().orElse(null);
300+
this.seeAlso = new ArrayList<String>(fromException.getSeeAlsos());
301+
this.obsoletedBy = fromException.getObsoletedBy().orElse(null);
302+
this.listVersionAdded = fromException.getListVersionAdded().orElse(null);
303+
this.licenseXml = fromException.getLicenseXml().orElse(null);
305304
}
306305

307306
@SuppressWarnings("deprecation")
308-
public void copyFrom(ListedLicenseException fromException) throws InvalidSPDXAnalysisException {
307+
public void copyFrom(org.spdx.library.model.v2.license.ListedLicenseException fromException) throws InvalidSPDXAnalysisException {
309308
this.comment = null;
310309
this.licenseComments = fromException.getComment();
311310
if (Objects.nonNull(this.licenseComments) && this.licenseComments.isEmpty()) {
@@ -372,14 +371,14 @@ public boolean isPropertyValueAssignableTo(PropertyDescriptor propertyDescriptor
372371

373372
public boolean isCollectionMembersAssignableTo(PropertyDescriptor propertyDescriptor, Class<?> clazz) {
374373
if (SpdxConstantsCompatV2.RDFS_PROP_SEE_ALSO.equals(propertyDescriptor) ||
375-
SpdxConstantsV3.PROP_EXPANDED_LICENSING_SEE_ALSO.equals(propertyDescriptor)) {
374+
SpdxConstantsV3.PROP_SEE_ALSO.equals(propertyDescriptor)) {
376375
return String.class.isAssignableFrom(clazz);
377376
} else if (SpdxConstantsV3.PROP_EXTERNAL_REF.equals(propertyDescriptor)) {
378377
return org.spdx.library.model.v3.core.ExternalRef.class.isAssignableFrom(clazz);
379378
} else if (SpdxConstantsV3.PROP_VERIFIED_USING.equals(propertyDescriptor)) {
380379
return org.spdx.library.model.v3.core.IntegrityMethod.class.isAssignableFrom(clazz);
381380
} else if (SpdxConstantsV3.PROP_EXTENSION.equals(propertyDescriptor)) {
382-
return org.spdx.library.model.v3.extension.ExtensionExtension.class.isAssignableFrom(clazz);
381+
return org.spdx.library.model.v3.extension.Extension.class.isAssignableFrom(clazz);
383382
} else if (SpdxConstantsV3.PROP_EXTERNAL_IDENTIFIER.equals(propertyDescriptor)) {
384383
return org.spdx.library.model.v3.core.ExternalIdentifier.class.isAssignableFrom(clazz);
385384
} else if (SpdxConstantsV3.PROP_CREATED_USING.equals(propertyDescriptor)) {

src/main/java/org/spdx/storage/listedlicense/LicenseCreationInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public boolean isCollectionMembersAssignableTo(
131131
} else if (SpdxConstantsV3.PROP_VERIFIED_USING.equals(propertyDescriptor)) {
132132
return org.spdx.library.model.v3.core.IntegrityMethod.class.isAssignableFrom(clazz);
133133
} else if (SpdxConstantsV3.PROP_EXTENSION.equals(propertyDescriptor)) {
134-
return org.spdx.library.model.v3.extension.ExtensionExtension.class.isAssignableFrom(clazz);
134+
return org.spdx.library.model.v3.extension.Extension.class.isAssignableFrom(clazz);
135135
} else if (SpdxConstantsV3.PROP_EXTERNAL_IDENTIFIER.equals(propertyDescriptor)) {
136136
return org.spdx.library.model.v3.core.ExternalIdentifier.class.isAssignableFrom(clazz);
137137
} else if (SpdxConstantsV3.PROP_CREATED_USING.equals(propertyDescriptor)) {

src/main/java/org/spdx/storage/listedlicense/LicenseCreatorAgent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public boolean isCollectionMembersAssignableTo(
104104
} else if (SpdxConstantsV3.PROP_VERIFIED_USING.equals(propertyDescriptor)) {
105105
return org.spdx.library.model.v3.core.IntegrityMethod.class.isAssignableFrom(clazz);
106106
} else if (SpdxConstantsV3.PROP_EXTENSION.equals(propertyDescriptor)) {
107-
return org.spdx.library.model.v3.extension.ExtensionExtension.class.isAssignableFrom(clazz);
107+
return org.spdx.library.model.v3.extension.Extension.class.isAssignableFrom(clazz);
108108
} else if (SpdxConstantsV3.PROP_EXTERNAL_IDENTIFIER.equals(propertyDescriptor)) {
109109
return org.spdx.library.model.v3.core.ExternalIdentifier.class.isAssignableFrom(clazz);
110110
} else if (SpdxConstantsV3.PROP_CREATED_USING.equals(propertyDescriptor)) {

0 commit comments

Comments
 (0)