Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorddunne2010-06-30 18:29:26 +0000
committerddunne2010-06-30 18:29:26 +0000
commit3413d4d015db6d30963268db537c27fff17da026 (patch)
treeeffa8bc4604ec07e1b344338785989c275d39c4a
parentfc02b2882295b9c09e117b308f5036234b235219 (diff)
downloadorg.eclipse.osee-3413d4d015db6d30963268db537c27fff17da026.tar.gz
org.eclipse.osee-3413d4d015db6d30963268db537c27fff17da026.tar.xz
org.eclipse.osee-3413d4d015db6d30963268db537c27fff17da026.zip
Events - UI
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskComposite.java44
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEventHandler.java21
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java18
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldViewerEventManager.java138
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewer.java64
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/event/DefaultBasicGuidArtifact.java38
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java88
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager2.java6
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/ArtifactEvent.java1
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/FrameworkEventManager.java25
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/artifact/EventBasicGuidArtifact.java22
12 files changed, 297 insertions, 170 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskComposite.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskComposite.java
index 145e4e04a93..5b0104a1e11 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskComposite.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskComposite.java
@@ -14,7 +14,9 @@ package org.eclipse.osee.ats.task;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashSet;
import java.util.Iterator;
+import java.util.Set;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
@@ -29,8 +31,11 @@ import org.eclipse.osee.ats.editor.SMAEditor;
import org.eclipse.osee.ats.internal.AtsPlugin;
import org.eclipse.osee.ats.util.AtsRelationTypes;
import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.world.IWorldEventHandler;
import org.eclipse.osee.ats.world.WorldContentProvider;
import org.eclipse.osee.ats.world.WorldLabelProvider;
+import org.eclipse.osee.ats.world.WorldViewerEventManager;
+import org.eclipse.osee.ats.world.WorldXViewer;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -66,11 +71,12 @@ import org.eclipse.ui.PlatformUI;
/**
* @author Donald G. Dunne
*/
-public class TaskComposite extends Composite implements IOpenNewAtsTaskEditorSelectedHandler, ITaskDeleteActionHandler, ITaskAddActionHandler, IOpenNewAtsTaskEditorHandler, IRefreshActionHandler {
+public class TaskComposite extends Composite implements IWorldEventHandler, IOpenNewAtsTaskEditorSelectedHandler, ITaskDeleteActionHandler, ITaskAddActionHandler, IOpenNewAtsTaskEditorHandler, IRefreshActionHandler {
private TaskXViewer taskXViewer;
private final IXTaskViewer iXTaskViewer;
protected Label showReleaseMetricsLabel;
+ private final Set<TaskArtifact> taskArts = new HashSet<TaskArtifact>(200);
public TaskComposite(IXTaskViewer iXTaskViewer, Composite parent, int style) throws OseeCoreException {
this(iXTaskViewer, parent, style, null);
@@ -112,6 +118,8 @@ public class TaskComposite extends Composite implements IOpenNewAtsTaskEditorSel
setupDragAndDropSupport();
parent.layout();
+
+ WorldViewerEventManager.add(this);
} catch (Exception ex) {
OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
}
@@ -121,31 +129,25 @@ public class TaskComposite extends Composite implements IOpenNewAtsTaskEditorSel
if (taskXViewer != null && !taskXViewer.getTree().isDisposed()) {
taskXViewer.dispose();
}
+ WorldViewerEventManager.remove(this);
}
public IXTaskViewer getIXTaskViewer() {
return iXTaskViewer;
}
- @SuppressWarnings("unchecked")
- public void add(Collection<TaskArtifact> taskArts) {
- if (getTaskXViewer().getInput() == null) {
- getTaskXViewer().setInput(Collections.singleton(taskArts));
- } else {
- Collection<TaskArtifact> currTaskArts = (Collection<TaskArtifact>) getTaskXViewer().getInput();
- for (TaskArtifact taskArt : taskArts) {
- if (!currTaskArts.contains(taskArt)) {
- currTaskArts.add(taskArt);
- }
- }
+ public void add(Collection<TaskArtifact> newTasks) {
+ this.taskArts.addAll(newTasks);
+ if (getTaskXViewer().getInput() != this.taskArts) {
+ getTaskXViewer().setInput(this.taskArts);
}
taskXViewer.refresh();
taskXViewer.getTree().setFocus();
}
public void loadTable() throws OseeCoreException {
- getTaskXViewer().setInput(iXTaskViewer.getTaskArtifacts(""));
- taskXViewer.getTree().setFocus();
+ this.taskArts.clear();
+ add(iXTaskViewer.getTaskArtifacts(""));
}
public void handleDeleteTask() {
@@ -190,7 +192,8 @@ public class TaskComposite extends Composite implements IOpenNewAtsTaskEditorSel
}
}
transaction.execute();
- taskXViewer.remove(items);
+ taskXViewer.remove(items.toArray(new Object[items.size()]));
+ taskArts.removeAll(items);
if (tasksNotInDb.size() > 0) {
new PurgeArtifacts(tasksNotInDb).execute();
@@ -213,7 +216,6 @@ public class TaskComposite extends Composite implements IOpenNewAtsTaskEditorSel
taskArt = ((TaskableStateMachineArtifact) iXTaskViewer.getSma()).createNewTask(ed.getEntry());
iXTaskViewer.getEditor().onDirtied();
add(Collections.singleton(taskArt));
- taskXViewer.getTree().setFocus();
} catch (Exception ex) {
OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
}
@@ -352,4 +354,14 @@ public class TaskComposite extends Composite implements IOpenNewAtsTaskEditorSel
public void taskDeleteActionHandler() {
handleDeleteTask();
}
+
+ @Override
+ public WorldXViewer getWorldXViewer() {
+ return taskXViewer;
+ }
+
+ @Override
+ public void removeItems(Collection<? extends Object> objects) {
+ taskArts.removeAll(objects);
+ }
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEventHandler.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEventHandler.java
new file mode 100644
index 00000000000..ccbc438142c
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/IWorldEventHandler.java
@@ -0,0 +1,21 @@
+/*
+ * Created on Jun 30, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.ats.world;
+
+import java.util.Collection;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IWorldEventHandler {
+
+ public WorldXViewer getWorldXViewer();
+
+ public void removeItems(Collection<? extends Object> objects);
+
+ public boolean isDisposed();
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java
index 17de4d51c7e..1d88893d2d1 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java
@@ -51,7 +51,7 @@ import org.eclipse.swt.widgets.Display;
/**
* @author Donald G. Dunne
*/
-public class WorldComposite extends ScrolledComposite implements IOpenNewAtsWorldEditorHandler, IOpenNewAtsWorldEditorSelectedHandler, IRefreshActionHandler {
+public class WorldComposite extends ScrolledComposite implements IWorldEventHandler, IOpenNewAtsWorldEditorHandler, IOpenNewAtsWorldEditorSelectedHandler, IRefreshActionHandler {
private final WorldXViewer worldXViewer;
private final Set<Artifact> worldArts = new HashSet<Artifact>(200);
@@ -94,6 +94,7 @@ public class WorldComposite extends ScrolledComposite implements IOpenNewAtsWorl
setExpandVertical(true);
layout();
+ WorldViewerEventManager.add(this);
}
public double getManHoursPerDayPreference() throws OseeCoreException {
@@ -214,11 +215,9 @@ public class WorldComposite extends ScrolledComposite implements IOpenNewAtsWorl
if (worldXViewer != null && !worldXViewer.getTree().isDisposed()) {
worldXViewer.dispose();
}
+ WorldViewerEventManager.remove(this);
}
- /**
- * @return the xViewer
- */
public WorldXViewer getXViewer() {
return worldXViewer;
}
@@ -247,4 +246,15 @@ public class WorldComposite extends ScrolledComposite implements IOpenNewAtsWorl
return worldXViewer.getSelectedArtifacts();
}
+ @Override
+ public void removeItems(Collection<? extends Object> objects) {
+ // remove from model
+ worldArts.removeAll(objects);
+ }
+
+ @Override
+ public WorldXViewer getWorldXViewer() {
+ return worldXViewer;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldViewerEventManager.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldViewerEventManager.java
new file mode 100644
index 00000000000..07ef60f0b28
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldViewerEventManager.java
@@ -0,0 +1,138 @@
+/*
+ * Created on Jun 30, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.ats.world;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.logging.Level;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+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.event2.ArtifactEvent;
+import org.eclipse.osee.framework.skynet.core.event2.artifact.EventBasicGuidArtifact;
+import org.eclipse.osee.framework.skynet.core.event2.artifact.IArtifactEventListener;
+import org.eclipse.osee.framework.skynet.core.event2.filter.IEventFilter;
+import org.eclipse.osee.framework.ui.plugin.util.Displays;
+
+/**
+ * Common location for event handling for task and world composites in order to keep number of registrations and
+ * processing to a minimum.
+ *
+ * @author Donald G. Dunne
+ */
+public class WorldViewerEventManager implements IArtifactEventListener {
+
+ List<IWorldEventHandler> handlers = new ArrayList<IWorldEventHandler>();
+ static WorldViewerEventManager instance;
+
+ public static void add(IWorldEventHandler iWorldEventHandler) {
+ if (instance == null) {
+ instance = new WorldViewerEventManager();
+ OseeEventManager.addListener(instance);
+ }
+ instance.handlers.add(iWorldEventHandler);
+ }
+
+ public static void remove(IWorldEventHandler iWorldEventHandler) {
+ if (instance != null) {
+ instance.handlers.remove(iWorldEventHandler);
+ }
+ }
+
+ @Override
+ public void handleArtifactEvent(final ArtifactEvent artifactEvent, Sender sender) {
+ for (IWorldEventHandler handler : new CopyOnWriteArrayList<IWorldEventHandler>(handlers)) {
+ if (handler.isDisposed()) {
+ handlers.remove(handler);
+ }
+ }
+ try {
+ if (artifactEvent.getBranchGuid() == null || !artifactEvent.getBranchGuid().equals(
+ AtsUtil.getAtsBranch().getGuid())) {
+ return;
+ }
+ } catch (OseeCoreException ex) {
+ return;
+ }
+ final Collection<Artifact> modifiedArts = artifactEvent.getModifiedCacheArtifacts();
+ final Collection<Artifact> relModifiedArts = artifactEvent.getRelCacheArtifacts();
+ final Collection<EventBasicGuidArtifact> deletedPurgedArts = artifactEvent.getDeletedPurged();
+
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (!deletedPurgedArts.isEmpty()) {
+ for (IWorldEventHandler handler : handlers) {
+ if (!handler.isDisposed()) {
+ // allow handler to remove from model
+ handler.removeItems(deletedPurgedArts);
+ IContentProvider contentProvider = handler.getWorldXViewer().getContentProvider();
+ // remove from UI
+ if (contentProvider instanceof WorldContentProvider) {
+ handler.getWorldXViewer().remove(
+ deletedPurgedArts.toArray(new Object[deletedPurgedArts.size()]));
+ }
+ }
+ }
+ }
+ for (IWorldEventHandler handler : handlers) {
+ if (!handler.isDisposed()) {
+ for (Artifact artifact : modifiedArts) {
+ try {
+ // Don't refresh deleted artifacts
+ if (artifact.isDeleted()) {
+ continue;
+ }
+ if (artifact instanceof IWorldViewArtifact) {
+ handler.getWorldXViewer().refresh(artifact);
+ // If parent is loaded and child changed, refresh parent
+ if (artifact instanceof StateMachineArtifact && ((StateMachineArtifact) artifact).getParentAtsArtifact() instanceof IWorldViewArtifact) {
+ handler.getWorldXViewer().refresh(
+ ((StateMachineArtifact) artifact).getParentAtsArtifact());
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ for (Artifact art : relModifiedArts) {
+ // Don't refresh deleted artifacts
+ if (art.isDeleted()) {
+ continue;
+ }
+ if (art instanceof IWorldViewArtifact) {
+ handler.getWorldXViewer().refresh(art);
+ // If parent is loaded and child changed, refresh parent
+ try {
+ if (art instanceof StateMachineArtifact && ((StateMachineArtifact) art).getParentAtsArtifact() instanceof IWorldViewArtifact) {
+ handler.getWorldXViewer().refresh(((StateMachineArtifact) art).getParentAtsArtifact());
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ public List<? extends IEventFilter> getEventFilters() {
+ return AtsUtil.getAtsObjectEventFilters();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewer.java
index 37d3347a921..271dd679aa0 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewer.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewer.java
@@ -15,7 +15,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import org.eclipse.jface.action.Action;
@@ -70,9 +69,6 @@ import org.eclipse.osee.framework.skynet.core.event.IArtifactsPurgedEventListene
import org.eclipse.osee.framework.skynet.core.event.IFrameworkTransactionEventListener;
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.event2.ArtifactEvent;
-import org.eclipse.osee.framework.skynet.core.event2.artifact.IArtifactEventListener;
-import org.eclipse.osee.framework.skynet.core.event2.filter.IEventFilter;
import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
import org.eclipse.osee.framework.skynet.core.utility.LoadedArtifacts;
@@ -100,7 +96,7 @@ import org.eclipse.ui.PartInitException;
*
* @author Donald G. Dunne
*/
-public class WorldXViewer extends XViewer implements IArtifactEventListener, ISelectedAtsArtifacts, IArtifactsPurgedEventListener, IArtifactReloadEventListener, IArtifactsChangeTypeEventListener, IFrameworkTransactionEventListener {
+public class WorldXViewer extends XViewer implements ISelectedAtsArtifacts, IArtifactsPurgedEventListener, IArtifactReloadEventListener, IArtifactsChangeTypeEventListener, IFrameworkTransactionEventListener {
private String title;
private String extendedStatusString = "";
public static final String MENU_GROUP_ATS_WORLD_EDIT = "ATS WORLD EDIT";
@@ -1130,62 +1126,4 @@ public class WorldXViewer extends XViewer implements IArtifactEventListener, ISe
super.doUpdateItem(item, element);
}
- @Override
- public void handleArtifactEvent(final ArtifactEvent artifactEvent, Sender sender) {
- if (thisXViewer.getTree().isDisposed()) {
- OseeEventManager.removeListener(this);
- return;
- }
- if (getContentProvider() == null) {
- return;
- }
- final Collection<Artifact> modifiedArts = artifactEvent.getModifiedCacheArtifacts();
- final Collection<Artifact> relModifiedArts = artifactEvent.getRelCacheArtifacts();
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- IContentProvider contentProvider = getContentProvider();
- if (contentProvider instanceof WorldContentProvider) {
- remove(artifactEvent.getDeletedPurged().toArray());
- }
-
- update(modifiedArts.toArray(), null);
- for (Artifact art : modifiedArts) {
- if (art instanceof IWorldViewArtifact) {
- // If parent is loaded and child changed, refresh parent
- try {
- if (art instanceof StateMachineArtifact && ((StateMachineArtifact) art).getParentAtsArtifact() instanceof IWorldViewArtifact) {
- update(((StateMachineArtifact) art).getParentAtsArtifact(), null);
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- }
-
- for (Artifact art : relModifiedArts) {
- // Don't refresh deleted artifacts
- if (art.isDeleted()) {
- continue;
- }
- if (art instanceof IWorldViewArtifact) {
- refresh(art);
- // If parent is loaded and child changed, refresh parent
- try {
- if (art instanceof StateMachineArtifact && ((StateMachineArtifact) art).getParentAtsArtifact() instanceof IWorldViewArtifact) {
- refresh(((StateMachineArtifact) art).getParentAtsArtifact());
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
- }
- }
- }
- });
- }
-
- @Override
- public List<? extends IEventFilter> getEventFilters() {
- return AtsUtil.getAtsObjectEventFilters();
- }
}
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/event/DefaultBasicGuidArtifact.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/event/DefaultBasicGuidArtifact.java
index 7421f9cdae7..f563604cf5d 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/event/DefaultBasicGuidArtifact.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/event/DefaultBasicGuidArtifact.java
@@ -46,26 +46,32 @@ public class DefaultBasicGuidArtifact implements Identity, IBasicGuidArtifact {
@Override
public int hashCode() {
- final int prime = 31;
- int result = prime * ((artTypeGuid == null) ? 0 : artTypeGuid.hashCode());
- result = prime * result + ((branchGuid == null) ? 0 : branchGuid.hashCode());
- return result;
+ // NOTE This hashcode MUST match that of Artifact class
+ int hashCode = 11;
+ hashCode = hashCode * 37 + getGuid().hashCode();
+ hashCode = hashCode * 37 + getBranchGuid().hashCode();
+ return hashCode;
}
@Override
public boolean equals(Object obj) {
- if (this == obj) return true;
- IBasicGuidArtifact other = (IBasicGuidArtifact) obj;
- if (artTypeGuid == null) {
- if (other.getArtTypeGuid() != null) return false;
- } else if (!artTypeGuid.equals(other.getArtTypeGuid())) return false;
- if (branchGuid == null) {
- if (other.getBranchGuid() != null) return false;
- } else if (!branchGuid.equals(other.getBranchGuid())) return false;
- if (artGuid == null) {
- if (other.getGuid() != null) return false;
- } else if (!artGuid.equals(other.getGuid())) return false;
- return true;
+ boolean equals = false;
+ if (this == obj) equals = true;
+ if (!equals && obj instanceof IBasicGuidArtifact) {
+ IBasicGuidArtifact other = (IBasicGuidArtifact) obj;
+
+ if (artTypeGuid == null || other.getArtTypeGuid() == null) equals = false;
+ equals = artTypeGuid.equals(other.getArtTypeGuid());
+
+ if (equals && branchGuid == null || other.getBranchGuid() == null)
+ equals = false;
+ else if (equals) equals = branchGuid.equals(other.getBranchGuid());
+
+ if (equals && artGuid == null || other.getGuid() == null)
+ equals = false;
+ else if (equals) equals = artGuid.equals(other.getGuid());
+ }
+ return equals;
}
public String getGuid() {
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 99085eace75..6af0f1b4722 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
@@ -145,7 +145,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* A historical artifact always corresponds to a fixed revision of an artifact
- *
+ *
* @return whether this artifact represents a fixed revision
*/
public boolean isHistorical() {
@@ -172,7 +172,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* All the artifacts related to this artifact by relations of type relationTypeName are returned in a list order
* based on the stored relation order
- *
+ *
* @param relationTypeName
* @return the artifacts related to this artifact by relations of type relationTypeName
* @throws ArtifactDoesNotExist
@@ -225,7 +225,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Check if artifacts are related to each other by relation type
- *
+ *
* @param relationEnum
* @param other artifact to check
* @return whether they are related
@@ -239,7 +239,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Get the exactly one artifact related to this artifact by relations of type relationType are returned in a list
* order based on
- *
+ *
* @param relationType
* @return the related artifact
* @throws ArtifactDoesNotExist
@@ -330,7 +330,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Determines if this artifact type equals, or is a sub-type of, the artifact type specified by the
* <code>otherType</code> parameter.
- *
+ *
* @param artifactTypeName
* @return whether this artifact's type or any of its super-types (any ancestor type) are the specified type
* @throws OseeDataStoreException
@@ -343,7 +343,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Determines if this artifact type equals, or is a sub-type of, the artifact type specified by the
* <code>otherType</code> parameter.
- *
+ *
* @param oseeType
* @return
* @throws OseeCoreException
@@ -480,7 +480,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Creates an instance of <code>Attribute</code> of the given attribute type. This method should not be called by
* applications. Use addAttribute() instead
- *
+ *
* @param <T>
* @param attributeType
* @return new Attribute
@@ -525,7 +525,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* The use of this method is discouraged since it directly returns Attributes.
- *
+ *
* @param <T>
* @param attributeTypeName
* @param value
@@ -543,7 +543,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* The use of this method is discouraged since it directly returns Attributes.
- *
+ *
* @param <T>
* @param attributeTypeName
* @param value
@@ -555,7 +555,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* The use of this method is discouraged since it directly returns Attributes.
- *
+ *
* @return attributes All attributes including deleted and artifact deleted
* @throws OseeCoreException
*/
@@ -565,7 +565,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* The use of this method is discouraged since it directly returns Attributes.
- *
+ *
* @return attributes All attributes of the specified type name including deleted and artifact deleted
* @throws OseeCoreException
*/
@@ -575,7 +575,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* The use of this method is discouraged since it directly returns Attributes.
- *
+ *
* @return attributes
* @throws OseeCoreException
*/
@@ -595,7 +595,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* The use of this method is discouraged since it directly returns Attributes.
- *
+ *
* @param <T>
* @param attributeTypeName
* @throws OseeCoreException
@@ -641,7 +641,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Deletes all attributes of the given type, if any
- *
+ *
* @param attributeTypeName
* @throws OseeCoreException
*/
@@ -653,7 +653,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Deletes all attributes of the given type, if any
- *
+ *
* @param attributeTypeName
* @throws OseeCoreException
*/
@@ -665,7 +665,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
private void ensureAttributesLoaded() throws OseeCoreException {
if (!isAttributesLoaded() && isInDb()) {
- ArtifactLoader.loadArtifactData(this, LoadLevel.ATTRIBUTE);
+ ArtifactLoader.loadArtifactData(this, LoadLevel.ATTRIBUTE);
}
}
@@ -724,7 +724,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
* invalid.<br>
* <br>
* Used for quick access to attribute value that should only have 0 or 1 instances of the attribute.
- *
+ *
* @param <T>
* @param attributeTypeName
* @return sole attribute value
@@ -760,7 +760,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
* defaultReturnValue.<br>
* <br>
* Used for display purposes where toString() of attribute is to be displayed.
- *
+ *
* @param attributeTypeName
* @param defaultReturnValue return value if attribute instance does not exist
* @return attribute value
@@ -795,7 +795,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
* defaultReturnValue.<br>
* <br>
* Used for purposes where attribute value of specified type is desired.
- *
+ *
* @param <T>
* @param attributeTypeName
* @param defaultReturnValue
@@ -836,7 +836,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
* NOTE: Use only for inline calls. This method returns identical data as
* getSoleTAttributeValue(attributeTypeName,defaultReturnValue) but provides an extra parameter that allows it to be
* called within another method call because it specifically defines the return type as clazz
- *
+ *
* @param <T>
* @param attributeTypeName
* @param defaultReturnValue
@@ -852,7 +852,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Delete attribute if exactly one exists. Does nothing if attribute does not exist and throw MultipleAttributesExist
* is more than one instance of the attribute type exsits for this artifact
- *
+ *
* @param attributeTypeName
* @throws OseeCoreException
*/
@@ -886,7 +886,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Used on attribute types with no more than one instance. If the attribute exists, it's value is changed, otherwise
* a new attribute is added and its value set.
- *
+ *
* @param <T>
* @param attributeTypeName
* @param value
@@ -939,7 +939,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
* All existing attributes matching a new value will be left untouched. Then for any remaining values, other existing
* attributes will be changed to match or if need be new attributes will be added to stored these values. Finally any
* excess attributes will be deleted.
- *
+ *
* @param attributeType
* @param newValues
* @throws OseeCoreException
@@ -952,7 +952,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
* All existing attributes matching a new value will be left untouched. Then for any remaining values, other existing
* attributes will be changed to match or if need be new attributes will be added to stored these values. Finally any
* excess attributes will be deleted.
- *
+ *
* @param attributeTypeName
* @param newValues
* @throws OseeCoreException
@@ -997,7 +997,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* adds a new attribute of the type named attributeTypeName and assigns it the given value
- *
+ *
* @param <T>
* @param attributeTypeName
* @param value
@@ -1009,7 +1009,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* adds a new attribute of the type named attributeTypeName and assigns it the given value
- *
+ *
* @param <T>
* @param attributeType
* @param value
@@ -1022,7 +1022,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* adds a new attribute of the type named attributeTypeName. The attribute is set to the default value for its type,
* if any.
- *
+ *
* @param attributeType
* @throws OseeCoreException
*/
@@ -1033,7 +1033,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* adds a new attribute of the type named attributeTypeName. The attribute is set to the default value for its type,
* if any.
- *
+ *
* @param attributeType
* @throws OseeCoreException
*/
@@ -1043,7 +1043,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* adds a new attribute of the type named attributeTypeName and assigns it the given value
- *
+ *
* @param attributeTypeName
* @param value
* @throws OseeCoreException
@@ -1056,7 +1056,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* we do not what duplicated enumerated values so this method silently returns if the specified attribute type is
* enumerated and value is already present
- *
+ *
* @param <T>
* @param attributeTypeName
* @param value
@@ -1125,7 +1125,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* This is used to mark that the artifact deleted.
- *
+ *
* @throws OseeCoreException
*/
public void internalSetDeleted() throws OseeCoreException {
@@ -1221,7 +1221,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Reloads this artifact's attributes and relations back to the last state saved. This will have no effect if the
* artifact has never been saved.
- *
+ *
* @throws OseeCoreException
*/
public void reloadAttributesAndRelations() throws OseeCoreException {
@@ -1282,7 +1282,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Returns all of the descendants through the primary decomposition tree that have a particular human readable id.
* This will not return the called upon node if the name matches since it can not be a descendant of itself.
- *
+ *
* @param humanReadableId The human readable id text to match against.
* @param caseSensitive Whether to use case sensitive matching.
* @return <code>Collection</code> of <code>Artifact</code>'s that match.
@@ -1306,7 +1306,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
* Starting from this artifact, walks down the child hierarchy based on the list of child names provided and returns
* the child of the last name provided. ArtifactDoesNotExist exception is thrown ff any child along the path does not
* exist.
- *
+ *
* @param names
* @return child at the leaf (bottom) of the specified hierarchy.
* @throws OseeCoreException
@@ -1348,7 +1348,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Remove artifact from a specific branch in the database
- *
+ *
* @throws OseeCoreException
*/
public void purgeFromBranch() throws OseeCoreException {
@@ -1433,7 +1433,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Creates new relations that don't already exist and removes relations to artifacts that are not in collection
- *
+ *
* @param relationSide
* @param artifacts
* @throws OseeCoreException
@@ -1522,7 +1522,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Return true if this artifact any of it's links specified or any of the artifacts on the other side of the links
* are dirty
- *
+ *
* @param links
*/
public String isRelationsAndArtifactsDirty(Set<IRelationEnumeration> links) {
@@ -1559,7 +1559,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Creates a new artifact and duplicates all of its attribute data.
- *
+ *
* @throws OseeCoreException
*/
public Artifact duplicate(Branch branch) throws OseeCoreException {
@@ -1586,7 +1586,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* An artifact reflected about its own branch returns itself. Otherwise a new artifact is introduced on the
* destinationBranch
- *
+ *
* @param destinationBranch
* @return the newly created artifact or this artifact if the destinationBranch is this artifact's branch
* @throws OseeCoreException
@@ -1702,7 +1702,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Changes the artifact type.
- *
+ *
* @param artifactType
* @throws OseeDataStoreException
*/
@@ -1729,7 +1729,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Since artifact names are free text it is important to reformat the name to ensure it is suitable as an element
* name
- *
+ *
* @return artifact name in a form that is valid as an XML element
*/
public String getSafeName() {
@@ -1834,7 +1834,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
@Override
public final int hashCode() {
int hashCode = 11;
- hashCode = hashCode * 37 + getArtId();
+ hashCode = hashCode * 37 + getGuid().hashCode();
hashCode = hashCode * 37 + getBranch().hashCode();
return hashCode;
}
@@ -1890,7 +1890,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Return relations that exist between artifacts
- *
+ *
* @throws ArtifactDoesNotExist
*/
public ArrayList<RelationLink> internalGetRelations(Artifact artifact) throws OseeCoreException {
@@ -1913,7 +1913,7 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, Na
/**
* Return relations that exist between artifacts of type side
- *
+ *
* @throws OseeCoreException
*/
@Deprecated
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager2.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager2.java
index 8050e5a3b1e..a98255ba084 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager2.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/InternalEventManager2.java
@@ -135,7 +135,7 @@ public class InternalEventManager2 {
*/
static void kickBranchEvent(final Sender sender, final BranchEvent branchEvent) {
if (branchEvent.getNetworkSender() == null) {
- OseeEventManager.eventLog("IEM2: kickTransactionEvent <<ERROR>> networkSender can't be null.");
+ OseeEventManager.eventLog("IEM2: kickBranchEvent - ERROR networkSender can't be null.");
return;
}
if (isDisableEvents()) {
@@ -173,7 +173,7 @@ public class InternalEventManager2 {
// Kick LOCAL and REMOTE ArtifactEvent
static void kickPersistEvent(final Sender sender, final ArtifactEvent artifactEvent) {
if (artifactEvent.getNetworkSender() == null) {
- OseeEventManager.eventLog("IEM2: kickPersistEvent <<ERROR>> networkSender can't be null.");
+ OseeEventManager.eventLog("IEM2: kickPersistEvent - ERROR networkSender can't be null.");
return;
}
if (isDisableEvents()) {
@@ -211,7 +211,7 @@ public class InternalEventManager2 {
// Kick LOCAL and REMOTE ArtifactEvent
static void kickTransactionEvent(final Sender sender, final TransactionEvent transEvent) {
if (transEvent.getNetworkSender() == null) {
- OseeEventManager.eventLog("IEM2: kickTransactionEvent <<ERROR>> networkSender can't be null.");
+ OseeEventManager.eventLog("IEM2: kickTransactionEvent - ERROR networkSender can't be null.");
return;
}
if (isDisableEvents()) {
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 6507b5a8ecc..7659d26821f 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
@@ -283,7 +283,7 @@ public class OseeEventManager {
public static void eventLog(String output, Exception ex) {
try {
if (isEventDebugConsole()) {
- System.err.println(output + (ex != null ? " <<ERROR>> " + ex.getLocalizedMessage() : ""));
+ System.err.println(output + (ex != null ? " <<ERROR>> " + ex.toString() : ""));
} else if (isEventDebugErrorLog()) {
if (ex != null) {
OseeLog.log(Activator.class, Level.SEVERE, output, ex);
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/ArtifactEvent.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/ArtifactEvent.java
index db0adbdb695..e8580826562 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/ArtifactEvent.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/ArtifactEvent.java
@@ -264,4 +264,5 @@ public class ArtifactEvent extends FrameworkEvent {
}
return false;
}
+
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/FrameworkEventManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/FrameworkEventManager.java
index da4c2bb4899..a8a8d5c5852 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/FrameworkEventManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/FrameworkEventManager.java
@@ -118,19 +118,20 @@ public class FrameworkEventManager {
// If no filters, this is a match
if (((IEventFilteredListener) listener).getEventFilters() == null || ((IEventFilteredListener) listener).getEventFilters().isEmpty()) {
match = true;
- }
- // Loop through filters and see if anything matches what's desired
- for (IEventFilter filter : ((IEventFilteredListener) listener).getEventFilters()) {
- for (EventBasicGuidArtifact guidArt : artifactEvent.getArtifacts()) {
- if (filter.isMatch(guidArt)) match = true;
- break;
- }
- if (match) break;
- for (EventBasicGuidRelation guidRel : artifactEvent.getRelations()) {
- if (filter.isMatch(guidRel)) match = true;
- break;
+ } else {
+ // Loop through filters and see if anything matches what's desired
+ for (IEventFilter filter : ((IEventFilteredListener) listener).getEventFilters()) {
+ for (EventBasicGuidArtifact guidArt : artifactEvent.getArtifacts()) {
+ if (filter.isMatch(guidArt)) match = true;
+ break;
+ }
+ if (match) break;
+ for (EventBasicGuidRelation guidRel : artifactEvent.getRelations()) {
+ if (filter.isMatch(guidRel)) match = true;
+ break;
+ }
+ if (match) break;
}
- if (match) break;
}
}
// If no filters, this is a match
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/artifact/EventBasicGuidArtifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/artifact/EventBasicGuidArtifact.java
index 3822c9172e3..dc1289deae5 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/artifact/EventBasicGuidArtifact.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/artifact/EventBasicGuidArtifact.java
@@ -76,18 +76,18 @@ public class EventBasicGuidArtifact extends DefaultBasicGuidArtifact {
@Override
public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj instanceof IBasicGuidArtifact) {
- IBasicGuidArtifact other = (IBasicGuidArtifact) obj;
- return other.getGuid().equals(getGuid()) && other.getBranchGuid().equals(getBranchGuid()) && other.getArtTypeGuid().equals(
- getArtTypeGuid());
+ boolean equals = false;
+ if (this == obj) equals = true;
+ if (!equals) {
+ equals = super.equals(obj);
}
- if (!super.equals(obj)) return false;
- EventBasicGuidArtifact other = (EventBasicGuidArtifact) obj;
- if (eventModType == null) {
- if (other.eventModType != null) return false;
- } else if (!eventModType.equals(other.eventModType)) return false;
- return true;
+ if (equals && obj instanceof EventBasicGuidArtifact) {
+ EventBasicGuidArtifact other = (EventBasicGuidArtifact) obj;
+ if (eventModType != other.getModType()) {
+ equals = false;
+ }
+ }
+ return equals;
}
public String toString() {

Back to the top