Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2016-02-02 23:20:44 +0000
committerRyan D. Brooks2016-02-02 23:20:44 +0000
commita372080c5d7719ef0877f741671e4e4c97ce2386 (patch)
treeee2a7ea95cd35c528b8a4ab2e6c63684577a3e66 /plugins
parent5b6c03dbcca90cc78accc97a4f0b6bd73696e0b6 (diff)
downloadorg.eclipse.osee-a372080c5d7719ef0877f741671e4e4c97ce2386.tar.gz
org.eclipse.osee-a372080c5d7719ef0877f741671e4e4c97ce2386.tar.xz
org.eclipse.osee-a372080c5d7719ef0877f741671e4e4c97ce2386.zip
feature[ats_ATS194178]: Replace Access Lock and Unlock Types
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonLock.java2
-rw-r--r--plugins/org.eclipse.osee.framework.access/OSGI-INF/access.artifact.lock.topic.handler.xml8
-rw-r--r--plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/AccessControlManager.java19
-rw-r--r--plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessArtifactTopicLockEventHandler.java35
-rw-r--r--plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessControlService.java29
-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/model/AbstractTopicEventType.java14
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessArtifactLockTopicEvent.java31
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessControlEventType.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessTopicEventPayload.java19
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessTopicEventType.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/ISerializeableTopicPayload.java20
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/OSGI-INF/access.artifact.lock.topic.handler.xml8
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/OSGI-INF/access.artifact.lock.topic.handler2.xml8
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/access/PolicyDialog.java16
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorEventManager.java22
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/ArtifactExplorer.java6
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/ArtifactExplorerEventManager.java36
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/menu/ArtifactExplorerMenu.java8
21 files changed, 226 insertions, 75 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java
index 7033824c50d..cf69b614248 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java
@@ -71,7 +71,7 @@ import org.osgi.service.event.EventConstants;
import org.osgi.service.event.EventHandler;
/**
- * TopicHandler for {@link AccessEventTopicType.ACCESS_BRANCH_MODIFIED}
+ * TopicHandler for {@link AccessTopicEventType.ACCESS_BRANCH_MODIFIED}
*
* @author Megumi Telles
* @author Donald G. Dunne
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonLock.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonLock.java
index ddf2ea79f32..88af19044ca 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonLock.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonLock.java
@@ -34,7 +34,7 @@ import org.eclipse.swt.widgets.Listener;
import org.osgi.service.event.EventHandler;
/**
- * TopicHandler for {@link AccessEventTopicType.ACCESS_BRANCH_MODIFIED}
+ * TopicHandler for {@link AccessTopicEventType.ACCESS_BRANCH_MODIFIED}
*
* @author Shawn F. Cook
*/
diff --git a/plugins/org.eclipse.osee.framework.access/OSGI-INF/access.artifact.lock.topic.handler.xml b/plugins/org.eclipse.osee.framework.access/OSGI-INF/access.artifact.lock.topic.handler.xml
new file mode 100644
index 00000000000..84d1e2e6cf8
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.access/OSGI-INF/access.artifact.lock.topic.handler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true">
+<implementation class="org.eclipse.osee.framework.access.internal.AccessArtifactTopicLockEventHandler"/>
+<service>
+ <provide interface="org.osgi.service.event.EventHandler"/>
+</service>
+ <property name="event.topics" value="framework/access/artifact/lock/modified" />
+</scr:component>
diff --git a/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/AccessControlManager.java b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/AccessControlManager.java
index a3cca90408c..f442b029c5e 100644
--- a/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/AccessControlManager.java
+++ b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/AccessControlManager.java
@@ -25,16 +25,12 @@ import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.User;
import org.eclipse.osee.framework.skynet.core.UserManager;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.event.listener.IAccessControlEventListener;
-import org.eclipse.osee.framework.skynet.core.event.model.AccessControlEvent;
-import org.eclipse.osee.framework.skynet.core.event.model.AccessControlEventType;
-import org.eclipse.osee.framework.skynet.core.event.model.Sender;
/**
* @author Jeff C. Phillips
*/
-public final class AccessControlManager implements IAccessControlEventListener {
+public final class AccessControlManager {
private AccessControlManager() {
// Hide constructor
@@ -151,17 +147,4 @@ public final class AccessControlManager implements IAccessControlEventListener {
return getService().getAccessData(UserManager.getUser(), objectsToCheck);
}
- @Override
- public void handleAccessControlArtifactsEvent(Sender sender, AccessControlEvent accessControlEvent) {
- try {
- if (accessControlEvent.getEventType() == AccessControlEventType.ArtifactsUnlocked ||
- //
- accessControlEvent.getEventType() == AccessControlEventType.ArtifactsLocked) {
- clearCaches();
- }
- } catch (Exception ex) {
- OseeLog.log(AccessControlManager.class, Level.SEVERE, ex);
- }
-
- }
}
diff --git a/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessArtifactTopicLockEventHandler.java b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessArtifactTopicLockEventHandler.java
new file mode 100644
index 00000000000..ad13d5682f2
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessArtifactTopicLockEventHandler.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.access.internal;
+
+import java.util.logging.Level;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventHandler;
+
+/**
+ * Handler for {@link AccessTopicEventType.ACCESS_ARTIFACT_LOCK_MODIFIED}
+ *
+ * @author Donald G. Dunne
+ */
+public class AccessArtifactTopicLockEventHandler implements EventHandler {
+
+ @Override
+ public void handleEvent(Event event) {
+ try {
+ AccessControlManager.clearCaches();
+ } catch (Exception ex) {
+ OseeLog.log(AccessControlManager.class, Level.SEVERE, ex);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessControlService.java b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessControlService.java
index 5ab517e4051..60abf959a5a 100644
--- a/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessControlService.java
+++ b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessControlService.java
@@ -72,8 +72,7 @@ import org.eclipse.osee.framework.skynet.core.event.filter.BranchUuidEventFilter
import org.eclipse.osee.framework.skynet.core.event.filter.IEventFilter;
import org.eclipse.osee.framework.skynet.core.event.listener.EventQosType;
import org.eclipse.osee.framework.skynet.core.event.listener.IArtifactEventListener;
-import org.eclipse.osee.framework.skynet.core.event.model.AccessControlEvent;
-import org.eclipse.osee.framework.skynet.core.event.model.AccessControlEventType;
+import org.eclipse.osee.framework.skynet.core.event.model.AccessArtifactLockTopicEvent;
import org.eclipse.osee.framework.skynet.core.event.model.AccessTopicEventPayload;
import org.eclipse.osee.framework.skynet.core.event.model.AccessTopicEventType;
import org.eclipse.osee.framework.skynet.core.event.model.ArtifactEvent;
@@ -676,7 +675,7 @@ public class AccessControlService implements IAccessControlService {
if (isArtifact) {
event.addArtifact(((ArtifactAccessObject) accessControlledObject).getArtId());
}
-
+
OseeEventManager.kickAccessTopicEvent(this, event, AccessTopicEventType.ACCESS_ARTIFACT_MODIFIED);
}
@@ -714,9 +713,12 @@ public class AccessControlService implements IAccessControlService {
}
public void lockObjects(Collection<Artifact> objects, Artifact subject) throws OseeCoreException {
+ Conditions.checkNotNull(subject, "subject");
+ Conditions.checkNotNullOrEmpty(objects, "objects");
ensurePopulated();
- AccessControlEvent event = new AccessControlEvent();
- event.setEventType(AccessControlEventType.ArtifactsLocked);
+ AccessArtifactLockTopicEvent event = new AccessArtifactLockTopicEvent();
+ event.setBranchUuid(objects.iterator().next().getBranchId());
+ event.setLocked(true);
Set<Artifact> lockedArts = new HashSet<>();
for (Artifact object : objects) {
Integer objectArtId = object.getArtId();
@@ -728,14 +730,12 @@ public class AccessControlService implements IAccessControlService {
AccessControlData data = new AccessControlData(subject, accessObject, PermissionEnum.LOCK, true);
persistPermission(data);
artifactLockCache.put(objectBranchId, objectArtId, subjectArtId);
- event.getArtifacts().add(object.getBasicGuidArtifact());
+ event.addArtifact(object.getUuid());
lockedArts.add(object);
}
}
try {
- if (eventService != null) {
- eventService.send(this, event);
- }
+ OseeEventManager.kickAccessTopicEvent(this, event, AccessTopicEventType.ACCESS_ARTIFACT_LOCK_MODIFIED);
} catch (Exception ex) {
OseeLog.log(AccessControlHelper.class, Level.SEVERE, ex);
}
@@ -743,8 +743,9 @@ public class AccessControlService implements IAccessControlService {
public void unLockObjects(Collection<Artifact> objects, Artifact subject) throws OseeCoreException, OseeAuthenticationRequiredException {
ensurePopulated();
- AccessControlEvent event = new AccessControlEvent();
- event.setEventType(AccessControlEventType.ArtifactsUnlocked);
+ AccessArtifactLockTopicEvent event = new AccessArtifactLockTopicEvent();
+ event.setBranchUuid(objects.iterator().next().getBranchId());
+ event.setLocked(false);
Set<Artifact> lockedArts = new HashSet<>();
for (Artifact object : objects) {
Integer objectArtId = object.getArtId();
@@ -754,14 +755,12 @@ public class AccessControlService implements IAccessControlService {
AccessObject accessObject = getAccessObject(object);
removeAccessControlDataIf(true, new AccessControlData(subject, accessObject, PermissionEnum.LOCK, false));
artifactLockCache.removeAndGet(branchUuid, objectArtId);
- event.getArtifacts().add(object.getBasicGuidArtifact());
+ event.addArtifact(object.getUuid());
lockedArts.add(object);
}
}
try {
- if (eventService != null) {
- eventService.send(this, event);
- }
+ OseeEventManager.kickAccessTopicEvent(this, event, AccessTopicEventType.ACCESS_ARTIFACT_LOCK_MODIFIED);
} catch (Exception ex) {
OseeLog.log(AccessControlHelper.class, Level.SEVERE, ex);
}
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 64ad7239c28..d877fa19d66 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
@@ -26,8 +26,8 @@ import org.eclipse.osee.framework.skynet.core.event.filter.IEventFilter;
import org.eclipse.osee.framework.skynet.core.event.listener.EventQosType;
import org.eclipse.osee.framework.skynet.core.event.listener.IEventListener;
import org.eclipse.osee.framework.skynet.core.event.model.AccessControlEvent;
-import org.eclipse.osee.framework.skynet.core.event.model.AccessTopicEventType;
import org.eclipse.osee.framework.skynet.core.event.model.AccessTopicEventPayload;
+import org.eclipse.osee.framework.skynet.core.event.model.AccessTopicEventType;
import org.eclipse.osee.framework.skynet.core.event.model.ArtifactEvent;
import org.eclipse.osee.framework.skynet.core.event.model.ArtifactEvent.ArtifactEventType;
import org.eclipse.osee.framework.skynet.core.event.model.BranchEvent;
@@ -112,7 +112,7 @@ public final class OseeEventManager {
/////////////////////////////////// NEW EVENT MODEL - TOPICS with JSON ////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // Kick LOCAL and REMOTE transaction event
+ // Kick LOCAL and REMOTE topic event
public static void kickTopicEvent(Object source, TopicEvent topicEvent) throws OseeCoreException {
Assert.isNotNull(source);
Assert.isNotNull(topicEvent);
@@ -121,14 +121,15 @@ public final class OseeEventManager {
getEventService().send(source, topicEvent);
}
- // Kick LOCAL and REMOTE access control events
- public static void kickAccessTopicEvent(Object source, AccessTopicEventPayload event, AccessTopicEventType accessEventTopicType) {
+ // Kick LOCAL and REMOTE topic event with payload
+ public static void kickAccessTopicEvent(Object source, AccessTopicEventPayload payload, AccessTopicEventType accessEventTopicType) {
try {
TopicEvent topicEvent =
- EventUtil.createTopic(accessEventTopicType.getTopic(), event, accessEventTopicType.getEventType());
+ EventUtil.createTopic(accessEventTopicType.getTopic(), payload, accessEventTopicType.getEventType());
kickTopicEvent(source, topicEvent);
} catch (Exception ex) {
- OseeLog.logf(OseeEventManager.class, Level.SEVERE, ex, "Error kicking event [%s]", event);
+ OseeLog.logf(OseeEventManager.class, Level.SEVERE, ex, "Error kicking event [%s][%s]", accessEventTopicType,
+ payload);
}
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AbstractTopicEventType.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AbstractTopicEventType.java
index 1ed4ca7fec4..4a9693e3f80 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AbstractTopicEventType.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AbstractTopicEventType.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.event.model;
+import org.osgi.service.event.Event;
+
/**
*
* @author Donald G. Dunne
@@ -40,4 +42,16 @@ public class AbstractTopicEventType {
this.topic = topic;
}
+ @Override
+ public String toString() {
+ return "EventTopic [eventType=" + eventType + ", topic=" + topic + "]";
+ }
+
+ /**
+ * @return true of this topic matches the event topic
+ */
+ public boolean matches(Event event) {
+ return getTopic().equals(event.getTopic());
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessArtifactLockTopicEvent.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessArtifactLockTopicEvent.java
new file mode 100644
index 00000000000..3165ed9a5e5
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessArtifactLockTopicEvent.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.skynet.core.event.model;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author Donald G. Dunne
+ */
+@XmlRootElement
+public class AccessArtifactLockTopicEvent extends AccessTopicEventPayload {
+
+ boolean locked;
+
+ public boolean isLocked() {
+ return locked;
+ }
+
+ public void setLocked(boolean locked) {
+ this.locked = locked;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessControlEventType.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessControlEventType.java
index cbeb3e58811..33fff2dc4c4 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessControlEventType.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessControlEventType.java
@@ -14,8 +14,6 @@ package org.eclipse.osee.framework.skynet.core.event.model;
* @author Donald G. Dunne
*/
public enum AccessControlEventType {
- ArtifactsLocked(EventType.LocalAndRemote, "AAn_QHnJpWky8xcyKEgA", 15),
- ArtifactsUnlocked(EventType.LocalAndRemote, "AFRkIPF_y3ExB4XCyPgA", 20),
UserAuthenticated(EventType.LocalOnly, "AFRkIhbm0BbIGKALcKQA", 25);
private final EventType eventType;
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessTopicEventPayload.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessTopicEventPayload.java
index 68b5a34b09e..de51e1d3156 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessTopicEventPayload.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessTopicEventPayload.java
@@ -15,14 +15,15 @@ import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.codehaus.jackson.map.ser.std.ToStringSerializer;
+import org.eclipse.osee.framework.core.data.ArtifactId;
/**
* Payload for the Access Topic Event
- *
+ *
* @author Donald G. Dunne
*/
@XmlRootElement
-public class AccessTopicEventPayload {
+public class AccessTopicEventPayload implements ISerializeableTopicPayload {
@JsonSerialize(using = ToStringSerializer.class)
long branchUuid;
@@ -44,6 +45,10 @@ public class AccessTopicEventPayload {
this.artifactUuids = artifactUuids;
}
+ public void addArtifact(ArtifactId artifact) {
+ addArtifact(artifact.getUuid());
+ }
+
public void addArtifact(Long artifactUuid) {
getArtifactUuids().add(String.valueOf(artifactUuid));
}
@@ -52,4 +57,14 @@ public class AccessTopicEventPayload {
getArtifactUuids().add(String.valueOf(Long.valueOf(artifactId)));
}
+ /**
+ * @return true if this artifact matches event branch and contains artifact
+ */
+ public boolean matches(ArtifactId artifact) {
+ if (!artifactUuids.isEmpty()) {
+ return artifact.getBranchId().equals(branchUuid) && artifactUuids.contains(String.valueOf(artifact.getUuid()));
+ }
+ return false;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessTopicEventType.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessTopicEventType.java
index eb7dece3d02..4217e020ca4 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessTopicEventType.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessTopicEventType.java
@@ -17,6 +17,8 @@ public class AccessTopicEventType extends AbstractTopicEventType {
public static final AccessTopicEventType ACCESS_ARTIFACT_MODIFIED =
new AccessTopicEventType(EventType.LocalAndRemote, "framework/access/artifact/modified");
+ public static final AccessTopicEventType ACCESS_ARTIFACT_LOCK_MODIFIED =
+ new AccessTopicEventType(EventType.LocalAndRemote, "framework/access/artifact/lock/modified");
public static final AccessTopicEventType ACCESS_BRANCH_MODIFIED =
new AccessTopicEventType(EventType.LocalAndRemote, "framework/access/branch/modified");
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/ISerializeableTopicPayload.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/ISerializeableTopicPayload.java
new file mode 100644
index 00000000000..2f4297d331d
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/ISerializeableTopicPayload.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.skynet.core.event.model;
+
+/**
+ * Class that is serializable for use in Topic Event as payload
+ *
+ * @author Donald G. Dunne
+ */
+public interface ISerializeableTopicPayload {
+ // do nothing
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
index 4d14c9e57a4..6509510758a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
@@ -183,6 +183,7 @@ Import-Package: com.google.common.base;version="15.0.0",
org.json,
org.mozilla.javascript,
org.osgi.framework,
+ org.osgi.service.event;version="1.3.1",
org.osgi.service.packageadmin,
org.osgi.service.prefs;version="1.1.1"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/OSGI-INF/access.artifact.lock.topic.handler.xml b/plugins/org.eclipse.osee.framework.ui.skynet/OSGI-INF/access.artifact.lock.topic.handler.xml
new file mode 100644
index 00000000000..c2c48d4ac18
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/OSGI-INF/access.artifact.lock.topic.handler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true">
+<implementation class="org.eclipse.osee.framework.ui.skynet.explorer.ArtifactExplorerEventManager"/>
+<service>
+ <provide interface="org.osgi.service.event.EventHandler"/>
+</service>
+ <property name="event.topics" value="framework/access/artifact/lock/modified" />
+</scr:component>
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/OSGI-INF/access.artifact.lock.topic.handler2.xml b/plugins/org.eclipse.osee.framework.ui.skynet/OSGI-INF/access.artifact.lock.topic.handler2.xml
new file mode 100644
index 00000000000..7d2b64d14af
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/OSGI-INF/access.artifact.lock.topic.handler2.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true">
+<implementation class="org.eclipse.osee.framework.ui.skynet.artifact.editor.ArtifactEditorEventManager"/>
+<service>
+ <provide interface="org.osgi.service.event.EventHandler"/>
+</service>
+ <property name="event.topics" value="framework/access/artifact/lock/modified" />
+</scr:component>
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/access/PolicyDialog.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/access/PolicyDialog.java
index 65dc33986ea..0cb8a85d498 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/access/PolicyDialog.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/access/PolicyDialog.java
@@ -32,8 +32,8 @@ 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.search.ArtifactQuery;
import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
-import org.eclipse.osee.framework.skynet.core.event.model.AccessControlEvent;
-import org.eclipse.osee.framework.skynet.core.event.model.AccessControlEventType;
+import org.eclipse.osee.framework.skynet.core.event.model.AccessArtifactLockTopicEvent;
+import org.eclipse.osee.framework.skynet.core.event.model.AccessTopicEventType;
import org.eclipse.osee.framework.ui.skynet.internal.Activator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -252,13 +252,13 @@ public class PolicyDialog extends Dialog {
// Send artifact locked event if changed in dialog
if (isArtifactLockedBeforeDialog != null) {
try {
- boolean isArtifactLockedAfterDialog = AccessControlManager.hasLock((Artifact) accessControlledObject);
+ Artifact artifact = (Artifact) accessControlledObject;
+ boolean isArtifactLockedAfterDialog = AccessControlManager.hasLock(artifact);
if (isArtifactLockedAfterDialog != isArtifactLockedBeforeDialog) {
- AccessControlEvent event = new AccessControlEvent();
- event.setEventType(
- isArtifactLockedAfterDialog ? AccessControlEventType.ArtifactsLocked : AccessControlEventType.ArtifactsUnlocked);
- event.getArtifacts().add(((Artifact) accessControlledObject).getBasicGuidArtifact());
- OseeEventManager.kickAccessControlArtifactsEvent(PolicyDialog.class, event);
+ AccessArtifactLockTopicEvent event = new AccessArtifactLockTopicEvent();
+ event.setBranchUuid(artifact.getBranchId());
+ event.addArtifact(artifact.getUuid());
+ OseeEventManager.kickAccessTopicEvent(this, event, AccessTopicEventType.ACCESS_ARTIFACT_LOCK_MODIFIED);
System.err.println("kicked access control event " + event);
}
} catch (Exception ex) {
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorEventManager.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorEventManager.java
index 7b3908346a8..54af66f25c9 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorEventManager.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorEventManager.java
@@ -21,11 +21,10 @@ import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.event.EventUtil;
import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
import org.eclipse.osee.framework.skynet.core.event.filter.IEventFilter;
-import org.eclipse.osee.framework.skynet.core.event.listener.IAccessControlEventListener;
import org.eclipse.osee.framework.skynet.core.event.listener.IArtifactEventListener;
import org.eclipse.osee.framework.skynet.core.event.listener.IBranchEventListener;
-import org.eclipse.osee.framework.skynet.core.event.model.AccessControlEvent;
-import org.eclipse.osee.framework.skynet.core.event.model.AccessControlEventType;
+import org.eclipse.osee.framework.skynet.core.event.model.AccessArtifactLockTopicEvent;
+import org.eclipse.osee.framework.skynet.core.event.model.AccessTopicEventType;
import org.eclipse.osee.framework.skynet.core.event.model.ArtifactEvent;
import org.eclipse.osee.framework.skynet.core.event.model.BranchEvent;
import org.eclipse.osee.framework.skynet.core.event.model.BranchEventType;
@@ -34,6 +33,8 @@ import org.eclipse.osee.framework.skynet.core.event.model.EventModType;
import org.eclipse.osee.framework.skynet.core.event.model.Sender;
import org.eclipse.osee.framework.ui.skynet.internal.Activator;
import org.eclipse.osee.framework.ui.swt.Displays;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventHandler;
/**
* Common location for event handling for ArtifactExplorers in order to keep number of registrations and processing to a
@@ -41,9 +42,9 @@ import org.eclipse.osee.framework.ui.swt.Displays;
*
* @author Donald G. Dunne
*/
-public class ArtifactEditorEventManager implements IArtifactEventListener, IBranchEventListener, IAccessControlEventListener {
+public class ArtifactEditorEventManager implements IArtifactEventListener, IBranchEventListener, EventHandler {
- List<IArtifactEditorEventHandler> handlers = new CopyOnWriteArrayList<>();
+ static List<IArtifactEditorEventHandler> handlers = new CopyOnWriteArrayList<>();
static ArtifactEditorEventManager instance;
public static void add(IArtifactEditorEventHandler iWorldEventHandler) {
@@ -51,12 +52,12 @@ public class ArtifactEditorEventManager implements IArtifactEventListener, IBran
instance = new ArtifactEditorEventManager();
OseeEventManager.addListener(instance);
}
- instance.handlers.add(iWorldEventHandler);
+ ArtifactEditorEventManager.handlers.add(iWorldEventHandler);
}
public static void remove(IArtifactEditorEventHandler iWorldEventHandler) {
if (instance != null) {
- instance.handlers.remove(iWorldEventHandler);
+ ArtifactEditorEventManager.handlers.remove(iWorldEventHandler);
}
}
@@ -149,12 +150,13 @@ public class ArtifactEditorEventManager implements IArtifactEventListener, IBran
}
@Override
- public void handleAccessControlArtifactsEvent(Sender sender, AccessControlEvent accessControlEvent) {
+ public void handleEvent(Event event) {
try {
- if (accessControlEvent.getEventType() == AccessControlEventType.ArtifactsLocked || accessControlEvent.getEventType() == AccessControlEventType.ArtifactsUnlocked) {
+ if (AccessTopicEventType.ACCESS_ARTIFACT_LOCK_MODIFIED.matches(event)) {
for (final IArtifactEditorEventHandler handler : handlers) {
if (!handler.isDisposed()) {
- if (accessControlEvent.getArtifacts().contains(handler.getArtifactFromEditorInput())) {
+ AccessArtifactLockTopicEvent payload = EventUtil.getTopicJson(event, AccessArtifactLockTopicEvent.class);
+ if (payload.matches(handler.getArtifactFromEditorInput())) {
Displays.ensureInDisplayThread(new Runnable() {
@Override
public void run() {
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/ArtifactExplorer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/ArtifactExplorer.java
index 9d5e102cbac..60dcf27d5b5 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/ArtifactExplorer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/ArtifactExplorer.java
@@ -416,11 +416,7 @@ public class ArtifactExplorer extends GenericViewPart implements IArtifactExplor
if (!accessControlEvent.isForBranch(branch)) {
return;
}
- if (accessControlEvent.getEventType() == AccessControlEventType.UserAuthenticated ||
- //
- accessControlEvent.getEventType() == AccessControlEventType.ArtifactsUnlocked ||
- //
- accessControlEvent.getEventType() == AccessControlEventType.ArtifactsLocked) {
+ if (accessControlEvent.getEventType() == AccessControlEventType.UserAuthenticated) {
Displays.ensureInDisplayThread(new Runnable() {
@Override
public void run() {
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/ArtifactExplorerEventManager.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/ArtifactExplorerEventManager.java
index fa52092f6c3..8df48eedba3 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/ArtifactExplorerEventManager.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/ArtifactExplorerEventManager.java
@@ -24,6 +24,7 @@ import org.eclipse.osee.framework.skynet.core.event.EventUtil;
import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
import org.eclipse.osee.framework.skynet.core.event.filter.IEventFilter;
import org.eclipse.osee.framework.skynet.core.event.listener.IArtifactEventListener;
+import org.eclipse.osee.framework.skynet.core.event.model.AccessTopicEventType;
import org.eclipse.osee.framework.skynet.core.event.model.ArtifactEvent;
import org.eclipse.osee.framework.skynet.core.event.model.EventBasicGuidArtifact;
import org.eclipse.osee.framework.skynet.core.event.model.EventModType;
@@ -33,16 +34,18 @@ import org.eclipse.osee.framework.ui.skynet.internal.Activator;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventHandler;
/**
* Common location for event handling for ArtifactExplorers in order to keep number of registrations and processing to a
* minimum.
- *
+ *
* @author Donald G. Dunne
*/
-public class ArtifactExplorerEventManager implements IArtifactEventListener {
+public class ArtifactExplorerEventManager implements IArtifactEventListener, EventHandler {
- List<IArtifactExplorerEventHandler> handlers = new CopyOnWriteArrayList<>();
+ static List<IArtifactExplorerEventHandler> handlers = new CopyOnWriteArrayList<>();
static ArtifactExplorerEventManager instance;
public static void add(IArtifactExplorerEventHandler iWorldEventHandler) {
@@ -50,12 +53,12 @@ public class ArtifactExplorerEventManager implements IArtifactEventListener {
instance = new ArtifactExplorerEventManager();
OseeEventManager.addListener(instance);
}
- instance.handlers.add(iWorldEventHandler);
+ ArtifactExplorerEventManager.handlers.add(iWorldEventHandler);
}
public static void remove(IArtifactExplorerEventHandler iWorldEventHandler) {
if (instance != null) {
- instance.handlers.remove(iWorldEventHandler);
+ ArtifactExplorerEventManager.handlers.remove(iWorldEventHandler);
}
}
@@ -152,4 +155,27 @@ public class ArtifactExplorerEventManager implements IArtifactEventListener {
}
});
}
+
+ @Override
+ public void handleEvent(Event event) {
+ try {
+ if (AccessTopicEventType.ACCESS_ARTIFACT_LOCK_MODIFIED.matches(event)) {
+ for (final IArtifactExplorerEventHandler handler : handlers) {
+ if (!handler.isDisposed()) {
+ Displays.ensureInDisplayThread(new Runnable() {
+
+ @Override
+ public void run() {
+ handler.getArtifactExplorer().getTreeViewer().refresh();
+ handler.getArtifactExplorer().refreshBranchWarning();
+ }
+ });
+ }
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/menu/ArtifactExplorerMenu.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/menu/ArtifactExplorerMenu.java
index 32a6d934968..66dbe35020f 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/menu/ArtifactExplorerMenu.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/menu/ArtifactExplorerMenu.java
@@ -590,8 +590,12 @@ public class ArtifactExplorerMenu {
}
try {
- AccessControlManager.unLockObjects(unlockArtifacts, UserManager.getUser());
- AccessControlManager.lockObjects(lockArtifacts, UserManager.getUser());
+ if (!unlockArtifacts.isEmpty()) {
+ AccessControlManager.unLockObjects(unlockArtifacts, UserManager.getUser());
+ }
+ if (!lockArtifacts.isEmpty()) {
+ AccessControlManager.lockObjects(lockArtifacts, UserManager.getUser());
+ }
} catch (Exception ex) {
OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
}

Back to the top