• 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

88.89
/api/src/main/java/org/openmrs/api/storage/StorageServiceCondition.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.util.Map;
13

14
import org.slf4j.Logger;
15
import org.slf4j.LoggerFactory;
16
import org.springframework.beans.factory.annotation.Qualifier;
17
import org.springframework.context.annotation.Condition;
18
import org.springframework.context.annotation.ConditionContext;
19
import org.springframework.core.type.AnnotatedTypeMetadata;
20

21
/**
22
 * Allows to conditionally enable storage service based on "storage_type" property.
23
 * <p>
24
 * It enables "local" storage by default.
25
 * 
26
 * @since 2.8.0, 2.7.4, 2.6.16, 2.5.15
27
 */
28
public class StorageServiceCondition implements Condition {
1✔
29
        private static final Logger log = LoggerFactory.getLogger(StorageServiceCondition.class);
1✔
30
        
31
        @Override
32
        public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
33
                Map<String, Object> annotationAttributes = metadata.getAnnotationAttributes(Qualifier.class.getName());
1✔
34
                Object value = annotationAttributes != null ? annotationAttributes.get("value") : null;
1✔
35
                
36
                String storageType = context.getEnvironment().getProperty("storage_type", String.class, "local");
1✔
37
                if (value != null && storageType.equalsIgnoreCase(value.toString())) {
1✔
38
                        log.info("Selected storage type: {}", storageType);
1✔
39
                        return true;
1✔
40
                }
NEW
41
                return false;
×
42
        }
43
}
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