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

openmrs / openmrs-core / 13853363634

14 Mar 2025 09:10AM UTC coverage: 65.081% (+0.1%) from 64.959%
13853363634

push

github

web-flow
TRUNK-6304 Refactor code to use Storage Service (#4944)

* TRUNK-6300 Add Storage Service

* TRUNK-6304 Refactor code to use Storage Service

319 of 401 new or added lines in 13 files covered. (79.55%)

17 existing lines in 4 files now uncovered.

23407 of 35966 relevant lines covered (65.08%)

0.65 hits per line

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

72.97
/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 {
22
        private Map<String, String> customMetadata = new HashMap<>();
1✔
23
        private Long length;
24
        private String mimeType;
25
        private String filename;
26
        private Instant creationTime;
27
        
28
        public ObjectMetadata() {}
1✔
29

30
        public ObjectMetadata(Long length, String mimeType, String filename, Instant creationTime, 
31
                                                  Map<String, String> customMetadata) {
32
                this();
1✔
33
                this.length = length;
1✔
34
                this.mimeType = mimeType;
1✔
35
                this.filename = filename;
1✔
36
                this.creationTime = creationTime;
1✔
37
                this.customMetadata = customMetadata;
1✔
38
        }
1✔
39
        
40
        public static ObjectMetadata.Builder builder() {
41
                return new ObjectMetadata.Builder();
1✔
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() {
59
                return length;
1✔
60
        }
61

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

66
        /**
67
         * @return mime type e.g. image/png
68
         */
69
        public String getMimeType() {
70
                return mimeType;
1✔
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() {
81
                return filename;
1✔
82
        }
83

84
        public void setFilename(String filename) {
85
                this.filename = filename;
1✔
86
        }
1✔
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

99
        public static class Builder {
1✔
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) {
107
                        this.length = length;
1✔
108
                        return this;
1✔
109
                }
110

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

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

121
                public Builder setCreationTime(Instant creationTime) {
122
                        this.creationTime = creationTime;
1✔
123
                        return this;
1✔
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() {
132
                        return new ObjectMetadata(length, mimeType, filename, creationTime, customMetadata);
1✔
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