Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2015-11-09 09:50:46 -0500
committerDonald Dunne2015-11-20 14:27:17 -0500
commit1573d9eb54d4eda2684222d68b43156eed3ea780 (patch)
tree2b748ac25b6bd0060a5a352d79312570cddc7429
parent60acab55cc8743097db98770a8d897d6d1bbd562 (diff)
downloadorg.eclipse.osee-1573d9eb54d4eda2684222d68b43156eed3ea780.tar.gz
org.eclipse.osee-1573d9eb54d4eda2684222d68b43156eed3ea780.tar.xz
org.eclipse.osee-1573d9eb54d4eda2684222d68b43156eed3ea780.zip
bug[ats_ATS257686]: Supply accountId via OseeAccountClientRequestFilter.
-rw-r--r--plugins/org.eclipse.osee.account.rest.client/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java11
-rw-r--r--plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/ActivityLogEndpoint.java6
-rw-r--r--plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogRequestFilter.java22
-rw-r--r--plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogResource.java4
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsActivityLogUtil.java4
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeClient.java24
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/users/CurrentUserProvider.java21
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/ActivityLogUtil.java29
-rw-r--r--plugins/org.eclipse.osee.framework.ui.plugin/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/util/ActivityLogJaxRsService.java38
-rw-r--r--plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/xnavigate/XNavigateComposite.java7
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientConfiguratorTest.java21
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClient.java37
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/OseeAccountClientRequestFilter.java33
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientConfigurator.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClient.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java2
19 files changed, 180 insertions, 91 deletions
diff --git a/plugins/org.eclipse.osee.account.rest.client/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.account.rest.client/META-INF/MANIFEST.MF
index 72f24592ce..0a2af3aa1c 100644
--- a/plugins/org.eclipse.osee.account.rest.client/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.account.rest.client/META-INF/MANIFEST.MF
@@ -13,6 +13,7 @@ Import-Package: com.google.inject,
javax.ws.rs.client;version="2.0.0",
javax.ws.rs.core;version="2.0.0",
org.eclipse.osee.account.rest.model,
+ org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.jaxrs,
org.eclipse.osee.jaxrs.client
diff --git a/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java b/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java
index 5f9226ec1b..163e684140 100644
--- a/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java
+++ b/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java
@@ -39,6 +39,7 @@ 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.SubscriptionData;
+import org.eclipse.osee.framework.core.data.OseeClient;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.framework.jdk.core.type.ResultSets;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
@@ -50,7 +51,7 @@ import org.eclipse.osee.jaxrs.client.JaxRsWebTarget;
*/
public class AccountClientImpl implements AccountClient {
- private static final String OSEE_APPLICATION_SERVER = "osee.application.server";
+ private static final String OSEE_APPLICATION_SERVER = OseeClient.OSEE_APPLICATION_SERVER;
private volatile JaxRsClient client;
private volatile URI baseUri;
@@ -162,8 +163,8 @@ public class AccountClientImpl implements AccountClient {
@Override
public AccountPreferencesData getAccountPreferencesByUniqueField(String accountId) {
- URI uri =
- UriBuilder.fromUri(baseUri).path(ACCOUNTS).path(ACCOUNT_ID_TEMPLATE).path(ACCOUNT_PREFERENCES).build(accountId);
+ URI uri = UriBuilder.fromUri(baseUri).path(ACCOUNTS).path(ACCOUNT_ID_TEMPLATE).path(ACCOUNT_PREFERENCES).build(
+ accountId);
try {
return newTarget(uri).request(MediaType.APPLICATION_JSON_TYPE).get(AccountPreferencesData.class);
} catch (Exception ex) {
@@ -218,8 +219,8 @@ public class AccountClientImpl implements AccountClient {
@Override
public boolean setAccountPreferences(String accountId, Map<String, String> preferences) {
- URI uri =
- UriBuilder.fromUri(baseUri).path(ACCOUNTS).path(ACCOUNT_ID_TEMPLATE).path(ACCOUNT_PREFERENCES).build(accountId);
+ URI uri = UriBuilder.fromUri(baseUri).path(ACCOUNTS).path(ACCOUNT_ID_TEMPLATE).path(ACCOUNT_PREFERENCES).build(
+ accountId);
AccountPreferencesInput input = new AccountPreferencesInput();
input.setMap(preferences);
diff --git a/plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/ActivityLogEndpoint.java b/plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/ActivityLogEndpoint.java
index 07185d7915..99e385181d 100644
--- a/plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/ActivityLogEndpoint.java
+++ b/plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/ActivityLogEndpoint.java
@@ -61,19 +61,17 @@ public interface ActivityLogEndpoint {
/**
* Create a new activity entry
- *
- * @param accountId account id
- * @param clientId client id
* @param typeId activity type id
* @param parentId of the parent activity
* @param status of the activity
* @param message to log for the activity
+ *
* @return entryId
*/
@POST
@Path("/entry")
@Produces({MediaType.APPLICATION_JSON})
- ActivityEntryId createEntry(@QueryParam("accountId") Long accountId, @QueryParam("clientId") Long clientId, @QueryParam("typeId") Long typeId, @QueryParam("parentId") Long parentId, @QueryParam("status") Integer status, @QueryParam("message") String message);
+ ActivityEntryId createEntry(@QueryParam("typeId") Long typeId, @QueryParam("parentId") Long parentId, @QueryParam("status") Integer status, @QueryParam("message") String message);
/**
* Create a new activity type
diff --git a/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogRequestFilter.java b/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogRequestFilter.java
index 682f5770cc..24391dd9b3 100644
--- a/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogRequestFilter.java
+++ b/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogRequestFilter.java
@@ -19,6 +19,7 @@ import javax.ws.rs.ext.Provider;
import org.eclipse.osee.activity.ActivityConstants;
import org.eclipse.osee.activity.api.Activity;
import org.eclipse.osee.activity.api.ActivityLog;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.logger.Log;
/**
@@ -48,11 +49,16 @@ public class ActivityLogRequestFilter implements ContainerRequestFilter {
if (activityLog.isEnabled()) {
try {
String message = String.format("%s %s", context.getMethod(), context.getUriInfo().getRequestUri());
-
Long serverId = getServerId(context);
- Long clientId = getClientId(context);
- Long accountId = getAccountId(context);
+ Long clientId = ActivityConstants.DEFAULT_CLIENT_ID;
+ if (Strings.isNumeric(context.getHeaders().getFirst("osee.client.id"))) {
+ clientId = Long.valueOf(context.getHeaders().getFirst("osee.client.id"));
+ }
+ Long accountId = ActivityConstants.DEFAULT_ACCOUNT_ID;
+ if (Strings.isNumeric(context.getHeaders().getFirst("osee.account.id"))) {
+ accountId = Long.valueOf(context.getHeaders().getFirst("osee.account.id"));
+ }
Long entryId =
activityLog.createActivityThread(Activity.JAXRS_METHOD_CALL, accountId, serverId, clientId, message);
@@ -68,14 +74,4 @@ public class ActivityLogRequestFilter implements ContainerRequestFilter {
return toReturn;
}
- private Long getClientId(ContainerRequestContext context) {
- Long toReturn = ActivityConstants.DEFAULT_CLIENT_ID;
- return toReturn;
- }
-
- private Long getAccountId(ContainerRequestContext context) {
- Long toReturn = ActivityConstants.DEFAULT_ACCOUNT_ID;
- return toReturn;
- }
-
}
diff --git a/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogResource.java b/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogResource.java
index f316847f2f..b58c277190 100644
--- a/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogResource.java
+++ b/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogResource.java
@@ -65,8 +65,8 @@ public final class ActivityLogResource implements ActivityLogEndpoint {
}
@Override
- public ActivityEntryId createEntry(Long accountId, Long clientId, Long typeId, Long parentId, Integer status, String message) {
- Long entryId = activityLog.createEntry(accountId, clientId, typeId, parentId, status, message);
+ public ActivityEntryId createEntry(Long typeId, Long parentId, Integer status, String message) {
+ Long entryId = activityLog.createEntry(typeId, parentId, status, message);
ActivityEntryId entity = new ActivityEntryId();
entity.setGuid(entryId);
return entity;
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsActivityLogUtil.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsActivityLogUtil.java
index bbf2148b2a..3f4ce318f9 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsActivityLogUtil.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsActivityLogUtil.java
@@ -7,14 +7,12 @@ package org.eclipse.osee.ats.util;
import org.eclipse.osee.activity.api.ActivityEntryId;
import org.eclipse.osee.activity.api.ActivityType;
-import org.eclipse.osee.framework.skynet.core.utility.ActivityLogUtil;
import org.eclipse.osee.framework.ui.plugin.util.ActivityLogJaxRsService;
public class AtsActivityLogUtil {
public static ActivityEntryId create(ActivityType type, long parent, Integer initialStatus, String message) {
- return ActivityLogJaxRsService.create(ActivityLogUtil.getAccountId(), ActivityLogUtil.getClientId(), type,
- parent, initialStatus, message);
+ return ActivityLogJaxRsService.create(type, parent, initialStatus, message);
}
public static void update(ActivityEntryId entryId, Integer statusId) {
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeClient.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeClient.java
new file mode 100644
index 0000000000..0e2eb1b620
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeClient.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.framework.core.data;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class OseeClient {
+
+ public static String OSEE_APPLICATION_SERVER = "osee.application.server";
+
+ private OseeClient() {
+ // utility class
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF
index 9d9da95276..aff109882a 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF
@@ -48,7 +48,9 @@ Export-Package: org.eclipse.osee.framework.skynet.core,
Bundle-Vendor: Eclipse Open System Engineering Environment
Import-Package: com.google.common.collect;version="15.0.0",
com.google.common.io;version="15.0.0",
+ javax.ws.rs.client;version="2.0.0",
javax.ws.rs.core;version="2.0.0",
+ javax.ws.rs.ext;version="2.0.0",
org.apache.commons.lang;version="2.4.0",
org.apache.xerces.parsers;version="2.9.0",
org.apache.xerces.xni.parser;version="2.9.0",
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/users/CurrentUserProvider.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/users/CurrentUserProvider.java
index cde30840c9..7205eab4fc 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/users/CurrentUserProvider.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/users/CurrentUserProvider.java
@@ -16,6 +16,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
import org.eclipse.osee.cache.admin.Cache;
import org.eclipse.osee.framework.core.client.ClientSessionManager;
+import org.eclipse.osee.framework.core.client.OseeClientSession;
import org.eclipse.osee.framework.core.data.IUserToken;
import org.eclipse.osee.framework.core.enums.SystemUser;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
@@ -23,12 +24,15 @@ import org.eclipse.osee.framework.core.exception.UserNotInDatabase;
import org.eclipse.osee.framework.jdk.core.type.LazyObject;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.UserManager;
import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
import org.eclipse.osee.framework.skynet.core.event.model.AccessControlEvent;
import org.eclipse.osee.framework.skynet.core.event.model.AccessControlEventType;
import org.eclipse.osee.framework.skynet.core.internal.Activator;
+import org.eclipse.osee.jaxrs.client.JaxRsClient;
/**
* @author Roberto E. Escobar
@@ -100,6 +104,23 @@ public class CurrentUserProvider extends LazyObject<User> {
"You are logged into OSEE as \"Guest\". If this is unexpected notify your OSEE admin");
}
}
+ OseeClientSession session = ClientSessionManager.getSession();
+ try {
+ String userId = session.getUserId();
+ if (Strings.isValid(userId) && !"bootstrap".equals(userId)) {
+ User user = UserManager.getUserByUserId(userId);
+ if (user != null) {
+ JaxRsClient.setAccountId(user.getUuid());
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, Level.WARNING, "Error setting jax-rs accountId credentials.", ex);
+ }
+ try {
+ JaxRsClient.setClientId(Long.valueOf(session.getId().hashCode()));
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, Level.WARNING, "Error setting jax-rs clientId credentials.", ex);
+ }
}
if (ClientSessionManager.isSessionValid()) {
AccessControlEvent event = new AccessControlEvent();
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/ActivityLogUtil.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/ActivityLogUtil.java
deleted file mode 100644
index b52ff09515..0000000000
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/ActivityLogUtil.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Created on Oct 22, 2014
- *
- * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
- */
-package org.eclipse.osee.framework.skynet.core.utility;
-
-import org.eclipse.osee.framework.core.client.ClientSessionManager;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-
-public class ActivityLogUtil {
-
- private static Long accountId;
- private static Long clientId;
-
- public static Long getClientId() {
- if (clientId == null) {
- clientId = Long.valueOf(ClientSessionManager.getSessionId().hashCode());
- }
- return clientId;
- }
-
- public static Long getAccountId() {
- if (accountId == null) {
- accountId = Long.valueOf(UserManager.getUser().getArtId());
- }
- return accountId;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.ui.plugin/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.ui.plugin/META-INF/MANIFEST.MF
index 32ebd94daf..e7a0d631e9 100644
--- a/plugins/org.eclipse.osee.framework.ui.plugin/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.ui.plugin/META-INF/MANIFEST.MF
@@ -28,12 +28,10 @@ Export-Package: org.eclipse.osee.framework.ui.plugin,
org.eclipse.osee.framework.ui.plugin.xnavigate
Import-Package: javax.ws.rs.core;version="2.0.0",
org.eclipse.osee.activity.api,
- org.eclipse.osee.framework.core.client,
org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.exception,
org.eclipse.osee.framework.core.operation,
org.eclipse.osee.framework.core.util,
org.eclipse.osee.framework.logging,
- org.eclipse.osee.framework.skynet.core.utility,
org.eclipse.osee.jaxrs.client
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/util/ActivityLogJaxRsService.java b/plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/util/ActivityLogJaxRsService.java
index ac449fb9ab..8c14704336 100644
--- a/plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/util/ActivityLogJaxRsService.java
+++ b/plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/util/ActivityLogJaxRsService.java
@@ -13,7 +13,8 @@ package org.eclipse.osee.framework.ui.plugin.util;
import org.eclipse.osee.activity.api.ActivityEntryId;
import org.eclipse.osee.activity.api.ActivityLogEndpoint;
import org.eclipse.osee.activity.api.ActivityType;
-import org.eclipse.osee.framework.core.client.OseeClientProperties;
+import org.eclipse.osee.framework.core.data.OseeClient;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
/**
@@ -22,23 +23,40 @@ import org.eclipse.osee.jaxrs.client.JaxRsClient;
public class ActivityLogJaxRsService {
public static ActivityLogEndpoint get() {
- String appServer = OseeClientProperties.getOseeApplicationServer();
- return JaxRsClient.newBuilder() //
- .createThreadSafeProxyClients(true) // if the client needs to be shared between threads
- .build() //
- .targetProxy(appServer, ActivityLogEndpoint.class);
+ try {
+ String appServer = System.getProperty(OseeClient.OSEE_APPLICATION_SERVER);
+ if (Strings.isValid(appServer)) {
+ return JaxRsClient.newBuilder() //
+ .createThreadSafeProxyClients(true) // if the client needs to be shared between threads
+ .build() //
+ .targetProxy(appServer, ActivityLogEndpoint.class);
+ }
+ } catch (Exception ex) {
+ // do nothing
+ }
+ return null;
}
public static void createActivityType(ActivityType type) {
- get().createActivityType(type.getTypeId(), type.getLogLevel(), type.getModule(), type.getMessageFormat());
+ ActivityLogEndpoint activityEp = get();
+ if (activityEp != null) {
+ activityEp.createActivityType(type.getTypeId(), type.getLogLevel(), type.getModule(), type.getMessageFormat());
+ }
}
- public static ActivityEntryId create(Long accountId, Long clientId, ActivityType type, long parent, Integer initialStatus, String message) {
- return get().createEntry(accountId, clientId, type.getTypeId(), parent, initialStatus, message);
+ public static ActivityEntryId create(ActivityType type, long parent, Integer initialStatus, String message) {
+ ActivityLogEndpoint activityEp = get();
+ if (activityEp != null) {
+ return activityEp.createEntry(type.getTypeId(), parent, initialStatus, message);
+ }
+ return null;
}
public static void update(ActivityEntryId entryId, Integer statusId) {
- get().updateEntry(entryId.getGuid(), statusId);
+ ActivityLogEndpoint activityEp = get();
+ if (activityEp != null) {
+ activityEp.updateEntry(entryId.getGuid(), statusId);
+ }
}
}
diff --git a/plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/xnavigate/XNavigateComposite.java b/plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/xnavigate/XNavigateComposite.java
index bdc88d5d6e..73adf88472 100644
--- a/plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/xnavigate/XNavigateComposite.java
+++ b/plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/xnavigate/XNavigateComposite.java
@@ -22,7 +22,6 @@ import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.utility.ActivityLogUtil;
import org.eclipse.osee.framework.ui.plugin.internal.UiPluginConstants;
import org.eclipse.osee.framework.ui.plugin.util.ActivityLogJaxRsService;
import org.eclipse.osee.framework.ui.swt.Displays;
@@ -142,11 +141,9 @@ public class XNavigateComposite extends Composite {
} else {
try {
long uuid = Lib.generateUuid();
- ActivityLogJaxRsService.create(ActivityLogUtil.getAccountId(), ActivityLogUtil.getClientId(),
- Activity.XNAVIGATEITEM, uuid, ActivityLog.INITIAL_STATUS, item.getName());
+ ActivityLogJaxRsService.create(Activity.XNAVIGATEITEM, uuid, ActivityLog.INITIAL_STATUS, item.getName());
item.run(tableLoadOptions);
- ActivityLogJaxRsService.create(ActivityLogUtil.getAccountId(), ActivityLogUtil.getClientId(),
- Activity.XNAVIGATEITEM, uuid, ActivityLog.COMPLETE_STATUS, item.getName());
+ ActivityLogJaxRsService.create(Activity.XNAVIGATEITEM, uuid, ActivityLog.COMPLETE_STATUS, item.getName());
} catch (Exception ex) {
OseeLog.log(UiPluginConstants.class, OseeLevel.SEVERE_POPUP, ex);
}
diff --git a/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientConfiguratorTest.java b/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientConfiguratorTest.java
index 2c1a1757f5..d1f4a74f05 100644
--- a/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientConfiguratorTest.java
+++ b/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientConfiguratorTest.java
@@ -43,6 +43,7 @@ import org.eclipse.osee.jaxrs.client.JaxRsClientConstants.ConnectionType;
import org.eclipse.osee.jaxrs.client.JaxRsClientConstants.ProxyType;
import org.eclipse.osee.jaxrs.client.JaxRsConfirmAccessHandler;
import org.eclipse.osee.jaxrs.client.JaxRsTokenStore;
+import org.eclipse.osee.jaxrs.client.internal.OseeAccountClientRequestFilter;
import org.eclipse.osee.jaxrs.client.internal.ext.CxfJaxRsClientConfigurator.OAuthFactory;
import org.eclipse.osee.jaxrs.client.internal.ext.OAuth2ClientRequestFilter.ClientAccessTokenCache;
import org.junit.Before;
@@ -57,7 +58,7 @@ import org.mockito.MockitoAnnotations;
/**
* Test Case for {@link CxfJaxRsClientConfigurator}
- *
+ *
* @author Roberto E. Escobar
*/
public class CxfJaxRsClientConfiguratorTest {
@@ -111,15 +112,15 @@ public class CxfJaxRsClientConfiguratorTest {
@Mock private HTTPConduit conduit;
@Mock private ClientBuilder builder;
@Mock private JAXRSClientFactoryBean bean;
-
+
@Mock private HTTPClientPolicy policy1;
- @Mock private AuthorizationPolicy policy2;
- @Mock private ProxyAuthorizationPolicy policy3;
+ @Mock private AuthorizationPolicy policy2;
+ @Mock private ProxyAuthorizationPolicy policy3;
@Mock private OAuthFactory oauthFactory;
@Mock private OAuth2ClientRequestFilter filter;
@Mock private JaxRsConfirmAccessHandler handler;
@Mock private JaxRsTokenStore store;
-
+
@Captor private ArgumentCaptor<Object> captor;
@Captor private ArgumentCaptor<HTTPClientPolicy> captor1;
@Captor private ArgumentCaptor<AuthorizationPolicy> captor2;
@@ -223,10 +224,10 @@ public class CxfJaxRsClientConfiguratorTest {
configurator.configureDefaults(props);
configurator.configureClientBuilder(config, builder);
- verify(builder, times(8)).register(captor.capture());
+ verify(builder, times(10)).register(captor.capture());
List<Object> actual = captor.getAllValues();
- assertEquals(8, actual.size());
+ assertEquals(10, actual.size());
Iterator<Object> iterator = actual.iterator();
assertEquals(GenericResponseExceptionMapper.class, iterator.next().getClass());
@@ -236,6 +237,7 @@ public class CxfJaxRsClientConfiguratorTest {
assertEquals(OAuthJSONProvider.class, iterator.next().getClass());
assertEquals(OAuthContextProvider.class, iterator.next().getClass());
+ assertEquals(OseeAccountClientRequestFilter.class, iterator.next().getClass());
assertEquals(LoggingFeature.class, iterator.next().getClass());
assertEquals(GZIPFeature.class, iterator.next().getClass());
@@ -465,9 +467,8 @@ public class CxfJaxRsClientConfiguratorTest {
when(config.getServerPassword()).thenReturn(SERVER_PASSWORD);
when(config.getServerAuthorizationType()).thenReturn(SERVER_AUTHORIZATION_TYPE);
- when(
- oauthFactory.newOAuthClientFilter(SERVER_USERNAME, SERVER_PASSWORD, CLIENT_ID, CLIENT_SECRET, AUTHORIZE_URI,
- TOKEN_URI, VALIDATION_URI)).thenReturn(filter);
+ when(oauthFactory.newOAuthClientFilter(SERVER_USERNAME, SERVER_PASSWORD, CLIENT_ID, CLIENT_SECRET, AUTHORIZE_URI,
+ TOKEN_URI, VALIDATION_URI)).thenReturn(filter);
List<Object> actual = configurator.getOAuthProviders(config);
assertEquals(1, actual.size());
diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClient.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClient.java
index 2941e9b02f..0a457861c2 100644
--- a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClient.java
+++ b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClient.java
@@ -55,6 +55,7 @@ public final class JaxRsClient {
private final JaxRsClientConfig config;
private final JaxRsClientFactory factory;
+ private static Long accountId, clientId, serverId;
protected JaxRsClient(JaxRsClientFactory factory, JaxRsClientConfig config) {
super();
@@ -64,7 +65,7 @@ public final class JaxRsClient {
/**
* Creates a JAX-RS WebTarget
- *
+ *
* @return target
*/
public JaxRsWebTarget target() {
@@ -73,7 +74,7 @@ public final class JaxRsClient {
/**
* Creates a JAX-RS WebTarget
- *
+ *
* @param baseAddress
* @return target
*/
@@ -83,7 +84,7 @@ public final class JaxRsClient {
/**
* Creates a JAX-RS WebTarget
- *
+ *
* @param baseAddress
* @return target
*/
@@ -94,7 +95,7 @@ public final class JaxRsClient {
/**
* Proxy sub-resource methods returning Objects can not be invoked. Prefer to have sub-resource methods returning
* typed classes: interfaces, abstract classes or concrete implementations.
- *
+ *
* @param endpointAddress - address to the endpoint represented by clazz
* @param clazz - JAX-RS annotated class used to create a proxy client
* @return targetProxy
@@ -106,7 +107,7 @@ public final class JaxRsClient {
/**
* Proxy sub-resource methods returning Objects can not be invoked. Prefer to have sub-resource methods returning
* typed classes: interfaces, abstract classes or concrete implementations.
- *
+ *
* @param endpointAddress - address to the endpoint represented by clazz
* @param clazz - JAX-RS annotated class used to create a proxy client
* @return targetProxy
@@ -117,7 +118,7 @@ public final class JaxRsClient {
/**
* JAX-RS Client configuration
- *
+ *
* @return config
*/
public JaxRsClientConfig getConfig() {
@@ -328,4 +329,28 @@ public final class JaxRsClient {
}
}
+ public static Long getAccountId() {
+ return accountId;
+ }
+
+ public static void setAccountId(Long accountId) {
+ JaxRsClient.accountId = accountId;
+ }
+
+ public static Long getClientId() {
+ return clientId;
+ }
+
+ public static void setClientId(Long clientId) {
+ JaxRsClient.clientId = clientId;
+ }
+
+ public static Long getServerId() {
+ return serverId;
+ }
+
+ public static void setServerId(Long serverId) {
+ JaxRsClient.serverId = serverId;
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/OseeAccountClientRequestFilter.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/OseeAccountClientRequestFilter.java
new file mode 100644
index 0000000000..09cf64f757
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/OseeAccountClientRequestFilter.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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.client.internal;
+
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientRequestFilter;
+import javax.ws.rs.ext.Provider;
+import org.eclipse.osee.jaxrs.client.JaxRsClient;
+
+/**
+ * @author Donald G. Dunne
+ */
+@Provider
+public class OseeAccountClientRequestFilter implements ClientRequestFilter {
+
+ @Override
+ public void filter(ClientRequestContext context) {
+ context.getHeaders().putSingle("osee.account.id",
+ JaxRsClient.getAccountId() == null ? "0" : JaxRsClient.getAccountId().toString());
+ context.getHeaders().putSingle("osee.client.id",
+ JaxRsClient.getClientId() == null ? "0" : JaxRsClient.getClientId().toString());
+ context.getHeaders().putSingle("osee.server.id",
+ JaxRsClient.getServerId() == null ? "0" : JaxRsClient.getServerId().toString());
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientConfigurator.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientConfigurator.java
index 19827d9ebf..a5be34a303 100644
--- a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientConfigurator.java
+++ b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientConfigurator.java
@@ -35,6 +35,7 @@ import org.eclipse.osee.jaxrs.client.JaxRsClientConfig;
import org.eclipse.osee.jaxrs.client.JaxRsClientConstants.ConnectionType;
import org.eclipse.osee.jaxrs.client.JaxRsClientConstants.ProxyType;
import org.eclipse.osee.jaxrs.client.internal.JaxRsClientConfigurator;
+import org.eclipse.osee.jaxrs.client.internal.OseeAccountClientRequestFilter;
import org.eclipse.osee.jaxrs.client.internal.ext.OAuth2ClientRequestFilter.ClientAccessTokenCache;
/**
@@ -93,6 +94,7 @@ public final class CxfJaxRsClientConfigurator implements JaxRsClientConfigurator
providers.add(new GenericResponseExceptionMapper());
providers.addAll(JacksonFeature.getProviders());
providers.addAll(OAuth2Util.getOAuthProviders());
+ providers.add(new OseeAccountClientRequestFilter());
this.providers = providers;
List<Feature> features = new ArrayList<>(2);
@@ -113,6 +115,7 @@ public final class CxfJaxRsClientConfigurator implements JaxRsClientConfigurator
bean.setFeatures(getFeatures());
bean.setProperties(getProperties());
bean.setProviders(getOAuthProviders(config));
+ bean.setProvider(new OseeAccountClientRequestFilter());
/**
* If threadSafe is true then multiple threads can invoke on the same proxy or WebClient instance.
@@ -136,6 +139,7 @@ public final class CxfJaxRsClientConfigurator implements JaxRsClientConfigurator
register(builder, getFeatures());
register(builder, getProperties());
register(builder, getOAuthProviders(config));
+ builder.register(new OseeAccountClientRequestFilter());
}
@Override
diff --git a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClient.java b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClient.java
index 0822dc42aa..712fee7af0 100644
--- a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClient.java
+++ b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClient.java
@@ -28,7 +28,8 @@ import org.eclipse.osee.orcs.rest.model.TypesEndpoint;
* @author John Misinco
*/
public interface OseeClient {
- String OSEE_APPLICATION_SERVER = "osee.application.server";
+
+ String OSEE_APPLICATION_SERVER = org.eclipse.osee.framework.core.data.OseeClient.OSEE_APPLICATION_SERVER;
QueryBuilder createQueryBuilder(IOseeBranch branch);
diff --git a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java
index ac961c9ea8..42f1b92960 100644
--- a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java
+++ b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java
@@ -55,7 +55,7 @@ import org.eclipse.osee.orcs.rest.model.search.artifact.SearchResult;
*/
public class OseeClientImpl implements OseeClient, QueryExecutor {
- private static final String OSEE_APPLICATION_SERVER = "osee.application.server";
+ private static final String OSEE_APPLICATION_SERVER = OseeClient.OSEE_APPLICATION_SERVER;
private PredicateFactory predicateFactory;
private volatile JaxRsClient client;

Back to the top