diff options
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.dsl.ui.integration')
3 files changed, 74 insertions, 166 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/META-INF/MANIFEST.MF index a06aad22688..ecfb68a607c 100644 --- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/META-INF/MANIFEST.MF @@ -24,6 +24,7 @@ Import-Package: org.eclipse.compare, org.eclipse.osee.framework.core.model, org.eclipse.osee.framework.core.model.access, org.eclipse.osee.framework.core.model.cache, + org.eclipse.osee.framework.core.model.type, org.eclipse.osee.framework.core.operation, org.eclipse.osee.framework.core.services, org.eclipse.osee.framework.core.translation, @@ -59,3 +60,4 @@ Require-Bundle: org.eclipse.osee.framework.core.dsl, org.eclipse.ui.views, org.eclipse.jface, org.eclipse.xtext +Export-Package: org.eclipse.osee.framework.core.dsl.ui.integration diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/ArtifactDataAccessor.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/ArtifactDataAccessor.java new file mode 100644 index 00000000000..8ce7a39b70c --- /dev/null +++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/ArtifactDataAccessor.java @@ -0,0 +1,72 @@ +package org.eclipse.osee.framework.core.dsl.ui.integration;
+
+import java.util.Collection;
+import java.util.HashSet;
+import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.dsl.integration.ArtifactDataProvider;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.IBasicArtifact;
+import org.eclipse.osee.framework.core.model.type.ArtifactType;
+import org.eclipse.osee.framework.core.model.type.RelationType;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+
+public final class ArtifactDataAccessor implements ArtifactDataProvider {
+
+ @Override
+ public boolean isApplicable(Object object) {
+ return asCastedObject(object) != null;
+ }
+
+ @Override
+ public ArtifactData asCastedObject(Object object) {
+ ArtifactData wrapper = null;
+ if (object instanceof Artifact) {
+ final Artifact artifact = (Artifact) object;
+ wrapper = new ArtifactWrapper(artifact);
+ }
+ return wrapper;
+ }
+
+ private final class ArtifactWrapper implements ArtifactData {
+ private final Artifact artifact;
+
+ public ArtifactWrapper(Artifact artifact) {
+ this.artifact = artifact;
+ }
+
+ @Override
+ public String getGuid() {
+ return artifact.getGuid();
+ }
+
+ @Override
+ public ArtifactType getArtifactType() {
+ return artifact.getArtifactType();
+ }
+
+ @Override
+ public boolean isAttributeTypeValid(IAttributeType attributeType) throws OseeCoreException {
+ return artifact.isAttributeTypeValid(attributeType);
+ }
+
+ @Override
+ public Collection<RelationType> getValidRelationTypes() throws OseeCoreException {
+ return artifact.getValidRelationTypes();
+ }
+
+ @Override
+ public IBasicArtifact<?> getObject() {
+ return artifact;
+ }
+
+ @Override
+ public Collection<String> getHierarchy() {
+ Collection<String> hierarchy = new HashSet<String>();
+ Artifact artifactPtr = artifact;
+ while (artifactPtr != null) {
+ hierarchy.add(artifactPtr.getGuid());
+ }
+ return hierarchy;
+ }
+ }
+}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeAccessModelInterpreter.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeAccessModelInterpreter.java deleted file mode 100644 index a7099bdaf38..00000000000 --- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeAccessModelInterpreter.java +++ /dev/null @@ -1,166 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.framework.core.dsl.ui.integration.internal; - -import java.util.Collection; -import org.eclipse.osee.framework.core.data.AccessContextId; -import org.eclipse.osee.framework.core.data.IArtifactType; -import org.eclipse.osee.framework.core.data.IAttributeType; -import org.eclipse.osee.framework.core.data.Identity; -import org.eclipse.osee.framework.core.dsl.integration.AccessModelInterpreter; -import org.eclipse.osee.framework.core.dsl.oseeDsl.AccessContext; -import org.eclipse.osee.framework.core.dsl.oseeDsl.AccessPermissionEnum; -import org.eclipse.osee.framework.core.dsl.oseeDsl.ArtifactInstanceRestriction; -import org.eclipse.osee.framework.core.dsl.oseeDsl.ArtifactTypeRestriction; -import org.eclipse.osee.framework.core.dsl.oseeDsl.AttributeTypeOfArtifactTypeRestriction; -import org.eclipse.osee.framework.core.dsl.oseeDsl.AttributeTypeRestriction; -import org.eclipse.osee.framework.core.dsl.oseeDsl.HierarchyRestriction; -import org.eclipse.osee.framework.core.dsl.oseeDsl.ObjectRestriction; -import org.eclipse.osee.framework.core.dsl.oseeDsl.PermissionRule; -import org.eclipse.osee.framework.core.dsl.oseeDsl.RelationTypeRestriction; -import org.eclipse.osee.framework.core.dsl.oseeDsl.util.OseeDslSwitch; -import org.eclipse.osee.framework.core.enums.PermissionEnum; -import org.eclipse.osee.framework.core.exception.OseeCoreException; -import org.eclipse.osee.framework.core.model.access.AccessDetail; - -/** - * @author Roberto E. Escobar - */ -public class OseeAccessModelInterpreter implements AccessModelInterpreter { - - public static interface ObjectDataAccessor { - - Collection<Identity> getHierarchy(Object object); - - Collection<IAttributeType> getAttributeTypes(Object object); - - Collection<IArtifactType> getArtifactSuperTypes(Object object); - } - - public OseeAccessModelInterpreter() { - } - - @Override - public AccessContext getContext(Collection<AccessContext> contexts, AccessContextId contextId) { - AccessContext toReturn = null; - for (AccessContext accessContext : contexts) { - if (contextId.equals(accessContext.getTypeGuid())) { - toReturn = accessContext; - } - } - return toReturn; - } - - @Override - public void computeAccessDetails(AccessContext context, Object objectToCheck, Collection<AccessDetail<?>> details) { - computeAccess(context, objectToCheck, details); - for (AccessContext superContext : context.getSuperAccessContexts()) { - computeAccess(superContext, objectToCheck, details); - } - } - - private void computeAccess(AccessContext context, Object objectToCheck, Collection<AccessDetail<?>> details) { - context.getAccessRules(); - - Collection<HierarchyRestriction> restrictions = context.getHierarchyRestrictions(); - for (HierarchyRestriction restriction : restrictions) { - restriction.getArtifact(); - // Apply childrenOf Rule; - boolean isApplicable = false; - if (isApplicable) { - restriction.getAccessRules(); - } - } - - } - - private AccessPermissionEnum getLeastRestrictive(AccessPermissionEnum permission1, AccessPermissionEnum permission2) { - if (permission1 == AccessPermissionEnum.ALLOW) { - - } - return permission1; - } - - public static void checkRuleConflict(Collection<PermissionRule> rules) throws OseeCoreException { - ObjectRestrictionSwitch checker = new ObjectRestrictionSwitch(); - for (PermissionRule rule : rules) { - ObjectRestriction restriction = rule.getObjectRestriction(); - checker.doSwitch(restriction); - } - if (checker.hasConflicts()) { - - } - } - - public static PermissionEnum toCorePermission(AccessPermissionEnum modelPermission) { - PermissionEnum toReturn = PermissionEnum.READ; - if (modelPermission == AccessPermissionEnum.ALLOW) { - toReturn = PermissionEnum.WRITE; - } - return toReturn; - } - - private static final class ObjectRestrictionSwitch extends OseeDslSwitch<Object> { - Collection<Identity> artifactInstances; - - // Collection<Identity> - @Override - public Object caseArtifactInstanceRestriction(ArtifactInstanceRestriction object) { - return object; - } - - @Override - public Object caseArtifactTypeRestriction(ArtifactTypeRestriction object) { - return object; - } - - @Override - public Object caseRelationTypeRestriction(RelationTypeRestriction object) { - return object; - } - - @Override - public Object caseAttributeTypeRestriction(AttributeTypeRestriction object) { - return object; - } - - @Override - public Object caseAttributeTypeOfArtifactTypeRestriction(AttributeTypeOfArtifactTypeRestriction object) { - object.getArtifactType(); - object.getAttributeType(); - - return object; - } - - public boolean hasConflicts() { - return false; - } - } - - // - // RequirementFolder1 art - // - // art.getParent... - // if not matches SoftwareRequirements -- - // PermissionEnum - Full --- Store what? - // else - // if ( art.getArtifactType isOfType("SoftwareRequirements")){ - // data.add(art, new Access<IAttributeType>(QualificationMethod), DENY); - // } else { - // - // } - // endif - // - // Branch allows Type - // deny contextId "lba.requirementer" edit - // attributeType "Qualification Method" of artifactType "Software Requirement" - // under "Software Requirements" -} |