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

openmrs / openmrs-core / 14617411652

23 Apr 2025 11:50AM UTC coverage: 63.801% (+0.1%) from 63.69%
14617411652

push

github

rkorytkowski
TRUNK-6300 Add Storage Service

(cherry picked from commit 8a14c70a3)

137 of 227 new or added lines in 6 files covered. (60.35%)

1 existing line in 1 file now uncovered.

22160 of 34733 relevant lines covered (63.8%)

0.64 hits per line

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

0.0
/api/src/main/java/org/openmrs/api/storage/ObjectMetadata.java
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
3
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
4
 * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
5
 * the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
6
 *
7
 * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
8
 * graphic logo is a trademark of OpenMRS Inc.
9
 */
10
package org.openmrs.api.storage;
11

12
import java.time.Instant;
13
import java.util.HashMap;
14
import java.util.Map;
15

16
/**
17
 * Used to store and retrieve metadata.
18
 * 
19
 * @since 2.8.0, 2.7.4, 2.6.16, 2.5.15
20
 */
21
public class ObjectMetadata {
NEW
22
        private Map<String, String> customMetadata = new HashMap<>();
×
23
        private Long length;
24
        private String mimeType;
25
        private String filename;
26
        private Instant creationTime;
27
        
NEW
28
        public ObjectMetadata() {}
×
29

30
        public ObjectMetadata(Long length, String mimeType, String filename, Instant creationTime, 
31
                                                  Map<String, String> customMetadata) {
NEW
32
                this();
×
NEW
33
                this.length = length;
×
NEW
34
                this.mimeType = mimeType;
×
NEW
35
                this.filename = filename;
×
NEW
36
                this.creationTime = creationTime;
×
NEW
37
                this.customMetadata = customMetadata;
×
NEW
38
        }
×
39
        
40
        public static ObjectMetadata.Builder builder() {
NEW
41
                return new ObjectMetadata.Builder();
×
42
        }
43

44
        /**
45
         * @return custom metadata
46
         */
47
        public Map<String, String> getCustomMetadata() {
NEW
48
                return customMetadata;
×
49
        }
50

51
        public void setCustomMetadata(Map<String, String> customMetadata) {
NEW
52
                this.customMetadata = customMetadata;
×
NEW
53
        }
×
54

55
        /**
56
         * @return length in bytes
57
         */
58
        public Long getLength() {
NEW
59
                return length;
×
60
        }
61

62
        public void setLength(Long length) {
NEW
63
                this.length = length;
×
NEW
64
        }
×
65

66
        /**
67
         * @return mime type e.g. image/png
68
         */
69
        public String getMimeType() {
NEW
70
                return mimeType;
×
71
        }
72

73
        public void setMimeType(String mimeType) {
NEW
74
                this.mimeType = mimeType;
×
NEW
75
        }
×
76

77
        /**
78
         * @return file name with extension
79
         */
80
        public String getFilename() {
NEW
81
                return filename;
×
82
        }
83

84
        public void setFilename(String filename) {
NEW
85
                this.filename = filename;
×
NEW
86
        }
×
87

88
        /**
89
         * @return creation time
90
         */
91
        public Instant getCreationTime() {
NEW
92
                return creationTime;
×
93
        }
94

95
        public void setCreationTime(Instant creationTime) {
NEW
96
                this.creationTime = creationTime;
×
NEW
97
        }
×
98

NEW
99
        public static class Builder {
×
100
                private Long length;
101
                private String mimeType;
102
                private String filename;
103
                private Instant creationTime;
104
                private Map<String, String> customMetadata;
105

106
                public Builder setLength(Long length) {
NEW
107
                        this.length = length;
×
NEW
108
                        return this;
×
109
                }
110

111
                public Builder setMimeType(String mimeType) {
NEW
112
                        this.mimeType = mimeType;
×
NEW
113
                        return this;
×
114
                }
115

116
                public Builder setFilename(String filename) {
NEW
117
                        this.filename = filename;
×
NEW
118
                        return this;
×
119
                }
120

121
                public Builder setCreationTime(Instant creationTime) {
NEW
122
                        this.creationTime = creationTime;
×
NEW
123
                        return this;
×
124
                }
125
                
126
                public Builder setCustomMetadata(Map<String, String> customMetadata) {
NEW
127
                        this.customMetadata = customMetadata;
×
NEW
128
                        return this;
×
129
                }
130

131
                public ObjectMetadata build() {
NEW
132
                        return new ObjectMetadata(length, mimeType, filename, creationTime, customMetadata);
×
133
                }
134
        }
135
}
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

© 2026 Coveralls, Inc