Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2016-01-28 23:36:50 +0000
committerRyan D. Brooks2016-01-28 23:36:50 +0000
commit4cff77d34bb5e83544a872a0fcd7ed61da1e7c9f (patch)
tree44cbeabb10958968e983a156b575cd35638985a1
parent6d1a9a151182fdef3be81ab5c3b9e13b90dc35e6 (diff)
downloadorg.eclipse.osee-4cff77d34bb5e83544a872a0fcd7ed61da1e7c9f.tar.gz
org.eclipse.osee-4cff77d34bb5e83544a872a0fcd7ed61da1e7c9f.tar.xz
org.eclipse.osee-4cff77d34bb5e83544a872a0fcd7ed61da1e7c9f.zip
feature[ats_ATS194178]: Add AccessTopicEvent
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/ev/AtsEarnedValueImpl.java3
-rw-r--r--plugins/org.eclipse.osee.framework.access/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.framework.access/OSGI-INF/access.artifact.topic.handler.xml8
-rw-r--r--plugins/org.eclipse.osee.framework.access/OSGI-INF/access.branch.topic.handler.xml8
-rw-r--r--plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/AccessControlData.java26
-rw-r--r--plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/AccessControlManager.java2
-rw-r--r--plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/AccessObject.java2
-rw-r--r--plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessArtifactTopicEventHandler.java36
-rw-r--r--plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessBranchTopicEventHandler.java36
-rw-r--r--plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessControlService.java120
-rw-r--r--plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/data/ArtifactAccessObject.java2
-rw-r--r--plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/data/BranchAccessObject.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF6
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/EventUtil.java34
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java37
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AbstractTopicEventType.java43
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessControlEventType.java16
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessTopicEventPayload.java55
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessTopicEventType.java27
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/TopicEvent.java12
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/handlers/TopicLocalEventHandler.java3
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/access/PolicyDialog.java23
22 files changed, 420 insertions, 84 deletions
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/ev/AtsEarnedValueImpl.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/ev/AtsEarnedValueImpl.java
index 95baf6f08d..bdb18716b1 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/ev/AtsEarnedValueImpl.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/ev/AtsEarnedValueImpl.java
@@ -40,6 +40,7 @@ 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.attribute.AttributeTypeManager;
import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
+import org.eclipse.osee.framework.skynet.core.event.model.EventType;
import org.eclipse.osee.framework.skynet.core.event.model.TopicEvent;
/**
@@ -143,7 +144,7 @@ public class AtsEarnedValueImpl implements IAtsEarnedValueService {
}
TopicEvent event = new TopicEvent(AtsEvents.WORK_ITEM_MODIFIED, AtsEvents.WORK_ITEM_UUDS,
- AtsObjects.toUuidsString(";", workItems));
+ AtsObjects.toUuidsString(";", workItems), EventType.LocalAndRemote);
OseeEventManager.kickTopicEvent(getClass(), event);
AtsClientService.get().getStoreService().reload(workItems);
diff --git a/plugins/org.eclipse.osee.framework.access/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.access/META-INF/MANIFEST.MF
index 88f6e1d15b..bda62bc36c 100644
--- a/plugins/org.eclipse.osee.framework.access/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.access/META-INF/MANIFEST.MF
@@ -34,7 +34,8 @@ Import-Package: com.google.common.cache;version="15.0.0",
org.eclipse.osee.framework.skynet.core.utility,
org.eclipse.osee.jdbc,
org.osgi.framework,
- org.osgi.util.tracker
+ org.osgi.util.tracker,
+ org.osgi.service.event
Bundle-ActivationPolicy: lazy
Eclipse-ExtensibleAPI: true
Export-Package: org.eclipse.osee.framework.access,
diff --git a/plugins/org.eclipse.osee.framework.access/OSGI-INF/access.artifact.topic.handler.xml b/plugins/org.eclipse.osee.framework.access/OSGI-INF/access.artifact.topic.handler.xml
new file mode 100644
index 0000000000..0ebc047582
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.access/OSGI-INF/access.artifact.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">
+<implementation class="org.eclipse.osee.framework.access.internal.AccessArtifactTopicEventHandler"/>
+<service>
+ <provide interface="org.osgi.service.event.EventHandler"/>
+</service>
+ <property name="event.topics" value="framework/access/artifact/modified" />
+</scr:component>
diff --git a/plugins/org.eclipse.osee.framework.access/OSGI-INF/access.branch.topic.handler.xml b/plugins/org.eclipse.osee.framework.access/OSGI-INF/access.branch.topic.handler.xml
new file mode 100644
index 0000000000..f1cef7381b
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.access/OSGI-INF/access.branch.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">
+<implementation class="org.eclipse.osee.framework.access.internal.AccessBranchTopicEventHandler"/>
+<service>
+ <provide interface="org.osgi.service.event.EventHandler"/>
+</service>
+ <property name="event.topics" value="framework/access/branch/modified" />
+</scr:component>
diff --git a/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/AccessControlData.java b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/AccessControlData.java
index 464439a256..42bc1253ba 100644
--- a/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/AccessControlData.java
+++ b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/AccessControlData.java
@@ -16,7 +16,7 @@ import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
/**
* A data object in an access control list. Contains a subject (user artifact) and object (what the subject is trying to
* access) and a permission level
- *
+ *
* @author Jeff C. Phillips
*/
public class AccessControlData implements Comparable<AccessControlData> {
@@ -43,16 +43,10 @@ public class AccessControlData implements Comparable<AccessControlData> {
this.object = object;
}
- /**
- * @return Returns the user.
- */
public Artifact getSubject() {
return subject;
}
- /**
- * @param permission The permissionLevel to set.
- */
public void setPermission(PermissionEnum permission) {
if (this.permission == permission) {
@@ -79,9 +73,6 @@ public class AccessControlData implements Comparable<AccessControlData> {
return permission;
}
- /**
- * @return Returns the dirty.
- */
public boolean isDirty() {
return dirty;
}
@@ -90,13 +81,13 @@ public class AccessControlData implements Comparable<AccessControlData> {
this.dirty = false;
}
- /**
- * @return Returns the object.
- */
public AccessObject getObject() {
return object;
}
+ /**
+ * @return true if this is a new permission; false if update
+ */
public boolean isBirth() {
return birth;
}
@@ -119,23 +110,14 @@ public class AccessControlData implements Comparable<AccessControlData> {
return subject.getName().hashCode();
}
- /**
- * @param branchPermission the branchPermission to set
- */
public void setBranchPermission(PermissionEnum branchPermission) {
this.branchPermission = branchPermission;
}
- /**
- * @param artifactTypePermission the artifactTypePermission to set
- */
public void setArtifactTypePermission(PermissionEnum artifactTypePermission) {
this.artifactTypePermission = artifactTypePermission;
}
- /**
- * @param artifactPermission the artifactPermission to set
- */
public void setArtifactPermission(PermissionEnum artifactPermission) {
this.artifactPermission = artifactPermission;
}
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 476a3f9108..a3cca90408 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
@@ -104,7 +104,7 @@ public final class AccessControlManager implements IAccessControlEventListener {
AccessControlData data = null;
if (object instanceof Artifact && hasLock((Artifact) object)) {
ArtifactAccessObject artifactAccessObject = ArtifactAccessObject.getArtifactAccessObject((Artifact) object);
- User subject = UserManager.getUser();
+ Artifact subject = getSubjectFromLockedObject(object);
data = new AccessControlData(subject, artifactAccessObject, PermissionEnum.LOCK, false, false);
data.setBranchPermission(getService().getBranchPermission(subject, ((Artifact) object).getBranch()));
data.setArtifactPermission(PermissionEnum.LOCK);
diff --git a/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/AccessObject.java b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/AccessObject.java
index e36eb9a3f2..3b8efde989 100644
--- a/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/AccessObject.java
+++ b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/AccessObject.java
@@ -24,7 +24,7 @@ public abstract class AccessObject {
public abstract void removeFromDatabase(int subjectId) throws OseeCoreException;
- public abstract long getId();
+ public abstract long getBranchId();
public static AccessObject getAccessObject(Object object) throws OseeCoreException {
if (object instanceof Artifact) {
diff --git a/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessArtifactTopicEventHandler.java b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessArtifactTopicEventHandler.java
new file mode 100644
index 0000000000..5d5d4db491
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessArtifactTopicEventHandler.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.eclipse.osee.framework.skynet.core.event.model.AccessTopicEventType;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventHandler;
+
+/**
+ * Handler for {@link AccessTopicEventType.ACCESS_ARTIFACT_MODIFIED}
+ *
+ * @author Donald G. Dunne
+ */
+public class AccessArtifactTopicEventHandler 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/AccessBranchTopicEventHandler.java b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessBranchTopicEventHandler.java
new file mode 100644
index 0000000000..427c3c55bd
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessBranchTopicEventHandler.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.eclipse.osee.framework.skynet.core.event.model.AccessTopicEventType;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventHandler;
+
+/**
+ * Handler for {@link AccessTopicEventType.ACCESS_BRANCH_MODIFIED}
+ *
+ * @author Donald G. Dunne
+ */
+public class AccessBranchTopicEventHandler 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 8e5523efcb..7dd4b30331 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
@@ -64,6 +64,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.BranchManager;
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.OseeEventService;
import org.eclipse.osee.framework.skynet.core.event.filter.ArtifactEventFilter;
import org.eclipse.osee.framework.skynet.core.event.filter.ArtifactTypeEventFilter;
@@ -73,6 +74,8 @@ 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.AccessTopicEventType;
+import org.eclipse.osee.framework.skynet.core.event.model.AccessTopicEventPayload;
import org.eclipse.osee.framework.skynet.core.event.model.ArtifactEvent;
import org.eclipse.osee.framework.skynet.core.event.model.Sender;
import org.eclipse.osee.framework.skynet.core.utility.DbUtil;
@@ -491,6 +494,33 @@ public class AccessControlService implements IAccessControlService {
}
public void persistPermission(AccessControlData data, boolean recurse) {
+ if (data.getObject() instanceof ArtifactAccessObject) {
+
+ ArtifactAccessObject artifactAccessObject = (ArtifactAccessObject) data.getObject();
+
+ AccessTopicEventPayload event = new AccessTopicEventPayload();
+ event.setBranchUuid(artifactAccessObject.getBranchId());
+
+ persistPermissionForArtifact(data, artifactAccessObject, recurse, event);
+ cacheAccessControlData(data);
+
+ OseeEventManager.kickAccessTopicEvent(this, event, AccessTopicEventType.ACCESS_ARTIFACT_MODIFIED);
+
+ } else if (data.getObject() instanceof BranchAccessObject) {
+
+ BranchAccessObject branchAccessObject = (BranchAccessObject) data.getObject();
+
+ persistPermissionForBranch(data, branchAccessObject, recurse, null);
+ cacheAccessControlData(data);
+
+ AccessTopicEventPayload event = new AccessTopicEventPayload();
+ event.setBranchUuid(branchAccessObject.getBranchId());
+ OseeEventManager.kickAccessTopicEvent(this, event, AccessTopicEventType.ACCESS_BRANCH_MODIFIED);
+
+ }
+ }
+
+ private void persistPermissionForArtifact(AccessControlData data, ArtifactAccessObject artifactAccessObject, boolean recurse, AccessTopicEventPayload event) {
ensurePopulated();
Artifact subject = data.getSubject();
PermissionEnum permission = data.getPermission();
@@ -499,53 +529,62 @@ public class AccessControlService implements IAccessControlService {
data.setNotDirty();
try {
- if (data.getObject() instanceof ArtifactAccessObject) {
- ArtifactAccessObject artifactAccessObject = (ArtifactAccessObject) data.getObject();
- if (data.isBirth()) {
- getJdbcClient().runPreparedUpdate(INSERT_INTO_ARTIFACT_ACL, artifactAccessObject.getArtId(),
- data.getPermission().getPermId(), data.getSubject().getArtId(), artifactAccessObject.getId());
- } else {
- getJdbcClient().runPreparedUpdate(UPDATE_ARTIFACT_ACL, data.getPermission().getPermId(),
- data.getSubject().getArtId(), artifactAccessObject.getArtId(), artifactAccessObject.getId());
- }
+ if (data.isBirth()) {
+ getJdbcClient().runPreparedUpdate(INSERT_INTO_ARTIFACT_ACL, artifactAccessObject.getArtId(),
+ data.getPermission().getPermId(), data.getSubject().getArtId(), artifactAccessObject.getBranchId());
+ } else {
+ getJdbcClient().runPreparedUpdate(UPDATE_ARTIFACT_ACL, data.getPermission().getPermId(),
+ data.getSubject().getArtId(), artifactAccessObject.getArtId(), artifactAccessObject.getBranchId());
+ }
+ event.addArtifact(artifactAccessObject.getArtId());
- if (recurse) {
- Artifact artifact = ArtifactQuery.getArtifactFromId(artifactAccessObject.getArtId(),
- BranchManager.getBranch(artifactAccessObject.getId()));
- AccessControlData childAccessControlData = null;
+ if (recurse) {
+ Artifact artifact = ArtifactQuery.getArtifactFromId(artifactAccessObject.getArtId(),
+ BranchManager.getBranch(artifactAccessObject.getBranchId()));
- for (Artifact child : artifact.getChildren()) {
- AccessObject accessObject = getAccessObject(child);
+ for (Artifact child : artifact.getChildren()) {
+ AccessControlData childAccessControlData = null;
+ AccessObject childAccessObject = getAccessObject(child);
- if (objectToSubjectCache.containsKey(accessObject)) {
- Collection<Integer> subjectIds = objectToSubjectCache.getValues(accessObject);
+ if (objectToSubjectCache.containsKey(childAccessObject)) {
+ Collection<Integer> subjectIds = objectToSubjectCache.getValues(childAccessObject);
- for (int subjectId : subjectIds) {
- if (subjectId == subject.getArtId()) {
- childAccessControlData = new AccessControlData(subject, accessObject, permission, false);
- }
+ for (int subjectId : subjectIds) {
+ if (subjectId == subject.getArtId()) {
+ childAccessControlData =
+ new AccessControlData(subject, childAccessObject, permission, false);
+ break;
}
}
+ }
- if (childAccessControlData == null) {
- childAccessControlData = new AccessControlData(subject, accessObject, permission, true);
- }
- persistPermission(childAccessControlData, true);
+ if (childAccessControlData == null) {
+ childAccessControlData = new AccessControlData(subject, childAccessObject, permission, true);
}
+ persistPermissionForArtifact(childAccessControlData, (ArtifactAccessObject) childAccessObject, true,
+ event);
}
- } else if (data.getObject() instanceof BranchAccessObject) {
- BranchAccessObject branchAccessObject = (BranchAccessObject) data.getObject();
+ }
- if (data.isBirth()) {
- getJdbcClient().runPreparedUpdate(INSERT_INTO_BRANCH_ACL, data.getPermission().getPermId(),
- data.getSubject().getArtId(), branchAccessObject.getId());
- } else {
- getJdbcClient().runPreparedUpdate(UPDATE_BRANCH_ACL, data.getPermission().getPermId(),
- data.getSubject().getArtId(), branchAccessObject.getId());
- }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AccessControlHelper.class, Level.SEVERE, ex);
+ }
+ }
+ }
+
+ private void persistPermissionForBranch(AccessControlData data, BranchAccessObject branchAccessObject, boolean recurse, AccessTopicEventPayload event) {
+ ensurePopulated();
+ if (data.isDirty()) {
+ data.setNotDirty();
+ try {
+ if (data.isBirth()) {
+ getJdbcClient().runPreparedUpdate(INSERT_INTO_BRANCH_ACL, data.getPermission().getPermId(),
+ data.getSubject().getArtId(), branchAccessObject.getBranchId());
+ } else {
+ getJdbcClient().runPreparedUpdate(UPDATE_BRANCH_ACL, data.getPermission().getPermId(),
+ data.getSubject().getArtId(), branchAccessObject.getBranchId());
}
- cacheAccessControlData(data);
} catch (OseeCoreException ex) {
OseeLog.log(AccessControlHelper.class, Level.SEVERE, ex);
}
@@ -612,13 +651,14 @@ public class AccessControlService implements IAccessControlService {
}
private PermissionEnum getBranchPermission(IBasicArtifact<?> subject, Object object) throws OseeCoreException {
- long branchUuid = ((AccessObject) object).getId();
+ long branchUuid = ((AccessObject) object).getBranchId();
Branch branch = BranchManager.getBranch(branchUuid);
return getBranchPermission(subject, branch);
}
public void removeAccessControlDataIf(boolean removeFromDb, AccessControlData data) throws OseeCoreException {
+
int subjectId = data.getSubject().getArtId();
AccessObject accessControlledObject = data.getObject();
if (removeFromDb) {
@@ -629,6 +669,14 @@ public class AccessControlService implements IAccessControlService {
accessControlledObject.removeFromCache();
}
deCacheAccessControlData(data);
+
+ AccessTopicEventPayload event = new AccessTopicEventPayload();
+ event.setBranchUuid(accessControlledObject.getBranchId());
+ if (accessControlledObject instanceof ArtifactAccessObject) {
+ event.addArtifact(((ArtifactAccessObject) accessControlledObject).getArtId());
+ }
+ OseeEventManager.kickAccessTopicEvent(this, event, AccessTopicEventType.ACCESS_ARTIFACT_MODIFIED);
+
}
private void deCacheAccessControlData(AccessControlData data) {
diff --git a/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/data/ArtifactAccessObject.java b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/data/ArtifactAccessObject.java
index e2e036e791..96e284dd14 100644
--- a/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/data/ArtifactAccessObject.java
+++ b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/data/ArtifactAccessObject.java
@@ -46,7 +46,7 @@ public class ArtifactAccessObject extends AccessObject {
}
@Override
- public long getId() {
+ public long getBranchId() {
return branchUuid;
}
diff --git a/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/data/BranchAccessObject.java b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/data/BranchAccessObject.java
index 6ed2bf8eff..10f4e320f0 100644
--- a/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/data/BranchAccessObject.java
+++ b/plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/data/BranchAccessObject.java
@@ -36,7 +36,7 @@ public class BranchAccessObject extends AccessObject {
}
@Override
- public long getId() {
+ public long getBranchId() {
return branchUuid;
}
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 24b921f927..798f2f89b7 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
@@ -12,7 +12,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.osee.framework.messaging.event.res,
org.eclipse.osee.framework.messaging,
org.eclipse.osee.framework.lifecycle,
- org.jsoup;bundle-version="1.7.2"
+ org.jsoup,
+ org.codehaus.jackson.core
Export-Package: org.eclipse.osee.framework.skynet.core,
org.eclipse.osee.framework.skynet.core.artifact,
org.eclipse.osee.framework.skynet.core.artifact.factory,
@@ -55,6 +56,9 @@ Import-Package: com.google.common.collect;version="15.0.0",
org.apache.xerces.parsers;version="2.9.0",
org.apache.xerces.xni.parser;version="2.9.0",
org.apache.xml.serialize;version="2.9.0",
+ org.codehaus.jackson.map,
+ org.codehaus.jackson.map.annotate,
+ org.codehaus.jackson.map.ser.std,
org.cyberneko.html.parsers,
org.eclipse.debug.core,
org.eclipse.emf.common.util,
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/EventUtil.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/EventUtil.java
index 8ac635b735..eca0009284 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/EventUtil.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/EventUtil.java
@@ -11,17 +11,23 @@
package org.eclipse.osee.framework.skynet.core.event;
import java.util.logging.Level;
+import org.codehaus.jackson.map.ObjectMapper;
import org.eclipse.osee.framework.core.enums.CoreBranches;
+import org.eclipse.osee.framework.core.exception.OseeWrappedException;
import org.eclipse.osee.framework.jdk.core.util.Collections;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.event.filter.BranchUuidEventFilter;
+import org.eclipse.osee.framework.skynet.core.event.model.EventType;
+import org.eclipse.osee.framework.skynet.core.event.model.TopicEvent;
import org.eclipse.osee.framework.skynet.core.internal.Activator;
+import org.osgi.service.event.Event;
/**
* @author Roberto E. Escobar
*/
public final class EventUtil {
private static BranchUuidEventFilter commonBranchGuidEvenFilter = new BranchUuidEventFilter(CoreBranches.COMMON);
+ private static ObjectMapper mapper;
private EventUtil() {
// Utility Class
@@ -83,4 +89,32 @@ public final class EventUtil {
return "console".equals(debugConsole);
}
+ public static ObjectMapper getEventJacksonMapper() {
+ if (mapper == null) {
+ mapper = new ObjectMapper();
+ }
+ return mapper;
+ }
+
+ /**
+ * Topic Events can have "json" property set. Desearialize as given class
+ */
+ public static <T> T getTopicJson(Event event, Class<T> class1) {
+ try {
+ return getEventJacksonMapper().readValue((String) event.getProperty("json"), class1);
+ } catch (Exception ex) {
+ throw new OseeWrappedException(ex, "Error reading topic json [%s]", event.toString());
+ }
+ }
+
+ /**
+ * Create topic event given topic and oject to searialize to json property
+ */
+ public static TopicEvent createTopic(String topic, Object event, EventType eventType) {
+ try {
+ return new TopicEvent(topic, "json", EventUtil.getEventJacksonMapper().writeValueAsString(event), eventType);
+ } catch (Exception ex) {
+ throw new OseeWrappedException(ex, "Error reading topic json [%s]", event.toString());
+ }
+ }
}
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 09ef8993fd..64ad7239c2 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
@@ -14,8 +14,10 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.messaging.event.res.RemoteEvent;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
@@ -24,6 +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.ArtifactEvent;
import org.eclipse.osee.framework.skynet.core.event.model.ArtifactEvent.ArtifactEventType;
import org.eclipse.osee.framework.skynet.core.event.model.BranchEvent;
@@ -104,6 +108,34 @@ public final class OseeEventManager {
return getEventListeners().size();
}
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ /////////////////////////////////// NEW EVENT MODEL - TOPICS with JSON ////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ // Kick LOCAL and REMOTE transaction event
+ public static void kickTopicEvent(Object source, TopicEvent topicEvent) throws OseeCoreException {
+ Assert.isNotNull(source);
+ Assert.isNotNull(topicEvent);
+ Assert.isNotNull(topicEvent.getEventType(), "TopicEvent.eventType can not be null");
+ Assert.isTrue(Strings.isValid(topicEvent.getTopic()), "TopicEvent.topic can not be null.");
+ getEventService().send(source, topicEvent);
+ }
+
+ // Kick LOCAL and REMOTE access control events
+ public static void kickAccessTopicEvent(Object source, AccessTopicEventPayload event, AccessTopicEventType accessEventTopicType) {
+ try {
+ TopicEvent topicEvent =
+ EventUtil.createTopic(accessEventTopicType.getTopic(), event, accessEventTopicType.getEventType());
+ kickTopicEvent(source, topicEvent);
+ } catch (Exception ex) {
+ OseeLog.logf(OseeEventManager.class, Level.SEVERE, ex, "Error kicking event [%s]", event);
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ /////////////////////////////////// LEGACY EVENT MODEL - serialized jaxb object ///////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
// Kick LOCAL remote-event event
public static void kickLocalRemEvent(Object source, RemoteEventServiceEventType remoteEventServiceEventType) throws OseeCoreException {
getEventService().send(source, remoteEventServiceEventType);
@@ -125,11 +157,6 @@ public final class OseeEventManager {
}
// Kick LOCAL and REMOTE transaction event
- public static void kickTopicEvent(Object source, TopicEvent artifactEvent) throws OseeCoreException {
- getEventService().send(source, artifactEvent);
- }
-
- // Kick LOCAL and REMOTE transaction event
public static void kickPersistEvent(Object source, ArtifactEvent artifactEvent) throws OseeCoreException {
getEventService().send(source, artifactEvent);
}
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
new file mode 100644
index 0000000000..1ed4ca7fec
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AbstractTopicEventType.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ *
+ * @author Donald G. Dunne
+ */
+public class AbstractTopicEventType {
+
+ private EventType eventType;
+ private String topic;
+
+ protected AbstractTopicEventType(EventType eventType, String topic) {
+ this.eventType = eventType;
+ this.topic = topic;
+ }
+
+ public EventType getEventType() {
+ return eventType;
+ }
+
+ public void setEventType(EventType eventType) {
+ this.eventType = eventType;
+ }
+
+ public String getTopic() {
+ return topic;
+ }
+
+ public void setTopic(String topic) {
+ this.topic = topic;
+ }
+
+}
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 a49f0ac2fc..2831dfbf42 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,13 +14,14 @@ package org.eclipse.osee.framework.skynet.core.event.model;
* @author Donald G. Dunne
*/
public enum AccessControlEventType {
- BranchAccessControlModified(EventType.LocalAndRemote, "ADTfjBxPSRAM5raZwywA"),
- ArtifactsLocked(EventType.LocalAndRemote, "AAn_QHnJpWky8xcyKEgA"),
- ArtifactsUnlocked(EventType.LocalAndRemote, "AFRkIPF_y3ExB4XCyPgA"),
- UserAuthenticated(EventType.LocalOnly, "AFRkIhbm0BbIGKALcKQA");
+ BranchAccessControlModified(EventType.LocalAndRemote, "ADTfjBxPSRAM5raZwywA", 10),
+ ArtifactsLocked(EventType.LocalAndRemote, "AAn_QHnJpWky8xcyKEgA", 15),
+ ArtifactsUnlocked(EventType.LocalAndRemote, "AFRkIPF_y3ExB4XCyPgA", 20),
+ UserAuthenticated(EventType.LocalOnly, "AFRkIhbm0BbIGKALcKQA", 25);
private final EventType eventType;
private final String guid;
+ private final int id;
public boolean isRemoteEventType() {
return eventType == EventType.LocalAndRemote || eventType == EventType.RemoteOnly;
@@ -30,9 +31,10 @@ public enum AccessControlEventType {
return eventType == EventType.LocalAndRemote || eventType == EventType.LocalOnly;
}
- private AccessControlEventType(EventType eventType, String guid) {
+ private AccessControlEventType(EventType eventType, String guid, int id) {
this.eventType = eventType;
this.guid = guid;
+ this.id = id;
}
public String getGuid() {
@@ -48,4 +50,8 @@ public enum AccessControlEventType {
return null;
}
+ public int getId() {
+ return id;
+ }
+
}
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
new file mode 100644
index 0000000000..68b5a34b09
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessTopicEventPayload.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * 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 java.util.ArrayList;
+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;
+
+/**
+ * Payload for the Access Topic Event
+ *
+ * @author Donald G. Dunne
+ */
+@XmlRootElement
+public class AccessTopicEventPayload {
+
+ @JsonSerialize(using = ToStringSerializer.class)
+ long branchUuid;
+ List<String> artifactUuids = new ArrayList<>();
+
+ public long getBranchUuid() {
+ return branchUuid;
+ }
+
+ public void setBranchUuid(long branchUuid) {
+ this.branchUuid = branchUuid;
+ }
+
+ public List<String> getArtifactUuids() {
+ return artifactUuids;
+ }
+
+ public void setArtifactUuids(List<String> artifactUuids) {
+ this.artifactUuids = artifactUuids;
+ }
+
+ public void addArtifact(Long artifactUuid) {
+ getArtifactUuids().add(String.valueOf(artifactUuid));
+ }
+
+ public void addArtifact(Integer artifactId) {
+ getArtifactUuids().add(String.valueOf(Long.valueOf(artifactId)));
+ }
+
+}
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
new file mode 100644
index 0000000000..eb7dece3d0
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AccessTopicEventType.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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;
+
+/**
+ * @author Donald G. Dunne
+ */
+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_BRANCH_MODIFIED =
+ new AccessTopicEventType(EventType.LocalAndRemote, "framework/access/branch/modified");
+
+ private AccessTopicEventType(EventType eventType, String topic) {
+ super(eventType, topic);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/TopicEvent.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/TopicEvent.java
index dd0a5147f8..9f9097ed3e 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/TopicEvent.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/TopicEvent.java
@@ -18,6 +18,7 @@ import java.util.Map;
*/
public class TopicEvent implements FrameworkEvent, HasNetworkSender {
+ EventType eventType;
private String topic;
private final Map<String, String> properties;
private NetworkSender networkSender;
@@ -27,8 +28,9 @@ public class TopicEvent implements FrameworkEvent, HasNetworkSender {
properties = new HashMap<>();
}
- public TopicEvent(String topic, String key, String value) {
+ public TopicEvent(String topic, String key, String value, EventType eventType) {
this(topic);
+ this.eventType = eventType;
properties.put(key, value);
}
@@ -58,4 +60,12 @@ public class TopicEvent implements FrameworkEvent, HasNetworkSender {
return properties;
}
+ public EventType getEventType() {
+ return eventType;
+ }
+
+ public void setEventType(EventType eventType) {
+ this.eventType = eventType;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/handlers/TopicLocalEventHandler.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/handlers/TopicLocalEventHandler.java
index d78c60bceb..edc5df5832 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/handlers/TopicLocalEventHandler.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/handlers/TopicLocalEventHandler.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.framework.skynet.core.internal.event.handlers;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.event.EventUtil;
import org.eclipse.osee.framework.skynet.core.event.FrameworkEventUtil;
+import org.eclipse.osee.framework.skynet.core.event.model.EventType;
import org.eclipse.osee.framework.skynet.core.event.model.Sender;
import org.eclipse.osee.framework.skynet.core.event.model.TopicEvent;
import org.eclipse.osee.framework.skynet.core.internal.event.EventHandlerLocal;
@@ -35,7 +36,7 @@ public class TopicLocalEventHandler implements EventHandlerLocal<TopicEventAdmin
if (transport.isDispatchToLocalAllowed(sender)) {
transport.sendLocal(sender, event);
}
- if (sender.isLocal()) {
+ if (sender.isLocal() && event.getEventType() == EventType.LocalAndRemote) {
transport.sendRemote(FrameworkEventUtil.getRemoteTopicEvent(event));
}
}
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 5cdea16ecc..65dc33986e 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
@@ -11,14 +11,15 @@
package org.eclipse.osee.framework.ui.skynet.access;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
+import java.util.List;
import java.util.logging.Level;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osee.framework.access.AccessControlData;
import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreBranches;
@@ -95,18 +96,17 @@ public class PolicyDialog extends Dialog {
// Create Input Widgets
Composite composite = new Composite(group, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
- composite.setLayout(new GridLayout(4, false));
+ composite.setLayout(new GridLayout(3, false));
permissionLevelCombo = new Combo(composite, SWT.NONE);
userCombo = new Combo(composite, SWT.NONE);
addButton = new Button(composite, SWT.PUSH);
addButton.setText("Add");
+ chkChildrenPermission = new Button(composite, SWT.CHECK);
+ chkChildrenPermission.setText("Set permission for artifact's default hierarchy descendents.");
new Label(mainComposite, SWT.NONE).setText(" NOTE: Higher permission rank overrides lower rank.");
- chkChildrenPermission = new Button(mainComposite, SWT.CHECK);
- chkChildrenPermission.setText("Set permission for artifact's default hierarchy descendents.");
-
try {
populateInputWidgets();
} catch (Exception ex) {
@@ -127,8 +127,17 @@ public class PolicyDialog extends Dialog {
// Setup permissions combo
permissionLevelCombo.setText("-Select Permission-");
- PermissionEnum[] permissions = PermissionEnum.values();
- Arrays.sort(permissions, new Comparator<PermissionEnum>() {
+ List<PermissionEnum> permissions = new ArrayList<>();
+ for (PermissionEnum permission : PermissionEnum.values()) {
+ if (permission == PermissionEnum.LOCK) {
+ if (accessControlledObject instanceof ArtifactId) {
+ permissions.add(permission);
+ }
+ } else {
+ permissions.add(permission);
+ }
+ }
+ Collections.sort(permissions, new Comparator<PermissionEnum>() {
@Override
public int compare(PermissionEnum o1, PermissionEnum o2) {

Back to the top