diff options
author | rescobar | 2010-07-23 22:47:25 +0000 |
---|---|---|
committer | rescobar | 2010-07-23 22:47:25 +0000 |
commit | 1c93a625f413a5b1b119c73ff7d3acc5badfe52b (patch) | |
tree | 6b8298c1370d4655a1284cf96d1ca5708fbe0fbe /plugins/org.eclipse.osee.framework.core.dsl.integration | |
parent | d8b815546802256eb87ce5d547873a48fabe85a8 (diff) | |
download | org.eclipse.osee-1c93a625f413a5b1b119c73ff7d3acc5badfe52b.tar.gz org.eclipse.osee-1c93a625f413a5b1b119c73ff7d3acc5badfe52b.tar.xz org.eclipse.osee-1c93a625f413a5b1b119c73ff7d3acc5badfe52b.zip |
"Team Workflow" - YGHW1 - "Block changes to requirements unless done under an appropriate action."
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.dsl.integration')
3 files changed, 91 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.core.dsl.integration/META-INF/MANIFEST.MF index edc6fe674be..076738d3e5d 100644 --- a/plugins/org.eclipse.osee.framework.core.dsl.integration/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/META-INF/MANIFEST.MF @@ -16,6 +16,7 @@ Import-Package: org.eclipse.core.runtime, org.eclipse.osee.framework.core.exception, org.eclipse.osee.framework.core.message, 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, diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/AccessModelInterpreter.java b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/AccessModelInterpreter.java new file mode 100644 index 00000000000..2103bd30740 --- /dev/null +++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/AccessModelInterpreter.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * 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.integration; + +import java.util.Collection; +import org.eclipse.osee.framework.core.data.AccessContextId; +import org.eclipse.osee.framework.core.dsl.oseeDsl.AccessContext; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.model.access.AccessDetail; + +/** + * @author Roberto E. Escobar + */ +public interface AccessModelInterpreter { + + AccessContext getContext(Collection<AccessContext> contexts, AccessContextId contextId) throws OseeCoreException; + + void computeAccessDetails(AccessContext context, Object objectToCheck, Collection<AccessDetail<?>> details) throws OseeCoreException; +} diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/OseeDslToAccessDataOperation.java b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/OseeDslToAccessDataOperation.java new file mode 100644 index 00000000000..7c585ba6a2b --- /dev/null +++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/OseeDslToAccessDataOperation.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * 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.integration; + +import java.util.Collection; +import java.util.HashSet; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.osee.framework.core.data.AccessContextId; +import org.eclipse.osee.framework.core.dsl.integration.internal.Activator; +import org.eclipse.osee.framework.core.dsl.oseeDsl.AccessContext; +import org.eclipse.osee.framework.core.model.access.AccessData; +import org.eclipse.osee.framework.core.model.access.AccessDetail; +import org.eclipse.osee.framework.core.operation.AbstractOperation; +import org.eclipse.osee.framework.core.util.Conditions; + +/** + * @author Roberto E. Escobar + */ +public class OseeDslToAccessDataOperation extends AbstractOperation { + + private final AccessModelInterpreter interpreter; + private final AccessData accessData; + private final AccessContextId contextId; + private final Collection<AccessContext> accessContexts; + private final Collection<?> objectsToCheck; + + public OseeDslToAccessDataOperation(AccessModelInterpreter interpreter, AccessData accessData, AccessContextId contextId, Collection<AccessContext> accessContexts, Collection<?> objectsToCheck) { + super("Access Dsl To AccessData", Activator.PLUGIN_ID); + this.accessData = accessData; + this.contextId = contextId; + this.accessContexts = accessContexts; + this.objectsToCheck = objectsToCheck; + this.interpreter = interpreter; + } + + @Override + protected void doWork(IProgressMonitor monitor) throws Exception { + AccessContext context = interpreter.getContext(accessContexts, contextId); + Conditions.checkNotNull(context, "context", "Unable to find accessContext for [%s]", contextId); + + if (objectsToCheck.isEmpty()) { + monitor.worked(getTotalWorkUnits()); + } else { + double stepAmount = 1.0 / objectsToCheck.size(); + int step = calculateWork(stepAmount); + for (Object objectToCheck : objectsToCheck) { + checkForCancelledStatus(monitor); + Collection<AccessDetail<?>> accessDetail = new HashSet<AccessDetail<?>>(); + interpreter.computeAccessDetails(context, objectToCheck, accessDetail); + accessData.addAll(objectToCheck, accessDetail); + monitor.worked(step); + } + } + } +} |