• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IQSS / dataverse / #23237

23 Sep 2024 03:40PM CUT coverage: 20.657%. First build
#23237

Pull #10781

github

pdurbin
Merge branch 'develop' into 10623-globus-improvements #10623
Pull Request #10781: Improved handling of Globus uploads

4 of 417 new or added lines in 15 files covered. (0.96%)

17604 of 85219 relevant lines covered (20.66%)

0.21 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/edu/harvard/iq/dataverse/ExternalFileUploadInProgress.java
1
package edu.harvard.iq.dataverse;
2

3
import jakarta.persistence.Column;
4
import jakarta.persistence.Index;
5
import jakarta.persistence.NamedQueries;
6
import jakarta.persistence.NamedQuery;
7
import jakarta.persistence.Table;
8
import java.io.Serializable;
9
import jakarta.persistence.Entity;
10
import jakarta.persistence.GeneratedValue;
11
import jakarta.persistence.GenerationType;
12
import jakarta.persistence.Id;
13

14
/**
15
 *
16
 * @author landreev
17
 * 
18
 * The name of the class is provisional. I'm open to better-sounding alternatives,
19
 * if anyone can think of any. 
20
 * But I wanted to avoid having the word "Globus" in the entity name. I'm adding 
21
 * it specifically for the Globus use case. But I'm guessing there's a chance 
22
 * this setup may come in handy for other types of datafile uploads that happen
23
 * externally. (?)
24
 */
25
@NamedQueries({
26
    @NamedQuery(name = "ExternalFileUploadInProgress.deleteByTaskId",
27
            query = "DELETE FROM ExternalFileUploadInProgress f WHERE f.taskId=:taskId"),
28
    @NamedQuery(name = "ExternalFileUploadInProgress.findByTaskId",
29
            query = "SELECT f FROM ExternalFileUploadInProgress f WHERE f.taskId=:taskId")})
30
@Entity
31
@Table(indexes = {@Index(columnList="taskid")})
32
public class ExternalFileUploadInProgress implements Serializable {
33

34
    private static final long serialVersionUID = 1L;
35
    @Id
36
    @GeneratedValue(strategy = GenerationType.IDENTITY)
37
    private Long id;
38

39
    public Long getId() {
NEW
40
        return id;
×
41
    }
42

43
    public void setId(Long id) {
NEW
44
        this.id = id;
×
NEW
45
    }
×
46
    
47
    /**
48
     * Rather than saving various individual fields defining the datafile, 
49
     * which would essentially replicate the DataFile table, we are simply 
50
     * storing the full json record as passed to the API here.  
51
     */
52
    @Column(columnDefinition = "TEXT", nullable=false)
53
    private String fileInfo;
54
    
55
    /**
56
     * This is Globus-specific task id associated with the upload in progress
57
     */  
58
    @Column(nullable=false)
59
    private String taskId; 
60
    
NEW
61
    public ExternalFileUploadInProgress() {
×
NEW
62
    }
×
63

NEW
64
    public ExternalFileUploadInProgress(String taskId, String fileInfo) {
×
NEW
65
        this.taskId = taskId;
×
NEW
66
        this.fileInfo = fileInfo;
×
NEW
67
    }
×
68
    
69
    public String getFileInfo() {
NEW
70
        return fileInfo;
×
71
    }
72
    
73
    public void setFileInfo(String fileInfo) {
NEW
74
        this.fileInfo = fileInfo;
×
NEW
75
    }
×
76
    
77
    public String getTaskId() {
NEW
78
        return taskId;
×
79
    }
80

81
    public void setTaskId(String taskId) {
NEW
82
        this.taskId = taskId;
×
NEW
83
    }
×
84
    
85
    @Override
86
    public int hashCode() {
NEW
87
        int hash = 0;
×
NEW
88
        hash += (id != null ? id.hashCode() : 0);
×
NEW
89
        return hash;
×
90
    }
91

92
    @Override
93
    public boolean equals(Object object) {
94
        // TODO: Warning - this method won't work in the case the id fields are not set
NEW
95
        if (!(object instanceof ExternalFileUploadInProgress)) {
×
NEW
96
            return false;
×
97
        }
NEW
98
        ExternalFileUploadInProgress other = (ExternalFileUploadInProgress) object;
×
NEW
99
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
×
NEW
100
            return false;
×
101
        }
NEW
102
        return true;
×
103
    }
104

105
    @Override
106
    public String toString() {
NEW
107
        return "edu.harvard.iq.dataverse.ExternalFileUploadInProgress[ id=" + id + " ]";
×
108
    }
109
    
110
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc