Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2021-01-27 12:50:32 +0000
committerdonald.g.dunne2021-01-28 13:42:09 +0000
commit7c6dec8b8d239644683df996e76927732067791e (patch)
treec58c01aca0aa7a4feebf5bc1dea80fa01336d749
parentd82a061e3c345b494db38ba5e8669f7f08c780b7 (diff)
downloadorg.eclipse.osee-7c6dec8b8d239644683df996e76927732067791e.tar.gz
org.eclipse.osee-7c6dec8b8d239644683df996e76927732067791e.tar.xz
org.eclipse.osee-7c6dec8b8d239644683df996e76927732067791e.zip
bug[TW18555]: Workflow Editor deletes attrs on transition
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/AtsTopicEvent.java25
-rw-r--r--plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/editor/event/WfeArtifactEventManager.java39
-rw-r--r--plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/ev/internal/AtsEarnedValueImpl.java15
-rw-r--r--plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/internal/Activator.java3
-rw-r--r--plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/internal/AtsChangeSet.java11
-rw-r--r--plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/internal/AtsEventServiceIdeImpl.java20
-rw-r--r--plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/AtsWorkItemRemoteTopicEventHandler.java61
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/AtsWorkPackageEndpointImpl.java4
-rw-r--r--plugins/org.eclipse.osee.framework.core.client/META-INF/MANIFEST.MF6
-rw-r--r--plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/TopicEventUtil.java68
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/event/TopicEvent.java7
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/result/XResultData.java9
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java8
13 files changed, 197 insertions, 79 deletions
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/AtsTopicEvent.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/AtsTopicEvent.java
index ed07d0c5fc9..5bba91aadb8 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/AtsTopicEvent.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/AtsTopicEvent.java
@@ -20,6 +20,19 @@ import org.eclipse.osee.framework.core.event.AbstractTopicEvent;
import org.eclipse.osee.framework.core.event.EventType;
/**
+ * Topic Events are the new mechanism for communicating both local and remote clients. This replaces the old
+ * ArtifactEvent from a transaction persist. Listeners should handle the topic event only, if possible. Or, realize that
+ * both events can come through. remotely. Eventually, everything will be done through these topic events.<br/>
+ * <br/>
+ * Example: IDE A initiates transition > Server transitions and persists > IDE A reloads workitems and kicks
+ * WORK_ITEM_MODIFIED remotely and WORK_ITEM_RELOADED locally. <br/>
+ * <br/>
+ * IDE A listeners either react to ArtifactEvent from the reload (deprecated) or listens for WORK_ITEM_RELOADED to
+ * refresh.<br/>
+ * <br/>
+ * IDE B,C,D listeners listens for WORK_ITEM_MODIFIED (one handler to reload), reloads and kicks WORK_ITEM_RELOADED.
+ * ArtifactEvent goes out from reload along with WORK_ITEM_RELOADED like IDE A.
+ *
* @author Donald G. Dunne
*/
public class AtsTopicEvent extends AbstractTopicEvent {
@@ -27,10 +40,18 @@ public class AtsTopicEvent extends AbstractTopicEvent {
public static Map<String, AtsTopicEvent> idToEvent = new HashMap<String, AtsTopicEvent>();
/**
- * Event for any work item modified including transition. Artifacts will be reloaded after a transition.
+ * Remote event to notify other clients that work items were modified. This handles the case where changes are made
+ * on server and reloaded locally, but other clients need to be notified to reload and refresh. There should only be
+ * ONE listener for this event.
*/
public static final AtsTopicEvent WORK_ITEM_MODIFIED =
- new AtsTopicEvent(EventType.LocalAndRemote, "ats/workitem/modified");
+ new AtsTopicEvent(EventType.RemoteOnly, "ats/workitem/modified");
+
+ /**
+ * Local event to notify listeners that work items were reloaded and they may need to refresh.
+ */
+ public static final AtsTopicEvent WORK_ITEM_RELOADED =
+ new AtsTopicEvent(EventType.LocalOnly, "ats/workitem/reloaded");
/**
* Specific event for only transitions. No reloaded is done through this event for transitioning so the events don't
diff --git a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/editor/event/WfeArtifactEventManager.java b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/editor/event/WfeArtifactEventManager.java
index 6ae08cd3ecf..cb644eaf752 100644
--- a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/editor/event/WfeArtifactEventManager.java
+++ b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/editor/event/WfeArtifactEventManager.java
@@ -16,15 +16,12 @@ package org.eclipse.osee.ats.ide.editor.event;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
-import org.eclipse.osee.ats.api.util.AtsTopicEvent;
import org.eclipse.osee.ats.ide.editor.WorkflowEditor;
import org.eclipse.osee.ats.ide.internal.Activator;
import org.eclipse.osee.ats.ide.internal.AtsApiService;
import org.eclipse.osee.ats.ide.util.AtsUtilClient;
import org.eclipse.osee.ats.ide.workflow.AbstractWorkflowArtifact;
-import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
import org.eclipse.osee.framework.skynet.core.event.filter.IEventFilter;
@@ -32,15 +29,14 @@ import org.eclipse.osee.framework.skynet.core.event.listener.IArtifactEventListe
import org.eclipse.osee.framework.skynet.core.event.model.ArtifactEvent;
import org.eclipse.osee.framework.skynet.core.event.model.Sender;
import org.eclipse.osee.framework.ui.swt.Displays;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventHandler;
/**
- * Common location for event handling for ATS objects
+ * Common location for WFE handling events. Only need to listen for ArtifactEvent cause transition locally will reload
+ * and remote transition will reload if in cache.
*
* @author Donald G. Dunne
*/
-public class WfeArtifactEventManager implements IArtifactEventListener, EventHandler {
+public class WfeArtifactEventManager implements IArtifactEventListener {
static List<WorkflowEditor> editors = new CopyOnWriteArrayList<>();
static WfeArtifactEventManager instance = new WfeArtifactEventManager();
@@ -106,33 +102,4 @@ public class WfeArtifactEventManager implements IArtifactEventListener, EventHan
}
- @Override
- public void handleEvent(Event event) {
- try {
- if (event.getTopic().equals(AtsTopicEvent.WORK_ITEM_MODIFIED.getTopic())) {
- String ids = (String) event.getProperty(AtsTopicEvent.WORK_ITEM_IDS_KEY);
- for (Long workItemId : Collections.fromString(ids, ";", Long::valueOf)) {
- ArtifactId workItemArtId = ArtifactId.valueOf(workItemId);
- for (WorkflowEditor editor : editors) {
- try {
- if (!editor.isDisposed()) {
- if (editor.getWorkItem().equals(workItemArtId)) {
- editor.refresh();
- }
- }
- } catch (Exception ex) {
- OseeLog.logf(Activator.class, Level.SEVERE, ex, "Error processing event handler for - %s", editor);
- }
- }
- }
- }
- } catch (Exception ex) {
- // do nothing
- }
- }
-
- public static void handleEventAfterReload(Event event) {
- instance.handleEvent(event);
- }
-
}
diff --git a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/ev/internal/AtsEarnedValueImpl.java b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/ev/internal/AtsEarnedValueImpl.java
index 1609c99951b..6a1ebf25504 100644
--- a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/ev/internal/AtsEarnedValueImpl.java
+++ b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/ev/internal/AtsEarnedValueImpl.java
@@ -23,16 +23,15 @@ import org.eclipse.osee.ats.api.ev.JaxWorkPackageData;
import org.eclipse.osee.ats.api.util.AtsTopicEvent;
import org.eclipse.osee.ats.api.workdef.IStateToken;
import org.eclipse.osee.ats.core.util.AtsAbstractEarnedValueImpl;
-import org.eclipse.osee.ats.core.util.AtsObjects;
import org.eclipse.osee.ats.ide.internal.AtsApiService;
import org.eclipse.osee.ats.ide.workflow.AbstractWorkflowArtifact;
import org.eclipse.osee.framework.core.data.ArtifactId;
-import org.eclipse.osee.framework.core.event.TopicEvent;
+import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.jdk.core.result.XResultData;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
import org.eclipse.osee.logger.Log;
/**
@@ -74,22 +73,22 @@ public class AtsEarnedValueImpl extends AtsAbstractEarnedValueImpl {
}
AtsWorkPackageEndpointApi workPackageEp = AtsApiService.get().getServerEndpoints().getWorkPackageEndpoint();
+ TransactionId transId = TransactionId.SENTINEL;
if (remove) {
XResultData rd = workPackageEp.deleteWorkPackageItems(workPackage == null ? 0L : workPackage.getId(), data);
if (rd.isErrors()) {
throw new OseeCoreException(rd.toString());
}
+ if (Strings.isNumeric(rd.getTxId())) {
+ transId = TransactionId.valueOf(rd.getTxId());
+ }
} else {
XResultData rd = workPackageEp.setWorkPackage(workPackage.getId(), data);
if (rd.isErrors()) {
throw new OseeCoreException(rd.toString());
}
}
-
- TopicEvent event = new TopicEvent(AtsTopicEvent.WORK_ITEM_MODIFIED, AtsTopicEvent.WORK_ITEM_IDS_KEY,
- AtsObjects.toIdsString(";", workItems));
- OseeEventManager.kickTopicEvent(getClass(), event);
-
+ atsApi.getEventService().postAtsWorkItemTopicEvent(AtsTopicEvent.WORK_ITEM_MODIFIED, workItems, transId);
}
@Override
diff --git a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/internal/Activator.java b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/internal/Activator.java
index 626c946e5f9..dcac23246c0 100644
--- a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/internal/Activator.java
+++ b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/internal/Activator.java
@@ -17,6 +17,7 @@ import org.eclipse.osee.ats.api.util.AtsTopicEvent;
import org.eclipse.osee.ats.api.util.AtsUtil;
import org.eclipse.osee.ats.ide.access.AtsBranchAccessManager;
import org.eclipse.osee.ats.ide.navigate.SavedSearchesNavigateItem;
+import org.eclipse.osee.ats.ide.workflow.AtsWorkItemRemoteTopicEventHandler;
import org.eclipse.osee.framework.plugin.core.OseeActivator;
import org.eclipse.osee.framework.skynet.core.event.model.AccessTopicEvent;
import org.eclipse.osee.framework.ui.skynet.internal.ServiceUtil;
@@ -34,6 +35,8 @@ public class Activator extends OseeActivator {
@Override
public void start(final BundleContext context) {
+ context.registerService(EventHandler.class.getName(), new AtsWorkItemRemoteTopicEventHandler(),
+ AtsUtil.hashTable(EventConstants.EVENT_TOPIC, AtsTopicEvent.WORK_ITEM_MODIFIED.getTopic()));
context.registerService(EventHandler.class.getName(), new AtsBranchAccessManager(),
AtsUtil.hashTable(EventConstants.EVENT_TOPIC, AccessTopicEvent.ACCESS_BRANCH_MODIFIED.getTopic()));
context.registerService(EventHandler.class.getName(), new SavedSearchesNavigateItem(),
diff --git a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/internal/AtsChangeSet.java b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/internal/AtsChangeSet.java
index e6dfa3f9614..85d9674b355 100644
--- a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/internal/AtsChangeSet.java
+++ b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/internal/AtsChangeSet.java
@@ -15,7 +15,6 @@ package org.eclipse.osee.ats.ide.util.internal;
import java.io.InputStream;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
@@ -25,7 +24,6 @@ import java.util.Set;
import org.eclipse.osee.ats.api.IAtsObject;
import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.user.AtsUser;
-import org.eclipse.osee.ats.api.util.AtsTopicEvent;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
import org.eclipse.osee.ats.api.util.IExecuteListener;
import org.eclipse.osee.ats.api.workflow.state.IAtsStateManager;
@@ -48,17 +46,14 @@ import org.eclipse.osee.framework.core.data.RelationTypeSide;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.enums.RelationSorter;
-import org.eclipse.osee.framework.core.event.TopicEvent;
import org.eclipse.osee.framework.jdk.core.type.Id;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
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.Collections;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
-import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
import org.eclipse.osee.framework.skynet.core.relation.RelationLink;
import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
@@ -535,12 +530,6 @@ public class AtsChangeSet extends AbstractAtsChangeSet {
relation.delete(false, transaction);
transaction.addArtifact(relation.getArtifactA());
transaction.execute();
-
- TopicEvent event =
- new TopicEvent(AtsTopicEvent.WORK_ITEM_MODIFIED, AtsTopicEvent.WORK_ITEM_IDS_KEY, Collections.toString(";",
- Arrays.asList(relation.getArtifactA().getIdString(), relation.getArtifactB().getIdString())));
- event.addProperty(AtsTopicEvent.WORK_ITEM_REL_TYPE_IDS_KEY, relation.getRelationId().getIdString());
- OseeEventManager.kickTopicEvent(getClass(), event);
}
}
diff --git a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/internal/AtsEventServiceIdeImpl.java b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/internal/AtsEventServiceIdeImpl.java
index eab2e32daf9..60e80ebab76 100644
--- a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/internal/AtsEventServiceIdeImpl.java
+++ b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/util/internal/AtsEventServiceIdeImpl.java
@@ -18,7 +18,6 @@ import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.util.AtsTopicEvent;
import org.eclipse.osee.ats.core.event.AbstractAtsEventServiceImpl;
import org.eclipse.osee.ats.core.util.AtsObjects;
-import org.eclipse.osee.ats.ide.editor.event.WfeArtifactEventManager;
import org.eclipse.osee.ats.ide.internal.AtsApiService;
import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.TransactionId;
@@ -57,25 +56,16 @@ public class AtsEventServiceIdeImpl extends AbstractAtsEventServiceImpl {
artifact.reloadAttributesAndRelations();
}
}
- // And, handle event for those WorkflowEditor listeners to specific attr, rel or arts
- WfeArtifactEventManager.handleEventAfterReload(event);
}
@Override
public void postAtsWorkItemTopicEvent(AtsTopicEvent event, Collection<IAtsWorkItem> workItems, TransactionId transaction) {
- // Send locally if need be
- if (event.getEventType() == EventType.LocalOnly || event.getEventType() == EventType.LocalAndRemote) {
- super.postAtsWorkItemTopicEvent(event, workItems, transaction);
- }
- // Send remote if need be
- if (event.getEventType() == EventType.LocalAndRemote || event.getEventType() == EventType.RemoteOnly) {
- TopicEvent topicEvent = new TopicEvent(event.getTopic(), AtsTopicEvent.WORK_ITEM_IDS_KEY,
- AtsObjects.toIdsString(";", workItems), transaction, EventType.RemoteOnly);
- if (transaction != null && transaction.isValid()) {
- topicEvent.addProperty(FrameworkTopicEvent.TRANSACTION_ID, transaction.getIdString());
- }
- OseeEventManager.kickTopicEvent(getClass(), topicEvent);
+ TopicEvent topicEvent = new TopicEvent(event.getTopic(), AtsTopicEvent.WORK_ITEM_IDS_KEY,
+ AtsObjects.toIdsString(";", workItems), transaction, EventType.RemoteOnly);
+ if (transaction != null && transaction.isValid()) {
+ topicEvent.addProperty(FrameworkTopicEvent.TRANSACTION_ID, transaction.getIdString());
}
+ OseeEventManager.kickTopicEvent(getClass(), topicEvent);
}
}
diff --git a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/AtsWorkItemRemoteTopicEventHandler.java b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/AtsWorkItemRemoteTopicEventHandler.java
new file mode 100644
index 00000000000..9cdd9f5633a
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/AtsWorkItemRemoteTopicEventHandler.java
@@ -0,0 +1,61 @@
+/*********************************************************************
+ * Copyright (c) 2021 Boeing
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.osee.ats.ide.workflow;
+
+import org.eclipse.osee.ats.api.util.AtsTopicEvent;
+import org.eclipse.osee.ats.ide.internal.AtsApiService;
+import org.eclipse.osee.framework.core.client.TopicEventUtil;
+import org.eclipse.osee.framework.core.data.TransactionId;
+import org.eclipse.osee.framework.core.event.EventUtil;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventHandler;
+
+/**
+ * Event handler to handle refreshing WorkItems when work item is update REMOTELY and no ArtifactEvent is propogated.
+ * Usually used for when changes, like transition or setting Work Package, are done on server and not the client.
+ * Eventually, all ATS work items changes will be done on server and events handled by this and not ArtifactEvent.
+ *
+ * @author Donald G. Dunne
+ */
+public class AtsWorkItemRemoteTopicEventHandler implements EventHandler {
+
+ @Override
+ public void handleEvent(Event event) {
+ try {
+ /**
+ * Need to process ONLY remote events. Do NOT reload on transition or you'll get 2 reloads.
+ */
+ Boolean isRemote = TopicEventUtil.isRemoteOrNull(event);
+ if (isRemote != null && isRemote) {
+ if (event.getTopic().equals(AtsTopicEvent.WORK_ITEM_MODIFIED.getTopic())) {
+ String ids = (String) event.getProperty(AtsTopicEvent.WORK_ITEM_IDS_KEY);
+ for (Long workItemId : Collections.fromString(ids, ";", Long::valueOf)) {
+ // If artifact in cache, then could be in open editor/view. Just reload.
+ Artifact artifact = ArtifactCache.getActive(workItemId, AtsApiService.get().getAtsBranch());
+ TransactionId transaction = EventUtil.getTransaction(event);
+ if (artifact != null && artifact.getTransaction().notEqual(transaction)) {
+ artifact.reloadAttributesAndRelations();
+ }
+ }
+ }
+ }
+ } catch (Exception ex) {
+ // do nothing
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/AtsWorkPackageEndpointImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/AtsWorkPackageEndpointImpl.java
index 754697ffe5d..f0442141c59 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/AtsWorkPackageEndpointImpl.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/AtsWorkPackageEndpointImpl.java
@@ -32,6 +32,7 @@ import org.eclipse.osee.ats.api.user.AtsUser;
import org.eclipse.osee.ats.api.util.ColorTeams;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
import org.eclipse.osee.ats.api.workflow.WorkItemType;
+import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.util.JsonUtil;
import org.eclipse.osee.framework.jdk.core.result.XResultData;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
@@ -98,7 +99,8 @@ public class AtsWorkPackageEndpointImpl implements AtsWorkPackageEndpointApi {
rd.getIds().add(workItemId.toString());
}
if (!changes.isEmpty()) {
- changes.execute();
+ TransactionId transactionId = changes.execute();
+ rd.setTxId(transactionId.getIdString());
}
return rd;
}
diff --git a/plugins/org.eclipse.osee.framework.core.client/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.core.client/META-INF/MANIFEST.MF
index 1e05713a135..b21fd3f914c 100644
--- a/plugins/org.eclipse.osee.framework.core.client/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.core.client/META-INF/MANIFEST.MF
@@ -7,7 +7,8 @@ Bundle-Version: 0.26.0.qualifier
Bundle-Activator: org.eclipse.osee.framework.core.client.internal.Activator
Bundle-Vendor: Eclipse Open System Engineering Environment
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package: org.eclipse.core.runtime,
+Import-Package: com.fasterxml.jackson.core,
+ org.eclipse.core.runtime,
org.eclipse.jdt.annotation,
org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
@@ -25,7 +26,8 @@ Import-Package: org.eclipse.core.runtime,
org.eclipse.osee.jdbc,
org.eclipse.osee.orcs.rest.client,
org.eclipse.osee.orcs.rest.model,
- org.osgi.framework
+ org.osgi.framework,
+ org.osgi.service.event
Export-Package: org.eclipse.osee.framework.core.client,
org.eclipse.osee.framework.core.client.server
Service-Component: OSGI-INF/*.xml
diff --git a/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/TopicEventUtil.java b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/TopicEventUtil.java
new file mode 100644
index 00000000000..b492f6283cf
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.client/src/org/eclipse/osee/framework/core/client/TopicEventUtil.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2021 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.client;
+
+import org.eclipse.osee.framework.core.data.IdeClientSession;
+import org.eclipse.osee.framework.core.exception.OseeAuthenticationRequiredException;
+import org.eclipse.osee.framework.core.util.JsonUtil;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.osgi.service.event.Event;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class TopicEventUtil {
+
+ public static final String SENDER_SESSION_PROPERTY = "senderSession";
+
+ public static String getSessionJson() {
+ String sessionJson = JsonUtil.toJson(ClientSessionManager.getSession());
+ return sessionJson;
+ }
+
+ public static IdeClientSession getSessionJson(String sessionJson) {
+ try {
+ IdeClientSession oseeSession = JsonUtil.readValue(sessionJson, IdeClientSession.class);
+ return oseeSession;
+ } catch (Exception ex) {
+ // do nothing
+ }
+ return null;
+ }
+
+ public static Boolean isRemoteOrNull(Event event) {
+ Boolean isRemote = null;
+ String sessionJson = (String) event.getProperty(SENDER_SESSION_PROPERTY);
+ if (Strings.isValid(sessionJson)) {
+ IdeClientSession oseeSession = getSessionJson(sessionJson);
+ if (oseeSession != null) {
+ isRemote = isRemote(oseeSession);
+ }
+ }
+ return isRemote;
+ }
+
+ public static boolean isRemote(IdeClientSession oseeSession) {
+ try {
+ String sessionId = oseeSession.getId();
+ if (!"Invalid".equalsIgnoreCase(sessionId)) {
+ IdeClientSession session = ClientSessionManager.getSession();
+ //Don't add version check here - can't assume events come from clients using the same version - could be old clients;
+ return !sessionId.equals(session.getId());
+ } else {
+ return false;
+ }
+ } catch (OseeAuthenticationRequiredException ex) {
+ return false;
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/event/TopicEvent.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/event/TopicEvent.java
index 033f0a257aa..8ce6099ef19 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/event/TopicEvent.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/event/TopicEvent.java
@@ -16,8 +16,6 @@ package org.eclipse.osee.framework.core.event;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.osee.framework.core.data.TransactionId;
-import org.eclipse.osee.framework.core.event.AbstractTopicEvent;
-import org.eclipse.osee.framework.core.event.EventType;
/**
* @author Donald G. Dunne
@@ -88,4 +86,9 @@ public class TopicEvent implements FrameworkEvent, HasNetworkSender {
this.transaction = transaction;
}
+ @Override
+ public String toString() {
+ return "TopicEvnt [type=" + eventType + ", topic=" + topic + ",\nprops=" + properties + ", tx=" + transaction + ", sender=" + networkSender + "]";
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/result/XResultData.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/result/XResultData.java
index 44f47293bca..d835d002d1a 100644
--- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/result/XResultData.java
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/result/XResultData.java
@@ -59,6 +59,7 @@ public class XResultData {
@JsonIgnore
private boolean logToSysErr;
public List<XResultTable> tables = new ArrayList<XResultTable>();
+ private String txId = "";
public XResultData() {
this(false);
@@ -381,4 +382,12 @@ public class XResultData {
addRaw(rd.toString());
}
+ public String getTxId() {
+ return txId;
+ }
+
+ public void setTxId(String txId) {
+ this.txId = txId;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java
index 6c1f2dc4750..44510172c00 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java
@@ -19,12 +19,13 @@ import java.util.List;
import java.util.logging.Level;
import org.eclipse.core.runtime.Assert;
import org.eclipse.osee.activity.api.ActivityLog;
+import org.eclipse.osee.framework.core.client.TopicEventUtil;
import org.eclipse.osee.framework.core.data.ArtifactToken;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.CoreActivityTypes;
+import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.event.EventUtil;
import org.eclipse.osee.framework.core.event.TopicEvent;
-import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.util.JsonUtil;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -125,6 +126,9 @@ public final class OseeEventManager {
Assert.isNotNull(topicEvent);
Assert.isNotNull(topicEvent.getEventType(), "TopicEvent.eventType can not be null");
Assert.isTrue(Strings.isValid(topicEvent.getTopic()), "TopicEvent.topic can not be null.");
+ // Add sender session to all topic events
+ String sessionJson = TopicEventUtil.getSessionJson();
+ topicEvent.addProperty(TopicEventUtil.SENDER_SESSION_PROPERTY, sessionJson);
getEventService().send(source, topicEvent);
}
@@ -238,7 +242,7 @@ public final class OseeEventManager {
* Kick a commit event to this local client to update artifact model for committed artifacts. This is needed cause
* commit is made on server, but clients need to be notified of updates to commited branch artifact model.
*/
- public static void kickCommitEvent(Class class1, ArtifactEvent artifactEvent) {
+ public static void kickCommitEvent(Class<?> class1, ArtifactEvent artifactEvent) {
getEventService().sendCommitEvent(class1, artifactEvent);
}

Back to the top