Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmisinco2011-11-02 21:07:29 +0000
committerRyan D. Brooks2011-11-02 21:07:29 +0000
commite95d831bde901479b3df02bd898b60da556c76a5 (patch)
treefb70ea8388aca4b48dc4f6ba386df5220de84ad3 /plugins/org.eclipse.osee.framework.access
parent48bbbd3e6b222fc3719d6e23abea1adaf4a9f724 (diff)
downloadorg.eclipse.osee-e95d831bde901479b3df02bd898b60da556c76a5.tar.gz
org.eclipse.osee-e95d831bde901479b3df02bd898b60da556c76a5.tar.xz
org.eclipse.osee-e95d831bde901479b3df02bd898b60da556c76a5.zip
bug[ats_XVQMW]: Right clicking on a change report not responding
Signed-off-by: jmisinco <misinco@gmail.com>
Diffstat (limited to 'plugins/org.eclipse.osee.framework.access')
-rw-r--r--plugins/org.eclipse.osee.framework.access/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.framework.access/src/org/eclipse/osee/framework/access/internal/AccessControlService.java26
2 files changed, 20 insertions, 9 deletions
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 c8e7b2cd6c4..4cdd680cf67 100644
--- a/plugins/org.eclipse.osee.framework.access/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.access/META-INF/MANIFEST.MF
@@ -6,7 +6,8 @@ Bundle-Version: 0.9.9.qualifier
Bundle-Activator: org.eclipse.osee.framework.access.internal.Activator
Bundle-Vendor: Eclipse Open System Engineering Environment
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Import-Package: org.eclipse.core.runtime,
+Import-Package: com.google.common.collect,
+ org.eclipse.core.runtime,
org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.exception,
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 cb982fde063..c203158f6bc 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
@@ -21,6 +21,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -52,6 +53,7 @@ import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.IOseeStatement;
import org.eclipse.osee.framework.jdk.core.type.DoubleKeyHashMap;
import org.eclipse.osee.framework.jdk.core.type.HashCollection;
+import org.eclipse.osee.framework.jdk.core.type.Pair;
import org.eclipse.osee.framework.lifecycle.AbstractLifecycleVisitor;
import org.eclipse.osee.framework.lifecycle.ILifecycleService;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -66,6 +68,7 @@ import org.eclipse.osee.framework.skynet.core.event.model.AccessControlEventType
import org.eclipse.osee.framework.skynet.core.utility.DbUtil;
import org.osgi.framework.Bundle;
import org.osgi.util.tracker.ServiceTracker;
+import com.google.common.collect.MapMaker;
/**
* @author Jeff C. Phillips
@@ -104,6 +107,8 @@ public class AccessControlService implements IAccessControlService {
private final Map<Integer, Integer> lockedObjectToSubject = new HashMap<Integer, Integer>(); // subject, permission
private final HashCollection<Integer, PermissionEnum> subjectToPermissionCache =
new HashCollection<Integer, PermissionEnum>(true);
+ private final Map<Pair<IBasicArtifact<?>, Collection<?>>, AccessDataQuery> accessDataCache =
+ new MapMaker().expiration(1, TimeUnit.HOURS).makeMap();;
private final IOseeCachingService cachingService;
private final IOseeDatabaseService databaseService;
@@ -281,14 +286,19 @@ public class AccessControlService implements IAccessControlService {
@Override
public AccessDataQuery getAccessData(IBasicArtifact<?> userArtifact, Collection<?> objectsToCheck) throws OseeCoreException {
- ILifecycleService service = getLifecycleService();
- AccessData accessData = new AccessData();
- if (!DbUtil.isDbInit()) {
- AbstractLifecycleVisitor<?> visitor = new AccessProviderVisitor(userArtifact, objectsToCheck, accessData);
- IStatus status = service.dispatch(new NullProgressMonitor(), visitor, ACCESS_POINT_ID);
- Operations.checkForErrorStatus(status);
- }
- return new AccessDataQuery(accessData);
+ Pair<IBasicArtifact<?>, Collection<?>> key =
+ new Pair<IBasicArtifact<?>, Collection<?>>(userArtifact, objectsToCheck);
+ if (!accessDataCache.containsKey(key)) {
+ ILifecycleService service = getLifecycleService();
+ AccessData accessData = new AccessData();
+ if (!DbUtil.isDbInit()) {
+ AbstractLifecycleVisitor<?> visitor = new AccessProviderVisitor(userArtifact, objectsToCheck, accessData);
+ IStatus status = service.dispatch(new NullProgressMonitor(), visitor, ACCESS_POINT_ID);
+ Operations.checkForErrorStatus(status);
+ }
+ accessDataCache.put(key, new AccessDataQuery(accessData));
+ }
+ return accessDataCache.get(key);
}
private ILifecycleService getLifecycleService() throws OseeCoreException {

Back to the top