Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorddunne2010-03-28 19:27:18 -0400
committerddunne2010-03-28 19:27:18 -0400
commit184a2c4fd47f11edbec44d419fa5c3490a4e76e0 (patch)
tree20105cfc9b62e52ea2d61d7a45d3cf464967ea93 /plugins
parent105a56714f4896db272f3efb666404922541edf1 (diff)
downloadorg.eclipse.osee-184a2c4fd47f11edbec44d419fa5c3490a4e76e0.tar.gz
org.eclipse.osee-184a2c4fd47f11edbec44d419fa5c3490a4e76e0.tar.xz
org.eclipse.osee-184a2c4fd47f11edbec44d419fa5c3490a4e76e0.zip
coverage events
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditor.java61
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/CoverageEventManager.java86
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/DefaultBasicGuidArtifact.java70
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IBasicGuidArtifact.java22
-rw-r--r--plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ISkynetArtifactEvent.java7
-rw-r--r--plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkAccessControlArtifactsEvent.java16
-rw-r--r--plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactAddedEvent.java5
-rw-r--r--plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactChangeTypeEvent.java22
-rw-r--r--plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactDeletedEvent.java5
-rw-r--r--plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactModifiedEvent.java5
-rw-r--r--plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactPurgeEvent.java10
-rw-r--r--plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkMessageEventBase.java33
-rw-r--r--plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetArtifactEventBase.java34
-rw-r--r--plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetArtifactsEventBase.java23
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/META-INF/MANIFEST.MF13
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_TestDb_Suite.java25
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/cases/ArtifactEventManagerLoopbackTest.java29
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/cases/ArtifactEventManagerTest.java216
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java7
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeArtifactType.java16
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/ArtifactModifiedEvent.java30
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/ArtifactTransactionModifiedEvent.java8
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkTransactionData.java198
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/IEventDispatcher.java13
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/ITransactionEventDispatcher.java22
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager.java273
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java13
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RelationModifiedEvent.java9
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RemoteEventManager.java33
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/ArtifactEventManager.java68
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/DefaultEventBasicGuidArtifact.java67
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/DefaultEventChangeTypeBasicGuidArtifact.java29
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/EventModType.java5
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/IArtifactListener.java21
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/IEventBasicGuidArtifact.java16
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/IEventChangeTypeBasicGuidArtifact.java15
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/filter/ArtifactTypeEventFilter.java38
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/filter/BranchGuidEventFilter.java35
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/filter/FilteredEventListener.java36
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/filter/IEventFilter.java13
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/LoadedArtifacts.java55
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/ui/plugin/event/UnloadedArtifact.java44
43 files changed, 1385 insertions, 365 deletions
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditor.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditor.java
index 2f71d78b14..8b6794fe53 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditor.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditor.java
@@ -17,10 +17,10 @@ import java.util.List;
import java.util.logging.Level;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.osee.coverage.event.CoverageEventManager;
import org.eclipse.osee.coverage.internal.Activator;
import org.eclipse.osee.coverage.model.CoveragePackage;
import org.eclipse.osee.coverage.model.CoveragePackageBase;
-import org.eclipse.osee.coverage.model.ICoverage;
import org.eclipse.osee.coverage.store.OseeCoveragePackageStore;
import org.eclipse.osee.coverage.util.CoverageImage;
import org.eclipse.osee.coverage.util.CoverageUtil;
@@ -34,12 +34,7 @@ import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.plugin.core.IActionable;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.event.FrameworkTransactionData;
-import org.eclipse.osee.framework.skynet.core.event.IArtifactsPurgedEventListener;
-import org.eclipse.osee.framework.skynet.core.event.IFrameworkTransactionEventListener;
-import org.eclipse.osee.framework.skynet.core.event.Sender;
import org.eclipse.osee.framework.skynet.core.relation.RelationManager;
-import org.eclipse.osee.framework.skynet.core.utility.LoadedArtifacts;
import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
import org.eclipse.osee.framework.ui.plugin.util.Displays;
@@ -60,7 +55,7 @@ import org.eclipse.ui.part.MultiPageEditorPart;
/**
* @author Donald G. Dunne
*/
-public class CoverageEditor extends FormEditor implements IActionable, IFrameworkTransactionEventListener, IArtifactsPurgedEventListener {
+public class CoverageEditor extends FormEditor implements IActionable {
public static final String EDITOR_ID = "org.eclipse.osee.coverage.editor.CoverageEditor";
private Integer startPage = null;
private CoverageEditorImportTab coverageEditorImportTab = null;
@@ -83,6 +78,7 @@ public class CoverageEditor extends FormEditor implements IActionable, IFramewor
} else {
Operations.executeAsJob(new LoadCoverage(loadingStr), true);
}
+ CoverageEventManager.getInstance().register(this);
} catch (Exception ex) {
OseeLog.log(Activator.class, Level.SEVERE, ex);
}
@@ -226,6 +222,11 @@ public class CoverageEditor extends FormEditor implements IActionable, IFramewor
@Override
public void dispose() {
+ try {
+ CoverageEventManager.getInstance().unregister(this);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE, ex);
+ }
super.dispose();
}
@@ -313,33 +314,6 @@ public class CoverageEditor extends FormEditor implements IActionable, IFramewor
return false;
}
- @Override
- public void handleFrameworkTransactionEvent(Sender sender, FrameworkTransactionData transData) throws OseeCoreException {
- Integer branchId = transData.getBranchId();
- if (branchId == null) {
- return;
- }
- if (getCoverageEditorInput().getCoveragePackageArtifact() == null) {
- return;
- }
- if (branchId != getCoverageEditorInput().getCoveragePackageArtifact().getBranch().getId()) {
- return;
- }
- Artifact packageArt = getCoverageEditorInput().getCoveragePackageArtifact();
- if (transData.isDeleted(packageArt)) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- closeEditor();
- }
- });
- return;
- }
- for (ICoverage coverage : getCoverageEditorInput().getCoveragePackageBase().getChildren(true)) {
- // TODO finish this
- }
- }
-
public CoverageEditorImportTab getCoverageEditorImportTab() {
return coverageEditorImportTab;
}
@@ -348,23 +322,4 @@ public class CoverageEditor extends FormEditor implements IActionable, IFramewor
return coverageEditorOverviewTab;
}
- @Override
- public void handleArtifactsPurgedEvent(Sender sender, LoadedArtifacts loadedArtifacts) throws OseeCoreException {
- if (getCoverageEditorInput().getCoveragePackageArtifact() == null) {
- return;
- }
- try {
- if (loadedArtifacts.getLoadedArtifacts().contains(getCoverageEditorInput().getCoveragePackageArtifact())) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- closeEditor();
- }
- });
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
-
- }
}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/CoverageEventManager.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/CoverageEventManager.java
new file mode 100644
index 0000000000..b7603e95f1
--- /dev/null
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/CoverageEventManager.java
@@ -0,0 +1,86 @@
+/*
+ * Created on Mar 22, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.coverage.event;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.coverage.editor.CoverageEditor;
+import org.eclipse.osee.coverage.internal.Activator;
+import org.eclipse.osee.coverage.store.CoverageArtifactTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
+import org.eclipse.osee.framework.skynet.core.event.Sender;
+import org.eclipse.osee.framework.skynet.core.event.artifact.EventModType;
+import org.eclipse.osee.framework.skynet.core.event.artifact.IArtifactListener;
+import org.eclipse.osee.framework.skynet.core.event.artifact.IEventBasicGuidArtifact;
+import org.eclipse.osee.framework.skynet.core.event.filter.ArtifactTypeEventFilter;
+import org.eclipse.osee.framework.skynet.core.event.filter.FilteredEventListener;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CoverageEventManager implements IArtifactListener {
+
+ private static CoverageEventManager instance;
+ private List<CoverageEditor> editors = new ArrayList<CoverageEditor>();
+ private ArtifactTypeEventFilter artifactTypeEventFilter;
+ private FilteredEventListener filteredEventListener;
+
+ private CoverageEventManager() {
+ artifactTypeEventFilter =
+ new ArtifactTypeEventFilter(CoverageArtifactTypes.CoverageFolder, CoverageArtifactTypes.CoverageUnit,
+ CoverageArtifactTypes.CoveragePackage);
+ filteredEventListener = new FilteredEventListener(this, artifactTypeEventFilter);
+ OseeEventManager.addListener(filteredEventListener);
+ }
+
+ public static CoverageEventManager getInstance() {
+ if (instance == null) {
+ instance = new CoverageEventManager();
+ }
+ return instance;
+ }
+
+ public static void dispose() {
+ if (instance != null) {
+ OseeEventManager.removeListener(instance);
+ instance.editors.clear();
+ instance = null;
+ }
+ }
+
+ public void register(CoverageEditor coverageEditor) throws OseeCoreException {
+ editors.add(coverageEditor);
+ }
+
+ public void unregister(CoverageEditor coverageEditor) throws OseeCoreException {
+ editors.remove(coverageEditor);
+ }
+
+ @Override
+ public void handleArtifactModified(Collection<IEventBasicGuidArtifact> eventArtifacts, Sender sender) {
+ for (CoverageEditor editor : editors) {
+ try {
+ for (IEventBasicGuidArtifact eventArt : eventArtifacts) {
+ if (editor.getCoverageEditorInput().getCoveragePackageArtifact() == null) return;
+ if (editor.getCoverageEditorInput().getCoveragePackageArtifact().getBranch().getGuid() != eventArt.getBranchGuid()) return;
+ if (eventArt.getModType() == EventModType.Deleted || eventArt.getModType() == EventModType.ChangeType || eventArt.getModType() == EventModType.Purged) {
+ if (eventArt.getGuid().equals(editor.getCoverageEditorInput().getCoveragePackageArtifact().getGuid())) {
+ unregister(editor);
+ editor.closeEditor();
+ }
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE, ex);
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/DefaultBasicGuidArtifact.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/DefaultBasicGuidArtifact.java
new file mode 100644
index 0000000000..8d74cc9bf3
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/DefaultBasicGuidArtifact.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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 DefaultBasicGuidArtifact implements Identity, IBasicGuidArtifact {
+
+ private static final long serialVersionUID = -4997763989583925345L;
+ private final String branchGuid;
+ private final String artTypeGuid;
+ private final String guid;
+
+ public DefaultBasicGuidArtifact(String branchGuid, String artTypeGuid, String guid) {
+ this.branchGuid = branchGuid;
+ this.artTypeGuid = artTypeGuid;
+ this.guid = guid;
+ }
+
+ public String getBranchGuid() {
+ return branchGuid;
+ }
+
+ public String getArtTypeGuid() {
+ return artTypeGuid;
+ }
+
+ public String toString() {
+ return String.format("[%s]", guid);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((artTypeGuid == null) ? 0 : artTypeGuid.hashCode());
+ result = prime * result + ((branchGuid == null) ? 0 : branchGuid.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (!super.equals(obj)) return false;
+ if (getClass() != obj.getClass()) return false;
+ DefaultBasicGuidArtifact other = (DefaultBasicGuidArtifact) obj;
+ if (artTypeGuid == null) {
+ if (other.artTypeGuid != null) return false;
+ } else if (!artTypeGuid.equals(other.artTypeGuid)) return false;
+ if (branchGuid == null) {
+ if (other.branchGuid != null) return false;
+ } else if (!branchGuid.equals(other.branchGuid)) return false;
+ return true;
+ }
+
+ public String getGuid() {
+ return guid;
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IBasicGuidArtifact.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IBasicGuidArtifact.java
new file mode 100644
index 0000000000..713ee55ad3
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IBasicGuidArtifact.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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 interface IBasicGuidArtifact extends Identity {
+
+ String getArtTypeGuid();
+
+ String getBranchGuid();
+
+}
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ISkynetArtifactEvent.java b/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ISkynetArtifactEvent.java
index 01821d4e96..acde1fb3b9 100644
--- a/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ISkynetArtifactEvent.java
+++ b/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/ISkynetArtifactEvent.java
@@ -12,12 +12,19 @@ package org.eclipse.osee.framework.messaging.event.skynet;
/**
* @author Robert A. Fisher
+ * @author Donald G. Dunne
*/
public interface ISkynetArtifactEvent extends ISkynetEvent {
public String getFactoryName();
+ public String getBranchGuid();
+
+ public String getArtGuid();
+
public int getArtId();
+ public String getArtTypeGuid();
+
public int getArtTypeId();
}
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkAccessControlArtifactsEvent.java b/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkAccessControlArtifactsEvent.java
index f94caae3ba..9d372e599f 100644
--- a/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkAccessControlArtifactsEvent.java
+++ b/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkAccessControlArtifactsEvent.java
@@ -19,27 +19,15 @@ public class NetworkAccessControlArtifactsEvent extends SkynetArtifactsEventBase
private static final long serialVersionUID = -4325821466558180270L;
private final String accessControlModType;
- /**
- * @return the accessControlModType
- */
public String getAccessControlModTypeName() {
return accessControlModType;
}
- /**
- * @param branchId
- * @param artifactIds
- * @param toArtifactTypeId
- * @param author
- */
- public NetworkAccessControlArtifactsEvent(String accessControlModType, int branchId, Collection<Integer> artifactIds, Collection<Integer> artifactTypeIds, NetworkSender networkSender) {
- super(branchId, artifactIds, artifactTypeIds, networkSender);
+ public NetworkAccessControlArtifactsEvent(String accessControlModType, int branchId, Collection<Integer> artifactIds, Collection<String> artifactGuids, Collection<Integer> artifactTypeIds, NetworkSender networkSender) {
+ super(branchId, artifactIds, artifactGuids, artifactTypeIds, networkSender);
this.accessControlModType = accessControlModType;
}
- /**
- * @return Returns the serialVersionUID.
- */
public static long getSerialVersionUID() {
return serialVersionUID;
}
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactAddedEvent.java b/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactAddedEvent.java
index 8bd2655652..1365c1bcec 100644
--- a/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactAddedEvent.java
+++ b/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactAddedEvent.java
@@ -12,12 +12,13 @@ package org.eclipse.osee.framework.messaging.event.skynet.event;
/**
* @author Robert A. Fisher
+ * @author Donald G. Dunne
*/
public class NetworkArtifactAddedEvent extends SkynetArtifactEventBase {
private static final long serialVersionUID = -4325821466558180270L;
- public NetworkArtifactAddedEvent(int branchId, int transactionId, int artId, int artTypeId, String factoryName, NetworkSender networkSender) {
- super(branchId, transactionId, artId, artTypeId, factoryName, networkSender);
+ public NetworkArtifactAddedEvent(int branchId, String branchGuid, int transactionId, int artId, String artGuid, int artTypeId, String artTypeGuid, String factoryName, NetworkSender networkSender) {
+ super(branchId, branchGuid, transactionId, artId, artGuid, artTypeId, artTypeGuid, factoryName, networkSender);
}
public NetworkArtifactAddedEvent(SkynetArtifactEventBase base) {
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactChangeTypeEvent.java b/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactChangeTypeEvent.java
index 633b2b900d..d4e9afd15e 100644
--- a/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactChangeTypeEvent.java
+++ b/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactChangeTypeEvent.java
@@ -19,30 +19,24 @@ public class NetworkArtifactChangeTypeEvent extends SkynetArtifactsEventBase {
private static final long serialVersionUID = -4325821466558180270L;
private final int toArtifactTypeId;
+ private final String toArtifactTypeGuid;
- /**
- * @return the toArtifactTypeId
- */
public int getToArtifactTypeId() {
return toArtifactTypeId;
}
- /**
- * @param branchId
- * @param artifactIds
- * @param toArtifactTypeId
- * @param author
- */
- public NetworkArtifactChangeTypeEvent(int branchId, Collection<Integer> artifactIds, Collection<Integer> artifactTypeIds, int toArtifactTypeId, NetworkSender networkSender) {
- super(branchId, artifactIds, artifactTypeIds, networkSender);
+ public NetworkArtifactChangeTypeEvent(int branchId, Collection<Integer> artifactIds, Collection<String> artifactGuids, Collection<Integer> artifactTypeIds, int toArtifactTypeId, String toArtifactTypeGuid, NetworkSender networkSender) {
+ super(branchId, artifactIds, artifactGuids, artifactTypeIds, networkSender);
this.toArtifactTypeId = toArtifactTypeId;
+ this.toArtifactTypeGuid = toArtifactTypeGuid;
}
- /**
- * @return Returns the serialVersionUID.
- */
public static long getSerialVersionUID() {
return serialVersionUID;
}
+ public String getToArtifactTypeGuid() {
+ return toArtifactTypeGuid;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactDeletedEvent.java b/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactDeletedEvent.java
index 5c0ba9f4a5..10e6af9209 100644
--- a/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactDeletedEvent.java
+++ b/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactDeletedEvent.java
@@ -12,12 +12,13 @@ package org.eclipse.osee.framework.messaging.event.skynet.event;
/**
* @author Robert A. Fisher
+ * @author Donald G. Dunne
*/
public class NetworkArtifactDeletedEvent extends SkynetArtifactEventBase {
private static final long serialVersionUID = 568951803773151575L;
- public NetworkArtifactDeletedEvent(int branchId, int transactionId, int artId, int artTypeId, String factoryName, NetworkSender networkSender) {
- super(branchId, transactionId, artId, artTypeId, factoryName, networkSender);
+ public NetworkArtifactDeletedEvent(int branchId, String branchGuid, int transactionId, int artId, String artGuid, int artTypeId, String artTypeGuid, String factoryName, NetworkSender networkSender) {
+ super(branchId, branchGuid, transactionId, artId, artGuid, artTypeId, artTypeGuid, factoryName, networkSender);
}
public NetworkArtifactDeletedEvent(SkynetArtifactEventBase base) {
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactModifiedEvent.java b/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactModifiedEvent.java
index a158ed29a5..6e3b92723a 100644
--- a/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactModifiedEvent.java
+++ b/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactModifiedEvent.java
@@ -14,13 +14,14 @@ import java.util.Collection;
/**
* @author Robert A. Fisher
+ * @author Donald G. Dunne
*/
public class NetworkArtifactModifiedEvent extends SkynetArtifactEventBase {
private static final long serialVersionUID = -4325821466558180270L;
private final Collection<SkynetAttributeChange> attributeValues;
- public NetworkArtifactModifiedEvent(int branchId, int transactionId, int artId, int artTypeId, String factoryName, NetworkSender networkSender, Collection<SkynetAttributeChange> attributeValues) {
- super(branchId, transactionId, artId, artTypeId, factoryName, networkSender);
+ public NetworkArtifactModifiedEvent(int branchId, String branchGuid, int transactionId, int artId, String artGuid, int artTypeId, String artTypeGuid, String factoryName, NetworkSender networkSender, Collection<SkynetAttributeChange> attributeValues) {
+ super(branchId, branchGuid, transactionId, artId, artGuid, artTypeId, artTypeGuid, factoryName, networkSender);
this.attributeValues = attributeValues;
}
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactPurgeEvent.java b/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactPurgeEvent.java
index 2220d5f461..d08498acfd 100644
--- a/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactPurgeEvent.java
+++ b/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkArtifactPurgeEvent.java
@@ -18,14 +18,8 @@ import java.util.Collection;
public class NetworkArtifactPurgeEvent extends SkynetArtifactsEventBase {
private static final long serialVersionUID = -4325821466558180270L;
- /**
- * @param branchId
- * @param artifactIds
- * @param toArtifactTypeId
- * @param author
- */
- public NetworkArtifactPurgeEvent(int branchId, Collection<Integer> artifactIds, Collection<Integer> artifactTypeIds, NetworkSender networkSender) {
- super(branchId, artifactIds, artifactTypeIds, networkSender);
+ public NetworkArtifactPurgeEvent(int branchId, Collection<Integer> artifactIds, Collection<String> artifactGuids, Collection<Integer> artifactTypeIds, NetworkSender networkSender) {
+ super(branchId, artifactIds, artifactGuids, artifactTypeIds, networkSender);
}
/**
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkMessageEventBase.java b/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkMessageEventBase.java
new file mode 100644
index 0000000000..92bcf15d99
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/NetworkMessageEventBase.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 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.messaging.event.skynet.event;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class NetworkMessageEventBase extends SkynetEventBase {
+
+ private static final long serialVersionUID = 4199206432501390599L;
+ private String message;
+
+ public NetworkMessageEventBase(String message, NetworkSender networkSender) {
+ super(networkSender);
+ this.message = message;
+ }
+
+ protected String getMessage() {
+ return message;
+ }
+
+ protected void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetArtifactEventBase.java b/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetArtifactEventBase.java
index bb421a37f3..aba2d4ece7 100644
--- a/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetArtifactEventBase.java
+++ b/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetArtifactEventBase.java
@@ -14,6 +14,7 @@ import org.eclipse.osee.framework.messaging.event.skynet.ISkynetArtifactEvent;
/**
* @author Robert A. Fisher
+ * @author Donald G. Dunne
*/
public class SkynetArtifactEventBase extends SkynetEventBase implements ISkynetArtifactEvent {
private static final long serialVersionUID = 7923550763258313718L;
@@ -23,30 +24,35 @@ public class SkynetArtifactEventBase extends SkynetEventBase implements ISkynetA
private final String factoryName;
private final int transactionId;
private final int branchId;
+ private final String branchGuid;
+ private final String artGuid;
+ private final String artTypeGuid;
- public SkynetArtifactEventBase(int branchId, int transactionId, int artId, int artTypeId, String factoryName, NetworkSender networkSender) {
+ public SkynetArtifactEventBase(int branchId, String branchGuid, int transactionId, int artId, String artGuid, int artTypeId, String artTypeGuid, String factoryName, NetworkSender networkSender) {
super(networkSender);
this.branchId = branchId;
-
+ this.branchGuid = branchGuid;
this.artId = artId;
+ this.artGuid = artGuid;
this.artTypeId = artTypeId;
+ this.artTypeGuid = artTypeGuid;
this.factoryName = factoryName;
this.transactionId = transactionId;
}
public SkynetArtifactEventBase(SkynetArtifactEventBase base) {
super(base.getNetworkSender());
-
this.branchId = base.branchId;
-
+ this.branchGuid = base.branchGuid;
this.artId = base.artId;
+ this.artGuid = base.artGuid;
this.artTypeId = base.artTypeId;
+ this.artTypeGuid = base.artTypeGuid;
this.factoryName = base.factoryName;
this.transactionId = base.transactionId;
-
}
- public int getId() {
+ public int getBranchId() {
return branchId;
}
@@ -65,4 +71,20 @@ public class SkynetArtifactEventBase extends SkynetEventBase implements ISkynetA
public String getFactoryName() {
return factoryName;
}
+
+ @Override
+ public String getArtGuid() {
+ return artGuid;
+ }
+
+ @Override
+ public String getArtTypeGuid() {
+ return artTypeGuid;
+ }
+
+ @Override
+ public String getBranchGuid() {
+ return branchGuid;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetArtifactsEventBase.java b/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetArtifactsEventBase.java
index 0198e2b2b1..28c46494aa 100644
--- a/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetArtifactsEventBase.java
+++ b/plugins/org.eclipse.osee.framework.messaging.event.skynet/src/org/eclipse/osee/framework/messaging/event/skynet/event/SkynetArtifactsEventBase.java
@@ -22,37 +22,28 @@ public abstract class SkynetArtifactsEventBase extends SkynetEventBase implement
private final Collection<Integer> artifactTypeIds;
private final Collection<Integer> artifactIds;
private final int branchId;
+ private final Collection<String> artifactGuids;
- /**
- * @param branchId
- * @param artifactIds
- * @param artifactTypeIds
- * @param author
- */
- public SkynetArtifactsEventBase(int branchId, Collection<Integer> artifactIds, Collection<Integer> artifactTypeIds, NetworkSender networkSender) {
+ public Collection<String> getArtifactGuids() {
+ return artifactGuids;
+ }
+
+ public SkynetArtifactsEventBase(int branchId, Collection<Integer> artifactIds, Collection<String> artifactGuids, Collection<Integer> artifactTypeIds, NetworkSender networkSender) {
super(networkSender);
this.branchId = branchId;
this.artifactIds = artifactIds;
this.artifactTypeIds = artifactTypeIds;
+ this.artifactGuids = artifactGuids;
}
- /**
- * @return the branchId
- */
public int getId() {
return branchId;
}
- /**
- * @return the artifactTypeIds
- */
public Collection<Integer> getArtifactTypeIds() {
return artifactTypeIds;
}
- /**
- * @return the artifactIds
- */
public Collection<Integer> getArtifactIds() {
return artifactIds;
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.skynet.core.test/META-INF/MANIFEST.MF
index 67f51b3bcf..52b1ee30de 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/META-INF/MANIFEST.MF
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: Test2 Fragment
+Bundle-Name: Test Fragment
Bundle-SymbolicName: org.eclipse.osee.framework.skynet.core.test;singleton:=true
Bundle-Version: 0.9.4.qualifier
Fragment-Host: org.eclipse.osee.framework.skynet.core
@@ -10,9 +10,18 @@ Require-Bundle: org.junit4,
Export-Package: org.eclipse.osee.framework.skynet.core.test,
org.eclipse.osee.framework.skynet.core.test.branch,
org.eclipse.osee.framework.skynet.core.test.cases,
+ org.eclipse.osee.framework.skynet.core.test.importing,
+ org.eclipse.osee.framework.skynet.core.test.relation,
+ org.eclipse.osee.framework.skynet.core.test.relation.order,
+ org.eclipse.osee.framework.skynet.core.test.relation.sorters,
org.eclipse.osee.framework.skynet.core.test.types,
org.eclipse.osee.framework.skynet.core.test.util
Import-Package: org.apache.commons.lang;version="2.4.0",
+ org.eclipse.osee.framework.core.client,
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.test.mocks,
- org.eclipse.osee.framework.jdk.core.util
+ org.eclipse.osee.framework.jdk.core.util,
+ org.eclipse.osee.framework.skynet.core.event,
+ org.eclipse.osee.framework.skynet.core.event.artifact,
+ org.eclipse.osee.framework.skynet.core.event.filter
+Bundle-Vendor: Eclipse.org
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_TestDb_Suite.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_TestDb_Suite.java
new file mode 100644
index 0000000000..4bbe559dd0
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_TestDb_Suite.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 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.skynet.core.test;
+
+import org.eclipse.osee.framework.skynet.core.test.cases.ArtifactEventManagerLoopbackTest;
+import org.eclipse.osee.framework.skynet.core.test.cases.ArtifactEventManagerTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {ArtifactEventManagerLoopbackTest.class, ArtifactEventManagerTest.class})
+/**
+ * @author Donald G. Dunne
+ */
+public class FrameworkCore_TestDb_Suite {
+
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/cases/ArtifactEventManagerLoopbackTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/cases/ArtifactEventManagerLoopbackTest.java
new file mode 100644
index 0000000000..f422686481
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/cases/ArtifactEventManagerLoopbackTest.java
@@ -0,0 +1,29 @@
+/*
+ * Created on Mar 28, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.skynet.core.test.cases;
+
+import org.eclipse.osee.framework.skynet.core.event.InternalEventManager;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+/**
+ * event loopback will test that remote messages get processed and treated like local messages by turning off local and
+ * enabling remote to be loop-ed back without another client. same tests as base-class should still pass
+ *
+ * @author Donald G. Dunne
+ */
+public class ArtifactEventManagerLoopbackTest extends ArtifactEventManagerTest {
+
+ @BeforeClass
+ public static void setUp() {
+ InternalEventManager.setEnableRemoteEventLoopback(true);
+ }
+
+ @AfterClass
+ public static void tearDown() {
+ InternalEventManager.setEnableRemoteEventLoopback(false);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/cases/ArtifactEventManagerTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/cases/ArtifactEventManagerTest.java
new file mode 100644
index 0000000000..da818a5607
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/cases/ArtifactEventManagerTest.java
@@ -0,0 +1,216 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 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.skynet.core.test.cases;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+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.BranchManager;
+import org.eclipse.osee.framework.skynet.core.artifact.ChangeArtifactType;
+import org.eclipse.osee.framework.skynet.core.artifact.StaticIdManager;
+import org.eclipse.osee.framework.skynet.core.event.Sender;
+import org.eclipse.osee.framework.skynet.core.event.artifact.ArtifactEventManager;
+import org.eclipse.osee.framework.skynet.core.event.artifact.EventModType;
+import org.eclipse.osee.framework.skynet.core.event.artifact.IArtifactListener;
+import org.eclipse.osee.framework.skynet.core.event.artifact.IEventBasicGuidArtifact;
+import org.eclipse.osee.framework.skynet.core.event.artifact.IEventChangeTypeBasicGuidArtifact;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ArtifactEventManagerTest {
+
+ final List<IEventBasicGuidArtifact> resultEventArtifacts = new ArrayList<IEventBasicGuidArtifact>();
+ public static Sender resultSender = null;
+ public class ArtifactEventListener implements IArtifactListener {
+ @Override
+ public void handleArtifactModified(Collection<IEventBasicGuidArtifact> eventArtifacts, Sender sender) {
+ resultEventArtifacts.addAll(eventArtifacts);
+ resultSender = sender;
+ }
+ }
+ // artifact listener create for use by all tests to just capture result eventArtifacts for query
+ private ArtifactEventListener artifactEventListener = new ArtifactEventListener();
+
+ @org.junit.Test
+ public void testRegistration() throws OseeCoreException {
+
+ ArtifactEventManager.removeAllListeners();
+ Assert.assertEquals(0, ArtifactEventManager.getNumberOfListeners());
+
+ ArtifactEventManager.addListener(artifactEventListener);
+ Assert.assertEquals(1, ArtifactEventManager.getNumberOfListeners());
+
+ ArtifactEventManager.removeListener(artifactEventListener);
+ Assert.assertEquals(0, ArtifactEventManager.getNumberOfListeners());
+ }
+
+ @org.junit.Test
+ public void testAddModifyDeleteArtifactEvents() throws OseeCoreException, InterruptedException {
+ ArtifactEventManager.removeAllListeners();
+ Assert.assertEquals(0, ArtifactEventManager.getNumberOfListeners());
+
+ ArtifactEventManager.addListener(artifactEventListener);
+ Assert.assertEquals(1, ArtifactEventManager.getNumberOfListeners());
+
+ // Add new Artifact Test
+ Artifact newArt = ArtifactTypeManager.addArtifact(CoreArtifactTypes.GeneralData, BranchManager.getCommonBranch());
+ newArt.persist();
+
+ Thread.sleep(3000);
+
+ Assert.assertEquals(2, resultEventArtifacts.size());
+ boolean addedFound = false, modifiedFound = false;
+ for (IEventBasicGuidArtifact guidArt : resultEventArtifacts) {
+ if (guidArt.getModType() == EventModType.Added) addedFound = true;
+ if (guidArt.getModType() == EventModType.Modified) modifiedFound = true;
+ Assert.assertEquals(newArt.getGuid(), guidArt.getGuid());
+ Assert.assertEquals(newArt.getArtifactType().getGuid(), guidArt.getArtTypeGuid());
+ Assert.assertEquals(newArt.getBranch().getGuid(), guidArt.getBranchGuid());
+ }
+ Assert.assertTrue(addedFound);
+ Assert.assertTrue(modifiedFound);
+
+ // Modify Artifact Test
+ resultEventArtifacts.clear();
+ StaticIdManager.setSingletonAttributeValue(newArt, "this");
+ newArt.persist();
+
+ Thread.sleep(3000);
+
+ Assert.assertEquals(1, resultEventArtifacts.size());
+ IEventBasicGuidArtifact guidArt = resultEventArtifacts.iterator().next();
+ Assert.assertEquals(EventModType.Modified, guidArt.getModType());
+ Assert.assertEquals(newArt.getGuid(), guidArt.getGuid());
+ Assert.assertEquals(newArt.getArtifactType().getGuid(), guidArt.getArtTypeGuid());
+ Assert.assertEquals(newArt.getBranch().getGuid(), guidArt.getBranchGuid());
+
+ // Delete Artifact Test
+ resultEventArtifacts.clear();
+ newArt.deleteAndPersist();
+
+ Thread.sleep(3000);
+
+ Assert.assertEquals(2, resultEventArtifacts.size());
+ boolean deletedFound = false;
+ modifiedFound = false;
+ for (IEventBasicGuidArtifact guidArt1 : resultEventArtifacts) {
+ if (guidArt1.getModType() == EventModType.Deleted) deletedFound = true;
+ if (guidArt1.getModType() == EventModType.Modified) modifiedFound = true;
+ Assert.assertEquals(newArt.getGuid(), guidArt1.getGuid());
+ Assert.assertEquals(newArt.getArtifactType().getGuid(), guidArt1.getArtTypeGuid());
+ Assert.assertEquals(newArt.getBranch().getGuid(), guidArt1.getBranchGuid());
+ }
+ Assert.assertTrue(deletedFound);
+ Assert.assertTrue(modifiedFound);
+
+ }
+
+ @org.junit.Test
+ public void testPurgeArtifactEvents() throws OseeCoreException, InterruptedException {
+ ArtifactEventManager.removeAllListeners();
+ Assert.assertEquals(0, ArtifactEventManager.getNumberOfListeners());
+
+ // Add new Artifact Test
+ Artifact newArt = ArtifactTypeManager.addArtifact(CoreArtifactTypes.GeneralData, BranchManager.getCommonBranch());
+ newArt.setName(getClass().getSimpleName() + " - testEvents");
+ newArt.persist();
+
+ Thread.sleep(3000);
+
+ ArtifactEventManager.addListener(artifactEventListener);
+ Assert.assertEquals(1, ArtifactEventManager.getNumberOfListeners());
+
+ // Purge Artifact
+ newArt.purgeFromBranch();
+
+ Thread.sleep(3000);
+
+ Assert.assertEquals(1, resultEventArtifacts.size());
+ IEventBasicGuidArtifact guidArt = resultEventArtifacts.iterator().next();
+ Assert.assertEquals(EventModType.Purged, guidArt.getModType());
+ Assert.assertEquals(newArt.getGuid(), guidArt.getGuid());
+ Assert.assertEquals(newArt.getArtifactType().getGuid(), guidArt.getArtTypeGuid());
+ Assert.assertEquals(newArt.getBranch().getGuid(), guidArt.getBranchGuid());
+
+ }
+
+ @org.junit.Test
+ public void testReloadArtifactEvents() throws OseeCoreException, InterruptedException {
+ ArtifactEventManager.removeAllListeners();
+ Assert.assertEquals(0, ArtifactEventManager.getNumberOfListeners());
+
+ // Add new Artifact Test
+ Artifact newArt = ArtifactTypeManager.addArtifact(CoreArtifactTypes.GeneralData, BranchManager.getCommonBranch());
+ newArt.setName(getClass().getSimpleName() + " - testEvents");
+ newArt.persist();
+
+ Thread.sleep(3000);
+
+ ArtifactEventManager.addListener(artifactEventListener);
+ Assert.assertEquals(1, ArtifactEventManager.getNumberOfListeners());
+
+ // reload Artifact
+ StaticIdManager.setSingletonAttributeValue(newArt, "this");
+ Assert.assertTrue(newArt.isDirty());
+ newArt.reloadAttributesAndRelations();
+
+ Thread.sleep(3000);
+
+ Assert.assertEquals(1, resultEventArtifacts.size());
+ IEventBasicGuidArtifact guidArt = resultEventArtifacts.iterator().next();
+ Assert.assertEquals(EventModType.Reloaded, guidArt.getModType());
+ Assert.assertEquals(newArt.getGuid(), guidArt.getGuid());
+ Assert.assertEquals(newArt.getArtifactType().getGuid(), guidArt.getArtTypeGuid());
+ Assert.assertEquals(newArt.getBranch().getGuid(), guidArt.getBranchGuid());
+
+ }
+
+ @org.junit.Test
+ public void testChangeTypeArtifactEvents() throws OseeCoreException, InterruptedException {
+ ArtifactEventManager.removeAllListeners();
+ Assert.assertEquals(0, ArtifactEventManager.getNumberOfListeners());
+
+ // Add new Artifact for Test
+ Artifact newArt = ArtifactTypeManager.addArtifact(CoreArtifactTypes.GeneralData, BranchManager.getCommonBranch());
+ newArt.setName(getClass().getSimpleName() + " - testEvents");
+ newArt.persist();
+
+ Thread.sleep(3000);
+
+ ArtifactEventManager.addListener(artifactEventListener);
+ Assert.assertEquals(1, ArtifactEventManager.getNumberOfListeners());
+
+ // reload Artifact
+ Assert.assertTrue(newArt.isOfType(CoreArtifactTypes.GeneralData));
+ ChangeArtifactType.changeArtifactType(Arrays.asList(newArt),
+ ArtifactTypeManager.getType(CoreArtifactTypes.Heading));
+
+ Thread.sleep(5000);
+
+ Assert.assertEquals(1, resultEventArtifacts.size());
+ IEventChangeTypeBasicGuidArtifact guidArt =
+ (IEventChangeTypeBasicGuidArtifact) resultEventArtifacts.iterator().next();
+ Assert.assertEquals(EventModType.ChangeType, guidArt.getModType());
+ Assert.assertEquals(newArt.getGuid(), guidArt.getGuid());
+ Assert.assertEquals(newArt.getBranch().getGuid(), guidArt.getBranchGuid());
+ Assert.assertEquals(CoreArtifactTypes.GeneralData.getGuid(), guidArt.getFromArtTypeGuid());
+ // TODO Framework needs to reload artifact as new type; doesn't happen yet
+ Assert.assertEquals(CoreArtifactTypes.Heading.getGuid(), newArt.getArtifactType().getGuid());
+ Assert.assertEquals(CoreArtifactTypes.Heading.getGuid(), guidArt.getArtTypeGuid());
+ }
+} \ No newline at end of file
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 836f9edfa5..5bfad621e9 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
@@ -13,7 +13,6 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.osee.framework.jdk.core,
org.eclipse.osee.framework.messaging.event.skynet,
org.eclipse.osee.framework.database
-Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.osee.framework.skynet.core,
org.eclipse.osee.framework.skynet.core.access,
org.eclipse.osee.framework.skynet.core.artifact,
@@ -30,6 +29,8 @@ Export-Package: org.eclipse.osee.framework.skynet.core,
org.eclipse.osee.framework.skynet.core.commit.actions,
org.eclipse.osee.framework.skynet.core.conflict,
org.eclipse.osee.framework.skynet.core.event,
+ org.eclipse.osee.framework.skynet.core.event.artifact,
+ org.eclipse.osee.framework.skynet.core.event.filter,
org.eclipse.osee.framework.skynet.core.exportImport,
org.eclipse.osee.framework.skynet.core.httpRequests,
org.eclipse.osee.framework.skynet.core.importing,
@@ -64,3 +65,4 @@ Import-Package: org.apache.commons.lang;version="2.4.0",
org.eclipse.osee.framework.plugin.core,
org.eclipse.osee.framework.plugin.core.util
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
index 25d3d143b0..792481e437 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
@@ -12,7 +12,6 @@
package org.eclipse.osee.framework.skynet.core.artifact;
import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.Default_Hierarchical__Child;
-
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
@@ -25,12 +24,12 @@ import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import java.util.regex.Pattern;
-
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.osee.framework.core.data.DefaultBasicGuidArtifact;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IOseeBranch;
@@ -1872,4 +1871,8 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
public Artifact getFullArtifact() throws OseeCoreException {
return this;
}
+
+ public DefaultBasicGuidArtifact getBasicGuidArtifact() {
+ return new DefaultBasicGuidArtifact(getBranch().getGuid(), getArtifactType().getGuid(), getGuid());
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeArtifactType.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeArtifactType.java
index aaa1a871d0..96ae148401 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeArtifactType.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeArtifactType.java
@@ -32,7 +32,7 @@ import org.eclipse.osee.framework.skynet.core.utility.LoadedArtifacts;
/**
* Changes the descriptor type of an artifact to the provided descriptor.
- *
+ *
* @author Jeff C. Phillips
*/
public class ChangeArtifactType {
@@ -42,7 +42,7 @@ public class ChangeArtifactType {
/**
* Changes the descriptor of the artifacts to the provided artifact descriptor
- *
+ *
* @param artifacts
* @param artifactType
*/
@@ -62,7 +62,7 @@ public class ChangeArtifactType {
// Kick Local and Remote Events
OseeEventManager.kickArtifactsChangeTypeEvent(ChangeArtifactType.class, artifactType.getId(),
- new LoadedArtifacts(artifacts));
+ artifactType.getGuid(), new LoadedArtifacts(artifacts));
}
public static void changeArtifactTypeReportOnly(StringBuffer results, Collection<Artifact> artifacts, ArtifactType artifactType) throws OseeCoreException {
@@ -82,8 +82,8 @@ public class ChangeArtifactType {
private static void getConflictString(StringBuffer results, Artifact artifact, ArtifactType artifactType) {
results.append("There has been a conflict in changing artifact " + artifact.getGuid() + " - \"" + artifact.getName() + "\"" +
- //
- " to \"" + artifactType.getName() + "\" type. \n" + "The following data will need to be purged ");
+ //
+ " to \"" + artifactType.getName() + "\" type. \n" + "The following data will need to be purged ");
for (RelationLink relationLink : relationsToDelete) {
results.append("([Relation][" + relationLink + "])");
}
@@ -96,7 +96,7 @@ public class ChangeArtifactType {
/**
* Splits the attributes of the current artifact into two groups. The attributes that are compatible for the new type
* and the attributes that will need to be purged.
- *
+ *
* @param artifact
* @param descriptor
*/
@@ -113,7 +113,7 @@ public class ChangeArtifactType {
/**
* Splits the relationLinks of the current artifact into Two groups. The links that are compatible for the new type
* and the links that will need to be purged.
- *
+ *
* @param artifact
* @param artifactType
* @throws OseeCoreException
@@ -153,7 +153,7 @@ public class ChangeArtifactType {
/**
* Sets the artifact descriptor.
- *
+ *
* @param artifact
* @param newArtifactType
* @throws OseeCoreException
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/ArtifactModifiedEvent.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/ArtifactModifiedEvent.java
index 754bc9da50..7899411a14 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/ArtifactModifiedEvent.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/ArtifactModifiedEvent.java
@@ -11,9 +11,16 @@
package org.eclipse.osee.framework.skynet.core.event;
import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
import org.eclipse.osee.framework.messaging.event.skynet.event.SkynetAttributeChange;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactModType;
+import org.eclipse.osee.framework.skynet.core.event.artifact.DefaultEventBasicGuidArtifact;
+import org.eclipse.osee.framework.skynet.core.event.artifact.EventModType;
+import org.eclipse.osee.framework.skynet.core.event.artifact.IEventBasicGuidArtifact;
import org.eclipse.osee.framework.ui.plugin.event.UnloadedArtifact;
/**
@@ -54,4 +61,27 @@ public class ArtifactModifiedEvent extends ArtifactTransactionModifiedEvent {
public Collection<SkynetAttributeChange> getAttributeChanges() {
return dirtySkynetAttributeChanges;
}
+
+ @Override
+ public Set<? extends IEventBasicGuidArtifact> getArtifactChanges() throws OseeCoreException {
+ EventModType eventModType = null;
+ if (artifactModType == ArtifactModType.Added) {
+ eventModType = EventModType.Added;
+ } else if (artifactModType == ArtifactModType.Deleted) {
+ eventModType = EventModType.Deleted;
+ } else if (artifactModType == ArtifactModType.Reverted) {
+ eventModType = EventModType.Reloaded;
+ } else {
+ eventModType = EventModType.Modified;
+ }
+ if (artifact != null) {
+ return Collections.singleton(new DefaultEventBasicGuidArtifact(eventModType, artifact.getBranch().getGuid(),
+ artifact.getArtifactType().getGuid(), artifact.getGuid()));
+ } else if (unloadedArtifact != null) {
+ return Collections.singleton(new DefaultEventBasicGuidArtifact(eventModType, unloadedArtifact.getBranchGuid(),
+ unloadedArtifact.getArtTypeGuid(), unloadedArtifact.getGuid()));
+ } else {
+ throw new OseeStateException("unhandled artifact change state");
+ }
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/ArtifactTransactionModifiedEvent.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/ArtifactTransactionModifiedEvent.java
index 4a9c7b1f59..4314fa7c7b 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/ArtifactTransactionModifiedEvent.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/ArtifactTransactionModifiedEvent.java
@@ -10,9 +10,15 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.event;
+import java.util.Set;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.event.artifact.IEventBasicGuidArtifact;
+
/**
* @author Donald G. Dunne
*/
-public class ArtifactTransactionModifiedEvent {
+public abstract class ArtifactTransactionModifiedEvent {
+
+ public abstract Set<? extends IEventBasicGuidArtifact> getArtifactChanges() throws OseeCoreException;
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkTransactionData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkTransactionData.java
index d38b5a8551..e14cfa66bc 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkTransactionData.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkTransactionData.java
@@ -13,11 +13,21 @@ package org.eclipse.osee.framework.skynet.core.event;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
+import java.util.logging.Level;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactModType;
import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.event.artifact.IEventBasicGuidArtifact;
+import org.eclipse.osee.framework.skynet.core.internal.Activator;
+import org.eclipse.osee.framework.skynet.core.relation.RelationEventType;
+import org.eclipse.osee.framework.skynet.core.relation.RelationLink;
+import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager;
import org.eclipse.osee.framework.ui.plugin.event.UnloadedArtifact;
import org.eclipse.osee.framework.ui.plugin.event.UnloadedRelation;
@@ -41,6 +51,7 @@ import org.eclipse.osee.framework.ui.plugin.event.UnloadedRelation;
public class FrameworkTransactionData {
Collection<ArtifactTransactionModifiedEvent> xModifiedEvents;
+ Set<IEventBasicGuidArtifact> artifactChanges;
// artifact collections of artifacts based on artifactModType that are currently loaded in the client's artifact cache
public Set<Artifact> cacheChangedArtifacts = new HashSet<Artifact>();
@@ -77,6 +88,10 @@ public class FrameworkTransactionData {
Changed, Deleted, Added, All
};
+ public FrameworkTransactionData(Collection<ArtifactTransactionModifiedEvent> xModifiedEvents) {
+ this.xModifiedEvents = xModifiedEvents;
+ }
+
/**
* Return branchId of loaded artifacts or -1 if no loaded artifacts
*/
@@ -240,6 +255,189 @@ public class FrameworkTransactionData {
public void setXModifiedEvents(Collection<ArtifactTransactionModifiedEvent> modifiedEvents) {
xModifiedEvents = modifiedEvents;
+ createTransactionDataRollup();
}
+ private void createTransactionDataRollup() {
+ // Roll-up change information
+
+ for (ArtifactTransactionModifiedEvent xModifiedEvent : getXModifiedEvents()) {
+ if (xModifiedEvent instanceof ArtifactModifiedEvent) {
+ ArtifactModifiedEvent xArtifactModifiedEvent = (ArtifactModifiedEvent) xModifiedEvent;
+ if (xArtifactModifiedEvent.artifactModType == ArtifactModType.Added) {
+ if (xArtifactModifiedEvent.artifact != null) {
+ cacheAddedArtifacts.add(xArtifactModifiedEvent.artifact);
+ if (branchId == -1) {
+ branchId = xArtifactModifiedEvent.artifact.getBranch().getId();
+ }
+ } else {
+ unloadedAddedArtifacts.add(xArtifactModifiedEvent.unloadedArtifact);
+ if (branchId == -1) {
+ try {
+ branchId =
+ BranchManager.getBranch(xArtifactModifiedEvent.unloadedArtifact.getBranchGuid()).getId();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE, "Invalid branch id", ex);
+ }
+ }
+ }
+ }
+ if (xArtifactModifiedEvent.artifactModType == ArtifactModType.Deleted) {
+ if (xArtifactModifiedEvent.artifact != null) {
+ cacheDeletedArtifacts.add(xArtifactModifiedEvent.artifact);
+ if (branchId == -1) {
+ branchId = xArtifactModifiedEvent.artifact.getBranch().getId();
+ }
+ } else {
+ unloadedDeletedArtifacts.add(xArtifactModifiedEvent.unloadedArtifact);
+ if (branchId == -1) {
+ try {
+ branchId =
+ BranchManager.getBranch(xArtifactModifiedEvent.unloadedArtifact.getBranchGuid()).getId();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE, "Invalid branch id", ex);
+ }
+ }
+ }
+ }
+ if (xArtifactModifiedEvent.artifactModType == ArtifactModType.Changed) {
+ if (xArtifactModifiedEvent.artifact != null) {
+ cacheChangedArtifacts.add(xArtifactModifiedEvent.artifact);
+ if (branchId == -1) {
+ branchId = xArtifactModifiedEvent.artifact.getBranch().getId();
+ }
+ } else {
+ unloadedChangedArtifacts.add(xArtifactModifiedEvent.unloadedArtifact);
+ if (branchId == -1) {
+ try {
+ branchId =
+ BranchManager.getBranch(xArtifactModifiedEvent.unloadedArtifact.getBranchGuid()).getId();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE, "Invalid branch id", ex);
+ }
+ }
+ }
+ }
+ }
+ if (xModifiedEvent instanceof RelationModifiedEvent) {
+ RelationModifiedEvent xRelationModifiedEvent = (RelationModifiedEvent) xModifiedEvent;
+ UnloadedRelation unloadedRelation = xRelationModifiedEvent.unloadedRelation;
+ LoadedRelation loadedRelation = null;
+ // If link is loaded, get information from link
+ if (xRelationModifiedEvent.link != null) {
+ RelationLink link = xRelationModifiedEvent.link;
+ // Get artifact A/B if loaded in artifact cache
+ Artifact artA = ArtifactCache.getActive(link.getAArtifactId(), link.getABranch());
+ Artifact artB = ArtifactCache.getActive(link.getBArtifactId(), link.getBBranch());
+ try {
+ loadedRelation =
+ new LoadedRelation(artA, artB, xRelationModifiedEvent.link.getRelationType(),
+ xRelationModifiedEvent.branch, unloadedRelation);
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ }
+ // Else, get information from unloadedRelation (if != null)
+ else if (unloadedRelation != null) {
+ Artifact artA = ArtifactCache.getActive(unloadedRelation.getArtifactAId(), unloadedRelation.getId());
+ Artifact artB = ArtifactCache.getActive(unloadedRelation.getArtifactBId(), unloadedRelation.getId());
+ if (artA != null || artB != null) {
+ try {
+ loadedRelation =
+ new LoadedRelation(artA, artB, RelationTypeManager.getType(unloadedRelation.getTypeId()),
+ artA != null ? artA.getBranch() : artB.getBranch(), unloadedRelation);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ if (xRelationModifiedEvent.relationEventType == RelationEventType.Added) {
+ if (loadedRelation != null) {
+ cacheAddedRelations.add(loadedRelation);
+ if (loadedRelation.getArtifactA() != null) {
+ cacheRelationAddedArtifacts.add(loadedRelation.getArtifactA());
+ if (branchId == -1) {
+ branchId = loadedRelation.getArtifactA().getBranch().getId();
+ }
+ }
+ if (loadedRelation.getArtifactB() != null) {
+ cacheRelationAddedArtifacts.add(loadedRelation.getArtifactB());
+ if (branchId == -1) {
+ branchId = loadedRelation.getArtifactB().getBranch().getId();
+ }
+ }
+ }
+ if (unloadedRelation != null) {
+ unloadedAddedRelations.add(unloadedRelation);
+ }
+ }
+ if (xRelationModifiedEvent.relationEventType == RelationEventType.Deleted) {
+ if (loadedRelation != null) {
+ cacheDeletedRelations.add(loadedRelation);
+ if (loadedRelation.getArtifactA() != null) {
+ cacheRelationDeletedArtifacts.add(loadedRelation.getArtifactA());
+ if (branchId == -1) {
+ branchId = loadedRelation.getArtifactA().getBranch().getId();
+ loadedRelation.getBranch();
+ }
+ }
+ if (loadedRelation.getArtifactB() != null) {
+ cacheRelationDeletedArtifacts.add(loadedRelation.getArtifactB());
+ if (branchId == -1) {
+ branchId = loadedRelation.getArtifactB().getBranch().getId();
+ }
+ }
+ }
+ if (unloadedRelation != null) {
+ unloadedDeletedRelations.add(unloadedRelation);
+ if (branchId == -1) {
+ branchId = unloadedRelation.getId();
+ }
+ }
+ }
+ if (xRelationModifiedEvent.relationEventType == RelationEventType.RationaleMod) {
+ if (loadedRelation != null) {
+ cacheChangedRelations.add(loadedRelation);
+ if (loadedRelation.getArtifactA() != null) {
+ cacheRelationChangedArtifacts.add(loadedRelation.getArtifactA());
+ if (branchId == -1) {
+ branchId = loadedRelation.getArtifactA().getBranch().getId();
+ }
+ }
+ if (loadedRelation.getArtifactB() != null) {
+ cacheRelationChangedArtifacts.add(loadedRelation.getArtifactB());
+ if (branchId == -1) {
+ branchId = loadedRelation.getArtifactB().getBranch().getId();
+ }
+ }
+ }
+ if (unloadedRelation != null) {
+ unloadedChangedRelations.add(unloadedRelation);
+ if (branchId == -1) {
+ branchId = unloadedRelation.getId();
+ }
+ }
+ }
+ }
+ }
+
+ // Clean out known duplicates
+ cacheChangedArtifacts.removeAll(cacheDeletedArtifacts);
+ cacheAddedArtifacts.removeAll(cacheDeletedArtifacts);
+
+ }
+
+ public Set<IEventBasicGuidArtifact> getArtifactChanges() {
+ if (artifactChanges == null) {
+ artifactChanges = new HashSet<IEventBasicGuidArtifact>();
+ for (ArtifactTransactionModifiedEvent event : xModifiedEvents) {
+ try {
+ artifactChanges.addAll(event.getArtifactChanges());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE, ex);
+ }
+ }
+ }
+ return artifactChanges;
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/IEventDispatcher.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/IEventDispatcher.java
new file mode 100644
index 0000000000..4512928248
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/IEventDispatcher.java
@@ -0,0 +1,13 @@
+/*
+ * Created on Mar 23, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.skynet.core.event;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IEventDispatcher {
+
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/ITransactionEventDispatcher.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/ITransactionEventDispatcher.java
new file mode 100644
index 0000000000..3e3f180f96
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/ITransactionEventDispatcher.java
@@ -0,0 +1,22 @@
+/*
+ * Created on Mar 23, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.skynet.core.event;
+
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.messaging.event.skynet.ISkynetEvent;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface ITransactionEventDispatcher extends IEventDispatcher {
+
+ public void kickLocalEvents(final Sender sender, Collection<ArtifactTransactionModifiedEvent> xModifiedEvents, FrameworkTransactionData transData);
+
+ public void generateNetworkSkynetEvents(Sender sender, Collection<ArtifactTransactionModifiedEvent> xModifiedEvents, List<ISkynetEvent> resultEvents) throws OseeCoreException;
+
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager.java
index e7badc7205..7d1ae845db 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager.java
@@ -15,13 +15,15 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.logging.Level;
-import org.eclipse.core.runtime.Platform;
+import org.eclipse.osee.framework.core.data.IBasicGuidArtifact;
import org.eclipse.osee.framework.core.enums.RelationSide;
import org.eclipse.osee.framework.core.exception.OseeAuthenticationRequiredException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
@@ -48,16 +50,18 @@ import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkTransactio
import org.eclipse.osee.framework.messaging.event.skynet.event.SkynetArtifactEventBase;
import org.eclipse.osee.framework.messaging.event.skynet.event.SkynetRelationLinkEventBase;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactModType;
import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.event.artifact.ArtifactEventManager;
+import org.eclipse.osee.framework.skynet.core.event.artifact.DefaultEventBasicGuidArtifact;
+import org.eclipse.osee.framework.skynet.core.event.artifact.DefaultEventChangeTypeBasicGuidArtifact;
+import org.eclipse.osee.framework.skynet.core.event.artifact.EventModType;
+import org.eclipse.osee.framework.skynet.core.event.artifact.IEventBasicGuidArtifact;
import org.eclipse.osee.framework.skynet.core.internal.Activator;
import org.eclipse.osee.framework.skynet.core.relation.RelationEventType;
import org.eclipse.osee.framework.skynet.core.relation.RelationLink;
-import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager;
import org.eclipse.osee.framework.skynet.core.utility.LoadedArtifacts;
import org.eclipse.osee.framework.ui.plugin.event.UnloadedArtifact;
-import org.eclipse.osee.framework.ui.plugin.event.UnloadedRelation;
/**
* Internal implementation of OSEE Event Manager that should only be accessed from RemoteEventManager and
@@ -69,6 +73,7 @@ public class InternalEventManager {
private static final List<IEventListener> priorityListeners = new CopyOnWriteArrayList<IEventListener>();
private static final List<IEventListener> listeners = new CopyOnWriteArrayList<IEventListener>();
+ private static final List<IEventDispatcher> dispatchers = new CopyOnWriteArrayList<IEventDispatcher>();
public static final Collection<UnloadedArtifact> EMPTY_UNLOADED_ARTIFACTS = Collections.emptyList();
private static boolean disableEvents = false;
@@ -79,10 +84,11 @@ public class InternalEventManager {
// This will disable all Local TransactionEvents and enable loopback routing of Remote TransactionEvents back
// through the RemoteEventService as if they came from another client. This is for testing purposes only and
// should be reset to false before release.
- public static final boolean enableRemoteEventLoopback = false;
+ private static boolean enableRemoteEventLoopback = false;
- private static final boolean DEBUG =
- "TRUE".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.osee.framework.skynet.core/debug/Events"));
+ private static final boolean DEBUG = true;
+
+ // "TRUE".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.osee.framework.skynet.core/debug/Events"));
// Kick LOCAL "remote event manager" event
static void kickRemoteEventManagerEvent(final Sender sender, final RemoteEventServiceEventType remoteEventServiceEventType) throws OseeCoreException {
@@ -268,16 +274,20 @@ public class InternalEventManager {
branchId = loadedArtifacts.getLoadedArtifacts().iterator().next().getBranch().getId();
}
Collection<Integer> artifactIds;
+ Collection<String> artifactGuids;
Collection<Integer> artifactTypeIds;
if (loadedArtifacts != null) {
artifactIds = loadedArtifacts.getAllArtifactIds();
+ artifactGuids = loadedArtifacts.getAllArtifactGuids();
artifactTypeIds = loadedArtifacts.getAllArtifactTypeIds();
} else {
artifactIds = Collections.emptyList();
artifactTypeIds = Collections.emptyList();
+ artifactGuids = Collections.emptyList();
}
RemoteEventManager.kick(new NetworkAccessControlArtifactsEvent(accessControlEventType.name(),
- branchId == null ? -1 : branchId, artifactIds, artifactTypeIds, sender.getNetworkSender()));
+ branchId == null ? -1 : branchId, artifactIds, artifactGuids, artifactTypeIds,
+ sender.getNetworkSender()));
}
} catch (OseeCoreException ex) {
OseeLog.log(Activator.class, Level.SEVERE, ex);
@@ -339,13 +349,20 @@ public class InternalEventManager {
// Kick LOCAL
safelyInvokeListeners(IArtifactsPurgedEventListener.class, "handleArtifactsPurgedEvent", sender,
loadedArtifacts);
+ try {
+ ArtifactEventManager.processArtifactChanges(sender, DefaultEventBasicGuidArtifact.get(
+ EventModType.Purged, loadedArtifacts.getArtifactChanges()));
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+
// Kick REMOTE (If source was Local and this was not a default branch changed event
try {
if (sender.isLocal()) {
RemoteEventManager.kick(new NetworkArtifactPurgeEvent(
loadedArtifacts.getLoadedArtifacts().iterator().next().getBranch().getId(),
- loadedArtifacts.getAllArtifactIds(), loadedArtifacts.getAllArtifactTypeIds(),
- sender.getNetworkSender()));
+ loadedArtifacts.getAllArtifactIds(), loadedArtifacts.getAllArtifactGuids(),
+ loadedArtifacts.getAllArtifactTypeIds(), sender.getNetworkSender()));
}
} catch (OseeCoreException ex) {
OseeLog.log(Activator.class, Level.SEVERE, ex);
@@ -356,7 +373,7 @@ public class InternalEventManager {
}
// Kick LOCAL and REMOTE artifact change type depending on sender
- static void kickArtifactsChangeTypeEvent(final Sender sender, final int toArtifactTypeId, final LoadedArtifacts loadedArtifacts) throws OseeCoreException {
+ static void kickArtifactsChangeTypeEvent(final Sender sender, final int toArtifactTypeId, final String toArtifactTypeGuid, final LoadedArtifacts loadedArtifacts) throws OseeCoreException {
if (isDisableEvents()) {
return;
}
@@ -366,12 +383,24 @@ public class InternalEventManager {
// Kick LOCAL
safelyInvokeListeners(IArtifactsChangeTypeEventListener.class, "handleArtifactsChangeTypeEvent", sender,
toArtifactTypeId, loadedArtifacts);
+ try {
+ Set<IEventBasicGuidArtifact> artifactChanges = new HashSet<IEventBasicGuidArtifact>();
+ for (IBasicGuidArtifact guidArt : loadedArtifacts.getArtifactChanges()) {
+ artifactChanges.add(new DefaultEventChangeTypeBasicGuidArtifact(guidArt.getBranchGuid(),
+ guidArt.getArtTypeGuid(), toArtifactTypeGuid, guidArt.getGuid()));
+ }
+ ArtifactEventManager.processArtifactChanges(sender, artifactChanges);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+
// Kick REMOTE (If source was Local and this was not a default branch changed event
try {
if (sender.isLocal()) {
RemoteEventManager.kick(new NetworkArtifactChangeTypeEvent(
loadedArtifacts.getLoadedArtifacts().iterator().next().getBranch().getId(),
- loadedArtifacts.getAllArtifactIds(), loadedArtifacts.getAllArtifactTypeIds(), toArtifactTypeId,
+ loadedArtifacts.getAllArtifactIds(), loadedArtifacts.getAllArtifactGuids(),
+ loadedArtifacts.getAllArtifactTypeIds(), toArtifactTypeId, toArtifactTypeGuid,
sender.getNetworkSender()));
}
} catch (OseeCoreException ex) {
@@ -419,7 +448,8 @@ public class InternalEventManager {
Runnable runnable = new Runnable() {
public void run() {
// Roll-up change information
- FrameworkTransactionData transData = createTransactionDataRollup(xModifiedEventsCopy);
+ FrameworkTransactionData transData = new FrameworkTransactionData(xModifiedEventsCopy);
+ transData.setXModifiedEvents(xModifiedEventsCopy);
try {
// Log if this is a loopback and what is happening
if (enableRemoteEventLoopback) {
@@ -433,11 +463,29 @@ public class InternalEventManager {
if (!enableRemoteEventLoopback || enableRemoteEventLoopback && sender.isRemote()) {
safelyInvokeListeners(IFrameworkTransactionEventListener.class, "handleFrameworkTransactionEvent",
sender, transData);
+ ArtifactEventManager.processArtifactChanges(sender, transData.getArtifactChanges());
+ for (IEventDispatcher dispatcher : dispatchers) {
+ if (dispatcher instanceof ITransactionEventDispatcher) {
+ try {
+ ((ITransactionEventDispatcher) dispatcher).kickLocalEvents(sender, xModifiedEventsCopy,
+ transData);
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ }
+ }
}
// Kick REMOTE (If source was Local and this was not a default branch changed event
if (sender.isLocal()) {
- List<ISkynetEvent> events = generateNetworkSkynetEvents(sender, xModifiedEventsCopy);
+ List<ISkynetEvent> events = new ArrayList<ISkynetEvent>();
+ generateNetworkSkynetEvents(sender, xModifiedEventsCopy, events);
+ for (IEventDispatcher dispatcher : dispatchers) {
+ if (dispatcher instanceof ITransactionEventDispatcher) {
+ ((ITransactionEventDispatcher) dispatcher).generateNetworkSkynetEvents(sender,
+ xModifiedEventsCopy, events);
+ }
+ }
RemoteEventManager.kick(events);
}
} catch (Exception ex) {
@@ -468,6 +516,12 @@ public class InternalEventManager {
// Kick LOCAL
if (!enableRemoteEventLoopback) {
safelyInvokeListeners(IArtifactReloadEventListener.class, "handleReloadEvent", sender, artifacts);
+ Set<IEventBasicGuidArtifact> artifactChanges = new HashSet<IEventBasicGuidArtifact>();
+ for (Artifact artifact : artifacts) {
+ artifactChanges.add(new DefaultEventBasicGuidArtifact(EventModType.Reloaded,
+ artifact.getBranch().getGuid(), artifact.getArtifactType().getGuid(), artifact.getGuid()));
+ }
+ ArtifactEventManager.processArtifactChanges(sender, artifactChanges);
}
} catch (Exception ex) {
OseeLog.log(Activator.class, Level.SEVERE, ex);
@@ -507,6 +561,21 @@ public class InternalEventManager {
priorityListeners.remove(listener);
}
+ static void addDispatcher(IEventDispatcher dispatcher) {
+ if (dispatcher == null) {
+ throw new IllegalArgumentException("dispatcher can not be null");
+ }
+ if (!dispatchers.contains(dispatcher)) {
+ dispatchers.add(dispatcher);
+ }
+ eventLog("OEM: addDispatcher (" + dispatchers.size() + ") " + dispatcher);
+ }
+
+ static void removeDispatcher(IEventDispatcher dispatcher) {
+ eventLog("OEM: removeDispatcher: (" + dispatchers.size() + ") " + dispatcher);
+ dispatchers.remove(dispatcher);
+ }
+
// This method clears all listeners. Should only be used for testing purposes.
public static void removeAllListeners() {
listeners.clear();
@@ -542,12 +611,10 @@ public class InternalEventManager {
return org.eclipse.osee.framework.jdk.core.util.Collections.toString("\n", (Object[]) listArr);
}
- private static List<ISkynetEvent> generateNetworkSkynetEvents(Sender sender, Collection<ArtifactTransactionModifiedEvent> xModifiedEvents) {
- List<ISkynetEvent> events = new ArrayList<ISkynetEvent>();
+ private static void generateNetworkSkynetEvents(Sender sender, Collection<ArtifactTransactionModifiedEvent> xModifiedEvents, List<ISkynetEvent> resultEvents) {
for (ArtifactTransactionModifiedEvent xModifiedEvent : xModifiedEvents) {
- events.add(generateNetworkSkynetEvent(xModifiedEvent, sender));
+ resultEvents.add(generateNetworkSkynetEvent(xModifiedEvent, sender));
}
- return events;
}
private static ISkynetEvent generateNetworkSkynetEvent(ArtifactTransactionModifiedEvent xModifiedEvent, Sender sender) {
@@ -579,8 +646,9 @@ public class InternalEventManager {
private static SkynetArtifactEventBase getArtifactEventBase(ArtifactModifiedEvent artEvent, Sender sender) {
Artifact artifact = artEvent.artifact;
SkynetArtifactEventBase eventBase =
- new SkynetArtifactEventBase(artifact.getBranch().getId(), artEvent.transactionNumber, artifact.getArtId(),
- artifact.getArtTypeId(), artifact.getFactory().getClass().getCanonicalName(),
+ new SkynetArtifactEventBase(artifact.getBranch().getId(), artifact.getBranch().getGuid(),
+ artEvent.transactionNumber, artifact.getArtId(), artifact.getGuid(), artifact.getArtTypeId(),
+ artifact.getArtifactType().getGuid(), artifact.getFactory().getClass().getCanonicalName(),
artEvent.sender.getNetworkSender());
return eventBase;
@@ -620,163 +688,6 @@ public class InternalEventManager {
return ret;
}
- private static FrameworkTransactionData createTransactionDataRollup(Collection<ArtifactTransactionModifiedEvent> xModifiedEvents) {
- // Roll-up change information
- FrameworkTransactionData transData = new FrameworkTransactionData();
- transData.setXModifiedEvents(xModifiedEvents);
-
- for (ArtifactTransactionModifiedEvent xModifiedEvent : xModifiedEvents) {
- if (xModifiedEvent instanceof ArtifactModifiedEvent) {
- ArtifactModifiedEvent xArtifactModifiedEvent = (ArtifactModifiedEvent) xModifiedEvent;
- if (xArtifactModifiedEvent.artifactModType == ArtifactModType.Added) {
- if (xArtifactModifiedEvent.artifact != null) {
- transData.cacheAddedArtifacts.add(xArtifactModifiedEvent.artifact);
- if (transData.branchId == -1) {
- transData.branchId = xArtifactModifiedEvent.artifact.getBranch().getId();
- }
- } else {
- transData.unloadedAddedArtifacts.add(xArtifactModifiedEvent.unloadedArtifact);
- if (transData.branchId == -1) {
- transData.branchId = xArtifactModifiedEvent.unloadedArtifact.getId();
- }
- }
- }
- if (xArtifactModifiedEvent.artifactModType == ArtifactModType.Deleted) {
- if (xArtifactModifiedEvent.artifact != null) {
- transData.cacheDeletedArtifacts.add(xArtifactModifiedEvent.artifact);
- if (transData.branchId == -1) {
- transData.branchId = xArtifactModifiedEvent.artifact.getBranch().getId();
- }
- } else {
- transData.unloadedDeletedArtifacts.add(xArtifactModifiedEvent.unloadedArtifact);
- if (transData.branchId == -1) {
- transData.branchId = xArtifactModifiedEvent.unloadedArtifact.getId();
- }
- }
- }
- if (xArtifactModifiedEvent.artifactModType == ArtifactModType.Changed) {
- if (xArtifactModifiedEvent.artifact != null) {
- transData.cacheChangedArtifacts.add(xArtifactModifiedEvent.artifact);
- if (transData.branchId == -1) {
- transData.branchId = xArtifactModifiedEvent.artifact.getBranch().getId();
- }
- } else {
- transData.unloadedChangedArtifacts.add(xArtifactModifiedEvent.unloadedArtifact);
- if (transData.branchId == -1) {
- transData.branchId = xArtifactModifiedEvent.unloadedArtifact.getId();
- }
- }
- }
- }
- if (xModifiedEvent instanceof RelationModifiedEvent) {
- RelationModifiedEvent xRelationModifiedEvent = (RelationModifiedEvent) xModifiedEvent;
- UnloadedRelation unloadedRelation = xRelationModifiedEvent.unloadedRelation;
- LoadedRelation loadedRelation = null;
- // If link is loaded, get information from link
- if (xRelationModifiedEvent.link != null) {
- RelationLink link = xRelationModifiedEvent.link;
- // Get artifact A/B if loaded in artifact cache
- Artifact artA = ArtifactCache.getActive(link.getAArtifactId(), link.getABranch());
- Artifact artB = ArtifactCache.getActive(link.getBArtifactId(), link.getBBranch());
- try {
- loadedRelation =
- new LoadedRelation(artA, artB, xRelationModifiedEvent.link.getRelationType(),
- xRelationModifiedEvent.branch, unloadedRelation);
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
- // Else, get information from unloadedRelation (if != null)
- else if (unloadedRelation != null) {
- Artifact artA = ArtifactCache.getActive(unloadedRelation.getArtifactAId(), unloadedRelation.getId());
- Artifact artB = ArtifactCache.getActive(unloadedRelation.getArtifactBId(), unloadedRelation.getId());
- if (artA != null || artB != null) {
- try {
- loadedRelation =
- new LoadedRelation(artA, artB, RelationTypeManager.getType(unloadedRelation.getTypeId()),
- artA != null ? artA.getBranch() : artB.getBranch(), unloadedRelation);
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
- }
- if (xRelationModifiedEvent.relationEventType == RelationEventType.Added) {
- if (loadedRelation != null) {
- transData.cacheAddedRelations.add(loadedRelation);
- if (loadedRelation.getArtifactA() != null) {
- transData.cacheRelationAddedArtifacts.add(loadedRelation.getArtifactA());
- if (transData.branchId == -1) {
- transData.branchId = loadedRelation.getArtifactA().getBranch().getId();
- }
- }
- if (loadedRelation.getArtifactB() != null) {
- transData.cacheRelationAddedArtifacts.add(loadedRelation.getArtifactB());
- if (transData.branchId == -1) {
- transData.branchId = loadedRelation.getArtifactB().getBranch().getId();
- }
- }
- }
- if (unloadedRelation != null) {
- transData.unloadedAddedRelations.add(unloadedRelation);
- }
- }
- if (xRelationModifiedEvent.relationEventType == RelationEventType.Deleted) {
- if (loadedRelation != null) {
- transData.cacheDeletedRelations.add(loadedRelation);
- if (loadedRelation.getArtifactA() != null) {
- transData.cacheRelationDeletedArtifacts.add(loadedRelation.getArtifactA());
- if (transData.branchId == -1) {
- transData.branchId = loadedRelation.getArtifactA().getBranch().getId();
- loadedRelation.getBranch();
- }
- }
- if (loadedRelation.getArtifactB() != null) {
- transData.cacheRelationDeletedArtifacts.add(loadedRelation.getArtifactB());
- if (transData.branchId == -1) {
- transData.branchId = loadedRelation.getArtifactB().getBranch().getId();
- }
- }
- }
- if (unloadedRelation != null) {
- transData.unloadedDeletedRelations.add(unloadedRelation);
- if (transData.branchId == -1) {
- transData.branchId = unloadedRelation.getId();
- }
- }
- }
- if (xRelationModifiedEvent.relationEventType == RelationEventType.RationaleMod) {
- if (loadedRelation != null) {
- transData.cacheChangedRelations.add(loadedRelation);
- if (loadedRelation.getArtifactA() != null) {
- transData.cacheRelationChangedArtifacts.add(loadedRelation.getArtifactA());
- if (transData.branchId == -1) {
- transData.branchId = loadedRelation.getArtifactA().getBranch().getId();
- }
- }
- if (loadedRelation.getArtifactB() != null) {
- transData.cacheRelationChangedArtifacts.add(loadedRelation.getArtifactB());
- if (transData.branchId == -1) {
- transData.branchId = loadedRelation.getArtifactB().getBranch().getId();
- }
- }
- }
- if (unloadedRelation != null) {
- transData.unloadedChangedRelations.add(unloadedRelation);
- if (transData.branchId == -1) {
- transData.branchId = unloadedRelation.getId();
- }
- }
- }
- }
- }
-
- // Clean out known duplicates
- transData.cacheChangedArtifacts.removeAll(transData.cacheDeletedArtifacts);
- transData.cacheAddedArtifacts.removeAll(transData.cacheDeletedArtifacts);
-
- return transData;
- }
-
public static void safelyInvokeListeners(Class<? extends IEventListener> c, String methodName, Object... args) {
for (IEventListener listener : priorityListeners) {
try {
@@ -815,4 +726,12 @@ public class InternalEventManager {
OseeLog.log(Activator.class, Level.INFO, ex);
}
}
+
+ public static boolean isEnableRemoteEventLoopback() {
+ return enableRemoteEventLoopback;
+ }
+
+ public static void setEnableRemoteEventLoopback(boolean enableRemoteEventLoopback) {
+ InternalEventManager.enableRemoteEventLoopback = enableRemoteEventLoopback;
+ }
}
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 89851f9e32..45966b87c3 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
@@ -123,11 +123,12 @@ public class OseeEventManager {
}
// Kick LOCAL and REMOTE artifact change type depending on sender
- public static void kickArtifactsChangeTypeEvent(Object source, int toArtifactTypeId, LoadedArtifacts loadedArtifacts) throws OseeCoreException {
+ public static void kickArtifactsChangeTypeEvent(Object source, int toArtifactTypeId, String toArtifactTypeGuid, LoadedArtifacts loadedArtifacts) throws OseeCoreException {
if (isDisableEvents()) {
return;
}
- InternalEventManager.kickArtifactsChangeTypeEvent(getSender(source), toArtifactTypeId, loadedArtifacts);
+ InternalEventManager.kickArtifactsChangeTypeEvent(getSender(source), toArtifactTypeId, toArtifactTypeGuid,
+ loadedArtifacts);
}
// Kick LOCAL and REMOTE transaction deleted event
@@ -171,6 +172,14 @@ public class OseeEventManager {
InternalEventManager.removeListeners(listener);
}
+ public static void addDispatcher(IEventDispatcher dispatcher) {
+ InternalEventManager.addDispatcher(dispatcher);
+ }
+
+ public static void removeDispatcher(IEventDispatcher dispatcher) {
+ InternalEventManager.removeDispatcher(dispatcher);
+ }
+
public static boolean isDisableEvents() {
return InternalEventManager.isDisableEvents();
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RelationModifiedEvent.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RelationModifiedEvent.java
index 9625d37837..e20e266890 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RelationModifiedEvent.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RelationModifiedEvent.java
@@ -10,7 +10,10 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.event;
+import java.util.Set;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.skynet.core.event.artifact.IEventBasicGuidArtifact;
import org.eclipse.osee.framework.skynet.core.relation.RelationEventType;
import org.eclipse.osee.framework.skynet.core.relation.RelationLink;
import org.eclipse.osee.framework.ui.plugin.event.UnloadedRelation;
@@ -49,4 +52,10 @@ public class RelationModifiedEvent extends ArtifactTransactionModifiedEvent {
public String toString() {
return relationEventType + " - " + (link != null ? "Loaded - " + link : "Unloaded - " + unloadedRelation) + " - " + sender;
}
+
+ @Override
+ public Set<? extends IEventBasicGuidArtifact> getArtifactChanges() throws OseeCoreException {
+ System.err.println("RelationModifiedEvent: Fix This");
+ return null;
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RemoteEventManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RemoteEventManager.java
index c19f916328..f4ce2a3a33 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RemoteEventManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/RemoteEventManager.java
@@ -65,6 +65,7 @@ import org.eclipse.osee.framework.skynet.core.UserManager;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactModType;
+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.artifact.BranchManager;
import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
@@ -163,7 +164,7 @@ public class RemoteEventManager {
* all processing and then kicking off display-thread when need to update ui. SessionId needs
* to be modified so this client doesn't think the events came from itself.
*/
- if (InternalEventManager.enableRemoteEventLoopback) {
+ if (InternalEventManager.isEnableRemoteEventLoopback()) {
OseeLog.log(Activator.class, Level.INFO, "REM: Loopback enabled - Returning events as Remote event.");
Thread thread = new Thread() {
@Override
@@ -337,6 +338,7 @@ public class RemoteEventManager {
LoadedArtifacts loadedArtifacts =
new LoadedArtifacts(((NetworkAccessControlArtifactsEvent) event).getId(),
((NetworkAccessControlArtifactsEvent) event).getArtifactIds(),
+ ((NetworkAccessControlArtifactsEvent) event).getArtifactGuids(),
((NetworkAccessControlArtifactsEvent) event).getArtifactTypeIds());
InternalEventManager.kickAccessControlArtifactsEvent(sender, accessControlModType,
loadedArtifacts);
@@ -439,9 +441,11 @@ public class RemoteEventManager {
LoadedArtifacts loadedArtifacts =
new LoadedArtifacts(((NetworkArtifactChangeTypeEvent) event).getId(),
((NetworkArtifactChangeTypeEvent) event).getArtifactIds(),
+ ((NetworkArtifactChangeTypeEvent) event).getArtifactGuids(),
((NetworkArtifactChangeTypeEvent) event).getArtifactTypeIds());
InternalEventManager.kickArtifactsChangeTypeEvent(sender,
- ((NetworkArtifactChangeTypeEvent) event).getToArtifactTypeId(), loadedArtifacts);
+ ((NetworkArtifactChangeTypeEvent) event).getToArtifactTypeId(),
+ ((NetworkArtifactChangeTypeEvent) event).getToArtifactTypeGuid(), loadedArtifacts);
} catch (Exception ex) {
OseeLog.log(Activator.class, Level.SEVERE, ex);
}
@@ -450,6 +454,7 @@ public class RemoteEventManager {
LoadedArtifacts loadedArtifacts =
new LoadedArtifacts(((NetworkArtifactPurgeEvent) event).getId(),
((NetworkArtifactPurgeEvent) event).getArtifactIds(),
+ ((NetworkArtifactPurgeEvent) event).getArtifactGuids(),
((NetworkArtifactPurgeEvent) event).getArtifactTypeIds());
for (Artifact artifact : loadedArtifacts.getLoadedArtifacts()) {
//This is because applications may still have a reference to the artifact
@@ -495,8 +500,6 @@ public class RemoteEventManager {
/**
* Updates local cache
- *
- * @param event
*/
private static void updateArtifacts(Sender sender, ISkynetArtifactEvent event, Collection<ArtifactTransactionModifiedEvent> xModifiedEvents) {
if (event == null) {
@@ -505,18 +508,21 @@ public class RemoteEventManager {
try {
int artId = event.getArtId();
+ String artGuid = event.getArtGuid();
int artTypeId = event.getArtTypeId();
List<String> dirtyAttributeName = new LinkedList<String>();
if (event instanceof NetworkArtifactModifiedEvent) {
- int branchId = ((NetworkArtifactModifiedEvent) event).getId();
+ int branchId = ((NetworkArtifactModifiedEvent) event).getBranchId();
Artifact artifact = ArtifactCache.getActive(artId, branchId);
if (artifact == null) {
- UnloadedArtifact unloadedArtifact = new UnloadedArtifact(branchId, artId, artTypeId);
+ UnloadedArtifact unloadedArtifact =
+ new UnloadedArtifact(event.getBranchGuid(), event.getArtTypeId(), event.getArtTypeGuid(),
+ event.getArtId(), event.getArtGuid());
xModifiedEvents.add(new ArtifactModifiedEvent(sender, ArtifactModType.Changed, unloadedArtifact));
} else if (!artifact.isHistorical()) {
for (SkynetAttributeChange skynetAttributeChange : ((NetworkArtifactModifiedEvent) event).getAttributeChanges()) {
- if (!InternalEventManager.enableRemoteEventLoopback) {
+ if (!InternalEventManager.isEnableRemoteEventLoopback()) {
try {
Attribute<?> attribute =
artifact.getAttributeById(skynetAttributeChange.getAttributeId(), true);
@@ -579,13 +585,16 @@ public class RemoteEventManager {
}
} else if (event instanceof NetworkArtifactDeletedEvent) {
- int branchId = ((NetworkArtifactDeletedEvent) event).getId();
+ int branchId = ((NetworkArtifactDeletedEvent) event).getBranchId();
+ String branchGuid = ((NetworkArtifactDeletedEvent) event).getBranchGuid();
Artifact artifact = ArtifactCache.getActive(artId, branchId);
if (artifact == null) {
- UnloadedArtifact unloadedArtifact = new UnloadedArtifact(branchId, artId, artTypeId);
+ UnloadedArtifact unloadedArtifact =
+ new UnloadedArtifact(branchGuid, artTypeId, ArtifactTypeManager.getType(artTypeId).getGuid(),
+ artId, artGuid);
xModifiedEvents.add(new ArtifactModifiedEvent(sender, ArtifactModType.Deleted, unloadedArtifact));
} else if (!artifact.isHistorical()) {
- if (!InternalEventManager.enableRemoteEventLoopback) {
+ if (!InternalEventManager.isEnableRemoteEventLoopback()) {
ArtifactCache.deCache(artifact);
artifact.internalSetDeleted();
}
@@ -600,10 +609,6 @@ public class RemoteEventManager {
}
}
- /**
- * @param event
- * @param newTransactionId
- */
private static void updateRelations(Sender sender, ISkynetRelationLinkEvent event, Collection<ArtifactTransactionModifiedEvent> xModifiedEvents) {
if (event == null) {
return;
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/ArtifactEventManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/ArtifactEventManager.java
new file mode 100644
index 0000000000..93987aeb30
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/ArtifactEventManager.java
@@ -0,0 +1,68 @@
+/*
+ * Created on Mar 24, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.skynet.core.event.artifact;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+import org.eclipse.osee.framework.skynet.core.event.IEventListener;
+import org.eclipse.osee.framework.skynet.core.event.Sender;
+import org.eclipse.osee.framework.skynet.core.event.filter.FilteredEventListener;
+import org.eclipse.osee.framework.skynet.core.event.filter.IEventFilter;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ArtifactEventManager {
+ private static final List<IEventListener> listeners = new CopyOnWriteArrayList<IEventListener>();
+
+ public static void addListener(IEventListener listener) {
+ if (listener == null) {
+ throw new IllegalArgumentException("listener can not be null");
+ }
+ if (!listeners.contains(listener)) {
+ listeners.add(listener);
+ }
+ }
+
+ public static void removeListener(IEventListener listener) {
+ listeners.remove(listener);
+ }
+
+ public static void removeAllListeners() {
+ listeners.clear();
+ }
+
+ public static int getNumberOfListeners() {
+ return listeners.size();
+ }
+
+ public static boolean isHandledBy(IEventListener event) {
+ return event instanceof IArtifactListener || (event instanceof FilteredEventListener && ((FilteredEventListener) event).isOfType(IArtifactListener.class));
+ }
+
+ public static void processArtifactChanges(Sender sender, Set<IEventBasicGuidArtifact> artifactChanges) {
+ for (IEventListener listener : listeners) {
+ IArtifactListener artifactListener = null;
+ Collection<IEventFilter> eventFilters = null;
+ if (listener instanceof IArtifactListener) {
+ artifactListener = (IArtifactListener) listener;
+ eventFilters = Collections.emptyList();
+ } else if (listener instanceof FilteredEventListener) {
+ artifactListener = (IArtifactListener) ((FilteredEventListener) listener).getEventListener();
+ eventFilters = ((FilteredEventListener) listener).getEventFilters();
+ }
+ if (artifactListener != null) {
+ // TODO handle filters first
+ artifactListener.handleArtifactModified(artifactChanges, sender);
+
+ // TODO handle artifact change type??
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/DefaultEventBasicGuidArtifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/DefaultEventBasicGuidArtifact.java
new file mode 100644
index 0000000000..e71424ff68
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/DefaultEventBasicGuidArtifact.java
@@ -0,0 +1,67 @@
+/*
+ * Created on Mar 24, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.skynet.core.event.artifact;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.osee.framework.core.data.DefaultBasicGuidArtifact;
+import org.eclipse.osee.framework.core.data.IBasicGuidArtifact;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class DefaultEventBasicGuidArtifact extends DefaultBasicGuidArtifact implements IEventBasicGuidArtifact {
+
+ private final EventModType eventModType;
+
+ public DefaultEventBasicGuidArtifact(EventModType eventModType, String branchGuid, String artTypeGuid, String guid) {
+ super(branchGuid, artTypeGuid, guid);
+ this.eventModType = eventModType;
+ }
+
+ @Override
+ public EventModType getModType() {
+ return eventModType;
+ }
+
+ public static Set<IEventBasicGuidArtifact> get(EventModType eventModType, Collection<IBasicGuidArtifact> basicGuidArtifacts) throws OseeCoreException {
+ if (eventModType == EventModType.ChangeType) throw new OseeArgumentException("Can't be used for ChangeType");
+ Set<IEventBasicGuidArtifact> eventArts = new HashSet<IEventBasicGuidArtifact>();
+ for (IBasicGuidArtifact guidArt : basicGuidArtifacts) {
+ eventArts.add(new DefaultEventBasicGuidArtifact(eventModType, guidArt.getBranchGuid(),
+ guidArt.getArtTypeGuid(), guidArt.getGuid()));
+ }
+ return eventArts;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((eventModType == null) ? 0 : eventModType.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (!super.equals(obj)) return false;
+ if (getClass() != obj.getClass()) return false;
+ DefaultEventBasicGuidArtifact other = (DefaultEventBasicGuidArtifact) obj;
+ if (eventModType == null) {
+ if (other.eventModType != null) return false;
+ } else if (!eventModType.equals(other.eventModType)) return false;
+ return true;
+ }
+
+ public String toString() {
+ return String.format("[%s - %s]", eventModType, getGuid());
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/DefaultEventChangeTypeBasicGuidArtifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/DefaultEventChangeTypeBasicGuidArtifact.java
new file mode 100644
index 0000000000..c6ebad74b2
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/DefaultEventChangeTypeBasicGuidArtifact.java
@@ -0,0 +1,29 @@
+/*
+ * Created on Mar 25, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.skynet.core.event.artifact;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class DefaultEventChangeTypeBasicGuidArtifact extends DefaultEventBasicGuidArtifact implements IEventChangeTypeBasicGuidArtifact {
+
+ private final String fromArtTypeGuid;
+
+ public DefaultEventChangeTypeBasicGuidArtifact(String branchGuid, String fromArtTypeGuid, String artTypeGuid, String guid) {
+ super(EventModType.ChangeType, branchGuid, artTypeGuid, guid);
+ this.fromArtTypeGuid = fromArtTypeGuid;
+ }
+
+ public String getFromArtTypeGuid() {
+ return fromArtTypeGuid;
+ }
+
+ public String toString() {
+ return String.format("[%s - %s from type %s to %s]", EventModType.ChangeType.name(), getGuid(), fromArtTypeGuid,
+ getArtTypeGuid());
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/EventModType.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/EventModType.java
new file mode 100644
index 0000000000..f0d3b2b6dc
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/EventModType.java
@@ -0,0 +1,5 @@
+package org.eclipse.osee.framework.skynet.core.event.artifact;
+
+public enum EventModType {
+ Modified, Deleted, Purged, Reloaded, Added, ChangeType
+};
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/IArtifactListener.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/IArtifactListener.java
new file mode 100644
index 0000000000..79140cffae
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/IArtifactListener.java
@@ -0,0 +1,21 @@
+/*
+ * Created on Mar 23, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.skynet.core.event.artifact;
+
+import java.util.Collection;
+import org.eclipse.osee.framework.skynet.core.event.IEventListener;
+import org.eclipse.osee.framework.skynet.core.event.Sender;
+
+/**
+ * This listener will be called upon a artifact,relation,attribute change gets persisted to the database
+ *
+ * @author Donald G. Dunne
+ */
+public interface IArtifactListener extends IEventListener {
+
+ public void handleArtifactModified(Collection<IEventBasicGuidArtifact> eventArtifacts, Sender sender);
+
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/IEventBasicGuidArtifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/IEventBasicGuidArtifact.java
new file mode 100644
index 0000000000..b3a5a9bfdd
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/IEventBasicGuidArtifact.java
@@ -0,0 +1,16 @@
+/*
+ * Created on Mar 24, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.skynet.core.event.artifact;
+
+import org.eclipse.osee.framework.core.data.IBasicGuidArtifact;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IEventBasicGuidArtifact extends IBasicGuidArtifact {
+
+ public EventModType getModType();
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/IEventChangeTypeBasicGuidArtifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/IEventChangeTypeBasicGuidArtifact.java
new file mode 100644
index 0000000000..de968d2446
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/artifact/IEventChangeTypeBasicGuidArtifact.java
@@ -0,0 +1,15 @@
+/*
+ * Created on Mar 25, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.skynet.core.event.artifact;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IEventChangeTypeBasicGuidArtifact extends IEventBasicGuidArtifact {
+
+ String getFromArtTypeGuid();
+
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/filter/ArtifactTypeEventFilter.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/filter/ArtifactTypeEventFilter.java
new file mode 100644
index 0000000000..19c331c492
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/filter/ArtifactTypeEventFilter.java
@@ -0,0 +1,38 @@
+/*
+ * Created on Mar 23, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.skynet.core.event.filter;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import org.eclipse.osee.framework.core.data.IArtifactType;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ArtifactTypeEventFilter implements IEventFilter {
+
+ private final Collection<String> artTypeGuids;
+
+ public ArtifactTypeEventFilter(String artTypeGuid) {
+ this.artTypeGuids = Arrays.asList(artTypeGuid);
+ }
+
+ public ArtifactTypeEventFilter(Collection<String> artTypeGuids) {
+ this.artTypeGuids = artTypeGuids;
+ }
+
+ public ArtifactTypeEventFilter(IArtifactType... artifactTypes) {
+ this.artTypeGuids = new HashSet<String>();
+ for (IArtifactType artifactType : artifactTypes) {
+ this.artTypeGuids.add(artifactType.getGuid());
+ }
+ }
+
+ public boolean isFiltered(String artTypeGuid) {
+ return this.artTypeGuids.contains(artTypeGuid);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/filter/BranchGuidEventFilter.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/filter/BranchGuidEventFilter.java
new file mode 100644
index 0000000000..14756781f0
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/filter/BranchGuidEventFilter.java
@@ -0,0 +1,35 @@
+/*
+ * Created on Mar 23, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.skynet.core.event.filter;
+
+import java.util.Arrays;
+import java.util.Collection;
+import org.eclipse.osee.framework.core.model.Branch;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class BranchGuidEventFilter implements IEventFilter {
+
+ private final Collection<String> branchGuids;
+
+ public BranchGuidEventFilter(String branchGuid) {
+ this.branchGuids = Arrays.asList(branchGuid);
+ }
+
+ public BranchGuidEventFilter(Collection<String> branchGuids) {
+ this.branchGuids = branchGuids;
+ }
+
+ public BranchGuidEventFilter(Branch branch) {
+ this(branch.getGuid());
+ }
+
+ public boolean isFiltered(String branchGuid) {
+ return this.branchGuids.contains(branchGuid);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/filter/FilteredEventListener.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/filter/FilteredEventListener.java
new file mode 100644
index 0000000000..362d0b70aa
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/filter/FilteredEventListener.java
@@ -0,0 +1,36 @@
+/*
+ * Created on Mar 23, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.skynet.core.event.filter;
+
+import java.util.Collection;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
+import org.eclipse.osee.framework.skynet.core.event.IEventListener;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class FilteredEventListener implements IEventListener {
+
+ private final IEventListener eventListener;
+ private final Collection<IEventFilter> eventFilters;
+
+ public FilteredEventListener(IEventListener eventListener, IEventFilter... eventFilters) {
+ this.eventListener = eventListener;
+ this.eventFilters = Collections.getAggregate(eventFilters);
+ }
+
+ public boolean isOfType(Class<?> clazz) {
+ return clazz.isAssignableFrom(getClass());
+ }
+
+ public IEventListener getEventListener() {
+ return eventListener;
+ }
+
+ public Collection<IEventFilter> getEventFilters() {
+ return eventFilters;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/filter/IEventFilter.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/filter/IEventFilter.java
new file mode 100644
index 0000000000..08e6e020eb
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/filter/IEventFilter.java
@@ -0,0 +1,13 @@
+/*
+ * Created on Mar 23, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.skynet.core.event.filter;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IEventFilter {
+
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/LoadedArtifacts.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/LoadedArtifacts.java
index 40077bff91..5394377603 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/LoadedArtifacts.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/LoadedArtifacts.java
@@ -15,10 +15,13 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
+import org.eclipse.osee.framework.core.data.DefaultBasicGuidArtifact;
+import org.eclipse.osee.framework.core.data.IBasicGuidArtifact;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
import org.eclipse.osee.framework.ui.plugin.event.UnloadedArtifact;
@@ -29,35 +32,42 @@ public class LoadedArtifacts {
private Set<Artifact> artifacts;
private final Collection<UnloadedArtifact> unloadedArtifacts;
+ private Set<String> allArtifactGuids;
+ private Set<String> allUnloadedArtifactGuids;
private Set<Integer> allArtifactIds;
private Set<Integer> allUnloadedArtifactIds;
private Set<Integer> allArtifactTypeIds;
+ private Set<IBasicGuidArtifact> artifactChanges = new HashSet<IBasicGuidArtifact>();
/**
* Called when network event passes artifactIds that may or may not be in current client's cache
*
- * @param branchId
- * @param artifactIds
- * @param artifactTypeIds
+ * @throws OseeCoreException
*/
- public LoadedArtifacts(int branchId, Collection<Integer> artifactIds, Collection<Integer> artifactTypeIds) {
+ public LoadedArtifacts(int branchId, Collection<Integer> artifactIds, Collection<String> artifactGuids, Collection<Integer> artifactTypeIds) throws OseeCoreException {
unloadedArtifacts = new ArrayList<UnloadedArtifact>();
int x = 0;
+ String branchGuid = BranchManager.getBranch(branchId).getGuid();
Integer[] artTypeIds = artifactTypeIds.toArray(new Integer[artifactTypeIds.size()]);
+ String[] artGuids = artifactGuids.toArray(new String[artifactGuids.size()]);
+ String artTypeGuid = ArtifactTypeManager.getType(artTypeIds[x]).getGuid();
for (Integer artId : artifactIds) {
- unloadedArtifacts.add(new UnloadedArtifact(branchId, artId, artTypeIds[x++]));
+ unloadedArtifacts.add(new UnloadedArtifact(branchGuid, artTypeIds[x], artTypeGuid, artId, artGuids[x]));
+ artifactChanges.add(new DefaultBasicGuidArtifact(branchGuid, artTypeGuid, artGuids[x]));
+ x++;
}
this.artifacts = null;
}
/**
* Called when local event is kicked. Since local, all artifacts are, by definition, cached
- *
- * @param artifacts
*/
public LoadedArtifacts(Collection<? extends Artifact> artifacts) {
this.artifacts = new HashSet<Artifact>();
this.artifacts.addAll(artifacts);
+ for (Artifact artifact : artifacts) {
+ artifactChanges.add(artifact.getBasicGuidArtifact());
+ }
unloadedArtifacts = new ArrayList<UnloadedArtifact>();
}
@@ -104,9 +114,22 @@ public class LoadedArtifacts {
return allArtifactIds;
}
+ public synchronized Collection<String> getAllArtifactGuids() {
+ if (allArtifactGuids == null) {
+ allArtifactGuids = new HashSet<String>(unloadedArtifacts.size() + unloadedArtifacts.size());
+ for (Artifact artifact : this.artifacts) {
+ allArtifactGuids.add(artifact.getGuid());
+ }
+ for (UnloadedArtifact unloadedArtifact : unloadedArtifacts) {
+ allArtifactGuids.add(unloadedArtifact.getGuid());
+ }
+ }
+ return allArtifactGuids;
+ }
+
public synchronized Collection<Integer> getAllArtifactTypeIds() {
if (allArtifactTypeIds == null) {
- allArtifactTypeIds = new HashSet<Integer>();
+ allArtifactTypeIds = new HashSet<Integer>(unloadedArtifacts.size() + unloadedArtifacts.size());
for (Artifact artifact : this.artifacts) {
allArtifactTypeIds.add(artifact.getArtTypeId());
}
@@ -127,6 +150,16 @@ public class LoadedArtifacts {
return allUnloadedArtifactIds;
}
+ public Collection<Integer> getUnloadedArtifactGuids() {
+ if (allUnloadedArtifactGuids == null) {
+ allUnloadedArtifactGuids = new HashSet<String>(unloadedArtifacts.size());
+ for (UnloadedArtifact unloadedArtifact : unloadedArtifacts) {
+ allUnloadedArtifactGuids.add(unloadedArtifact.getGuid());
+ }
+ }
+ return allUnloadedArtifactIds;
+ }
+
public synchronized Collection<Artifact> getLoadedArtifacts() throws OseeCoreException {
// If artifacts have not been set, resolve any unloaded artifactIds that exist in current cache
if (artifacts == null) {
@@ -135,7 +168,7 @@ public class LoadedArtifacts {
for (UnloadedArtifact unloadedArtifact : new CopyOnWriteArrayList<UnloadedArtifact>(unloadedArtifacts)) {
Artifact art =
ArtifactCache.getActive(unloadedArtifact.getArtifactId(),
- BranchManager.getBranch(unloadedArtifact.getId()));
+ BranchManager.getBranch(unloadedArtifact.getBranchGuid()));
if (art != null) {
unloadedArtifacts.remove(unloadedArtifact);
artifacts.add(art);
@@ -146,4 +179,8 @@ public class LoadedArtifacts {
}
return artifacts;
}
+
+ public Set<IBasicGuidArtifact> getArtifactChanges() throws OseeCoreException {
+ return artifactChanges;
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/ui/plugin/event/UnloadedArtifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/ui/plugin/event/UnloadedArtifact.java
index d43d540942..63bc34fb3d 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/ui/plugin/event/UnloadedArtifact.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/ui/plugin/event/UnloadedArtifact.java
@@ -10,58 +10,38 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.plugin.event;
+import org.eclipse.osee.framework.core.data.DefaultBasicGuidArtifact;
+
/**
* @author Donald G. Dunne
*/
-public class UnloadedArtifact {
- private int artifactId;
- private int branchId;
+public class UnloadedArtifact extends DefaultBasicGuidArtifact {
+
private int artifactTypeId;
+ private int artifactId;
- public UnloadedArtifact(int branchId, int artifactId, int artifactTypeId) {
- this.branchId = branchId;
- this.artifactId = artifactId;
+ public UnloadedArtifact(String branchGuid, int artifactTypeId, String artTypeGuid, int artifactId, String artifactGuid) {
+ this(branchGuid, artTypeGuid, artifactGuid);
this.artifactTypeId = artifactTypeId;
+ this.artifactId = artifactId;
+ }
+
+ public UnloadedArtifact(String branchGuid, String artTypeGuid, String guid) {
+ super(branchGuid, artTypeGuid, guid);
}
- /**
- * @return the artifactId
- */
public int getArtifactId() {
return artifactId;
}
- /**
- * @param artifactId the artifactId to set
- */
public void setArtifactId(int artifactId) {
this.artifactId = artifactId;
}
- /**
- * @return the branchId
- */
- public int getId() {
- return branchId;
- }
-
- /**
- * @param branchId the branchId to set
- */
- public void setBranchId(int branchId) {
- this.branchId = branchId;
- }
-
- /**
- * @return the artifactTypeId
- */
public int getArtifactTypeId() {
return artifactTypeId;
}
- /**
- * @param artifactTypeId the artifactTypeId to set
- */
public void setArtifactTypeId(int artifactTypeId) {
this.artifactTypeId = artifactTypeId;
}

Back to the top