-
Notifications
You must be signed in to change notification settings - Fork 172
/
FetchedFile.java
153 lines (143 loc) · 3.77 KB
/
FetchedFile.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
package org.hl7.fhir.igtools.publisher;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.utilities.validation.ValidationMessage;
public class FetchedFile {
public final static int PROCESS_RESOURCE = 0;
public final static int PROCESS_XSLT = 1;
public final static int PROCESS_NONE = 2;
private String path;
private String relativePath;
private String name;
private String title;
private byte[] xslt;
private byte[] source;
private long hash;
private long time;
private String contentType;
private List<FetchedFile> dependencies;
private List<FetchedResource> resources = new ArrayList<FetchedResource>();
private List<ValidationMessage> errors = new ArrayList<ValidationMessage>();
private Bundle bundle;
private Map<String, String> valuesetsToLoad = new HashMap<String, String>();
private boolean folder;
private List<String> files; // if it's a folder
private int processMode;
private Set<String> outputNames = new HashSet<String>();
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getRelativePath() {
return relativePath;
}
public void setRelativePath(String relativePath) {
this.relativePath = relativePath;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public byte[] getXslt() {
return xslt;
}
public void setXslt(byte[] xslt) {
this.xslt = xslt;
}
public long getTime() {
return time;
}
public void setTime(long time) {
this.time = time;
}
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public List<FetchedFile> getDependencies() {
return dependencies;
}
public void setDependencies(List<FetchedFile> dependencies) {
this.dependencies = dependencies;
}
public long getHash() {
return hash;
}
public void setHash(long hash) {
this.hash = hash;
}
public byte[] getSource() {
if (source == null)
throw new Error("Source has been dropped");
return source;
}
public void setSource(byte[] source) {
this.source = source;
this.hash =Arrays.hashCode(source);
}
public void dropSource() {
source = null;
}
public List<FetchedResource> getResources() {
return resources;
}
public FetchedResource addResource() {
FetchedResource r = new FetchedResource();
resources.add(r);
return r;
}
public List<ValidationMessage> getErrors() {
return errors;
}
public Bundle getBundle() {
return bundle;
}
public void setBundle(Bundle bundle) {
this.bundle = bundle;
}
public Map<String, String> getValuesetsToLoad() {
return valuesetsToLoad;
}
public boolean isFolder() {
return folder;
}
public void setFolder(boolean folder) {
this.folder = folder;
}
public List<String> getFiles() {
if (files == null)
files = new ArrayList<String>();
return files;
}
public Set<String> getOutputNames() {
return outputNames;
}
public int getProcessMode() {
return processMode;
}
public void setProcessMode(int processMode) {
this.processMode = processMode;
}
public String getTitle() {
return title == null ? name : title;
}
public void setTitle(String title) {
this.title = title;
}
public boolean matches(FetchedFile other) {
return this.path.equals(other.path);
}
}