Tabnine Logo
AdministrationService.getGlobalProperty
Code IndexAdd Tabnine to your IDE (free)

How to use
getGlobalProperty
method
in
org.openmrs.api.AdministrationService

Best Java code snippets using org.openmrs.api.AdministrationService.getGlobalProperty (Showing top 20 results out of 315)

origin: openmrs/openmrs-core

  @Override
  public String getDefaultLayoutFormat() {
    String ret = Context.getAdministrationService().getGlobalProperty("layout.name.format");
    return (ret != null && ret.length() > 0) ? ret : defaultLayoutFormat;
  }
}
origin: openmrs/openmrs-core

public void purgeGlobalProperty(String propertyName) {
  GlobalProperty globalProperty = administrationService.getGlobalPropertyObject(propertyName);
  
  if (globalProperty != null) {
    administrationService.purgeGlobalProperty(globalProperty);
  }
  Assert.assertNull(administrationService.getGlobalProperty(propertyName));
}

origin: openmrs/openmrs-core

/**
 * @return the validTime for which the password reset activation key will be valid
 */
private int getValidTime() {
  String validTimeGp = Context.getAdministrationService()
      .getGlobalProperty(OpenmrsConstants.GP_PASSWORD_RESET_VALIDTIME);
  final int validTime = StringUtils.isBlank(validTimeGp) ? DEFAULT_VALID_TIME : Integer.parseInt(validTimeGp);
  //if valid time is less that a minute or greater than 12hrs reset valid time to 1 minutes else set it to the required time.
  return (validTime < MIN_VALID_TIME) || (validTime > MAX_VALID_TIME) ? DEFAULT_VALID_TIME : validTime;
}

origin: openmrs/openmrs-core

@Test
public void saveGlobalProperty_shouldOverwriteGlobalPropertyIfExists() {
  executeDataSet(ADMIN_INITIAL_DATA_XML);
  
  GlobalProperty gp = adminService.getGlobalPropertyObject("a_valid_gp_key");
  assertEquals("correct-value", gp.getPropertyValue());
  gp.setPropertyValue("new-even-more-correct-value");
  adminService.saveGlobalProperty(gp);
  assertEquals("new-even-more-correct-value", adminService.getGlobalProperty("a_valid_gp_key"));
}

origin: openmrs/openmrs-core

/**
 * @see org.openmrs.api.EncounterService#checkIfEncounterTypesAreLocked()
 */
@Override
@Transactional(readOnly = true)
public void checkIfEncounterTypesAreLocked() {
  String locked = Context.getAdministrationService().getGlobalProperty(
    OpenmrsConstants.GLOBAL_PROPERTY_ENCOUNTER_TYPES_LOCKED, "false");
  if (Boolean.valueOf(locked)) {
    throw new EncounterTypeLockedException();
  }
}

origin: openmrs/openmrs-core

/**
 * Returns the location of the OpenMRS log file.
 * 
 * @return the path to the OpenMRS log file
 * @since 1.9.2
 */
public static String getOpenmrsLogLocation() {
  String logPathGP = Context.getAdministrationService().getGlobalProperty(OpenmrsConstants.GP_LOG_LOCATION, "");
  File logPath = OpenmrsUtil.getDirectoryInApplicationDataDirectory(logPathGP);
  
  File logFile = new File(logPath, "openmrs.log");
  return logFile.getPath();
}

origin: openmrs/openmrs-core

@Override
public void checkIfFormsAreLocked() {
  String locked = Context.getAdministrationService().getGlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_FORMS_LOCKED,
    "false");
  if (Boolean.valueOf(locked)) {
    throw new FormsLockedException();
  }
}

origin: openmrs/openmrs-core

  @Override
  public void checkIfPersonAttributeTypesAreLocked() {
    String locked = Context.getAdministrationService()
        .getGlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_PERSON_ATRIBUTE_TYPES_LOCKED, "false");
    if (Boolean.valueOf(locked)) {
      throw new PersonAttributeTypeLockedException();
    }
  }
}
origin: openmrs/openmrs-core

  /**
   * @see org.openmrs.api.ProviderService#getUnknownProvider()
   */
  @Override
  @Transactional(readOnly = true)
  public Provider getUnknownProvider() {
    return getProviderByUuid(Context.getAdministrationService().getGlobalProperty(
      OpenmrsConstants.GP_UNKNOWN_PROVIDER_UUID));
  }
}
origin: openmrs/openmrs-core

@Override
public Concept getNonCodedDrugConcept() {
  String conceptUuid = Context.getAdministrationService().getGlobalProperty(OpenmrsConstants.GP_DRUG_ORDER_DRUG_OTHER);
  if (StringUtils.hasText(conceptUuid)) {
    return Context.getConceptService().getConceptByUuid(conceptUuid);
  }
  return null;
}

origin: openmrs/openmrs-core

  private List<Concept> getSetMembersOfConceptSetFromGP(String globalProperty) {
    String conceptUuid = Context.getAdministrationService().getGlobalProperty(globalProperty);
    Concept concept = Context.getConceptService().getConceptByUuid(conceptUuid);
    if (concept != null && concept.getSet()) {
      return concept.getSetMembers();
    }
    return Collections.emptyList();
  }
}
origin: openmrs/openmrs-core

@Test
public void setGlobalProperty_shouldSaveAGlobalPropertyWhoseTypedValueIsHandledByACustomDatatype() {
  
  String newKey = "Flag";
  String initialValue = adminService.getGlobalProperty(newKey);
  assertNull(initialValue);
  
  adminService.setGlobalProperty(newKey, Boolean.FALSE.toString());
  assertEquals(adminService.getGlobalProperty("Flag"), "false");
  
}

