diff --git a/api/pom.xml b/api/pom.xml index 344a1286..d9143fa0 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -1,24 +1,11 @@ - - - 4.0.0 org.openmrs.module adminui - 1.7.0-SNAPSHOT + 2.0.0-SNAPSHOT adminui-api @@ -34,12 +21,6 @@ openmrs-api jar - - - org.openmrs.web - openmrs-web - jar - org.openmrs.api @@ -64,19 +45,19 @@ - - org.openmrs.module - providermanagement-api - - org.openmrs.module uiframework-api - org.openmrs.module - legacyui-omod + org.mockito + mockito-inline + + + + net.bytebuddy + byte-buddy diff --git a/api/src/main/java/org/openmrs/module/adminui/account/Account.java b/api/src/main/java/org/openmrs/module/adminui/account/Account.java index 92880734..bd911304 100644 --- a/api/src/main/java/org/openmrs/module/adminui/account/Account.java +++ b/api/src/main/java/org/openmrs/module/adminui/account/Account.java @@ -9,19 +9,9 @@ */ package org.openmrs.module.adminui.account; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - import org.openmrs.Auditable; import org.openmrs.Person; +import org.openmrs.PersonAttribute; import org.openmrs.PersonName; import org.openmrs.Provider; import org.openmrs.Role; @@ -29,9 +19,19 @@ import org.openmrs.api.APIException; import org.openmrs.api.context.Context; import org.openmrs.module.adminui.AdminUiConstants; +import org.openmrs.util.OpenmrsConstants; import org.openmrs.util.OpenmrsUtil; -import org.openmrs.web.user.UserProperties; -import org.openmrs.PersonAttribute; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; public class Account { @@ -209,7 +209,7 @@ public Date getDateChanged() { } public boolean isSupposedToChangePassword(User user) { - return new UserProperties(user.getUserProperties()).isSupposedToChangePassword(); + return Boolean.parseBoolean(user.getUserProperty(OpenmrsConstants.USER_PROPERTY_CHANGE_PASSWORD, "false")); } public String getPassword(User user) { diff --git a/api/src/main/java/org/openmrs/module/adminui/adminui.java b/api/src/main/java/org/openmrs/module/adminui/adminui.java deleted file mode 100644 index f8eedb08..00000000 --- a/api/src/main/java/org/openmrs/module/adminui/adminui.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public License, - * v. 2.0. If a copy of the MPL was not distributed with this file, You can - * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under - * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. - * - * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS - * graphic logo is a trademark of OpenMRS Inc. - */ -package org.openmrs.module.adminui; - -import java.io.Serializable; -import org.openmrs.BaseOpenmrsObject; -import org.openmrs.BaseOpenmrsMetadata; - -/** - * It is a model class. It should extend either {@link BaseOpenmrsObject} or {@link BaseOpenmrsMetadata}. - */ -public class adminui extends BaseOpenmrsObject implements Serializable { - - private static final long serialVersionUID = 1L; - - private Integer id; - - @Override - public Integer getId() { - return id; - } - - @Override - public void setId(Integer id) { - this.id = id; - } - -} \ No newline at end of file diff --git a/api/src/test/java/org/openmrs/module/adminui/TestUtils.java b/api/src/test/java/org/openmrs/module/adminui/TestUtils.java deleted file mode 100644 index ec2459ef..00000000 --- a/api/src/test/java/org/openmrs/module/adminui/TestUtils.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public License, - * v. 2.0. If a copy of the MPL was not distributed with this file, You can - * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under - * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. - * - * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS - * graphic logo is a trademark of OpenMRS Inc. - */ -package org.openmrs.module.adminui; - -import org.apache.commons.beanutils.PropertyUtils; -import org.hamcrest.Matcher; -import org.junit.Assert; -import org.mockito.ArgumentMatcher; -import org.openmrs.util.OpenmrsUtil; - -import java.util.Collection; - -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - -/** - * Various utils to help with testing - */ -public class TestUtils { - - /** - * To test things like: assertContainsElementWithProperty(listOfPatients, "patientId", 2) - * - * @param collection - * @param property - * @param value - */ - public static void assertContainsElementWithProperty(Collection collection, String property, Object value) { - for (Object o : collection) { - try { - if (OpenmrsUtil.nullSafeEquals(value, PropertyUtils.getProperty(o, property))) { - return; - } - } catch (Exception ex) { - // pass - } - } - Assert.fail("Collection does not contain an element with " + property + " = " + value + ". Collection: " - + collection); - } - - public static ArgumentMatcher isCollectionOfExactlyElementsWithProperties(final String property, - final Object... expectedPropertyValues) { - return new ArgumentMatcher() { - - @Override - public boolean matches(Object o) { - assertTrue(o instanceof Collection); - Collection actual = (Collection) o; - assertThat(actual.size(), is(expectedPropertyValues.length)); - for (Object expectedPropertyValue : expectedPropertyValues) { - assertContainsElementWithProperty(actual, property, expectedPropertyValue); - } - return true; - } - }; - } - - /** - * Creates an argument matcher that tests equality based on the equals method, the developer - * doesn't have to type cast the returned argument when pass it to - * {@link org.mockito.Mockito#argThat(org.hamcrest.Matcher)} as it would be the case if we used - * {@link org.mockito.internal.matchers.Equals} matcher - * - * @param object - * @return Matcher - */ - @SuppressWarnings("unchecked") - public static Matcher equalsMatcher(final T object) { - return new ArgumentMatcher() { - - /** - * @see org.mockito.ArgumentMatcher#matches(Object) - */ - @Override - public boolean matches(Object arg) { - return OpenmrsUtil.nullSafeEquals(object, (T) arg); - } - }; - } -} diff --git a/api/src/test/java/org/openmrs/module/adminui/account/AccountServiceComponentTest.java b/api/src/test/java/org/openmrs/module/adminui/account/AccountServiceComponentTest.java index 66a68d4e..6c9df5e5 100644 --- a/api/src/test/java/org/openmrs/module/adminui/account/AccountServiceComponentTest.java +++ b/api/src/test/java/org/openmrs/module/adminui/account/AccountServiceComponentTest.java @@ -9,31 +9,26 @@ */ package org.openmrs.module.adminui.account; -import static org.junit.Assert.assertNotNull; - -import org.junit.Before; import org.junit.Test; +import org.openmrs.Provider; import org.openmrs.User; +import org.openmrs.api.ProviderService; import org.openmrs.api.UserService; -import org.openmrs.api.context.Context; -import org.openmrs.module.providermanagement.Provider; -import org.openmrs.module.providermanagement.api.ProviderManagementService; import org.openmrs.test.BaseModuleContextSensitiveTest; +import org.springframework.beans.factory.annotation.Autowired; + +import static org.junit.Assert.assertNotNull; public class AccountServiceComponentTest extends BaseModuleContextSensitiveTest { - + + @Autowired private AccountService accountService; - + + @Autowired private UserService userService; - - private ProviderManagementService providerManagementService; - - @Before - public void setup() { - userService = Context.getUserService(); - accountService = Context.getService(AccountService.class); - providerManagementService = Context.getService(ProviderManagementService.class); - } + + @Autowired + private ProviderService providerService; /** * @verifies get all unique accounts @@ -48,7 +43,7 @@ public void saveAccount_shouldSaveNewAccountWithAProviderAndUserAccount() throws user.addRole(userService.getRole("Application Role: Archives"));//capability Provider provider = new Provider(); - provider.setProviderRole(providerManagementService.getProviderRole(1001)); + provider.setProviderRole(providerService.getProviderRole(1001)); Account account = new Account(null); account.setFamilyName("some"); account.setGivenName("tester"); diff --git a/api/src/test/java/org/openmrs/module/adminui/account/AccountServiceTest.java b/api/src/test/java/org/openmrs/module/adminui/account/AccountServiceTest.java index c8e98b6c..35851d35 100644 --- a/api/src/test/java/org/openmrs/module/adminui/account/AccountServiceTest.java +++ b/api/src/test/java/org/openmrs/module/adminui/account/AccountServiceTest.java @@ -9,17 +9,11 @@ */ package org.openmrs.module.adminui.account; -import static org.junit.Assert.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.Arrays; -import java.util.List; - +import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; +import org.mockito.MockedStatic; import org.openmrs.Person; import org.openmrs.Provider; import org.openmrs.Role; @@ -30,16 +24,14 @@ import org.openmrs.api.UserService; import org.openmrs.api.context.Context; import org.openmrs.module.adminui.AdminUiConstants; -import org.openmrs.module.adminui.TestUtils; -import org.openmrs.module.providermanagement.api.ProviderManagementService; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; -@RunWith(PowerMockRunner.class) -@PrepareForTest(Context.class) -@PowerMockIgnore("jdk.internal.reflect.*") +import java.util.Arrays; +import java.util.List; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.when; + public class AccountServiceTest { private AccountServiceImpl accountService; @@ -50,17 +42,16 @@ public class AccountServiceTest { private ProviderService providerService; - private ProviderManagementService providerManagementService; - private AdministrationService adminService; + + private MockedStatic context; @Before public void setup() { - PowerMockito.mockStatic(Context.class); + context = mockStatic(Context.class); userService = mock(UserService.class); personService = mock(PersonService.class); providerService = mock(ProviderService.class); - providerManagementService = mock(ProviderManagementService.class); adminService = mock(AdministrationService.class); accountService = new AccountServiceImpl(); @@ -71,7 +62,12 @@ public void setup() { when(Context.getUserService()).thenReturn(userService); when(Context.getProviderService()).thenReturn(providerService); } - + + @After + public void cleanup() { + context.close(); + } + /** * @verifies get all unique accounts * @see AccountService#getAllAccounts() @@ -117,14 +113,23 @@ public void getAllAccounts_shouldGetAllUniqueAccounts() throws Exception { @Test public void getAllCapabilities_shouldReturnAllRolesWithTheCapabilityPrefix() throws Exception { Role role1 = new Role(AdminUiConstants.ROLE_PREFIX_CAPABILITY + "role1"); - Role role3 = new Role("role2"); - Role role2 = new Role(AdminUiConstants.ROLE_PREFIX_CAPABILITY + "role3"); + Role role2 = new Role("role2"); + Role role3 = new Role(AdminUiConstants.ROLE_PREFIX_CAPABILITY + "role3"); when(userService.getAllRoles()).thenReturn(Arrays.asList(role1, role2, role3)); List capabilities = accountService.getAllCapabilities(); Assert.assertEquals(2, capabilities.size()); - assertThat(capabilities, TestUtils.isCollectionOfExactlyElementsWithProperties("role", - AdminUiConstants.ROLE_PREFIX_CAPABILITY + "role1", AdminUiConstants.ROLE_PREFIX_CAPABILITY + "role3")); + for (Role role : capabilities) { + if (role.equals(role1)) { + Assert.assertEquals(AdminUiConstants.ROLE_PREFIX_CAPABILITY + "role1", role.getRole()); + } + else if (role.equals(role3)) { + Assert.assertEquals(AdminUiConstants.ROLE_PREFIX_CAPABILITY + "role3", role.getRole()); + } + else { + Assert.fail("Unexpected role: " + role); + } + } } /** @@ -134,16 +139,23 @@ public void getAllCapabilities_shouldReturnAllRolesWithTheCapabilityPrefix() thr @Test public void getAllPrivilegeLevels_shouldReturnAllRolesWithThePrivilegeLevelPrefix() throws Exception { Role role1 = new Role(AdminUiConstants.ROLE_PREFIX_PRIVILEGE_LEVEL + "role1"); - Role role3 = new Role("role2"); - Role role2 = new Role(AdminUiConstants.ROLE_PREFIX_PRIVILEGE_LEVEL + "role3"); + Role role2 = new Role("role2"); + Role role3 = new Role(AdminUiConstants.ROLE_PREFIX_PRIVILEGE_LEVEL + "role3"); when(userService.getAllRoles()).thenReturn(Arrays.asList(role1, role2, role3)); List privilegeLevels = accountService.getAllPrivilegeLevels(); Assert.assertEquals(2, privilegeLevels.size()); - assertThat( - privilegeLevels, - TestUtils.isCollectionOfExactlyElementsWithProperties("role", AdminUiConstants.ROLE_PREFIX_PRIVILEGE_LEVEL - + "role1", AdminUiConstants.ROLE_PREFIX_PRIVILEGE_LEVEL + "role3")); + for (Role role : privilegeLevels) { + if (role.equals(role1)) { + Assert.assertEquals(AdminUiConstants.ROLE_PREFIX_PRIVILEGE_LEVEL + "role1", role.getRole()); + } + else if (role.equals(role3)) { + Assert.assertEquals(AdminUiConstants.ROLE_PREFIX_PRIVILEGE_LEVEL + "role3", role.getRole()); + } + else { + Assert.fail("Unexpected role: " + role); + } + } } } diff --git a/api/src/test/java/org/openmrs/module/adminui/account/AccountTest.java b/api/src/test/java/org/openmrs/module/adminui/account/AccountTest.java index 07f2e632..8984a7fd 100644 --- a/api/src/test/java/org/openmrs/module/adminui/account/AccountTest.java +++ b/api/src/test/java/org/openmrs/module/adminui/account/AccountTest.java @@ -10,19 +10,19 @@ package org.openmrs.module.adminui.account; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; - import org.junit.Test; import org.openmrs.Person; import org.openmrs.PersonName; import org.openmrs.Provider; import org.openmrs.User; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + public class AccountTest { private Account initializeNewAccount(Person person) { diff --git a/api/src/test/java/org/openmrs/module/adminui/account/AdminUiAccountValidatorTest.java b/api/src/test/java/org/openmrs/module/adminui/account/AdminUiAccountValidatorTest.java index d01e9194..fdf1aede 100644 --- a/api/src/test/java/org/openmrs/module/adminui/account/AdminUiAccountValidatorTest.java +++ b/api/src/test/java/org/openmrs/module/adminui/account/AdminUiAccountValidatorTest.java @@ -9,39 +9,41 @@ */ package org.openmrs.module.adminui.account; -import static org.powermock.api.mockito.PowerMockito.when; - +import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; +import org.mockito.MockedStatic; import org.mockito.Mockito; import org.openmrs.api.AdministrationService; import org.openmrs.api.context.Context; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; import org.springframework.validation.BindException; import org.springframework.validation.Errors; -@RunWith(PowerMockRunner.class) -@PrepareForTest(Context.class) -@PowerMockIgnore("jdk.internal.reflect.*") +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.when; + public class AdminUiAccountValidatorTest { private AdminUiAccountValidator validator; private AdministrationService adminService; + + private MockedStatic context; @Before public void setValidator() { - PowerMockito.mockStatic(Context.class); + context = mockStatic(Context.class); adminService = Mockito.mock(AdministrationService.class); when(Context.getAdministrationService()).thenReturn(adminService); validator = new AdminUiAccountValidator(); } + + @After + public void cleanup() { + context.close(); + } /** * @see AdminUiAccountValidator#validate(Object,org.springframework.validation.Errors) diff --git a/api/src/test/resources/TestingApplicationContext.xml b/api/src/test/resources/TestingApplicationContext.xml index 1acfa5ec..51cf8230 100644 --- a/api/src/test/resources/TestingApplicationContext.xml +++ b/api/src/test/resources/TestingApplicationContext.xml @@ -1,22 +1,12 @@ - - - + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> + @@ -25,8 +15,14 @@ - + + + + + org.openmrs + + \ No newline at end of file diff --git a/api/src/test/resources/accountComponentTestDataset.xml b/api/src/test/resources/accountComponentTestDataset.xml index f8a95663..0af49352 100644 --- a/api/src/test/resources/accountComponentTestDataset.xml +++ b/api/src/test/resources/accountComponentTestDataset.xml @@ -19,10 +19,10 @@ - - diff --git a/api/src/test/resources/test-hibernate.cfg.xml b/api/src/test/resources/test-hibernate.cfg.xml index c646bc77..660ebf26 100644 --- a/api/src/test/resources/test-hibernate.cfg.xml +++ b/api/src/test/resources/test-hibernate.cfg.xml @@ -18,7 +18,5 @@ - - diff --git a/omod/pom.xml b/omod/pom.xml index db5265a6..d035c269 100644 --- a/omod/pom.xml +++ b/omod/pom.xml @@ -18,7 +18,7 @@ org.openmrs.module adminui - 1.7.0-SNAPSHOT + 2.0.0-SNAPSHOT adminui-omod @@ -106,11 +106,6 @@ uiframework-api - - org.openmrs.module - providermanagement-api - - org.openmrs.module uicommons-omod @@ -151,6 +146,13 @@ gem provided + + + javax.servlet + javax.servlet-api + 4.0.1 + test + @@ -315,6 +317,14 @@ ${gem.home}/bin/compass compile ${basedir}/src/main/compass + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + diff --git a/omod/src/main/java/org/openmrs/module/adminui/fragment/controller/systemadmin/accounts/ProviderTabContentPaneFragmentController.java b/omod/src/main/java/org/openmrs/module/adminui/fragment/controller/systemadmin/accounts/ProviderTabContentPaneFragmentController.java index 01b96558..c36a0b96 100644 --- a/omod/src/main/java/org/openmrs/module/adminui/fragment/controller/systemadmin/accounts/ProviderTabContentPaneFragmentController.java +++ b/omod/src/main/java/org/openmrs/module/adminui/fragment/controller/systemadmin/accounts/ProviderTabContentPaneFragmentController.java @@ -9,13 +9,10 @@ */ package org.openmrs.module.adminui.fragment.controller.systemadmin.accounts; -import javax.servlet.http.HttpServletRequest; - import org.openmrs.OpenmrsObject; +import org.openmrs.Provider; import org.openmrs.api.PersonService; import org.openmrs.api.ProviderService; -import org.openmrs.module.providermanagement.Provider; -import org.openmrs.module.providermanagement.api.ProviderManagementService; import org.openmrs.ui.framework.UiUtils; import org.openmrs.ui.framework.annotation.BindParams; import org.openmrs.ui.framework.annotation.SpringBean; @@ -28,6 +25,8 @@ import org.springframework.validation.Errors; import org.springframework.web.bind.annotation.RequestParam; +import javax.servlet.http.HttpServletRequest; + @Controller public class ProviderTabContentPaneFragmentController { @@ -39,7 +38,6 @@ public FragmentActionResult process(@RequestParam(value = "uuid", required = fal @RequestParam(value = "reason", required = false) String reason, @SpringBean("personService") PersonService personService, @SpringBean("providerService") ProviderService providerService, - @SpringBean("providerManagementService") ProviderManagementService providerManagementService, HttpServletRequest request, UiUtils ui) { try { diff --git a/omod/src/main/java/org/openmrs/module/adminui/page/controller/systemadmin/accounts/AccountPageController.java b/omod/src/main/java/org/openmrs/module/adminui/page/controller/systemadmin/accounts/AccountPageController.java index 831c5324..b588755c 100644 --- a/omod/src/main/java/org/openmrs/module/adminui/page/controller/systemadmin/accounts/AccountPageController.java +++ b/omod/src/main/java/org/openmrs/module/adminui/page/controller/systemadmin/accounts/AccountPageController.java @@ -9,25 +9,22 @@ */ package org.openmrs.module.adminui.page.controller.systemadmin.accounts; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Collections; - -import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.codehaus.jackson.map.ObjectMapper; import org.openmrs.OpenmrsObject; import org.openmrs.Person; +import org.openmrs.PersonAttribute; +import org.openmrs.PersonAttributeType; import org.openmrs.PersonName; +import org.openmrs.Provider; +import org.openmrs.ProviderRole; import org.openmrs.Role; import org.openmrs.User; import org.openmrs.api.APIException; import org.openmrs.api.AdministrationService; +import org.openmrs.api.ProviderService; import org.openmrs.api.UserService; import org.openmrs.api.context.Context; import org.openmrs.messagesource.MessageSourceService; @@ -37,9 +34,6 @@ import org.openmrs.module.adminui.account.AdminUiAccountValidator; import org.openmrs.module.appframework.domain.Extension; import org.openmrs.module.appframework.service.AppFrameworkService; -import org.openmrs.module.providermanagement.Provider; -import org.openmrs.module.providermanagement.ProviderRole; -import org.openmrs.module.providermanagement.api.ProviderManagementService; import org.openmrs.module.uicommons.UiCommonsConstants; import org.openmrs.module.uicommons.util.InfoErrorMessageUtil; import org.openmrs.ui.framework.SimpleObject; @@ -53,8 +47,14 @@ import org.springframework.validation.Errors; import org.springframework.validation.ObjectError; import org.springframework.web.bind.annotation.RequestParam; -import org.openmrs.PersonAttributeType; -import org.openmrs.PersonAttribute; + +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; /** * This controller only handles requests to create a new account and doesn't support editing @@ -83,17 +83,17 @@ public Account getAccount(@RequestParam(value = "personId", required = false) Pe * @param model * @param account * @param accountService - * @param providerManagementService + * @param providerService */ public void get(PageModel model, @MethodParam("getAccount") Account account, @SpringBean("adminAccountService") AccountService accountService, @SpringBean("adminService") AdministrationService administrationService, - @SpringBean("providerManagementService") ProviderManagementService providerManagementService, + @SpringBean("providerService") ProviderService providerService, UiUtils uu, @SpringBean("appFrameworkService") AppFrameworkService appFrameworkService) throws IOException { - setModelAttributes(model, account, null, accountService, administrationService, providerManagementService, uu, appFrameworkService); + setModelAttributes(model, account, null, accountService, administrationService, providerService, uu, appFrameworkService); if (account.getPerson().getPersonId() == null) { setJsonFormData(model, account, null, uu); } @@ -104,7 +104,7 @@ public void get(PageModel model, @MethodParam("getAccount") Account account, * @param messageSourceService * @param accountService * @param administrationService - * @param providerManagementService + * @param providerService * @param accountValidator * @param model * @param request @@ -116,7 +116,7 @@ public String post(PageModel model, @MethodParam("getAccount") @BindParams Accou @SpringBean("adminAccountService") AccountService accountService, @SpringBean("adminService") AdministrationService administrationService, @SpringBean("adminUiAccountValidator") AdminUiAccountValidator accountValidator, - @SpringBean("providerManagementService") ProviderManagementService providerManagementService, + @SpringBean("providerService") ProviderService providerService, @SpringBean("appFrameworkService") AppFrameworkService appFrameworkService, HttpServletRequest request, UiUtils uu) throws IOException { @@ -131,7 +131,7 @@ public String post(PageModel model, @MethodParam("getAccount") @BindParams Accou String[] parameterValues = parameterMap.get(userPropertyName); if (parameterValues != null && parameterValues.length > 0) { String parameterValue; - if (userPropertyName == "locationUuid") { + if (userPropertyName.equalsIgnoreCase("locationUuid")) { parameterValue = String.join(",", parameterValues); } else { if (parameterValues.length > 1) { @@ -139,7 +139,7 @@ public String post(PageModel model, @MethodParam("getAccount") @BindParams Accou } parameterValue = parameterValues[0]; } - if (userPropertyName != null && parameterValue != null) { + if (parameterValue != null) { user.setUserProperty(userPropertyName, parameterValue); } } @@ -188,7 +188,7 @@ public String post(PageModel model, @MethodParam("getAccount") @BindParams Accou if (otherAccountData.getAddProviderAccount()) { Provider provider = new Provider(); provider.setIdentifier(request.getParameter("identifier")); - provider.setProviderRole(providerManagementService.getProviderRoleByUuid(request.getParameter("providerRole"))); + provider.setProviderRole(providerService.getProviderRoleByUuid(request.getParameter("providerRole"))); account.addProviderAccount(provider); } @@ -217,7 +217,7 @@ public String post(PageModel model, @MethodParam("getAccount") @BindParams Accou } setModelAttributes(model, account, otherAccountData, accountService, administrationService, - providerManagementService, uu, appFrameworkService); + providerService, uu, appFrameworkService); sendErrorMessage(errors, model, messageSourceService, request); @@ -231,7 +231,7 @@ public String post(PageModel model, @MethodParam("getAccount") @BindParams Accou public void setModelAttributes(PageModel model, Account account, OtherAccountData otherAccountData, AccountService accountService, AdministrationService administrationService, - ProviderManagementService providerManagementService, UiUtils uu, + ProviderService providerService, UiUtils uu, AppFrameworkService appFrameworkService) throws IOException { model.addAttribute("account", account); @@ -259,7 +259,7 @@ public void setModelAttributes(PageModel model, Account account, OtherAccountDat model.addAttribute("privilegeLevelPrefix", privilegeLevelPrefix); model.addAttribute("rolePrefix", rolePrefix); model.addAttribute("allowedLocales", administrationService.getAllowedLocales()); - List providerRoles = providerManagementService.getAllProviderRoles(false); + List providerRoles = providerService.getAllProviderRoles(false); model.addAttribute("providerRoles", providerRoles); List customPersonAttributeEditFragments = diff --git a/omod/src/main/resources/config.xml b/omod/src/main/resources/config.xml index 4a9a9f29..c17763a2 100644 --- a/omod/src/main/resources/config.xml +++ b/omod/src/main/resources/config.xml @@ -32,7 +32,6 @@ org.openmrs.module.appframework org.openmrs.module.uicommons org.openmrs.module.appui - org.openmrs.module.providermanagement org.openmrs.module.webservices.rest diff --git a/pom.xml b/pom.xml index 233a8b1c..67e58c29 100644 --- a/pom.xml +++ b/pom.xml @@ -1,22 +1,10 @@ - - 4.0.0 org.openmrs.module adminui - 1.7.0-SNAPSHOT + 2.0.0-SNAPSHOT pom Admin UI Module Administration Tools for the Reference Application @@ -49,13 +37,12 @@ - 2.0.0 + 2.8.2-SNAPSHOT UTF-8 2.1 1.7 3.9 2.9 - 2.5.0 2.16 1.16.0 @@ -125,14 +112,6 @@ ${appframeworkVersion} - - org.openmrs.module - providermanagement-api - ${providermanagementVersion} - jar - provided - - org.openmrs.module legacyui-omod @@ -149,7 +128,19 @@ provided + + org.mockito + mockito-inline + 3.12.4 + test + + + net.bytebuddy + byte-buddy + 1.17.4 + test + @@ -160,9 +151,10 @@ org.apache.maven.plugins maven-compiler-plugin + 3.14.1 - 1.7 - 1.7 + 8 + 8 @@ -192,47 +184,6 @@ - - - - com.mycila - license-maven-plugin - 3.0 - - -This Source Code Form is subject to the terms of the Mozilla Public License, -v. 2.0. If a copy of the MPL was not distributed with this file, You can -obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under -the terms of the Healthcare Disclaimer located at http://openmrs.org/license. - -Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS -graphic logo is a trademark of OpenMRS Inc. - - - **/*.java - **/*.txt - **/*.xml - - - .rubygems/** - .rubygems-provided/** - - release-scripts/** - - - - - - check - - validate - - - - @@ -308,7 +259,7 @@ graphic logo is a trademark of OpenMRS Inc. org.apache.maven.plugins maven-surefire-plugin - 3.2.2 + 3.5.4 --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED