Skip to content

Commit

Permalink
added jdbcType CLOB in model classes
Browse files Browse the repository at this point in the history
  • Loading branch information
sahibamittal committed Feb 19, 2024
1 parent 621ba00 commit 5ac15fd
Show file tree
Hide file tree
Showing 28 changed files with 113 additions and 113 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class AnalysisComment implements Serializable {
private String comment;

@Persistent(defaultFetchGroup = "true")
@Column(name = "COMMENTER")
@Column(name = "COMMENTER", jdbcType = "CLOB")
@JsonDeserialize(using = TrimmedStringDeserializer.class)
private String commenter;

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/dependencytrack/model/Bom.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,19 @@ public String getFormatLongName() {
private Date imported;

@Persistent
@Column(name = "BOM_FORMAT")
@Column(name = "BOM_FORMAT", jdbcType = "CLOB")
private String bomFormat;

@Persistent
@Column(name = "SPEC_VERSION")
@Column(name = "SPEC_VERSION", jdbcType = "CLOB")
private String specVersion;

@Persistent
@Column(name = "BOM_VERSION")
private Integer bomVersion;

@Persistent
@Column(name = "SERIAL_NUMBER")
@Column(name = "SERIAL_NUMBER", jdbcType = "CLOB")
private String serialNumber;

@Persistent(defaultFetchGroup = "true")
Expand Down
27 changes: 14 additions & 13 deletions src/main/java/org/dependencytrack/model/Component.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public enum FetchGroup {
private String author;

@Persistent
@Column(name = "PUBLISHER")
@Column(name = "PUBLISHER", jdbcType = "CLOB")
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The publisher may only contain printable characters")
private String publisher;

Expand All @@ -127,21 +127,21 @@ public enum FetchGroup {
private OrganizationalEntity supplier;

@Persistent
@Column(name = "GROUP")
@Column(name = "GROUP", jdbcType = "CLOB")
@Index(name = "COMPONENT_GROUP_IDX")
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The group may only contain printable characters")
private String group;

@Persistent
@Column(name = "NAME", allowsNull = "false")
@Column(name = "NAME", allowsNull = "false", jdbcType = "CLOB")
@Index(name = "COMPONENT_NAME_IDX")
@NotBlank
@JsonDeserialize(using = TrimmedStringDeserializer.class)
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The name may only contain printable characters")
private String name;

@Persistent
@Column(name = "VERSION")
@Column(name = "VERSION", jdbcType = "CLOB")
@JsonDeserialize(using = TrimmedStringDeserializer.class)
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The version may only contain printable characters")
private String version;
Expand All @@ -153,13 +153,13 @@ public enum FetchGroup {
private Classifier classifier;

@Persistent
@Column(name = "FILENAME")
@Column(name = "FILENAME", jdbcType = "CLOB")
@JsonDeserialize(using = TrimmedStringDeserializer.class)
@Pattern(regexp = RegexSequence.Definition.FS_DIRECTORY_NAME, message = "The specified filename is not valid and cannot be used as a filename")
private String filename;

@Persistent
@Column(name = "EXTENSION")
@Column(name = "EXTENSION", jdbcType = "CLOB")
@JsonDeserialize(using = TrimmedStringDeserializer.class)
@Pattern(regexp = RegexSequence.Definition.FS_FILE_NAME, message = "The specified filename extension is not valid and cannot be used as a extension")
private String extension;
Expand Down Expand Up @@ -238,26 +238,27 @@ public enum FetchGroup {

@Persistent
@Index(name = "COMPONENT_CPE_IDX")
@Column(name = "CPE")
@Column(name = "CPE", jdbcType = "CLOB")
//Patterns obtained from https://csrc.nist.gov/schema/cpe/2.3/cpe-naming_2.3.xsd
@Pattern(regexp = "(cpe:2\\.3:[aho\\*\\-](:(((\\?*|\\*?)([a-zA-Z0-9\\-\\._]|(\\\\[\\\\\\*\\?!\"#$$%&'\\(\\)\\+,/:;<=>@\\[\\]\\^`\\{\\|}~]))+(\\?*|\\*?))|[\\*\\-])){5}(:(([a-zA-Z]{2,3}(-([a-zA-Z]{2}|[0-9]{3}))?)|[\\*\\-]))(:(((\\?*|\\*?)([a-zA-Z0-9\\-\\._]|(\\\\[\\\\\\*\\?!\"#$$%&'\\(\\)\\+,/:;<=>@\\[\\]\\^`\\{\\|}~]))+(\\?*|\\*?))|[\\*\\-])){4})|([c][pP][eE]:/[AHOaho]?(:[A-Za-z0-9\\._\\-~%]*){0,6})", message = "The CPE must conform to the CPE v2.2 or v2.3 specification defined by NIST")
private String cpe;

@Persistent(defaultFetchGroup = "true")
@Index(name = "COMPONENT_PURL_IDX")
@Column(name = "PURL")
@Column(name = "PURL", jdbcType = "CLOB")
@com.github.packageurl.validator.PackageURL
@JsonDeserialize(using = TrimmedStringDeserializer.class)
private String purl;

@Persistent(defaultFetchGroup = "true")
@Index(name = "COMPONENT_PURL_COORDINATES_IDX")
@Column(name = "PURLCOORDINATES", jdbcType = "CLOB")
@com.github.packageurl.validator.PackageURL
@JsonDeserialize(using = TrimmedStringDeserializer.class)
private String purlCoordinates; // Field should contain only type, namespace, name, and version. Everything up to the qualifiers

@Persistent
@Column(name = "SWIDTAGID")
@Column(name = "SWIDTAGID", jdbcType = "CLOB")
@Index(name = "COMPONENT_SWID_TAGID_IDX")
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The SWID tagId may only contain printable characters")
private String swidTagId;
Expand All @@ -268,19 +269,19 @@ public enum FetchGroup {
private Boolean internal;

@Persistent
@Column(name = "DESCRIPTION")
@Column(name = "DESCRIPTION", jdbcType = "CLOB")
@JsonDeserialize(using = TrimmedStringDeserializer.class)
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The description may only contain printable characters")
private String description;

@Persistent
@Column(name = "COPYRIGHT")
@Column(name = "COPYRIGHT", jdbcType = "CLOB")
@JsonDeserialize(using = TrimmedStringDeserializer.class)
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The copyright may only contain printable characters")
private String copyright;

@Persistent
@Column(name = "LICENSE")
@Column(name = "LICENSE", jdbcType = "CLOB")
@JsonDeserialize(using = TrimmedStringDeserializer.class)
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The license may only contain printable characters")
private String license;
Expand All @@ -292,7 +293,7 @@ public enum FetchGroup {
private String licenseExpression;

@Persistent
@Column(name = "LICENSE_URL")
@Column(name = "LICENSE_URL", jdbcType = "CLOB")
@JsonDeserialize(using = TrimmedStringDeserializer.class)
@Pattern(regexp = RegexSequence.Definition.URL, message = "The license URL must be a valid URL")
private String licenseUrl;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/dependencytrack/model/Cwe.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class Cwe implements Serializable {
private int cweId;

@Persistent
@Column(name = "NAME", allowsNull = "false")
@Column(name = "NAME", allowsNull = "false", jdbcType = "CLOB")
@NotNull
@JsonDeserialize(using = TrimmedStringDeserializer.class)
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The name may only contain printable characters")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ public class FindingAttribution implements Serializable {
private Vulnerability vulnerability;

@Persistent
@Column(name = "ALT_ID", allowsNull = "true")
@Column(name = "ALT_ID", allowsNull = "true", jdbcType = "CLOB")
private String alternateIdentifier;

@Persistent
@Column(name = "REFERENCE_URL", allowsNull = "true")
@Column(name = "REFERENCE_URL", allowsNull = "true", jdbcType = "CLOB")
private String referenceUrl;

@Persistent(customValueStrategy = "uuid")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void setSha512(String sha512) {
private String sha512;

@Persistent
@Column(name = "PURL", allowsNull = "false")
@Column(name = "PURL", allowsNull = "false", jdbcType = "CLOB")
@Index(name = "PURL_IDX")
@com.github.packageurl.validator.PackageURL
@JsonDeserialize(using = TrimmedStringDeserializer.class)
Expand All @@ -100,7 +100,7 @@ public void setSha512(String sha512) {
private FetchStatus status;

@Persistent
@Column(name = "REPOSITORY_URL")
@Column(name = "REPOSITORY_URL", jdbcType = "CLOB")
private String repositoryUrl;


Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/dependencytrack/model/License.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public enum FetchGroup {
* The String representation of the license name (i.e. Apache License 2.0).
*/
@Persistent(defaultFetchGroup = "true")
@Column(name = "NAME", allowsNull = "false")
@Column(name = "NAME", allowsNull = "false", jdbcType = "CLOB")
@Index(name = "LICENSE_NAME_IDX")
@JsonProperty(value = "name")
@NotBlank
Expand Down Expand Up @@ -149,7 +149,7 @@ public enum FetchGroup {
* The SPDX defined licenseId (i.e. Apache-2.0).
*/
@Persistent(defaultFetchGroup = "true")
@Column(name = "LICENSEID")
@Column(name = "LICENSEID", jdbcType = "CLOB")
@Index(name = "LICENSE_LICENSEID_IDX", unique = "true")
@JsonProperty(value = "licenseId")
@JsonAlias(value = "licenseExceptionId")
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/dependencytrack/model/LicenseGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class LicenseGroup implements Serializable {
* The String representation of the license group name (i.e. Copyleft).
*/
@Persistent
@Column(name = "NAME", allowsNull = "false")
@Column(name = "NAME", allowsNull = "false", jdbcType = "CLOB")
@Index(name = "LICENSEGROUP_NAME_IDX")
@NotBlank
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The name may only contain printable characters")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ public enum FetchGroup {
private long id;

@Persistent(defaultFetchGroup = "true")
@Column(name = "NAME", allowsNull = "false")
@Column(name = "NAME", allowsNull = "false", jdbcType = "CLOB")
@NotBlank
@JsonDeserialize(using = TrimmedStringDeserializer.class)
private String name;

@Persistent(defaultFetchGroup = "true")
@Column(name = "DESCRIPTION")
@Column(name = "DESCRIPTION", jdbcType = "CLOB")
@JsonDeserialize(using = TrimmedStringDeserializer.class)
private String description;

@Persistent(defaultFetchGroup = "true")
@Column(name = "PUBLISHER_CLASS", allowsNull = "false")
@Column(name = "PUBLISHER_CLASS", allowsNull = "false", jdbcType = "CLOB")
@NotBlank
@JsonDeserialize(using = TrimmedStringDeserializer.class)
private String publisherClass;
Expand All @@ -94,7 +94,7 @@ public enum FetchGroup {
private String template;

@Persistent(defaultFetchGroup = "true")
@Column(name = "TEMPLATE_MIME_TYPE", allowsNull = "false")
@Column(name = "TEMPLATE_MIME_TYPE", allowsNull = "false", jdbcType = "CLOB")
@NotBlank
@JsonDeserialize(using = TrimmedStringDeserializer.class)
private String templateMimeType;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/dependencytrack/model/NotificationRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class NotificationRule implements Serializable {
* The String representation of the name of the notification.
*/
@Persistent
@Column(name = "NAME", allowsNull = "false")
@Column(name = "NAME", allowsNull = "false", jdbcType = "CLOB")
@NotBlank
@JsonDeserialize(using = TrimmedStringDeserializer.class)
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The name may only contain printable characters")
Expand Down Expand Up @@ -121,11 +121,11 @@ public class NotificationRule implements Serializable {
private List<Team> teams;

@Persistent
@Column(name = "NOTIFY_ON")
@Column(name = "NOTIFY_ON", jdbcType = "CLOB")
private String notifyOn;

@Persistent
@Column(name = "MESSAGE")
@Column(name = "MESSAGE", jdbcType = "CLOB")
@JsonDeserialize(using = TrimmedStringDeserializer.class)
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The message may only contain printable characters")
private String message;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/dependencytrack/model/Policy.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public enum ViolationState {
* The String representation of the policy name.
*/
@Persistent
@Column(name = "NAME", allowsNull = "false")
@Column(name = "NAME", allowsNull = "false", jdbcType = "CLOB")
@Index(name = "POLICY_NAME_IDX")
@NotBlank
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The name may only contain printable characters")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public enum Type {
private Date timestamp;

@Persistent
@Column(name = "TEXT")
@Column(name = "TEXT", jdbcType = "CLOB")
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The text may only contain printable characters")
private String text;

Expand Down
20 changes: 10 additions & 10 deletions src/main/java/org/dependencytrack/model/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ public enum FetchGroup {
private long id;

@Persistent
@Column(name = "AUTHOR")
@Column(name = "AUTHOR", jdbcType = "CLOB")
@JsonDeserialize(using = TrimmedStringDeserializer.class)
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The author may only contain printable characters")
private String author;

@Persistent
@Column(name = "PUBLISHER")
@Column(name = "PUBLISHER", jdbcType = "CLOB")
@JsonDeserialize(using = TrimmedStringDeserializer.class)
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The publisher may only contain printable characters")
private String publisher;
Expand All @@ -163,29 +163,29 @@ public enum FetchGroup {
private OrganizationalEntity supplier;

@Persistent
@Column(name = "GROUP")
@Column(name = "GROUP", jdbcType = "CLOB")
@Index(name = "PROJECT_GROUP_IDX")
@JsonDeserialize(using = TrimmedStringDeserializer.class)
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The group may only contain printable characters")
private String group;

@Persistent
@Index(name = "PROJECT_NAME_IDX")
@Column(name = "NAME", allowsNull = "false")
@Column(name = "NAME", allowsNull = "false", jdbcType = "CLOB")
@NotBlank
@JsonDeserialize(using = TrimmedStringDeserializer.class)
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The name may only contain printable characters")
private String name;

@Persistent
@Column(name = "DESCRIPTION")
@Column(name = "DESCRIPTION", jdbcType = "CLOB")
@JsonDeserialize(using = TrimmedStringDeserializer.class)
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The description may only contain printable characters")
private String description;

@Persistent
@Index(name = "PROJECT_VERSION_IDX")
@Column(name = "VERSION")
@Column(name = "VERSION", jdbcType = "CLOB")
@JsonDeserialize(using = TrimmedStringDeserializer.class)
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The version may only contain printable characters")
private String version;
Expand All @@ -198,22 +198,22 @@ public enum FetchGroup {

@Persistent
@Index(name = "PROJECT_CPE_IDX")
@Column(name = "CPE")
@Column(name = "CPE", jdbcType = "CLOB")
@JsonDeserialize(using = TrimmedStringDeserializer.class)
//Patterns obtained from https://csrc.nist.gov/schema/cpe/2.3/cpe-naming_2.3.xsd
@Pattern(regexp = "(cpe:2\\.3:[aho\\*\\-](:(((\\?*|\\*?)([a-zA-Z0-9\\-\\._]|(\\\\[\\\\\\*\\?!\"#$$%&'\\(\\)\\+,/:;<=>@\\[\\]\\^`\\{\\|}~]))+(\\?*|\\*?))|[\\*\\-])){5}(:(([a-zA-Z]{2,3}(-([a-zA-Z]{2}|[0-9]{3}))?)|[\\*\\-]))(:(((\\?*|\\*?)([a-zA-Z0-9\\-\\._]|(\\\\[\\\\\\*\\?!\"#$$%&'\\(\\)\\+,/:;<=>@\\[\\]\\^`\\{\\|}~]))+(\\?*|\\*?))|[\\*\\-])){4})|([c][pP][eE]:/[AHOaho]?(:[A-Za-z0-9\\._\\-~%]*){0,6})", message = "The CPE must conform to the CPE v2.2 or v2.3 specification defined by NIST")
private String cpe;

@Persistent
@Index(name = "PROJECT_PURL_IDX")
@Column(name = "PURL")
@Column(name = "PURL", jdbcType = "CLOB")
@com.github.packageurl.validator.PackageURL
@JsonDeserialize(using = TrimmedStringDeserializer.class)
private String purl;

@Persistent
@Index(name = "PROJECT_SWID_TAGID_IDX")
@Column(name = "SWIDTAGID")
@Column(name = "SWIDTAGID", jdbcType = "CLOB")
@JsonDeserialize(using = TrimmedStringDeserializer.class)
@Pattern(regexp = RegexSequence.Definition.PRINTABLE_CHARS, message = "The SWID tagId may only contain printable characters")
private String swidTagId;
Expand Down Expand Up @@ -260,7 +260,7 @@ public enum FetchGroup {
*/
@Persistent
@Index(name = "PROJECT_LASTBOMIMPORT_FORMAT_IDX")
@Column(name = "LAST_BOM_IMPORTED_FORMAT")
@Column(name = "LAST_BOM_IMPORTED_FORMAT", jdbcType = "CLOB")
private String lastBomImportFormat;

/**
Expand Down
Loading

0 comments on commit 5ac15fd

Please sign in to comment.