Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngel Avila2015-09-23 22:58:38 +0000
committerAngel Avila2015-10-09 23:34:53 +0000
commit563e417f65cccbb9f3aa5bacf333437ee3fa5aad (patch)
tree7154135c3f62fb2df84e1994d0d2b9c4e5155a50
parent00878178c763d9dae76166f92462eff6672c5e30 (diff)
downloadorg.eclipse.osee-563e417f65cccbb9f3aa5bacf333437ee3fa5aad.tar.gz
org.eclipse.osee-563e417f65cccbb9f3aa5bacf333437ee3fa5aad.tar.xz
org.eclipse.osee-563e417f65cccbb9f3aa5bacf333437ee3fa5aad.zip
feature[ats_ATS209686]: Add OAuth protected resource at server root
-rw-r--r--plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/AccountAdminImplTest.java95
-rw-r--r--plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/AccountResolverTest.java14
-rw-r--r--plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/SubscriptionAdminImplTest.java38
-rw-r--r--plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/SubscriptionResolverTest.java24
-rw-r--r--plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/validator/UuidValidatorTest.java6
-rw-r--r--plugins/org.eclipse.osee.account.admin/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/Account.java2
-rw-r--r--plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/AccountAdmin.java6
-rw-r--r--plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/AccountField.java2
-rw-r--r--plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/SubscriptionAdmin.java6
-rw-r--r--plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/ds/AccountStorage.java12
-rw-r--r--plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/ds/SubscriptionStorage.java4
-rw-r--r--plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/AccountAdminImpl.java34
-rw-r--r--plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/AccountResolver.java4
-rw-r--r--plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/SubscriptionAdminImpl.java15
-rw-r--r--plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/SubscriptionResolver.java10
-rw-r--r--plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/validator/UuidValidator.java2
-rw-r--r--plugins/org.eclipse.osee.account.rest.model/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.osee.account.rest.model/src/org/eclipse/osee/account/rest/model/AccountUtil.java60
-rw-r--r--plugins/org.eclipse.osee.account.rest.model/src/org/eclipse/osee/account/rest/model/AccountWebPreferences.java79
-rw-r--r--plugins/org.eclipse.osee.account.rest.model/src/org/eclipse/osee/account/rest/model/Link.java57
-rw-r--r--plugins/org.eclipse.osee.account.rest.test/src/org/eclipse/osee/account/rest/internal/AccountOpsTest.java4
-rw-r--r--plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountOps.java33
-rw-r--r--plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountsResource.java21
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/web/legacy/js/userController.js2
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java1
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java14
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee11
-rw-r--r--plugins/org.eclipse.osee.http.jetty.test/.project28
-rw-r--r--plugins/org.eclipse.osee.jaxrs.server/OSGI-INF/root.app.xml7
-rw-r--r--plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/applications/OseeRootApplication.java46
-rw-r--r--plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/applications/OseeRootResource.java38
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsAccountStorageTest.java24
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsSubscriptionStorageTest.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/AccountArtifact.java10
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/AccountFactory.java10
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/BootstrapAccount.java6
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/OrcsAccountStorage.java34
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/OrcsSubscriptionStorage.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.script.dsl/xtend-gen/org/eclipse/osee/orcs/script/dsl/generator/OrcsScriptDslGenerator.java1
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/utility/OrcsUtil.java4
-rw-r--r--plugins/org.eclipse.osee.web.ui/src/dispo/js/userController.js2
-rw-r--r--plugins/org.eclipse.osee.web.ui/src/libs/js/oseeAuth/oseeAuth.js10
-rw-r--r--plugins/org.eclipse.osee.web.ui/src/osee/js/meController.js154
-rw-r--r--plugins/org.eclipse.osee.web.ui/src/osee/js/oseeApp.js25
-rw-r--r--plugins/org.eclipse.osee.web.ui/src/osee/ui/index.html6
-rw-r--r--plugins/org.eclipse.osee.web.ui/src/osee/views/me.html45
48 files changed, 856 insertions, 170 deletions
diff --git a/plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/AccountAdminImplTest.java b/plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/AccountAdminImplTest.java
index 7ee4611986..126bcb77cc 100644
--- a/plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/AccountAdminImplTest.java
+++ b/plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/AccountAdminImplTest.java
@@ -58,13 +58,13 @@ import org.mockito.Mockito;
/**
* Test Case for {@link AccountAdminImpl}
- *
+ *
* @author Roberto E. Escobar
*/
public class AccountAdminImplTest {
private static final long ID = 123121412L;
- private static final String UUID = GUID.create();
+ private static final String GUID_STRING = GUID.create();
private static final String USERNAME = "atest";
private static final String EMAIL = "atest@email.com";
private static final String NAME = "myName";
@@ -76,7 +76,7 @@ public class AccountAdminImplTest {
@Mock private Log logger;
@Mock private AccountStorage storage;
@Mock private AuthenticationAdmin authenticationAdmin;
-
+
@Mock private CreateAccountRequest request;
@Mock private Account account;
@Mock private AccountSession accountSession;
@@ -100,7 +100,7 @@ public class AccountAdminImplTest {
accountAdmin.setAuthenticationAdmin(authenticationAdmin);
accountAdmin.start(Collections.<String, Object> emptyMap());
- when(newAccount.getGuid()).thenReturn(UUID);
+ when(newAccount.getGuid()).thenReturn(GUID_STRING);
}
@Test
@@ -120,21 +120,21 @@ public class AccountAdminImplTest {
public void testGetById() {
accountAdmin.getAccountById(newAccount);
- verify(storage).getAccountByUuid(UUID);
+ verify(storage).getAccountByGuid(GUID_STRING);
}
@Test
- public void testGetAccountByUuidWithNull() {
+ public void testGetAccountByGuidWithNull() {
thrown.expect(OseeArgumentException.class);
- thrown.expectMessage("uuid cannot be null");
- accountAdmin.getAccountByUuid(null);
+ thrown.expectMessage("guid cannot be null");
+ accountAdmin.getAccountByGuid(null);
}
@Test
- public void testGetByUuiId() {
- accountAdmin.getAccountByUuid(UUID);
+ public void testGetByGuiId() {
+ accountAdmin.getAccountByGuid(GUID_STRING);
- verify(storage).getAccountByUuid(UUID);
+ verify(storage).getAccountByGuid(GUID_STRING);
}
@Test
@@ -189,15 +189,15 @@ public class AccountAdminImplTest {
@Test
public void testGetAccountPrefsByUuidWithNull() {
thrown.expect(OseeArgumentException.class);
- thrown.expectMessage("uuid cannot be null");
- accountAdmin.getAccountPreferencesByUuid(null);
+ thrown.expectMessage("guid cannot be null");
+ accountAdmin.getAccountPreferencesByGuid(null);
}
@Test
public void testGetAccountPrefsByUuid() {
- accountAdmin.getAccountPreferencesByUuid(UUID);
+ accountAdmin.getAccountPreferencesByGuid(GUID_STRING);
- verify(storage).getAccountPreferencesByUuid(UUID);
+ verify(storage).getAccountPreferencesByGuid(GUID_STRING);
}
@Test
@@ -211,7 +211,7 @@ public class AccountAdminImplTest {
public void testGetAccountPrefsById() {
accountAdmin.getAccountPreferencesById(newAccount);
- verify(storage).getAccountPreferencesByUuid(UUID);
+ verify(storage).getAccountPreferencesByGuid(GUID_STRING);
}
@Test
@@ -250,13 +250,13 @@ public class AccountAdminImplTest {
public void testSetActiveModified() {
ResultSet<Account> resultSet = ResultSets.singleton(account);
- when(storage.getAccountByUuid(UUID)).thenReturn(resultSet);
+ when(storage.getAccountByGuid(GUID_STRING)).thenReturn(resultSet);
when(account.isActive()).thenReturn(true);
boolean modified = accountAdmin.setActive(newAccount, false);
assertTrue(modified);
- verify(storage).getAccountByUuid(UUID);
+ verify(storage).getAccountByGuid(GUID_STRING);
verify(storage).setActive(account, false);
}
@@ -264,13 +264,13 @@ public class AccountAdminImplTest {
public void testSetActiveNotModified() {
ResultSet<Account> resultSet = ResultSets.singleton(account);
- when(storage.getAccountByUuid(UUID)).thenReturn(resultSet);
+ when(storage.getAccountByGuid(GUID_STRING)).thenReturn(resultSet);
when(account.isActive()).thenReturn(true);
boolean modified = accountAdmin.setActive(newAccount, true);
assertFalse(modified);
- verify(storage).getAccountByUuid(UUID);
+ verify(storage).getAccountByGuid(GUID_STRING);
verify(storage, times(0)).setActive(account, true);
}
@@ -285,12 +285,12 @@ public class AccountAdminImplTest {
public void testDeleteAccountIdModified() {
ResultSet<Account> resultSet = ResultSets.singleton(account);
- when(storage.getAccountByUuid(UUID)).thenReturn(resultSet);
+ when(storage.getAccountByGuid(GUID_STRING)).thenReturn(resultSet);
boolean modified = accountAdmin.deleteAccount(newAccount);
assertTrue(modified);
- verify(storage).getAccountByUuid(UUID);
+ verify(storage).getAccountByGuid(GUID_STRING);
verify(storage).deleteAccount(account);
}
@@ -299,7 +299,7 @@ public class AccountAdminImplTest {
@SuppressWarnings("unchecked")
ResultSet<Account> resultSet = Mockito.mock(ResultSet.class);
- when(storage.getAccountByUuid(UUID)).thenReturn(resultSet);
+ when(storage.getAccountByGuid(GUID_STRING)).thenReturn(resultSet);
when(resultSet.getOneOrNull()).thenReturn(null);
boolean modified = accountAdmin.deleteAccount(newAccount);
@@ -332,14 +332,14 @@ public class AccountAdminImplTest {
ResultSet<AccountPreferences> resultSet = ResultSets.singleton(preferences);
- when(storage.getAccountPreferencesByUuid(UUID)).thenReturn(resultSet);
+ when(storage.getAccountPreferencesByGuid(GUID_STRING)).thenReturn(resultSet);
when(preferences.asMap()).thenReturn(original);
boolean modified = accountAdmin.setAccountPreferences(newAccount, newMap);
assertTrue(modified);
verify(storage).setAccountPreferences(preferences, newMap);
- verify(storage).getAccountPreferencesByUuid(UUID);
+ verify(storage).getAccountPreferencesByGuid(GUID_STRING);
verify(preferences).asMap();
}
@@ -353,14 +353,14 @@ public class AccountAdminImplTest {
ResultSet<AccountPreferences> resultSet = ResultSets.singleton(preferences);
- when(storage.getAccountPreferencesByUuid(UUID)).thenReturn(resultSet);
+ when(storage.getAccountPreferencesByGuid(GUID_STRING)).thenReturn(resultSet);
when(preferences.asMap()).thenReturn(original);
boolean modified = accountAdmin.setAccountPreferences(newAccount, newMap);
assertFalse(modified);
verify(storage, times(0)).setAccountPreferences(newAccount, newMap);
- verify(storage).getAccountPreferencesByUuid(UUID);
+ verify(storage).getAccountPreferencesByGuid(GUID_STRING);
verify(preferences).asMap();
}
@@ -394,13 +394,13 @@ public class AccountAdminImplTest {
ResultSet<AccountPreferences> resultSet = ResultSets.singleton(preferences);
- when(storage.getAccountPreferencesByUuid(UUID)).thenReturn(resultSet);
+ when(storage.getAccountPreferencesByGuid(GUID_STRING)).thenReturn(resultSet);
when(preferences.asMap()).thenReturn(map);
boolean modified = accountAdmin.setAccountPreference(newAccount, "b", "123412");
assertTrue(modified);
- verify(storage).getAccountPreferencesByUuid(UUID);
+ verify(storage).getAccountPreferencesByGuid(GUID_STRING);
verify(storage).setAccountPreferences(eq(preferences), newPrefsCaptor.capture());
Map<String, String> actual = newPrefsCaptor.getValue();
@@ -419,13 +419,13 @@ public class AccountAdminImplTest {
ResultSet<AccountPreferences> resultSet = ResultSets.singleton(preferences);
- when(storage.getAccountPreferencesByUuid(UUID)).thenReturn(resultSet);
+ when(storage.getAccountPreferencesByGuid(GUID_STRING)).thenReturn(resultSet);
when(preferences.asMap()).thenReturn(map);
boolean modified = accountAdmin.setAccountPreference(newAccount, "b", "123412");
assertFalse(modified);
- verify(storage).getAccountPreferencesByUuid(UUID);
+ verify(storage).getAccountPreferencesByGuid(GUID_STRING);
verify(storage, times(0)).setAccountPreferences(eq(newAccount), anyMapOf(String.class, String.class));
}
@@ -452,13 +452,13 @@ public class AccountAdminImplTest {
ResultSet<AccountPreferences> resultSet = ResultSets.singleton(preferences);
- when(storage.getAccountPreferencesByUuid(UUID)).thenReturn(resultSet);
+ when(storage.getAccountPreferencesByGuid(GUID_STRING)).thenReturn(resultSet);
when(preferences.asMap()).thenReturn(map);
boolean modified = accountAdmin.deleteAccountPreference(newAccount, "b");
assertTrue(modified);
- verify(storage).getAccountPreferencesByUuid(UUID);
+ verify(storage).getAccountPreferencesByGuid(GUID_STRING);
verify(storage).setAccountPreferences(eq(preferences), newPrefsCaptor.capture());
Map<String, String> actual = newPrefsCaptor.getValue();
@@ -475,13 +475,13 @@ public class AccountAdminImplTest {
ResultSet<AccountPreferences> resultSet = ResultSets.singleton(preferences);
- when(storage.getAccountPreferencesByUuid(UUID)).thenReturn(resultSet);
+ when(storage.getAccountPreferencesByGuid(GUID_STRING)).thenReturn(resultSet);
when(preferences.asMap()).thenReturn(map);
boolean modified = accountAdmin.deleteAccountPreference(newAccount, "b");
assertFalse(modified);
- verify(storage).getAccountPreferencesByUuid(UUID);
+ verify(storage).getAccountPreferencesByGuid(GUID_STRING);
verify(storage, times(0)).setAccountPreferences(eq(newAccount), anyMapOf(String.class, String.class));
}
@@ -620,12 +620,12 @@ public class AccountAdminImplTest {
when(storage.getAccountByEmail(EMAIL)).thenReturn(resultSet);
AccountLoginRequest request = AccountLoginRequestBuilder.newBuilder()//
- .userName(userName)//
- .password(password)//
- .scheme(scheme)//
- .remoteAddress(remoteAddress)//
- .accessedBy(accessDetails)//
- .build();
+ .userName(userName)//
+ .password(password)//
+ .scheme(scheme)//
+ .remoteAddress(remoteAddress)//
+ .accessedBy(accessDetails)//
+ .build();
when(authenticationAdmin.authenticate(any(AuthenticationRequest.class))).thenReturn(authenticatedUser);
when(authenticatedUser.getName()).thenReturn(EMAIL);
@@ -635,7 +635,6 @@ public class AccountAdminImplTest {
accountAdmin.login(request);
verify(storage, times(0)).createAccountSession(anyString(), any(Account.class), anyString(), anyString());
-
verify(authenticationAdmin).authenticate(authenticationRequestCaptor.capture());
AuthenticationRequest authRequest = authenticationRequestCaptor.getValue();
@@ -661,12 +660,12 @@ public class AccountAdminImplTest {
when(authenticatedUser.getName()).thenReturn(EMAIL);
AccountLoginRequest request = AccountLoginRequestBuilder.newBuilder()//
- .userName(userName)//
- .password(password)//
- .scheme(scheme)//
- .remoteAddress(remoteAddress)//
- .accessedBy(accessDetails)//
- .build();
+ .userName(userName)//
+ .password(password)//
+ .scheme(scheme)//
+ .remoteAddress(remoteAddress)//
+ .accessedBy(accessDetails)//
+ .build();
AccountSession actual = accountAdmin.login(request);
assertEquals(session, actual);
diff --git a/plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/AccountResolverTest.java b/plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/AccountResolverTest.java
index 5cbedecb59..f3b3280663 100644
--- a/plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/AccountResolverTest.java
+++ b/plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/AccountResolverTest.java
@@ -34,7 +34,7 @@ import org.mockito.Mock;
/**
* Test Case for {@link AccountResolver}
- *
+ *
* @author Roberto E. Escobar
*/
public class AccountResolverTest {
@@ -145,7 +145,7 @@ public class AccountResolverTest {
verify(accountAdmin, times(0)).getAccountByEmail(anyString());
verify(accountAdmin, times(0)).getAccountById(anyLong());
- verify(accountAdmin, times(0)).getAccountByUuid(anyString());
+ verify(accountAdmin, times(0)).getAccountByGuid(anyString());
verify(accountAdmin, times(0)).getAccountByName(anyString());
verify(accountAdmin, times(0)).getAccountByUserName(anyString());
}
@@ -163,15 +163,15 @@ public class AccountResolverTest {
}
@Test
- public void testResolveAccountAsUuid() {
- when(validator.guessFormatType(TEST_VALUE)).thenReturn(AccountField.UUID);
- when(accountAdmin.getAccountByUuid(TEST_VALUE)).thenReturn(accountResult);
+ public void testResolveAccountAsGuid() {
+ when(validator.guessFormatType(TEST_VALUE)).thenReturn(AccountField.GUID);
+ when(accountAdmin.getAccountByGuid(TEST_VALUE)).thenReturn(accountResult);
ResultSet<Account> actual = resolver.resolveAccount(TEST_VALUE);
assertEquals(accountResult, actual);
verify(validator).guessFormatType(TEST_VALUE);
- verify(accountAdmin).getAccountByUuid(TEST_VALUE);
+ verify(accountAdmin).getAccountByGuid(TEST_VALUE);
}
@Test
@@ -183,7 +183,7 @@ public class AccountResolverTest {
verify(accountAdmin, times(0)).getAccountByEmail(anyString());
verify(accountAdmin, times(0)).getAccountById(anyLong());
- verify(accountAdmin, times(0)).getAccountByUuid(anyString());
+ verify(accountAdmin, times(0)).getAccountByGuid(anyString());
verify(accountAdmin, times(0)).getAccountByName(anyString());
verify(accountAdmin, times(0)).getAccountByUserName(anyString());
}
diff --git a/plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/SubscriptionAdminImplTest.java b/plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/SubscriptionAdminImplTest.java
index f8c8b57d15..cfbae7a1e4 100644
--- a/plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/SubscriptionAdminImplTest.java
+++ b/plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/SubscriptionAdminImplTest.java
@@ -42,13 +42,13 @@ import org.mockito.Mockito;
/**
* Test Case for {@link SubscriptionAdminImpl}
- *
+ *
* @author Roberto E. Escobar
*/
public class SubscriptionAdminImplTest {
private static final long ID = 123121412L;
- private static final String UUID = GUID.create();
+ private static final String GUID_STRING = GUID.create();
private static final String GROUP_NAME = "group-name";
private static final String EMAIL = "atest@email.com";
private static final long ACCOUNT_ID = 21231L;
@@ -61,7 +61,7 @@ public class SubscriptionAdminImplTest {
@Mock private Log logger;
@Mock private SubscriptionStorage storage;
@Mock private AccountAdmin accountManager;
-
+
@Mock private SubscriptionGroup group;
@Mock private Account account;
@Mock private Subscription subscription;
@@ -98,9 +98,9 @@ public class SubscriptionAdminImplTest {
@Test
public void testGetSubscription() {
- manager.getSubscription(UUID);
+ manager.getSubscription(GUID_STRING);
- verify(storage).getSubscription(UUID);
+ verify(storage).getSubscription(GUID_STRING);
}
@Test
@@ -123,14 +123,14 @@ public class SubscriptionAdminImplTest {
public void testGetSubscriptionGroupByUuidWithNull() {
thrown.expect(OseeArgumentException.class);
thrown.expectMessage("group uuid cannot be null");
- manager.getSubscriptionGroupByUuid(null);
+ manager.getSubscriptionGroupByGuid(null);
}
@Test
public void testGetSubscriptionGroupByUuiId() {
- manager.getSubscriptionGroupByUuid(UUID);
+ manager.getSubscriptionGroupByGuid(GUID_STRING);
- verify(storage).getSubscriptionGroupByUuid(UUID);
+ verify(storage).getSubscriptionGroupByGuid(GUID_STRING);
}
@Test
@@ -208,17 +208,17 @@ public class SubscriptionAdminImplTest {
}
@Test
- public void testGetMembersByUuidWithNull() {
+ public void testGetMembersByGuidWithNull() {
thrown.expect(OseeArgumentException.class);
thrown.expectMessage("uuid cannot be null");
- manager.getSubscriptionGroupMembersByUuid(null);
+ manager.getSubscriptionGroupMembersByGuid(null);
}
@Test
- public void testGetMembersByUuiId() {
- manager.getSubscriptionGroupMembersByUuid(UUID);
+ public void testGetMembersByGuiId() {
+ manager.getSubscriptionGroupMembersByGuid(GUID_STRING);
- verify(storage).getSubscriptionGroupMembersByUuid(UUID);
+ verify(storage).getSubscriptionGroupMembersByGuid(GUID_STRING);
}
@Test
@@ -256,25 +256,25 @@ public class SubscriptionAdminImplTest {
@Test
public void testSetSubscriptionActiveModified() {
- when(storage.getSubscription(UUID)).thenReturn(subscription);
+ when(storage.getSubscription(GUID_STRING)).thenReturn(subscription);
when(subscription.isActive()).thenReturn(true);
- boolean modified = manager.setSubscriptionActive(UUID, false);
+ boolean modified = manager.setSubscriptionActive(GUID_STRING, false);
assertTrue(modified);
- verify(storage).getSubscription(UUID);
+ verify(storage).getSubscription(GUID_STRING);
verify(storage).updateSubscription(ACCOUNT_ID, GROUP_ID, false);
}
@Test
public void testSetSubscriptionActiveNotModified() {
- when(storage.getSubscription(UUID)).thenReturn(subscription);
+ when(storage.getSubscription(GUID_STRING)).thenReturn(subscription);
when(subscription.isActive()).thenReturn(true);
- boolean modified = manager.setSubscriptionActive(UUID, true);
+ boolean modified = manager.setSubscriptionActive(GUID_STRING, true);
assertFalse(modified);
- verify(storage).getSubscription(UUID);
+ verify(storage).getSubscription(GUID_STRING);
verify(storage, times(0)).updateSubscription(ACCOUNT_ID, GROUP_ID, true);
}
diff --git a/plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/SubscriptionResolverTest.java b/plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/SubscriptionResolverTest.java
index a53e801879..3b8852e33a 100644
--- a/plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/SubscriptionResolverTest.java
+++ b/plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/SubscriptionResolverTest.java
@@ -34,7 +34,7 @@ import org.mockito.Mock;
/**
* Test Case for {@link SubscriptionResolver}
- *
+ *
* @author Roberto E. Escobar
*/
public class SubscriptionResolverTest {
@@ -49,10 +49,10 @@ public class SubscriptionResolverTest {
// @formatter:off
@Mock private Validator validator;
@Mock private SubscriptionAdmin manager;
-
+
@Mock private SubscriptionGroup group;
@Mock private ResultSet<SubscriptionGroup> groups;
-
+
@Mock private Account account;
@Mock private ResultSet<Account> members;
// @formatter:on
@@ -98,7 +98,7 @@ public class SubscriptionResolverTest {
verify(validator).guessFormatType(TEST_VALUE);
verify(manager, times(0)).getSubscriptionGroupByLocalId(anyLong());
- verify(manager, times(0)).getSubscriptionGroupByUuid(anyString());
+ verify(manager, times(0)).getSubscriptionGroupByGuid(anyString());
verify(manager, times(0)).getSubscriptionGroupByName(anyString());
}
@@ -116,14 +116,14 @@ public class SubscriptionResolverTest {
@Test
public void testResolveSubscriptionGroupAsUuid() {
- when(validator.guessFormatType(TEST_VALUE)).thenReturn(AccountField.UUID);
- when(manager.getSubscriptionGroupByUuid(TEST_VALUE)).thenReturn(groups);
+ when(validator.guessFormatType(TEST_VALUE)).thenReturn(AccountField.GUID);
+ when(manager.getSubscriptionGroupByGuid(TEST_VALUE)).thenReturn(groups);
ResultSet<SubscriptionGroup> actual = resolver.resolveSubscriptionGroup(TEST_VALUE);
assertEquals(groups, actual);
verify(validator).guessFormatType(TEST_VALUE);
- verify(manager).getSubscriptionGroupByUuid(TEST_VALUE);
+ verify(manager).getSubscriptionGroupByGuid(TEST_VALUE);
}
@Test
@@ -163,7 +163,7 @@ public class SubscriptionResolverTest {
verify(validator).guessFormatType(TEST_VALUE);
verify(manager, times(0)).getSubscriptionGroupMembersByLocalId(anyLong());
- verify(manager, times(0)).getSubscriptionGroupMembersByUuid(anyString());
+ verify(manager, times(0)).getSubscriptionGroupMembersByGuid(anyString());
verify(manager, times(0)).getSubscriptionGroupMembersByName(anyString());
}
@@ -180,15 +180,15 @@ public class SubscriptionResolverTest {
}
@Test
- public void testResolveMembersAsUuid() {
- when(validator.guessFormatType(TEST_VALUE)).thenReturn(AccountField.UUID);
- when(manager.getSubscriptionGroupMembersByUuid(TEST_VALUE)).thenReturn(members);
+ public void testResolveMembersAsGuid() {
+ when(validator.guessFormatType(TEST_VALUE)).thenReturn(AccountField.GUID);
+ when(manager.getSubscriptionGroupMembersByGuid(TEST_VALUE)).thenReturn(members);
ResultSet<Account> actual = resolver.resolveSubscriptionGroupMembersByGroupUniqueField(TEST_VALUE);
assertEquals(members, actual);
verify(validator).guessFormatType(TEST_VALUE);
- verify(manager).getSubscriptionGroupMembersByUuid(TEST_VALUE);
+ verify(manager).getSubscriptionGroupMembersByGuid(TEST_VALUE);
}
@Test
diff --git a/plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/validator/UuidValidatorTest.java b/plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/validator/UuidValidatorTest.java
index 0a5c9149c3..9829021106 100644
--- a/plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/validator/UuidValidatorTest.java
+++ b/plugins/org.eclipse.osee.account.admin.test/src/org/eclipse/osee/account/admin/internal/validator/UuidValidatorTest.java
@@ -20,11 +20,11 @@ import org.eclipse.osee.framework.jdk.core.util.GUID;
*/
public class UuidValidatorTest extends AbstractValidatorTest<UuidValidator> {
- private static final String VALID_UUID = GUID.create();
- private static final String INVALID_UUID = "12 31 asd";
+ private static final String VALID_GUID = GUID.create();
+ private static final String INVALID_GUID = "12 31 asd";
public UuidValidatorTest() {
- super(AccountField.UUID, VALID_UUID, INVALID_UUID);
+ super(AccountField.GUID, VALID_GUID, INVALID_GUID);
}
@Override
diff --git a/plugins/org.eclipse.osee.account.admin/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.account.admin/META-INF/MANIFEST.MF
index 63f1b803fb..965b48cfab 100644
--- a/plugins/org.eclipse.osee.account.admin/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.account.admin/META-INF/MANIFEST.MF
@@ -6,7 +6,8 @@ Bundle-Version: 0.23.0.qualifier
Bundle-Vendor: Eclipse Open System Engineering Environment
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Service-Component: OSGI-INF/*.xml
-Import-Package: org.eclipse.osee.authentication.admin,
+Import-Package: org.eclipse.osee.account.rest.model,
+ org.eclipse.osee.authentication.admin,
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.framework.jdk.core.util,
org.eclipse.osee.logger
diff --git a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/Account.java b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/Account.java
index 9742dc8837..a3e542d01c 100644
--- a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/Account.java
+++ b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/Account.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.account.admin;
+import org.eclipse.osee.account.rest.model.AccountWebPreferences;
import org.eclipse.osee.framework.jdk.core.type.Identifiable;
/**
@@ -27,4 +28,5 @@ public interface Account extends Identifiable<String> {
AccountPreferences getPreferences();
+ AccountWebPreferences getWebPreferences();
}
diff --git a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/AccountAdmin.java b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/AccountAdmin.java
index 55822cadd1..3b4c3b54bc 100644
--- a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/AccountAdmin.java
+++ b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/AccountAdmin.java
@@ -27,7 +27,7 @@ public interface AccountAdmin {
ResultSet<Account> getAccountById(Identifiable<String> id);
- ResultSet<Account> getAccountByUuid(String id);
+ ResultSet<Account> getAccountByGuid(String guid);
ResultSet<Account> getAccountByUserName(String username);
@@ -41,7 +41,7 @@ public interface AccountAdmin {
ResultSet<AccountPreferences> getAccountPreferencesById(Identifiable<String> id);
- ResultSet<AccountPreferences> getAccountPreferencesByUuid(String id);
+ ResultSet<AccountPreferences> getAccountPreferencesByGuid(String id);
Identifiable<String> createAccount(CreateAccountRequest request);
@@ -75,4 +75,6 @@ public interface AccountAdmin {
ResultSet<Account> getAnonymousAccount();
+ boolean setAccountWebPreference(String accountGuid, String key, String itemId, String newValue);
+
}
diff --git a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/AccountField.java b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/AccountField.java
index 798bae20e7..daf5e08e93 100644
--- a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/AccountField.java
+++ b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/AccountField.java
@@ -17,7 +17,7 @@ package org.eclipse.osee.account.admin;
*/
public enum AccountField {
LOCAL_ID,
- UUID,
+ GUID,
EMAIL,
DISPLAY_NAME,
USERNAME,
diff --git a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/SubscriptionAdmin.java b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/SubscriptionAdmin.java
index c8e7632382..9f202ecfd8 100644
--- a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/SubscriptionAdmin.java
+++ b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/SubscriptionAdmin.java
@@ -19,6 +19,8 @@ public interface SubscriptionAdmin {
ResultSet<Subscription> getSubscriptionsByAccountUniqueField(String accountUniqueField);
+ ResultSet<Subscription> getSubscriptionsByGuid(String guid);
+
Subscription getSubscription(String subscriptionUuid);
boolean setSubscriptionActive(Subscription subscription, boolean active);
@@ -33,7 +35,7 @@ public interface SubscriptionAdmin {
ResultSet<SubscriptionGroup> getSubscriptionGroupByName(String groupName);
- ResultSet<SubscriptionGroup> getSubscriptionGroupByUuid(String groupUuid);
+ ResultSet<SubscriptionGroup> getSubscriptionGroupByGuid(String groupUuid);
SubscriptionGroup createSubscriptionGroup(String groupName);
@@ -45,6 +47,6 @@ public interface SubscriptionAdmin {
ResultSet<Account> getSubscriptionGroupMembersByName(String groupName);
- ResultSet<Account> getSubscriptionGroupMembersByUuid(String groupUuid);
+ ResultSet<Account> getSubscriptionGroupMembersByGuid(String groupUuid);
}
diff --git a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/ds/AccountStorage.java b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/ds/AccountStorage.java
index deea9614f6..26e81ef45b 100644
--- a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/ds/AccountStorage.java
+++ b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/ds/AccountStorage.java
@@ -15,6 +15,7 @@ import org.eclipse.osee.account.admin.Account;
import org.eclipse.osee.account.admin.AccountPreferences;
import org.eclipse.osee.account.admin.AccountSession;
import org.eclipse.osee.account.admin.CreateAccountRequest;
+import org.eclipse.osee.account.rest.model.AccountWebPreferences;
import org.eclipse.osee.framework.jdk.core.type.Identifiable;
import org.eclipse.osee.framework.jdk.core.type.Identity;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
@@ -28,6 +29,8 @@ public interface AccountStorage {
ResultSet<Account> getAccountByUserName(String username);
+ ResultSet<Account> getAccountByGuid(String guid);
+
ResultSet<Account> getAccountByUuid(String accountUuid);
ResultSet<Account> getAccountByLocalId(long accountId);
@@ -38,7 +41,7 @@ public interface AccountStorage {
ResultSet<AccountPreferences> getAccountPreferencesById(long accountId);
- ResultSet<AccountPreferences> getAccountPreferencesByUuid(String uuid);
+ ResultSet<AccountPreferences> getAccountPreferencesByGuid(String guid);
Identifiable<String> createAccount(CreateAccountRequest request);
@@ -63,4 +66,11 @@ public interface AccountStorage {
void deleteAccountSessionBySessionToken(String sessionToken);
ResultSet<Account> getAnonymousAccount();
+
+ AccountWebPreferences getAccountWebPreferencesByGuid(String accountGuid);
+
+ AccountWebPreferences getAccountWebPreferencesById(int accountId);
+
+ void setAccountWebPreferences(String accountGuid, String newPreferences);
+
}
diff --git a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/ds/SubscriptionStorage.java b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/ds/SubscriptionStorage.java
index b53c3353e5..173404e402 100644
--- a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/ds/SubscriptionStorage.java
+++ b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/ds/SubscriptionStorage.java
@@ -32,7 +32,7 @@ public interface SubscriptionStorage {
ResultSet<SubscriptionGroup> getSubscriptionGroupByName(String name);
- ResultSet<SubscriptionGroup> getSubscriptionGroupByUuid(String uuid);
+ ResultSet<SubscriptionGroup> getSubscriptionGroupByGuid(String guid);
boolean subscriptionGroupNameExists(String groupName);
@@ -44,6 +44,6 @@ public interface SubscriptionStorage {
ResultSet<Account> getSubscriptionGroupMembersByName(String name);
- ResultSet<Account> getSubscriptionGroupMembersByUuid(String uuid);
+ ResultSet<Account> getSubscriptionGroupMembersByGuid(String guid);
}
diff --git a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/AccountAdminImpl.java b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/AccountAdminImpl.java
index 7a755bf006..d97d8d6258 100644
--- a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/AccountAdminImpl.java
+++ b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/AccountAdminImpl.java
@@ -26,6 +26,8 @@ import org.eclipse.osee.account.admin.CreateAccountRequest;
import org.eclipse.osee.account.admin.ds.AccountStorage;
import org.eclipse.osee.account.admin.internal.validator.Validator;
import org.eclipse.osee.account.admin.internal.validator.Validators;
+import org.eclipse.osee.account.rest.model.AccountUtil;
+import org.eclipse.osee.account.rest.model.AccountWebPreferences;
import org.eclipse.osee.authentication.admin.AuthenticatedUser;
import org.eclipse.osee.authentication.admin.AuthenticationAdmin;
import org.eclipse.osee.authentication.admin.AuthenticationRequest;
@@ -103,13 +105,13 @@ public class AccountAdminImpl implements AccountAdmin {
@Override
public ResultSet<Account> getAccountById(Identifiable<String> id) {
Conditions.checkNotNull(id, "id");
- return getAccountByUuid(id.getGuid());
+ return getAccountByGuid(id.getGuid());
}
@Override
- public ResultSet<Account> getAccountByUuid(String uuid) {
- Conditions.checkNotNull(uuid, "uuid");
- return getStorage().getAccountByUuid(uuid);
+ public ResultSet<Account> getAccountByGuid(String guid) {
+ Conditions.checkNotNull(guid, "guid");
+ return getStorage().getAccountByGuid(guid);
}
@Override
@@ -136,15 +138,15 @@ public class AccountAdminImpl implements AccountAdmin {
}
@Override
- public ResultSet<AccountPreferences> getAccountPreferencesByUuid(String uuid) {
- Conditions.checkNotNull(uuid, "uuid");
- return getStorage().getAccountPreferencesByUuid(uuid);
+ public ResultSet<AccountPreferences> getAccountPreferencesByGuid(String guid) {
+ Conditions.checkNotNull(guid, "guid");
+ return getStorage().getAccountPreferencesByGuid(guid);
}
@Override
public ResultSet<AccountPreferences> getAccountPreferencesById(Identifiable<String> id) {
Conditions.checkNotNull(id, "id");
- return getAccountPreferencesByUuid(id.getGuid());
+ return getAccountPreferencesByGuid(id.getGuid());
}
@Override
@@ -249,6 +251,22 @@ public class AccountAdminImpl implements AccountAdmin {
return setAccountPreference(result, key, value);
}
+ @Override
+ public boolean setAccountWebPreference(String accountGuid, String key, String itemId, String newValue) {
+ Conditions.checkNotNull(key, "account preference key");
+ Conditions.checkNotNull(newValue, "account preference value", "Use delete account preference instead");
+
+ AccountWebPreferences allPreferences = getStorage().getAccountWebPreferencesByGuid(accountGuid);
+ String newPreferences = AccountUtil.updateSinglePreference(allPreferences, key, itemId, newValue);
+
+ boolean modified = false;
+ if (Strings.isValid(newPreferences) && !newPreferences.equalsIgnoreCase(allPreferences.toString())) {
+ getStorage().setAccountWebPreferences(accountGuid, newPreferences);
+ modified = true;
+ }
+ return modified;
+ }
+
private boolean setAccountPreference(ResultSet<AccountPreferences> result, String key, String value) {
Conditions.checkNotNull(key, "account preference key");
Conditions.checkNotNull(value, "account preference value", "Use delete account preference instead");
diff --git a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/AccountResolver.java b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/AccountResolver.java
index 85c467db75..a8e5768fb6 100644
--- a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/AccountResolver.java
+++ b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/AccountResolver.java
@@ -50,8 +50,8 @@ public class AccountResolver {
long id = parseLocalId(uniqueFieldValue);
toReturn = accountAdmin.getAccountById(id);
break;
- case UUID:
- toReturn = accountAdmin.getAccountByUuid(uniqueFieldValue);
+ case GUID:
+ toReturn = accountAdmin.getAccountByGuid(uniqueFieldValue);
break;
case DISPLAY_NAME:
toReturn = accountAdmin.getAccountByName(uniqueFieldValue);
diff --git a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/SubscriptionAdminImpl.java b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/SubscriptionAdminImpl.java
index 67fe1232dd..0bb8d011d5 100644
--- a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/SubscriptionAdminImpl.java
+++ b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/SubscriptionAdminImpl.java
@@ -156,9 +156,9 @@ public class SubscriptionAdminImpl implements SubscriptionAdmin {
}
@Override
- public ResultSet<SubscriptionGroup> getSubscriptionGroupByUuid(String groupUuid) {
+ public ResultSet<SubscriptionGroup> getSubscriptionGroupByGuid(String groupUuid) {
Conditions.checkNotNull(groupUuid, "group uuid");
- return getStorage().getSubscriptionGroupByUuid(groupUuid);
+ return getStorage().getSubscriptionGroupByGuid(groupUuid);
}
@Override
@@ -173,9 +173,16 @@ public class SubscriptionAdminImpl implements SubscriptionAdmin {
}
@Override
- public ResultSet<Account> getSubscriptionGroupMembersByUuid(String groupUuid) {
+ public ResultSet<Account> getSubscriptionGroupMembersByGuid(String groupUuid) {
Conditions.checkNotNull(groupUuid, "group uuid");
- return getStorage().getSubscriptionGroupMembersByUuid(groupUuid);
+ return getStorage().getSubscriptionGroupMembersByGuid(groupUuid);
+ }
+
+ @Override
+ public ResultSet<Subscription> getSubscriptionsByGuid(String guid) {
+ ResultSet<Account> result = accountAdmin.getAccountByGuid(guid);
+ Account account = result.getExactlyOne();
+ return getStorage().getSubscriptionsByAccountLocalId(account.getId());
}
}
diff --git a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/SubscriptionResolver.java b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/SubscriptionResolver.java
index 189d66e558..1d869f659b 100644
--- a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/SubscriptionResolver.java
+++ b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/SubscriptionResolver.java
@@ -12,8 +12,8 @@ package org.eclipse.osee.account.admin.internal;
import org.eclipse.osee.account.admin.Account;
import org.eclipse.osee.account.admin.AccountField;
-import org.eclipse.osee.account.admin.SubscriptionGroup;
import org.eclipse.osee.account.admin.SubscriptionAdmin;
+import org.eclipse.osee.account.admin.SubscriptionGroup;
import org.eclipse.osee.account.admin.internal.validator.Validator;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.framework.jdk.core.type.ResultSets;
@@ -46,8 +46,8 @@ public class SubscriptionResolver {
long id = parseLocalId(uniqueFieldValue);
toReturn = subscriptionsAdmin.getSubscriptionGroupByLocalId(id);
break;
- case UUID:
- toReturn = subscriptionsAdmin.getSubscriptionGroupByUuid(uniqueFieldValue);
+ case GUID:
+ toReturn = subscriptionsAdmin.getSubscriptionGroupByGuid(uniqueFieldValue);
break;
case SUBSCRIPTION_GROUP_NAME:
toReturn = subscriptionsAdmin.getSubscriptionGroupByName(uniqueFieldValue);
@@ -68,8 +68,8 @@ public class SubscriptionResolver {
long id = parseLocalId(uniqueFieldValue);
toReturn = subscriptionsAdmin.getSubscriptionGroupMembersByLocalId(id);
break;
- case UUID:
- toReturn = subscriptionsAdmin.getSubscriptionGroupMembersByUuid(uniqueFieldValue);
+ case GUID:
+ toReturn = subscriptionsAdmin.getSubscriptionGroupMembersByGuid(uniqueFieldValue);
break;
case SUBSCRIPTION_GROUP_NAME:
toReturn = subscriptionsAdmin.getSubscriptionGroupMembersByName(uniqueFieldValue);
diff --git a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/validator/UuidValidator.java b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/validator/UuidValidator.java
index 72b3f85b23..d4cb7037a0 100644
--- a/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/validator/UuidValidator.java
+++ b/plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/validator/UuidValidator.java
@@ -20,7 +20,7 @@ public class UuidValidator extends AbstractValidator {
@Override
public AccountField getFieldType() {
- return AccountField.UUID;
+ return AccountField.GUID;
}
@Override
diff --git a/plugins/org.eclipse.osee.account.rest.model/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.account.rest.model/META-INF/MANIFEST.MF
index fdbf4977b9..6742bcfc9a 100644
--- a/plugins/org.eclipse.osee.account.rest.model/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.account.rest.model/META-INF/MANIFEST.MF
@@ -6,4 +6,6 @@ Bundle-Version: 0.23.0.qualifier
Bundle-Vendor: Eclipse Open System Engineering Environment
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.eclipse.osee.account.rest.model
-Import-Package: org.eclipse.osee.framework.jdk.core.type
+Import-Package: org.eclipse.osee.framework.jdk.core.type,
+ org.eclipse.osee.framework.jdk.core.util,
+ org.json
diff --git a/plugins/org.eclipse.osee.account.rest.model/src/org/eclipse/osee/account/rest/model/AccountUtil.java b/plugins/org.eclipse.osee.account.rest.model/src/org/eclipse/osee/account/rest/model/AccountUtil.java
new file mode 100644
index 0000000000..1520f4a40e
--- /dev/null
+++ b/plugins/org.eclipse.osee.account.rest.model/src/org/eclipse/osee/account/rest/model/AccountUtil.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.account.rest.model;
+
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * @author Angel Avila
+ */
+public class AccountUtil {
+
+ public static String updateSinglePreference(AccountWebPreferences allPreferences, String key, String id, String newValue) {
+ try {
+ JSONObject preferencesJObject = new JSONObject(allPreferences);
+ JSONObject singlePreferenceObject = preferencesJObject.getJSONObject(key);
+
+ JSONObject newValueAsObject;
+ if (!Strings.isValid(id)) {
+ newValueAsObject = createNewPreference(newValue);
+ singlePreferenceObject.put(newValueAsObject.getString("id"), newValueAsObject);
+ } else {
+ newValueAsObject = new JSONObject(newValue);
+ if (newValueAsObject.toString().equals("{}")) {
+ singlePreferenceObject.remove(id);
+ } else {
+ singlePreferenceObject.put(id, newValueAsObject);
+ }
+ }
+
+ preferencesJObject.put(key, singlePreferenceObject);
+
+ return preferencesJObject.toString();
+ } catch (JSONException ex) {
+ throw new OseeCoreException(ex);
+ }
+ }
+
+ private static JSONObject createNewPreference(String newValue) {
+ String newId = GUID.create();
+ try {
+ JSONObject newObject = new JSONObject(newValue);
+ newObject.put("id", newId);
+ return newObject;
+ } catch (JSONException ex) {
+ throw new OseeCoreException(ex);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.account.rest.model/src/org/eclipse/osee/account/rest/model/AccountWebPreferences.java b/plugins/org.eclipse.osee.account.rest.model/src/org/eclipse/osee/account/rest/model/AccountWebPreferences.java
new file mode 100644
index 0000000000..b09094e7be
--- /dev/null
+++ b/plugins/org.eclipse.osee.account.rest.model/src/org/eclipse/osee/account/rest/model/AccountWebPreferences.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.account.rest.model;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * @author Angel Avila
+ */
+public class AccountWebPreferences {
+
+ Map<String, Link> linksMap;
+
+ public AccountWebPreferences() {
+
+ }
+
+ public AccountWebPreferences(Map<String, String> teamToPreferences) {
+ for (String team : teamToPreferences.keySet()) {
+ initPreferences(teamToPreferences.get(team), team);
+ }
+
+ }
+
+ private void initPreferences(String string, String team) {
+ try {
+ JSONObject jObject = new JSONObject(string);
+
+ if (linksMap == null) {
+ linksMap = new HashMap<String, Link>();
+ }
+ JSONObject linkJsonObject = jObject.getJSONObject("links");
+ @SuppressWarnings("unchecked")
+ Iterator<String> keys = linkJsonObject.keys();
+ while (keys.hasNext()) {
+ String next = keys.next();
+ JSONObject linkJObject = linkJsonObject.getJSONObject(next);
+ Link link = new Link();
+ if (linkJObject.has("name")) {
+ link.setName(linkJObject.getString("name"));
+ }
+ if (linkJObject.has("url")) {
+ link.setUrl(linkJObject.getString("url"));
+ }
+ link.setTeam(team);
+ link.setId(linkJObject.getString("id"));
+ linksMap.put(next, link);
+ }
+
+ } catch (JSONException ex) {
+ //
+ }
+ }
+
+ public AccountWebPreferences(String jsonString, String team) {
+ initPreferences(jsonString, team);
+ }
+
+ public Map<String, Link> getLinks() {
+ return linksMap;
+ }
+
+ public void setLinks(Map<String, Link> links) {
+ this.linksMap = links;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.account.rest.model/src/org/eclipse/osee/account/rest/model/Link.java b/plugins/org.eclipse.osee.account.rest.model/src/org/eclipse/osee/account/rest/model/Link.java
new file mode 100644
index 0000000000..7f500b6cd2
--- /dev/null
+++ b/plugins/org.eclipse.osee.account.rest.model/src/org/eclipse/osee/account/rest/model/Link.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.account.rest.model;
+
+/**
+ * @author Angel Avila
+ */
+public class Link {
+ String name;
+ String url;
+ String id;
+ String team;
+
+ public Link() {
+
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public void setTeam(String team) {
+ this.team = team;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public String getTeam() {
+ return team;
+ }
+}
diff --git a/plugins/org.eclipse.osee.account.rest.test/src/org/eclipse/osee/account/rest/internal/AccountOpsTest.java b/plugins/org.eclipse.osee.account.rest.test/src/org/eclipse/osee/account/rest/internal/AccountOpsTest.java
index ed547da583..77c6db2d8d 100644
--- a/plugins/org.eclipse.osee.account.rest.test/src/org/eclipse/osee/account/rest/internal/AccountOpsTest.java
+++ b/plugins/org.eclipse.osee.account.rest.test/src/org/eclipse/osee/account/rest/internal/AccountOpsTest.java
@@ -53,7 +53,7 @@ import org.mockito.MockitoAnnotations;
/**
* Test Case for {@link AccountOps}
- *
+ *
* @author Roberto E. Escobar
*/
public class AccountOpsTest {
@@ -104,7 +104,7 @@ public class AccountOpsTest {
long accountId = 1982671L;
Account account = mockAccount(accountId, guid, name, email, username, active);
ResultSet<Account> result = ResultSets.singleton(account);
- when(accountAdmin.getAccountByUuid(guid)).thenReturn(result);
+ when(accountAdmin.getAccountByGuid(guid)).thenReturn(result);
AccountInfoData actual = ops.createAccount(username, input);
diff --git a/plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountOps.java b/plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountOps.java
index 96e36ec9e6..a18ca3528b 100644
--- a/plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountOps.java
+++ b/plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountOps.java
@@ -30,6 +30,7 @@ import org.eclipse.osee.account.rest.model.AccountPreferencesData;
import org.eclipse.osee.account.rest.model.AccountPreferencesInput;
import org.eclipse.osee.account.rest.model.AccountSessionData;
import org.eclipse.osee.account.rest.model.AccountSessionDetailsData;
+import org.eclipse.osee.account.rest.model.AccountWebPreferences;
import org.eclipse.osee.framework.jdk.core.type.Identifiable;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
@@ -75,12 +76,12 @@ public class AccountOps {
public AccountSessionData doLogin(RequestInfo info, AccountLoginData input) {
AccountLoginRequestBuilder builder = AccountLoginRequestBuilder.newBuilder();
AccountLoginRequest request = builder//
- .userName(input.getUsername())//
- .password(input.getPassword())//
- .scheme(input.getScheme()) //
- .accessedBy(info.getDetails())//
- .remoteAddress(info.getRemoteIpAddress()) //
- .build();
+ .userName(input.getUsername())//
+ .password(input.getPassword())//
+ .scheme(input.getScheme()) //
+ .accessedBy(info.getDetails())//
+ .remoteAddress(info.getRemoteIpAddress()) //
+ .build();
AccountSession session = accountAdmin.login(request);
return AccountDataUtil.asSessionData(session);
}
@@ -100,7 +101,7 @@ public class AccountOps {
.build();
Identifiable<String> id = accountAdmin.createAccount(request);
- ResultSet<Account> result = accountAdmin.getAccountByUuid(id.getGuid());
+ ResultSet<Account> result = accountAdmin.getAccountByGuid(id.getGuid());
Account account = result.getExactlyOne();
return AccountDataUtil.asAccountData(account);
}
@@ -140,6 +141,24 @@ public class AccountOps {
return AccountDataUtil.asAccountData(account);
}
+ public boolean editAccountWebPreferencesData(String accountGuid, String key, String itemId, String newValue) {
+ return accountAdmin.setAccountWebPreference(accountGuid, key, itemId, newValue);
+ }
+
+ public AccountWebPreferences getDefaultAccountWebPreferencesData(String value) {
+ ResultSet<Account> result = accountAdmin.getAccountByGuid(value);
+ Account account = result.getExactlyOne();
+ AccountWebPreferences preferences = account.getWebPreferences();
+ return preferences;
+ }
+
+ public AccountWebPreferences getAccountWebPreferencesData(String value) {
+ ResultSet<Account> result = accountAdmin.getAccountByGuid(value);
+ Account account = result.getExactlyOne();
+ AccountWebPreferences preferences = account.getWebPreferences();
+ return preferences;
+ }
+
public AccountPreferencesData getAccountPreferencesData(String value) {
ResultSet<Account> result = accountAdmin.getAccountByUniqueField(value);
Account account = result.getExactlyOne();
diff --git a/plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountsResource.java b/plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountsResource.java
index 752e7b5201..5581ce75ee 100644
--- a/plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountsResource.java
+++ b/plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountsResource.java
@@ -12,11 +12,14 @@ package org.eclipse.osee.account.rest.internal;
import javax.annotation.security.PermitAll;
import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
import org.eclipse.osee.account.rest.model.AccountContexts;
import org.eclipse.osee.account.rest.model.AccountInfoData;
import org.eclipse.osee.framework.jdk.core.type.OseePrincipal;
@@ -47,9 +50,25 @@ public class AccountsResource {
return toReturn;
}
+ @GET
+ @Path("preferences/{id}")
+ @PermitAll
+ @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ public Response getPreferences(@PathParam("id") String id) {
+ return Response.ok().entity(accountOps.getAccountWebPreferencesData(id)).build();
+ }
+
+ @PUT
+ @Path("preferences/{id}")
+ @PermitAll
+ @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ public Response editPreferences(@PathParam("id") String userGuid, @QueryParam("key") String key, @QueryParam("itemId") String itemId, String newValue) {
+ return Response.ok().entity(accountOps.editAccountWebPreferencesData(userGuid, key, itemId, newValue)).build();
+ }
+
/**
* Get all Accounts
- *
+ *
* @return All accounts
*/
@GET
diff --git a/plugins/org.eclipse.osee.disposition.rest/web/legacy/js/userController.js b/plugins/org.eclipse.osee.disposition.rest/web/legacy/js/userController.js
index 8cd817e18d..3c7f85f093 100644
--- a/plugins/org.eclipse.osee.disposition.rest/web/legacy/js/userController.js
+++ b/plugins/org.eclipse.osee.disposition.rest/web/legacy/js/userController.js
@@ -35,7 +35,7 @@ app.controller('userController', [
};
// if this is a search result view, populate program, set and items from parent scope
- if(window.opener != null) {
+ if(window.opener != null && window.opener.$windowScope != undefined) {
$scope.programs = window.opener.$windowScope.programs;
$scope.sets = window.opener.$windowScope.sets;
$scope.programSelection = window.opener.$windowScope.programSelection;
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java
index e4e305f544..bdb1e4c700 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java
@@ -95,6 +95,7 @@ public final class CoreAttributeTypes {
public static final IAttributeType VerificationLevel = TokenFactory.createAttributeType(0x100000000000008BL, "Verification Level");
public static final IAttributeType VerificationCriteria = TokenFactory.createAttributeType(0x100000000000008DL, "Verification Acceptance Criteria");
public static final IAttributeType Website = TokenFactory.createAttributeType(0x100000000000006CL, "Website");
+ public static final IAttributeType WebPreferences = TokenFactory.createAttributeType(0x100000000000019AL, "Web Preferences");
public static final IAttributeType WholeWordContent = TokenFactory.createAttributeType(0x100000000000007BL, "Whole Word Content");
public static final IAttributeType WordOleData = TokenFactory.createAttributeType(0x1000000000000074L, "Word Ole Data");
public static final IAttributeType WordTemplateContent = TokenFactory.createAttributeType(0x100000000000007AL, "Word Template Content");
diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java
index 185f5159bd..83a77c2682 100644
--- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java
@@ -579,14 +579,16 @@ public final class Lib {
toProcess = toProcess.replaceAll("\\\\", "/");
String[] pathsArray = toProcess.split("/");
- String fileName = pathsArray[0];
if (pathsArray.length > 0) {
- fileName = pathsArray[pathsArray.length - 1];
- }
+ String fileName = pathsArray[0];
+ if (pathsArray.length > 0) {
+ fileName = pathsArray[pathsArray.length - 1];
+ }
- int index = fileName.lastIndexOf('.');
- if (index >= 0 && index + 1 < fileName.length()) {
- toReturn = fileName.substring(index + 1);
+ int index = fileName.lastIndexOf('.');
+ if (index >= 0 && index + 1 < fileName.length()) {
+ toReturn = fileName.substring(index + 1);
+ }
}
}
return toReturn;
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee b/plugins/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee
index b282750e83..4df555a89f 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee
+++ b/plugins/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee
@@ -81,6 +81,7 @@ artifactType "User" extends "Artifact" {
attribute "XViewer Customization"
attribute "XViewer Defaults"
attribute "Zip"
+ attribute "Web Preferences"
}
attributeType "Active" extends BooleanAttribute {
@@ -205,6 +206,16 @@ attributeType "User Settings" extends StringAttribute {
mediaType "text/plain"
}
+attributeType "Web Preferences" extends StringAttribute {
+ uuid 0x100000000000019A
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max 1
+ fileExtension "xml"
+ mediaType "text/plain"
+}
+
+
attributeType "XViewer Customization" extends StringAttribute {
uuid 0x1000000000000065
dataProvider DefaultAttributeDataProvider
diff --git a/plugins/org.eclipse.osee.http.jetty.test/.project b/plugins/org.eclipse.osee.http.jetty.test/.project
new file mode 100644
index 0000000000..36404739d3
--- /dev/null
+++ b/plugins/org.eclipse.osee.http.jetty.test/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.http.jetty.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.osee.jaxrs.server/OSGI-INF/root.app.xml b/plugins/org.eclipse.osee.jaxrs.server/OSGI-INF/root.app.xml
new file mode 100644
index 0000000000..e04522e8b0
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.server/OSGI-INF/root.app.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop">
+ <implementation class="org.eclipse.osee.jaxrs.server.internal.applications.OseeRootApplication"/>
+ <service>
+ <provide interface="javax.ws.rs.core.Application"/>
+ </service>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/applications/OseeRootApplication.java b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/applications/OseeRootApplication.java
new file mode 100644
index 0000000000..f8fa5bb307
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/applications/OseeRootApplication.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.jaxrs.server.internal.applications;
+
+import java.util.HashSet;
+import java.util.Set;
+import javax.ws.rs.ApplicationPath;
+import javax.ws.rs.core.Application;
+import org.eclipse.osee.logger.Log;
+
+/**
+ * @author Angel Avila
+ */
+@ApplicationPath("/")
+public class OseeRootApplication extends Application {
+
+ private final Set<Object> singletons = new HashSet<Object>();
+
+ private Log logger;
+
+ public void setLogger(Log logger) {
+ this.logger = logger;
+ }
+
+ public void start() {
+ singletons.add(new OseeRootResource());
+ }
+
+ public void stop() {
+ singletons.clear();
+ }
+
+ @Override
+ public Set<Object> getSingletons() {
+ return singletons;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/applications/OseeRootResource.java b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/applications/OseeRootResource.java
new file mode 100644
index 0000000000..1878bdc426
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/applications/OseeRootResource.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.jaxrs.server.internal.applications;
+
+import java.net.URI;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+
+/**
+ * @author Angel Avila
+ */
+@Path("/")
+public class OseeRootResource {
+
+ public OseeRootResource() {
+
+ }
+
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response getRoot() {
+ URI uri = UriBuilder.fromUri("/osee/ui/index.html").build();
+ return Response.seeOther(uri).build();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsAccountStorageTest.java b/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsAccountStorageTest.java
index 9e060bff5c..5d2c844990 100644
--- a/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsAccountStorageTest.java
+++ b/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsAccountStorageTest.java
@@ -39,7 +39,7 @@ import org.mockito.Mock;
/**
* Test Case for {@link OrcsAccountStorage}
- *
+ *
* @author Roberto E. Escobar
*/
public class OrcsAccountStorageTest {
@@ -102,14 +102,14 @@ public class OrcsAccountStorageTest {
@Test
public void testGetById() {
- ResultSet<Account> result = storage.getAccountByUuid(newAccount.getGuid());
+ ResultSet<Account> result = storage.getAccountByGuid(newAccount.getGuid());
Account account1 = result.getExactlyOne();
assertAccount(account1, newAccount.getGuid(), name, email, username, active, prefs);
}
@Test
public void testGetByUuiId() {
- ResultSet<Account> result = storage.getAccountByUuid(newAccount.getGuid());
+ ResultSet<Account> result = storage.getAccountByGuid(newAccount.getGuid());
Account account1 = result.getExactlyOne();
assertAccount(account1, newAccount.getGuid(), name, email, username, active, prefs);
@@ -142,7 +142,7 @@ public class OrcsAccountStorageTest {
@Test
public void testGetAccountPrefsByUuid() {
- AccountPreferences actual = storage.getAccountPreferencesByUuid(newAccount.getGuid()).getExactlyOne();
+ AccountPreferences actual = storage.getAccountPreferencesByGuid(newAccount.getGuid()).getExactlyOne();
assertPrefs(actual, newAccount.getGuid(), prefs);
AccountPreferences actual2 = storage.getAccountPreferencesById(actual.getId()).getExactlyOne();
@@ -151,7 +151,7 @@ public class OrcsAccountStorageTest {
@Test
public void testGetAccountPrefsByLocalId() {
- Account account = storage.getAccountByUuid(newAccount.getGuid()).getExactlyOne();
+ Account account = storage.getAccountByGuid(newAccount.getGuid()).getExactlyOne();
AccountPreferences actual = storage.getAccountPreferencesById(account.getId()).getExactlyOne();
assertPrefs(actual, account.getGuid(), account.getId(), prefs);
@@ -159,28 +159,28 @@ public class OrcsAccountStorageTest {
@Test
public void testSetActive() {
- Account account = storage.getAccountByUuid(newAccount.getGuid()).getExactlyOne();
+ Account account = storage.getAccountByGuid(newAccount.getGuid()).getExactlyOne();
assertAccount(account, newAccount.getGuid(), name, email, username, active, prefs);
storage.setActive(newAccount, false);
- account = storage.getAccountByUuid(newAccount.getGuid()).getExactlyOne();
+ account = storage.getAccountByGuid(newAccount.getGuid()).getExactlyOne();
assertFalse(account.isActive());
storage.setActive(newAccount, true);
- account = storage.getAccountByUuid(newAccount.getGuid()).getExactlyOne();
+ account = storage.getAccountByGuid(newAccount.getGuid()).getExactlyOne();
assertTrue(account.isActive());
}
@Test
public void testDeleteAccount() {
- ResultSet<Account> result = storage.getAccountByUuid(newAccount.getGuid());
+ ResultSet<Account> result = storage.getAccountByGuid(newAccount.getGuid());
assertEquals(1, result.size());
storage.deleteAccount(newAccount);
- result = storage.getAccountByUuid(newAccount.getGuid());
+ result = storage.getAccountByGuid(newAccount.getGuid());
assertTrue(result.isEmpty());
}
@@ -194,7 +194,7 @@ public class OrcsAccountStorageTest {
storage.setAccountPreferences(newAccount, expected);
- Account account = storage.getAccountByUuid(newAccount.getGuid()).getExactlyOne();
+ Account account = storage.getAccountByGuid(newAccount.getGuid()).getExactlyOne();
AccountPreferences actual = account.getPreferences();
assertPrefs(actual, newAccount.getGuid(), account.getId(), expected);
}
@@ -205,7 +205,7 @@ public class OrcsAccountStorageTest {
String address = "myAddress";
String details = "myDetails";
- Account account = storage.getAccountByUuid(newAccount.getGuid()).getExactlyOne();
+ Account account = storage.getAccountByGuid(newAccount.getGuid()).getExactlyOne();
AccountSession actual = storage.createAccountSession(token, account, address, details);
assertEquals(details, actual.getAccessDetails());
diff --git a/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsSubscriptionStorageTest.java b/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsSubscriptionStorageTest.java
index a427ad49a2..1b5ed52a65 100644
--- a/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsSubscriptionStorageTest.java
+++ b/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsSubscriptionStorageTest.java
@@ -37,7 +37,7 @@ import org.mockito.Mock;
/**
* Test Case for {@link OrcsSubscriptionStorage}
- *
+ *
* @author Roberto E. Escobar
*/
public class OrcsSubscriptionStorageTest {
@@ -99,7 +99,7 @@ public class OrcsSubscriptionStorageTest {
@Test
public void testSubscriptionAPI() {
- Account account = accountStorage.getAccountByUuid(newAccount.getGuid()).getExactlyOne();
+ Account account = accountStorage.getAccountByGuid(newAccount.getGuid()).getExactlyOne();
long accountId = account.getId();
ResultSet<Subscription> results = storage.getSubscriptionsByAccountLocalId(accountId);
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.account.admin/META-INF/MANIFEST.MF
index 826dccbe8b..28b1d5f410 100644
--- a/plugins/org.eclipse.osee.orcs.account.admin/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs.account.admin/META-INF/MANIFEST.MF
@@ -12,6 +12,7 @@ Import-Package: com.google.common.base;version="15.0.0",
com.google.gson.reflect,
org.eclipse.osee.account.admin,
org.eclipse.osee.account.admin.ds,
+ org.eclipse.osee.account.rest.model,
org.eclipse.osee.executor.admin,
org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/AccountArtifact.java b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/AccountArtifact.java
index 1a016a8ea3..33114a9c4d 100644
--- a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/AccountArtifact.java
+++ b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/AccountArtifact.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.orcs.account.admin.internal;
import org.eclipse.osee.account.admin.Account;
import org.eclipse.osee.account.admin.AccountPreferences;
+import org.eclipse.osee.account.rest.model.AccountWebPreferences;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.jdk.core.type.BaseIdentity;
import org.eclipse.osee.orcs.data.ArtifactReadable;
@@ -25,11 +26,13 @@ public class AccountArtifact extends BaseIdentity<String> implements Account {
private final ArtifactReadable artifact;
private final AccountPreferences preferences;
+ private final AccountWebPreferences webPreferences;
- public AccountArtifact(String uuid, ArtifactReadable artifact, AccountPreferences preferences) {
+ public AccountArtifact(String uuid, ArtifactReadable artifact, AccountPreferences preferences, AccountWebPreferences webPreferences) {
super(artifact.getGuid());
this.artifact = artifact;
this.preferences = preferences;
+ this.webPreferences = webPreferences;
}
@Override
@@ -58,6 +61,11 @@ public class AccountArtifact extends BaseIdentity<String> implements Account {
}
@Override
+ public AccountWebPreferences getWebPreferences() {
+ return webPreferences;
+ }
+
+ @Override
public AccountPreferences getPreferences() {
return preferences;
}
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/AccountFactory.java b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/AccountFactory.java
index 32ef66ecbf..0f1f35e0b7 100644
--- a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/AccountFactory.java
+++ b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/AccountFactory.java
@@ -15,6 +15,8 @@ import org.eclipse.osee.account.admin.Account;
import org.eclipse.osee.account.admin.AccountPreferences;
import org.eclipse.osee.account.admin.AccountSession;
import org.eclipse.osee.account.admin.SubscriptionGroup;
+import org.eclipse.osee.account.rest.model.AccountWebPreferences;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.framework.jdk.core.type.ResultSetTransform.Function;
import org.eclipse.osee.framework.jdk.core.type.ResultSets;
@@ -40,7 +42,8 @@ public class AccountFactory {
public Account newAccount(ArtifactReadable artifact) {
AccountPreferences preferences = newAccountPreferences(artifact);
- return new AccountArtifact(artifact.getGuid(), artifact, preferences);
+ AccountWebPreferences webPreferences = newAccountWebPreferences(artifact);
+ return new AccountArtifact(artifact.getGuid(), artifact, preferences, webPreferences);
}
public AccountPreferences newAccountPreferences(ArtifactReadable artifact) {
@@ -48,6 +51,11 @@ public class AccountFactory {
return new AccountPreferencesArtifact(id, artifact);
}
+ public AccountWebPreferences newAccountWebPreferences(ArtifactReadable artifact) {
+ String webPreferencesJson = artifact.getSoleAttributeAsString(CoreAttributeTypes.WebPreferences, "{}");
+ return new AccountWebPreferences(webPreferencesJson, artifact.getName());
+ }
+
private class ArtifactToAccount implements Function<String, ArtifactReadable, Account> {
@Override
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/BootstrapAccount.java b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/BootstrapAccount.java
index ad974bb355..a2499965c2 100644
--- a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/BootstrapAccount.java
+++ b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/BootstrapAccount.java
@@ -15,6 +15,7 @@ import java.util.Map;
import java.util.Set;
import org.eclipse.osee.account.admin.Account;
import org.eclipse.osee.account.admin.AccountPreferences;
+import org.eclipse.osee.account.rest.model.AccountWebPreferences;
import org.eclipse.osee.framework.core.enums.SystemUser;
import org.eclipse.osee.framework.jdk.core.type.BaseIdentity;
@@ -77,4 +78,9 @@ public class BootstrapAccount extends BaseIdentity<String> implements Account, A
return false;
}
+ @Override
+ public AccountWebPreferences getWebPreferences() {
+ return null;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/OrcsAccountStorage.java b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/OrcsAccountStorage.java
index 66fb3e1a03..fe86a6cb19 100644
--- a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/OrcsAccountStorage.java
+++ b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/OrcsAccountStorage.java
@@ -19,6 +19,7 @@ import org.eclipse.osee.account.admin.AccountPreferences;
import org.eclipse.osee.account.admin.AccountSession;
import org.eclipse.osee.account.admin.CreateAccountRequest;
import org.eclipse.osee.account.admin.ds.AccountStorage;
+import org.eclipse.osee.account.rest.model.AccountWebPreferences;
import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
@@ -98,9 +99,15 @@ public class OrcsAccountStorage extends AbstractOrcsStorage implements AccountSt
}
@Override
+ public ResultSet<Account> getAccountByGuid(String guid) {
+ ResultSet<ArtifactReadable> results = newQuery().andIsOfType(CoreArtifactTypes.User).andGuid(guid).getResults();
+ return getFactory().newAccountResultSet(results);
+ }
+
+ @Override
public ResultSet<Account> getAccountByUuid(String accountUuid) {
ResultSet<ArtifactReadable> results =
- newQuery().andIsOfType(CoreArtifactTypes.User).andGuid(accountUuid).getResults();
+ newQuery().andIsOfType(CoreArtifactTypes.User).andUuid(Long.parseLong(accountUuid)).getResults();
return getFactory().newAccountResultSet(results);
}
@@ -133,8 +140,8 @@ public class OrcsAccountStorage extends AbstractOrcsStorage implements AccountSt
}
@Override
- public ResultSet<AccountPreferences> getAccountPreferencesByUuid(String uuid) {
- ResultSet<ArtifactReadable> results = newQuery().andIsOfType(CoreArtifactTypes.User).andGuid(uuid).getResults();
+ public ResultSet<AccountPreferences> getAccountPreferencesByGuid(String guid) {
+ ResultSet<ArtifactReadable> results = newQuery().andIsOfType(CoreArtifactTypes.User).andGuid(guid).getResults();
return getFactory().newAccountPreferencesResultSet(results);
}
@@ -259,4 +266,25 @@ public class OrcsAccountStorage extends AbstractOrcsStorage implements AccountSt
};
}
+ @Override
+ public void setAccountWebPreferences(String guid, String preferences) {
+ ArtifactId artId = OrcsUtil.newArtifactId(1, guid, "name");
+ TransactionBuilder tx = newTransaction("User - Save Web Preferences");
+ tx.setSoleAttributeFromString(artId, CoreAttributeTypes.WebPreferences, preferences);
+ tx.commit();
+ }
+
+ @Override
+ public AccountWebPreferences getAccountWebPreferencesByGuid(String guid) {
+ ResultSet<ArtifactReadable> results = newQuery().andIsOfType(CoreArtifactTypes.User).andGuid(guid).getResults();
+ return getFactory().newAccountWebPreferences(results.getExactlyOne());
+ }
+
+ @Override
+ public AccountWebPreferences getAccountWebPreferencesById(int accountId) {
+ ResultSet<ArtifactReadable> results =
+ newQuery().andIsOfType(CoreArtifactTypes.User).andUuid(accountId).getResults();
+ return getFactory().newAccountWebPreferences(results.getExactlyOne());
+ }
+
}
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/OrcsSubscriptionStorage.java b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/OrcsSubscriptionStorage.java
index a37746329d..8dae80c8e1 100644
--- a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/OrcsSubscriptionStorage.java
+++ b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/OrcsSubscriptionStorage.java
@@ -117,9 +117,9 @@ public class OrcsSubscriptionStorage extends AbstractOrcsStorage implements Subs
}
@Override
- public ResultSet<SubscriptionGroup> getSubscriptionGroupByUuid(String uuid) {
+ public ResultSet<SubscriptionGroup> getSubscriptionGroupByGuid(String guid) {
ResultSet<ArtifactReadable> results =
- newQuery().andGuid(uuid).andIsOfType(CoreArtifactTypes.SubscriptionGroup).getResults();
+ newQuery().andGuid(guid).andIsOfType(CoreArtifactTypes.SubscriptionGroup).getResults();
return getFactory().newAccountSubscriptionGroupResultSet(results);
}
@@ -164,9 +164,9 @@ public class OrcsSubscriptionStorage extends AbstractOrcsStorage implements Subs
}
@Override
- public ResultSet<Account> getSubscriptionGroupMembersByUuid(String uuid) {
+ public ResultSet<Account> getSubscriptionGroupMembersByGuid(String guid) {
ResultSet<ArtifactReadable> results =
- newQuery().andIsOfType(CoreArtifactTypes.SubscriptionGroup).andGuid(uuid).getResults();
+ newQuery().andIsOfType(CoreArtifactTypes.SubscriptionGroup).andGuid(guid).getResults();
ArtifactReadable group = results.getOneOrNull();
return getMembers(group);
}
diff --git a/plugins/org.eclipse.osee.orcs.script.dsl/xtend-gen/org/eclipse/osee/orcs/script/dsl/generator/OrcsScriptDslGenerator.java b/plugins/org.eclipse.osee.orcs.script.dsl/xtend-gen/org/eclipse/osee/orcs/script/dsl/generator/OrcsScriptDslGenerator.java
index 7194356eb2..e453cbed85 100644
--- a/plugins/org.eclipse.osee.orcs.script.dsl/xtend-gen/org/eclipse/osee/orcs/script/dsl/generator/OrcsScriptDslGenerator.java
+++ b/plugins/org.eclipse.osee.orcs.script.dsl/xtend-gen/org/eclipse/osee/orcs/script/dsl/generator/OrcsScriptDslGenerator.java
@@ -14,7 +14,6 @@ import org.eclipse.xtext.generator.IGenerator;
*/
@SuppressWarnings("all")
public class OrcsScriptDslGenerator implements IGenerator {
- @Override
public void doGenerate(final Resource resource, final IFileSystemAccess fsa) {
}
}
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/utility/OrcsUtil.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/utility/OrcsUtil.java
index 463564a413..ecc7fb28e4 100644
--- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/utility/OrcsUtil.java
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/utility/OrcsUtil.java
@@ -26,6 +26,10 @@ public final class OrcsUtil {
return new ArtifactToken(uuid, guid, name);
}
+ public static ArtifactId newArtifactId(long uuid) {
+ return new ArtifactToken(uuid, null, null);
+ }
+
private static class ArtifactToken extends NamedIdentity<String>implements ArtifactId {
private final long uuid;
diff --git a/plugins/org.eclipse.osee.web.ui/src/dispo/js/userController.js b/plugins/org.eclipse.osee.web.ui/src/dispo/js/userController.js
index 00037c80f3..9ee3d7c530 100644
--- a/plugins/org.eclipse.osee.web.ui/src/dispo/js/userController.js
+++ b/plugins/org.eclipse.osee.web.ui/src/dispo/js/userController.js
@@ -38,7 +38,7 @@ app.controller('userController', [
};
// if this is a search result view, populate program, set and items from parent scope
- if(window.opener != null) {
+ if(window.opener != null && window.opener.$windowScope != undefined) {
$scope.programs = window.opener.$windowScope.programs;
$scope.sets = window.opener.$windowScope.sets;
$scope.programSelection = window.opener.$windowScope.programSelection;
diff --git a/plugins/org.eclipse.osee.web.ui/src/libs/js/oseeAuth/oseeAuth.js b/plugins/org.eclipse.osee.web.ui/src/libs/js/oseeAuth/oseeAuth.js
index 11d17e4ade..d610d5b77e 100644
--- a/plugins/org.eclipse.osee.web.ui/src/libs/js/oseeAuth/oseeAuth.js
+++ b/plugins/org.eclipse.osee.web.ui/src/libs/js/oseeAuth/oseeAuth.js
@@ -17,8 +17,7 @@ directives.directive('osee', [
'Endpoint',
'$localStorage',
'$sessionStorage',
- '$cookieStore',
- function($rootScope, $compile, $http, $location, $templateCache, AccessToken, Profile, Endpoint, $localStorage, $sessionStorage, $cookieStore) {
+ function($rootScope, $compile, $http, $location, $templateCache, AccessToken, Profile, Endpoint, $localStorage, $sessionStorage) {
var definition = {
restrict : 'E',
replace : true,
@@ -145,8 +144,9 @@ directives.directive('osee', [
scope.$on("oauth:authorized", function(event, token) {
Profile.find(scope.profileUri).success(function(response) {
+ $localStorage.uuid = response.accountId;
+ $localStorage.guid = response.guid;
scope.profile = response;
- $cookieStore.put("name", scope.profile.name);
});
if($localStorage.continueTo) {
// Change the state to the continueTo we caught when User first tried to get into page
@@ -155,14 +155,14 @@ directives.directive('osee', [
}
})
scope.$on("oauth:logout", function() {
+ $localStorage.uuid = 1896;
scope.profile = scope.anonymousUser;
- $cookieStore.put("name", scope.profile.name);
AccessToken.destroy();
$location.path("/");
})
scope.$on("oauth:denied", function(event, token) {
+ $localStorage.uuid = 1896;
scope.profile = scope.anonymousUser;
- $cookieStore.put("name", scope.profile.name);
AccessToken.destroy();
});
diff --git a/plugins/org.eclipse.osee.web.ui/src/osee/js/meController.js b/plugins/org.eclipse.osee.web.ui/src/osee/js/meController.js
new file mode 100644
index 0000000000..10507f6061
--- /dev/null
+++ b/plugins/org.eclipse.osee.web.ui/src/osee/js/meController.js
@@ -0,0 +1,154 @@
+app.controller('meController', [
+ '$scope',
+ '$localStorage',
+ '$modal',
+ 'Preferences',
+ 'uiGridConstants',
+ function($scope, $localStorage, $modal, Preferences, uiGridConstants) {
+ $scope.editLinks = false;
+
+ $scope.editItem = function(item, key) {
+ if(item.url.match(/http.*/) == null) {
+ item.url = "http://" + item.url;
+ }
+ Preferences.update({
+ id: $localStorage.guid,
+ key: key,
+ itemId: item.id,
+ }, item, function() {
+ }, function(data) {
+ alert("Could not make change, please try refreshing");
+ });
+ }
+
+
+ $scope.deleteLink = function(item) {
+ var newLink = {};
+ var key = "links";
+ Preferences.update({
+ id: $localStorage.guid,
+ key: key,
+ itemId: item.id,
+ }, newLink, function() {
+ $scope.getPreferences();
+ }, function(data) {
+ alert("Could not make change, please try refreshing");
+ });
+ }
+
+ var clickCellTmpl = '<a href="{{ COL_FIELD }}" target="_blank">{{ COL_FIELD }}</a>'
+ var dellCellTmpl = '<button width="35px" class="btn btn-default btn-sm setDelete" ng-show="!readOnly" ng-click="grid.appScope.deleteLink(row.entity)">X</button>';
+
+ $scope.defaultGridOptions = {
+ data: 'defaultLinks',
+ columnDefs: [
+ {field: 'name', displayName: 'Name'},
+ {field: 'url', displayName: 'URL', cellTemplate: clickCellTmpl}
+ ],
+ onRegisterApi: function( gridApi ) {
+ $scope.gridApi = gridApi;
+ gridApi.edit.on.afterCellEdit($scope,function(rowEntity, colDef, newValue, oldValue){
+ this.grid.appScope.editItem(null);
+ });
+ }
+
+ };
+
+ $scope.personalColumns = [
+ {field: 'name', displayName: 'Name', cellEditableCondition: function( $scope ) {
+ return $scope.$parent.$parent.grid.appScope.editLinks; }},
+ {field: 'url', displayName: 'URL', cellTemplate: clickCellTmpl, cellEditableCondition: function( $scope ) {
+ return $scope.$parent.$parent.grid.appScope.editLinks; }},
+ {field: 'delete', width: 35, displayName: 'X', enableCellEdit: false, cellTemplate: dellCellTmpl, enableColumnMenu: false, visible: false}
+ ];
+
+ $scope.personalGridOptions = {
+ data: 'personalLinks',
+ columnDefs: $scope.personalColumns,
+ onRegisterApi: function( gridApi ) {
+ $scope.gridApi = gridApi;
+ gridApi.edit.on.afterCellEdit($scope,function(rowEntity, colDef, newValue, oldValue){
+ if(newValue != oldValue) {
+ this.grid.appScope.editItem(rowEntity, 'links');
+ }
+ });
+ }
+
+ };
+
+ $scope.toggleEditLinks = function() {
+ $scope.editLinks = !$scope.editLinks;
+ $scope.personalColumns[2].visible = !($scope.personalColumns[2].visible || $scope.personalColumns[2].visible === undefined);
+ $scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.COLUMN);
+ }
+
+ $scope.getDefaultPreferences = function() {
+ Preferences.get({
+ id: 'AAABDi35uzwAxJLISLBZdA'
+ }, function(data) {
+ $scope.defaultLinks = Object.keys(data.links).map(function (key) {return data.links[key]});
+ });
+ }
+ $scope.getDefaultPreferences();
+
+ $scope.getPreferences = function() {
+ Preferences.get({
+ id: $localStorage.guid
+ }, function(data) {
+ $scope.personalLinks = Object.keys(data.links).map(function (key) {return data.links[key]});
+ });
+ }
+ $scope.getPreferences();
+
+ $scope.createNewLink = function(name, url) {
+ var newLink = {};
+ newLink.name = name;
+ if(url.match(/http.*/) == null) {
+ url = "http://" + url;
+ }
+ newLink.url = url;
+ var key = "links";
+
+ Preferences.update({
+ id: $localStorage.guid,
+ key: key,
+ itemId: null,
+ }, newLink, function() {
+ $scope.getPreferences();
+ }, function(data) {
+ alert("Could not make change, please try refreshing");
+ });
+ }
+
+
+ // Create Set Modal
+ $scope.showCreateLinkModal = function() {
+ var modalInstance = $modal.open({
+ templateUrl: 'popup.html',
+ controller: CreateSetModalCtrl,
+ size: 'sm',
+ windowClass: 'createSetModal'
+ });
+
+ modalInstance.result.then(function(inputs) {
+ $scope.createNewLink(inputs.name, inputs.url);
+ });
+ }
+
+ var CreateSetModalCtrl = function($scope, $modalInstance) {
+ $scope.linkName = "";
+ $scope.linkUrl = "";
+
+ $scope.ok = function() {
+ var inputs = {};
+ inputs.name = this.linkName;
+ inputs.url = this.linkUrl;
+ $modalInstance.close(inputs);
+ };
+
+ $scope.cancel = function() {
+ $modalInstance.dismiss('cancel');
+ };
+ };
+
+ }]); \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.web.ui/src/osee/js/oseeApp.js b/plugins/org.eclipse.osee.web.ui/src/osee/js/oseeApp.js
index f372f43d84..15329f665c 100644
--- a/plugins/org.eclipse.osee.web.ui/src/osee/js/oseeApp.js
+++ b/plugins/org.eclipse.osee.web.ui/src/osee/js/oseeApp.js
@@ -1,6 +1,6 @@
-var app = angular.module('oseeApp', ['oauth', 'oseeProvider', 'ngRoute', 'aLinkRewrite']);
+var app = angular.module('oseeApp', ['oauth', 'ngResource', 'ui.bootstrap', 'oseeProvider', 'ngRoute', 'aLinkRewrite', 'ui.grid', 'ui.grid.edit']);
-+app.config(['$routeProvider',
+app.config(['$routeProvider',
function($routeProvider) {
$routeProvider.when('/', {
@@ -15,6 +15,9 @@ var app = angular.module('oseeApp', ['oauth', 'oseeProvider', 'ngRoute', 'aLinkR
}).when('/contactUs', {
templateUrl: '../views/contactUs.html',
controller: 'indexController'
+ }).when('/me', {
+ templateUrl: '../views/me.html',
+ controller: 'meController'
}).when('/redirect', {
templateUrl: '../views/home.html',
controller: 'indexController'
@@ -23,4 +26,20 @@ var app = angular.module('oseeApp', ['oauth', 'oseeProvider', 'ngRoute', 'aLinkR
redirectTo: "/"
});
}
- ]); \ No newline at end of file
+ ]);
+
+app.provider('Preferences', function() {
+ this.$get = ['$resource',
+ function($resource) {
+ var Preferences = $resource('/accounts/preferences/:id', {}, {
+ update: {
+ method: 'PUT',
+ headers: {
+ "Accept": "application/json"
+ }
+ }
+ });
+ return Preferences;
+ }
+ ];
+}); \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.web.ui/src/osee/ui/index.html b/plugins/org.eclipse.osee.web.ui/src/osee/ui/index.html
index 6a5bf7e8dc..5123e81127 100644
--- a/plugins/org.eclipse.osee.web.ui/src/osee/ui/index.html
+++ b/plugins/org.eclipse.osee.web.ui/src/osee/ui/index.html
@@ -10,6 +10,8 @@
</meta>
<link rel="stylesheet" href="/ajax/libs/bootstrap/3.3.2/css/bootstrap.min.css">
</link>
+ <link rel="stylesheet" href="/ajax/libs/ui-grid/3.0.1/ui-grid.css">
+ </link>
<script src="/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="/ajax/libs/angularjs/1.3.11/angular.js"></script>
<script src="/ajax/libs/angularjs/1.3.11/angular-route.min.js"></script>
@@ -20,7 +22,9 @@
<script src="/ajax/libs/oauth-ng/0.3.8/oauth-ng.js"></script>
<script src="/libs/js/oseeAuth/oseeAuth.js"></script>
<script src="/libs/js/support/linkRewrite.js"></script>
+ <script src="/ajax/libs/ui-grid/3.0.1/ui-grid.js"></script>
<script src="../js/oseeApp.js"></script>
+ <script src="../js/meController.js"></script>
<link rel="icon" type="image/x-icon" href="images/osee.ico" />
<link rel="shortcut icon" type="image/x-icon" href="/libs/images/osee.ico" />
<title>OSEE</title>
@@ -38,7 +42,7 @@
app.controller("indexController", [
"$scope", '$location', '$window',
function($scope, $location, $window) {
- $scope.links = [ { ref: '', name: 'Home'}, { ref: 'about', name: 'About'}, { ref: 'wiki', name: 'Wiki'}, { ref: 'contactUs', name: 'Contact Us'}];
+ $scope.links = [ { ref: '', name: 'Home'}, { ref: 'me', name: 'Me'},{ ref: 'about', name: 'About'}, { ref: 'wiki', name: 'Wiki'}, { ref: 'contactUs', name: 'Contact Us'}];
}]);
</script>
</html> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.web.ui/src/osee/views/me.html b/plugins/org.eclipse.osee.web.ui/src/osee/views/me.html
new file mode 100644
index 0000000000..1efa6bb530
--- /dev/null
+++ b/plugins/org.eclipse.osee.web.ui/src/osee/views/me.html
@@ -0,0 +1,45 @@
+ <div class="container-fluid" id="content">
+ <div class="row">
+ <div class="col-md-7">
+ <div class="row">
+ <div class="col-md-5">
+ <h5>DEFAULT</h5>
+ </div>
+ </div>
+ <div class="gridStyle" ui-grid="defaultGridOptions" ui-grid-edit class="grid"></div>
+ <div class="row" id="personalDiv">
+ <div class="col-md-1">
+ <h5>PERSONAL</h5>
+ </div>
+ <div class="col-md-2 col-md-offset-8">
+ <button ng-click="showCreateLinkModal()" ng-show="editLinks" ng-class="{'btn active btn-primary': true}">NEW</button>
+ </div>
+ <div class="col-md-1 col-md-offset-0">
+ <button ng-click="toggleEditLinks()" ng-class="{'btn pull-right active': true, 'btn-primary': !editLinks, 'btn-info': editLinks}">EDIT</button>
+ </div>
+ </div>
+ <div class="gridStyle" external-scopes="externalScope" ui-grid="personalGridOptions" ui-grid-edit class="grid"></div>
+ </div>
+ </div>
+</div>
+
+<!-- definitions for modal forms -->
+<script type="text/ng-template" id="popup.html">
+ <div class="modal-header">
+ <h3 class="modal-title">Create Link</h3>
+ </div>
+ <div class="modal-body" style="height: 300px; overflow: auto;">
+ <div class="form-group">
+ <label for="linkNameInput">Set Name</label>
+ <input ng-model="linkName" class="form-control" name="linkName" placeholder="Enter Link Name" required>
+ </div>
+ <div class="form-group">
+ <label for="setLinkUrl">Path</label>
+ <input ng-model="linkUrl" class="form-control" name="linkUrl" placeholder="Enter Link URL" required>
+ </div>
+ <div class="modal-footer">
+ <button class="btn btn-primary" ng-click="ok()">OK</button>
+ <button class="btn btn-warning" ng-click="cancel()">Cancel</button>
+ </div>
+
+ </script> \ No newline at end of file

Back to the top