origin: openmrs/openmrs-core

@Test
public void setGlobalProperty_shouldCreateGlobalPropertyInDatabase() {
  String newKey = "new_gp_key";
  
  String initialValue = adminService.getGlobalProperty(newKey);
  assertNull(initialValue); // ensure gp doesn't exist before test
  adminService.setGlobalProperty(newKey, "new_key");
  
  String newValue = adminService.getGlobalProperty(newKey);
  assertNotNull(newValue);
}

origin: openmrs/openmrs-core

@Test
public void getGlobalProperty_shouldGetPropertyInCaseInsensitiveWay() {
  executeDataSet("org/openmrs/api/include/AdministrationServiceTest-globalproperties.xml");
  
  // sanity check
  String orig = adminService.getGlobalProperty("another-global-property");
  assertEquals("anothervalue", orig);
  
  // try to get a global property with invalid case
  String noprop = adminService.getGlobalProperty("ANOTher-global-property");
  assertEquals(orig, noprop);
}

origin: openmrs/openmrs-core

@Before
public void initializeContext() throws APIException, IOException {
  mockStatic(Context.class);
  when(Context.getAdministrationService()).thenReturn(administrationService);
  when(administrationService.getGlobalProperty(any())).thenReturn(complexObsTestFolder.newFolder().getAbsolutePath());
}

origin: openmrs/openmrs-core

@Test
public void getGlobalProperty_shouldGetPropertyValueGivenValidPropertyName() {
  // put the global property into the database
  executeDataSet("org/openmrs/api/include/AdministrationServiceTest-globalproperties.xml");
  
  String propertyValue = adminService.getGlobalProperty("a_valid_gp_key");
  
  assertEquals("correct-value", propertyValue);
}

origin: openmrs/openmrs-core

@Test
public void updateGlobalProperty_shouldUpdateAGlobalPropertyWhoseTypedvalueIsHandledByACustomDatatype() {
  GlobalProperty gp = new GlobalProperty();
  gp.setProperty("Flag");
  gp.setDatatypeClassname(BooleanDatatype.class.getName());
  gp.setValue(Boolean.FALSE);
  adminService.saveGlobalProperty(gp);
  assertEquals(adminService.getGlobalProperty("Flag"), "false");
  
  adminService.updateGlobalProperty("Flag", Boolean.TRUE.toString());
  assertEquals(adminService.getGlobalProperty("Flag"), "true");
}

origin: openmrs/openmrs-core

/**
 * @see LocaleUtility#getDefaultLocale()
 */
@Test
public void getDefaultLocale_shouldNotReturnNullIfGlobalPropertyDoesNotExist() {
  // sanity check
  Assert.assertNull(Context.getAdministrationService().getGlobalProperty(
    OpenmrsConstants.GLOBAL_PROPERTY_DEFAULT_LOCALE));
  
  // check for nonnullness
  Assert.assertNotNull(LocaleUtility.getDefaultLocale());
}

origin: openmrs/openmrs-core

@Test
public void saveGlobalProperty_shouldCreateGlobalPropertyInDatabase() {
  executeDataSet(ADMIN_INITIAL_DATA_XML);
  
  adminService.saveGlobalProperty(new GlobalProperty("detectHiddenSkill", "100"));
  assertNotNull(adminService.getGlobalProperty("detectHiddenSkill"));
}

origin: openmrs/openmrs-core

@Before
public void setup() {
  allergies = new Allergies();
  executeDataSet(ALLERGY_OTHER_NONCODED_TEST_DATASET);
  Allergen.setOtherNonCodedConceptUuid(Context.getAdministrationService().getGlobalProperty(
      OpenmrsConstants.GP_ALLERGEN_OTHER_NON_CODED_UUID));
}

org.openmrs.apiAdministrationServicegetGlobalProperty

Javadoc

Gets the global property that has the given propertyName.

If propertyName is not found in the list of Global Properties currently in the database, a null value is returned. This method should not have any authorization check.

Popular methods of AdministrationService

  • saveGlobalProperty
    Save the given global property to the database
  • getGlobalPropertyObject
    Gets the global property that has the given propertyName
  • getAllGlobalProperties
    Get a list of all global properties in the system
  • getAllowedLocales
    Gets the list of locales which the administrator has allowed for use on the system. This is specifie
  • executeSQL
    Runs the sql on the database. If selectOnly is flagged then any non-select sql statements will be re
  • getGlobalPropertiesByPrefix
    Gets all global properties that begin with prefix.
  • getGlobalPropertyByUuid
    Get a global property by its uuid. There should be only one of these in the database (well, in the w
  • getGlobalPropertyValue
    Returns a global property according to the type specified
  • purgeGlobalProperty
    Completely remove the given global property from the database
  • addGlobalPropertyListener
    Allows code to be notified when a global property is created/edited/deleted.
  • getSearchLocales
    Returns a list of locales used by the user when searching.
  • getSystemVariables
    Get a listing or important variables used in openmrs
  • getSearchLocales,
  • getSystemVariables,
  • setGlobalProperty,
  • setImplementationId,
  • validate,
  • getGlobalPropertiesBySuffix,
  • getImplementationId,
  • getMaximumPropertyLength,
  • getPresentationLocales

Popular in Java

  • Making http post requests using okhttp
  • setRequestProperty (URLConnection)
  • setContentView (Activity)
  • findViewById (Activity)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Collectors (java.util.stream)
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now