Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2014-05-14 19:48:49 -0400
committerdonald.g.dunne2014-05-14 19:50:14 -0400
commit40183b964cea1536b955ebb34ad6e74e7554b524 (patch)
treec719d86b7d53cce8003480078989b779199bc6c6
parent5a6679cd17d1225e34bdbff9fd4e962fa6ca540e (diff)
downloadorg.eclipse.osee-ats_from_branch.tar.gz
org.eclipse.osee-ats_from_branch.tar.xz
org.eclipse.osee-ats_from_branch.zip
feature[ats_ATS34674]: ATS from another branchats_from_branch
-rw-r--r--plugins/org.eclipse.osee.ats.api/.project6
-rw-r--r--plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/context/AtsContextUtil.java20
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/context/IAtsContextLoadListener.java22
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/context/IAtsContextService.java33
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/data/AtsArtifactToken.java2
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAttributeResolver.java9
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsBranchService.java2
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsClient.java6
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsUserAdmin.java4
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/config/AtsBulkLoad.java12
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java8
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/IArtifactProvider.java4
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/config/LoadAtsConfigCacheCallable.java225
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/user/AtsUserAdminImpl.java59
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/user/AtsUserByValues.java164
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/workflow/AtsAttributeResolverServiceImpl.java23
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/AtsBranchServiceImpl.java5
-rw-r--r--plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/AtsCore.java11
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/context/AtsContext.java52
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/context/AtsContextService.java96
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/context/AtsContextStore.java158
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsUtilCore.java36
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsAttributeResolverServiceImpl.java29
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsBranchServiceImpl.java7
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsUtilServer.java5
-rw-r--r--plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AbstractAtsConfig2Data.java5
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsDatabaseConfig.java4
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsNewBranchConfigNavigateItem.java83
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/context/AtsContextLoadListener.java53
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/context/AtsContextUi.java155
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/NavigateView.java61
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/AtsWorkDefinitionSheetProviders.java2
-rw-r--r--plugins/org.eclipse.osee.ats/support/AtsBranchConfig.ats148
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreArtifactTokens.java1
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/OseeSystemArtifacts.java4
-rw-r--r--plugins/org.eclipse.osee.support.config/launchConfig/OSEE_IDE_[localhost].launch2
41 files changed, 1504 insertions, 18 deletions
diff --git a/plugins/org.eclipse.osee.ats.api/.project b/plugins/org.eclipse.osee.ats.api/.project
index 7cae829f3a..e8d6e05ae0 100644
--- a/plugins/org.eclipse.osee.ats.api/.project
+++ b/plugins/org.eclipse.osee.ats.api/.project
@@ -6,6 +6,11 @@
</projects>
<buildSpec>
<buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
@@ -24,5 +29,6 @@
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>
diff --git a/plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF
index f42f2b759d..a2e967d613 100644
--- a/plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF
@@ -8,6 +8,7 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.eclipse.osee.ats.api,
org.eclipse.osee.ats.api.ai,
org.eclipse.osee.ats.api.commit,
+ org.eclipse.osee.ats.api.context,
org.eclipse.osee.ats.api.data,
org.eclipse.osee.ats.api.ev,
org.eclipse.osee.ats.api.notify,
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/context/AtsContextUtil.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/context/AtsContextUtil.java
new file mode 100644
index 0000000000..367e10731e
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/context/AtsContextUtil.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.ats.api.context;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsContextUtil {
+
+ public static final String ATS_SYSTEM_CURRENT_CONTEXT_UUID = "AtsContextUuid";
+
+}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/context/IAtsContextLoadListener.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/context/IAtsContextLoadListener.java
new file mode 100644
index 0000000000..19ca5fab1b
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/context/IAtsContextLoadListener.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.ats.api.context;
+
+public interface IAtsContextLoadListener {
+
+ void switchToContext(String contextUuid, String contextName);
+
+ void createNewContextBranch();
+
+ void store() throws Exception;
+
+ void storeAsDefault(String contextUuid) throws Exception;
+}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/context/IAtsContextService.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/context/IAtsContextService.java
new file mode 100644
index 0000000000..1ca64c9979
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/context/IAtsContextService.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.ats.api.context;
+
+import java.util.Set;
+
+public interface IAtsContextService {
+
+ public abstract void addContext(String uuid, String name);
+
+ public abstract Set<String> getContextUuids();
+
+ public abstract String getContextName(String uuid);
+
+ public abstract String getUserContextUuid(String userId);
+
+ public abstract void setUserContextUuid(String userId, String uuid);
+
+ public abstract Set<String> getUserIds();
+
+ public void writeToStore() throws Exception;
+
+ public void read() throws Exception;
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/data/AtsArtifactToken.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/data/AtsArtifactToken.java
index 85f28a772f..3e28158f00 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/data/AtsArtifactToken.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/data/AtsArtifactToken.java
@@ -41,6 +41,8 @@ public final class AtsArtifactToken {
CoreArtifactTypes.UserGroup);
public static IArtifactToken AtsTempAdmin = TokenFactory.createArtifactToken("AAABHaItoVsAG7ZAAMyhQw",
"AtsTempAdmin", CoreArtifactTypes.UserGroup);
+ public static IArtifactToken AtsBranchConfig = TokenFactory.createArtifactToken("AFX1AeBHWiDWPTDaqRwA",
+ "AtsBranchConfig", AtsArtifactTypes.WorkDefinition);
private AtsArtifactToken() {
// Constants
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAttributeResolver.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAttributeResolver.java
index bbf49a5fb5..58c3da4f47 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAttributeResolver.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAttributeResolver.java
@@ -11,10 +11,13 @@
package org.eclipse.osee.ats.api.workdef;
import java.util.Collection;
+import java.util.List;
import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
import org.eclipse.osee.ats.api.workflow.IAttribute;
+import org.eclipse.osee.framework.core.data.IArtifactToken;
import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
/**
@@ -68,4 +71,10 @@ public interface IAttributeResolver {
IAttributeType getAttributeType(String atrributeName);
+ <T> Collection<IAttribute<T>> getAttributes(IOseeBranch branch, IArtifactToken artifact, IAttributeType attributeType);
+
+ void addAttribute(IOseeBranch branch, IArtifactToken artifact, IAttributeType attributeType, String value);
+
+ List<String> getAttributesToStringList(IOseeBranch branch, IArtifactToken artifact, IAttributeType staticid);
+
}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsBranchService.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsBranchService.java
index 36aece0ce9..5640cd9b93 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsBranchService.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsBranchService.java
@@ -36,4 +36,6 @@ public interface IAtsBranchService {
boolean isBranchValid(ICommitConfigItem configArt);
IOseeBranch getBranchInherited(IAtsVersion version);
+
+ IOseeBranch getBranch(Long uuidL);
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF
index ff7e40f002..080a5679d4 100644
--- a/plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF
@@ -18,6 +18,7 @@ Import-Package: com.google.inject,
org.eclipse.osee.ats.api,
org.eclipse.osee.ats.api.ai,
org.eclipse.osee.ats.api.commit,
+ org.eclipse.osee.ats.api.context,
org.eclipse.osee.ats.api.data,
org.eclipse.osee.ats.api.ev,
org.eclipse.osee.ats.api.notify,
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsClient.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsClient.java
index 24f0d7a635..e2f5393b82 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsClient.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsClient.java
@@ -34,6 +34,8 @@ import org.eclipse.osee.ats.core.config.IActionableItemFactory;
import org.eclipse.osee.ats.core.config.IAtsConfigProvider;
import org.eclipse.osee.ats.core.config.ITeamDefinitionFactory;
import org.eclipse.osee.ats.core.config.IVersionFactory;
+import org.eclipse.osee.framework.core.data.IArtifactToken;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
@@ -55,6 +57,9 @@ public interface IAtsClient extends IAttributeResolverProvider, IAtsReviewServic
@Override
Artifact getArtifact(IAtsObject atsObject) throws OseeCoreException;
+ @Override
+ Artifact getArtifact(IArtifactToken artifactToken, IOseeBranch branch);
+
AbstractWorkflowArtifact getWorkflowArtifact(IAtsObject atsObject) throws OseeCoreException;
List<Artifact> getConfigArtifacts(Collection<? extends IAtsObject> atsObjects) throws OseeCoreException;
@@ -91,4 +96,5 @@ public interface IAtsClient extends IAttributeResolverProvider, IAtsReviewServic
@Override
IAtsReviewService getReviewService() throws OseeCoreException;
+
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsUserAdmin.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsUserAdmin.java
index 5cde2fa652..5455178738 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsUserAdmin.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsUserAdmin.java
@@ -45,4 +45,8 @@ public interface IAtsUserAdmin {
Collection<IAtsUser> getAtsUsers(Collection<User> users) throws OseeCoreException;
+ IAtsUser createUser(String userId, String name, String email, boolean active, boolean admin);
+
+ void cache(IAtsUser user);
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/config/AtsBulkLoad.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/config/AtsBulkLoad.java
index b98c3028ba..b921dc4863 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/config/AtsBulkLoad.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/config/AtsBulkLoad.java
@@ -17,6 +17,7 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.ats.api.data.AtsRelationTypes;
+import org.eclipse.osee.ats.core.AtsCore;
import org.eclipse.osee.ats.core.client.action.ActionArtifact;
import org.eclipse.osee.ats.core.client.internal.Activator;
import org.eclipse.osee.ats.core.client.internal.AtsClientService;
@@ -38,8 +39,19 @@ import org.eclipse.osee.framework.ui.skynet.util.DbConnectionUtility;
public class AtsBulkLoad {
private static AtomicBoolean atsTypeDataLoadedStarted = new AtomicBoolean(false);
+ private static String userContextUuid;
public static List<IOperation> getConfigLoadingOperations() {
+ userContextUuid =
+ AtsCore.getContextService().getUserContextUuid(
+ AtsClientService.get().getUserAdmin().getCurrentUser().getUserId());
+ Long uuid = null;
+ try {
+ uuid = Long.valueOf(userContextUuid);
+ // AtsUtilCore.setBranch(uuid);
+ } catch (Exception ex) {
+ // do nothing
+ }
List<IOperation> ops = new ArrayList<IOperation>();
if (atsTypeDataLoadedStarted.compareAndSet(false, true) && DbConnectionUtility.isVersionSupported()) {
IOperation op = new AbstractOperation("Re-load ATS Config", Activator.PLUGIN_ID) {
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java
index ad885b6961..aa8e140b23 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java
@@ -69,13 +69,16 @@ import org.eclipse.osee.ats.core.config.IVersionFactory;
import org.eclipse.osee.ats.core.util.CacheProvider;
import org.eclipse.osee.ats.core.workdef.AtsWorkDefinitionAdminImpl;
import org.eclipse.osee.ats.core.workdef.AtsWorkDefinitionCache;
+import org.eclipse.osee.framework.core.data.IArtifactToken;
import org.eclipse.osee.framework.core.data.IArtifactType;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
import org.eclipse.osee.framework.core.util.XResultData;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
/**
* @author Donald G. Dunne
@@ -428,4 +431,9 @@ public class AtsClientImpl implements IAtsClient {
public IAttributeResolver getAttributeResolver() {
return attributeResolverService;
}
+
+ @Override
+ public Artifact getArtifact(IArtifactToken artifactToken, IOseeBranch branch) {
+ return ArtifactQuery.getArtifactFromToken(artifactToken, branch);
+ }
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/IArtifactProvider.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/IArtifactProvider.java
index 105e98c59e..5a62463d0a 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/IArtifactProvider.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/IArtifactProvider.java
@@ -11,6 +11,8 @@
package org.eclipse.osee.ats.core.client.internal;
import org.eclipse.osee.ats.api.IAtsObject;
+import org.eclipse.osee.framework.core.data.IArtifactToken;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
@@ -20,4 +22,6 @@ import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
public interface IArtifactProvider {
Artifact getArtifact(IAtsObject atsObject) throws OseeCoreException;
+
+ Artifact getArtifact(IArtifactToken artifact, IOseeBranch branch);
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/config/LoadAtsConfigCacheCallable.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/config/LoadAtsConfigCacheCallable.java
index 6c37ca6d2e..712cffbd47 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/config/LoadAtsConfigCacheCallable.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/config/LoadAtsConfigCacheCallable.java
@@ -11,18 +11,43 @@
package org.eclipse.osee.ats.core.client.internal.config;
import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import java.util.concurrent.Callable;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.osee.ats.api.IAtsConfigObject;
import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
+import org.eclipse.osee.ats.api.data.AtsArtifactToken;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
+import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
+import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.version.IAtsVersion;
+import org.eclipse.osee.ats.core.client.IAtsUserAdmin;
+import org.eclipse.osee.ats.core.client.internal.AtsClientService;
import org.eclipse.osee.ats.core.client.internal.IAtsArtifactStore;
import org.eclipse.osee.ats.core.util.AtsUtilCore;
+import org.eclipse.osee.ats.dsl.BooleanDefUtil;
+import org.eclipse.osee.ats.dsl.ModelUtil;
+import org.eclipse.osee.ats.dsl.UserRefUtil;
+import org.eclipse.osee.ats.dsl.atsDsl.ActionableItemDef;
+import org.eclipse.osee.ats.dsl.atsDsl.AtsDsl;
+import org.eclipse.osee.ats.dsl.atsDsl.TeamDef;
+import org.eclipse.osee.ats.dsl.atsDsl.UserDef;
+import org.eclipse.osee.ats.dsl.atsDsl.UserRef;
+import org.eclipse.osee.ats.dsl.atsDsl.VersionDef;
import org.eclipse.osee.framework.core.data.IArtifactType;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.DeletionFlag;
+import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
@@ -32,6 +57,9 @@ import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
public class LoadAtsConfigCacheCallable implements Callable<AtsArtifactConfigCache> {
private final IAtsArtifactStore artifactStore;
+ private final Map<String, IAtsTeamDefinition> newTeams = new HashMap<String, IAtsTeamDefinition>();
+ private final Map<String, IAtsVersion> newVersions = new HashMap<String, IAtsVersion>();
+ private final Map<String, IAtsActionableItem> newAIs = new HashMap<String, IAtsActionableItem>();
public LoadAtsConfigCacheCallable(IAtsArtifactStore artifactStore) {
this.artifactStore = artifactStore;
@@ -41,17 +69,202 @@ public class LoadAtsConfigCacheCallable implements Callable<AtsArtifactConfigCac
public AtsArtifactConfigCache call() throws Exception {
AtsArtifactConfigCache cache = new AtsArtifactConfigCache();
- List<IArtifactType> typesToLoad = getTypesToLoad();
- List<Artifact> artifactListFromType =
- ArtifactQuery.getArtifactListFromType(typesToLoad, AtsUtilCore.getAtsBranch(),
- DeletionFlag.EXCLUDE_DELETED);
+ IOseeBranch atsBranch = AtsUtilCore.getAtsBranch();
+ if (AtsUtilCore.isArtifactConfig()) {
+ List<IArtifactType> typesToLoad = getTypesToLoad();
+ List<Artifact> artifactListFromType =
+ ArtifactQuery.getArtifactListFromType(typesToLoad, atsBranch, DeletionFlag.EXCLUDE_DELETED);
- for (Artifact artifact : artifactListFromType) {
- loadAtsConfigCacheArtifacts(artifactStore, cache, artifact);
+ for (Artifact artifact : artifactListFromType) {
+ loadAtsConfigCacheArtifacts(artifactStore, cache, artifact);
+ }
+ } else {
+ Artifact artifact = ArtifactQuery.getArtifactFromToken(AtsArtifactToken.AtsBranchConfig, atsBranch);
+ loadAtsConfigCacheFromDsl(cache, artifact);
}
return cache;
}
+ /**
+ * Load ATS config from single artifact containing ATS DSL for Versions, AIs and Team Defs
+ */
+ private void loadAtsConfigCacheFromDsl(AtsArtifactConfigCache cache, Artifact artifact) throws Exception {
+ String dslStr = artifact.getSoleAttributeValue(AtsAttributeTypes.DslSheet, "");
+ AtsDsl atsDsl = ModelUtil.loadModel("AtsConfig.ats", dslStr);
+ loadUsers(atsDsl.getUserDef(), cache);
+ loadTeamDefinitions(atsDsl.getTeamDef(), cache, null);
+ loadActionableItems(atsDsl.getActionableItemDef(), cache, null);
+ }
+
+ private void loadActionableItems(EList<ActionableItemDef> aiDefs, AtsArtifactConfigCache cache, IAtsActionableItem parent) {
+ for (ActionableItemDef dslAIDef : aiDefs) {
+ String dslAIName = Strings.unquote(dslAIDef.getName());
+ String guid = dslAIDef.getGuid();
+ if (guid == null || !GUID.isValid(guid)) {
+ throw new OseeArgumentException("Invalid guid [%s] specified for DSL Actionable Item Definition [%s]",
+ guid, dslAIDef);
+ }
+ // System.out.println(" - Importing Actionable Item " + dslAIName);
+ ActionableItem newAi = (ActionableItem) cache.getSoleByGuid(dslAIDef.getGuid(), IAtsActionableItem.class);
+ if (newAi == null) {
+ newAi = new ActionableItem(dslAIName, dslAIDef.getGuid());
+ cache.cache(newAi);
+ }
+ if (parent != null && !parent.equals(newAi)) {
+ parent.getChildrenActionableItems().add(newAi);
+ }
+ newAIs.put(newAi.getName(), newAi);
+ newAi.setActive(BooleanDefUtil.get(dslAIDef.getActive(), true));
+ newAi.setActionable(BooleanDefUtil.get(dslAIDef.getActionable(), true));
+ for (String staticId : dslAIDef.getStaticId()) {
+ newAi.getStaticIds().add(staticId);
+ cache.cacheByTag(staticId, newAi);
+ }
+ newAi.getLeads().addAll(getUsers(dslAIDef.getLead()));
+ // TODO Not supported in DSL yet
+ // newAi.getOwnsers().addAll(getUsers(dslAIDef.getOwner()));
+ if (dslAIDef.getTeamDef() != null) {
+ if (dslAIDef.getTeamDef() == null) {
+ throw new OseeStateException(String.format("No Team Definition defined for Actionable Item [%s]",
+ dslAIName));
+ }
+ newAi.setTeamDefinition(newTeams.get(dslAIDef.getTeamDef()));
+ }
+ loadAccessContextIds(newAi, dslAIDef.getAccessContextId());
+ loadActionableItems(dslAIDef.getChildren(), cache, newAi);
+ }
+ }
+
+ private void loadUsers(EList<UserDef> userDefs, AtsArtifactConfigCache cache) {
+ for (UserDef dslUser : userDefs) {
+ IAtsUserAdmin userAdmin = AtsClientService.get().getUserAdmin();
+ IAtsUser user = userAdmin.getUserById(dslUser.getUserId());
+ if (user == null) {
+ String userId = dslUser.getUserId();
+ if (!Strings.isValid(userId)) {
+ throw new OseeArgumentException("Invalid userId [%s] specified for DSL User [%s]", userId, dslUser);
+ }
+ user =
+ userAdmin.createUser(userId, dslUser.getName(), dslUser.getEmail(),
+ BooleanDefUtil.get(dslUser.getActive(), true), BooleanDefUtil.get(dslUser.getAdmin(), false));
+ userAdmin.cache(user);
+ }
+ }
+ }
+
+ private void loadTeamDefinitions(EList<TeamDef> teamDefs, AtsArtifactConfigCache cache, IAtsTeamDefinition parentTeam) {
+ for (TeamDef dslTeamDef : teamDefs) {
+ String dslTeamName = Strings.unquote(dslTeamDef.getName());
+ // System.out.println(" - Importing Team " + dslTeamName);
+ TeamDefinition newTeam = null;
+ String guid = dslTeamDef.getGuid();
+ if (guid == null || !GUID.isValid(guid)) {
+ throw new OseeArgumentException("Invalid guid [%s] specified for DSL Team Definition [%s]", guid,
+ dslTeamDef);
+ }
+ if (dslTeamDef.getTeamDefOption().contains("GetOrCreate")) {
+ newTeam = (TeamDefinition) cache.getSoleByGuid(dslTeamDef.getGuid(), IAtsTeamDefinition.class);
+ }
+ if (newTeam == null) {
+ newTeam = new TeamDefinition(dslTeamName, dslTeamDef.getGuid());
+ cache.cache(newTeam);
+ }
+
+ if (parentTeam != null && !parentTeam.equals(newTeam)) {
+ parentTeam.getChildrenTeamDefinitions().add(newTeam);
+ }
+ newTeams.put(newTeam.getName(), newTeam);
+
+ newTeam.setActive(BooleanDefUtil.get(dslTeamDef.getActive(), true));
+ // newTeam.setSoleAttributeValue(CoreAttributeTypes.Active, BooleanDefUtil.get(dslTeamDef.getActive(), true));
+ for (String staticId : dslTeamDef.getStaticId()) {
+ newTeam.getStaticIds().add(staticId);
+ cache.cacheByTag(staticId, newTeam);
+ }
+ newTeam.getLeads().addAll(getUsers(dslTeamDef.getLead()));
+ newTeam.getMembers().addAll(getUsers(dslTeamDef.getMember()));
+ newTeam.getPrivilegedMembers().addAll(getUsers(dslTeamDef.getPrivileged()));
+ if (Strings.isValid(dslTeamDef.getWorkDefinition())) {
+ newTeam.setWorkflowDefinition(dslTeamDef.getWorkDefinition());
+ }
+ if (Strings.isValid(dslTeamDef.getRelatedTaskWorkDefinition())) {
+ newTeam.setRelatedTaskWorkDefinition(dslTeamDef.getRelatedTaskWorkDefinition());
+ }
+ loadAccessContextIds(newTeam, dslTeamDef.getAccessContextId());
+ loadVersionDefinitions(dslTeamDef.getVersion(), cache, newTeam);
+ // process children
+ loadTeamDefinitions(dslTeamDef.getChildren(), cache, newTeam);
+ }
+ }
+
+ private void loadVersionDefinitions(EList<VersionDef> versionDefs, AtsArtifactConfigCache cache, TeamDefinition teamDef) throws OseeCoreException {
+
+ Map<String, Version> nameToVerArt = new HashMap<String, Version>();
+ for (VersionDef dslVersionDef : versionDefs) {
+ String dslVerName = Strings.unquote(dslVersionDef.getName());
+ // System.out.println(" - Importing Version " + dslVerName);
+
+ String guid = dslVersionDef.getGuid();
+ if (guid == null || !GUID.isValid(guid)) {
+ throw new OseeArgumentException("Invalid guid [%s] specified for DSL Version Definition [%s]", guid,
+ dslVersionDef);
+ }
+ Version newVer = (Version) cache.getSoleByGuid(guid, IAtsVersion.class);
+ if (newVer == null) {
+ newVer = new Version(AtsClientService.get().getAtsVersionService(), dslVerName, dslVersionDef.getGuid());
+ cache.cache(newVer);
+ }
+
+ teamDef.getVersions().add(newVer);
+ nameToVerArt.put(newVer.getName(), newVer);
+ newVersions.put(newVer.getName(), newVer);
+ newVer.setAllowCommitBranch(BooleanDefUtil.get(dslVersionDef.getAllowCommitBranch(), true));
+ newVer.setAllowCreateBranch(BooleanDefUtil.get(dslVersionDef.getAllowCreateBranch(), true));
+ newVer.setNextVersion(BooleanDefUtil.get(dslVersionDef.getNext(), false));
+ newVer.setReleased(BooleanDefUtil.get(dslVersionDef.getReleased(), false));
+ if (Strings.isValid(dslVersionDef.getBaselineBranchUuid())) {
+ newVer.setBaselineBranchUuid(dslVersionDef.getBaselineBranchUuid());
+ }
+ for (String staticId : dslVersionDef.getStaticId()) {
+ newVer.getStaticIds().add(staticId);
+ cache.cacheByTag(staticId, newVer);
+ }
+ }
+ // Handle parallel versions
+ for (VersionDef dslVersionDef : versionDefs) {
+ String aiName = Strings.unquote(dslVersionDef.getName());
+ Version verArt = nameToVerArt.get(aiName);
+ for (String parallelVerStr : dslVersionDef.getParallelVersion()) {
+ // System.out.println(String.format(" - Importing Parallel Version [%s] -> Child [%s]", aiName, parallelVerStr));
+ Version childVer = nameToVerArt.get(parallelVerStr);
+ verArt.getParallelVersions().add(childVer);
+ }
+ }
+ }
+
+ private void loadAccessContextIds(IAtsConfigObject configObj, EList<String> contextIds) throws OseeCoreException {
+ for (String accessContextId : contextIds) {
+ // TBD: Not supported by AtsDsl
+ // configObj.getAccessContextIds.add(accessContextId);
+ }
+ }
+
+ private Set<IAtsUser> getUsers(EList<UserRef> userRefs) throws OseeCoreException {
+ Set<IAtsUser> users = new HashSet<IAtsUser>();
+ if (userRefs != null) {
+ IAtsUserAdmin userAdmin = AtsClientService.get().getUserAdmin();
+ for (String userId : UserRefUtil.getUserIds(userRefs)) {
+ IAtsUser user = userAdmin.getUserById(userId);
+ users.add(user);
+ }
+ for (String userName : UserRefUtil.getUserNames(userRefs)) {
+ IAtsUser user = userAdmin.getUserByName(Strings.unquote(userName));
+ users.add(user);
+ }
+ }
+ return users;
+ }
+
private List<IArtifactType> getTypesToLoad() {
return Arrays.asList(AtsArtifactTypes.TeamDefinition, AtsArtifactTypes.ActionableItem, AtsArtifactTypes.Version);
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/user/AtsUserAdminImpl.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/user/AtsUserAdminImpl.java
index dd10f74fa4..815e4c4513 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/user/AtsUserAdminImpl.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/user/AtsUserAdminImpl.java
@@ -11,8 +11,12 @@
package org.eclipse.osee.ats.core.client.internal.user;
import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.core.client.IAtsUserAdmin;
import org.eclipse.osee.ats.core.users.AtsCoreUsers;
@@ -29,10 +33,14 @@ import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
*/
public class AtsUserAdminImpl implements IAtsUserAdmin {
+ private final Map<String, IAtsUser> userIdCache = new HashMap<String, IAtsUser>();
+
@Override
public Collection<IAtsUser> getUsers() throws OseeCoreException {
- List<User> users = UserManager.getUsers();
- return getAtsUsers(users);
+ List<User> userArts = UserManager.getUsers();
+ Set<IAtsUser> users = new HashSet<IAtsUser>();
+ users.addAll(getAtsUsers(userArts));
+ return users;
}
@Override
@@ -44,6 +52,12 @@ public class AtsUserAdminImpl implements IAtsUserAdmin {
User user = UserManager.getUserByUserId(userId);
atsUser = new AtsUser(user);
}
+ for (IAtsUser aUser : userIdCache.values()) {
+ if (aUser.getUserId().equals(UserManager.getUser().getUserId())) {
+ atsUser = aUser;
+ break;
+ }
+ }
}
return atsUser;
}
@@ -62,17 +76,39 @@ public class AtsUserAdminImpl implements IAtsUserAdmin {
@Override
public IAtsUser getCurrentUser() throws OseeCoreException {
- return getUserById(getCurrentOseeUser().getUserId());
+ IAtsUser user = getUserById(getCurrentOseeUser().getUserId());
+ if (user == null) {
+ for (IAtsUser aUser : userIdCache.values()) {
+ if (aUser.getUserId().equals(UserManager.getUser().getUserId())) {
+ user = aUser;
+ break;
+ }
+ }
+ }
+ return user;
}
@Override
public IAtsUser getUserByName(String name) throws OseeCoreException {
- return getUserFromOseeUser(UserManager.getUserByName(name));
+ IAtsUser user = getUserFromOseeUser(UserManager.getUserByName(name));
+ if (user == null) {
+ for (IAtsUser aUser : userIdCache.values()) {
+ if (aUser.getName().equals(name)) {
+ user = aUser;
+ break;
+ }
+ }
+ }
+ return user;
}
@Override
public IAtsUser getUserFromToken(IUserToken token) throws OseeCoreException {
- return getUserById(token.getUserId());
+ IAtsUser user = getUserById(token.getUserId());
+ if (user == null) {
+ user = userIdCache.get(token.getUserId());
+ }
+ return user;
}
@Override
@@ -134,6 +170,7 @@ public class AtsUserAdminImpl implements IAtsUserAdmin {
results.add(userByUserId);
}
}
+ results.addAll(userIdCache.values());
return results;
}
@@ -142,4 +179,16 @@ public class AtsUserAdminImpl implements IAtsUserAdmin {
return UserManager.getUserByUserId(userId);
}
+ @Override
+ public IAtsUser createUser(String userId, String name, String email, boolean active, boolean admin) {
+ return new AtsUserByValues(userId, name, email, active, admin);
+ }
+
+ @Override
+ public void cache(IAtsUser user) {
+ if (user.getStoreObject() == null) {
+ userIdCache.put(user.getUserId(), user);
+ }
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/user/AtsUserByValues.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/user/AtsUserByValues.java
new file mode 100644
index 0000000000..fc0f37f78c
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/user/AtsUserByValues.java
@@ -0,0 +1,164 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.ats.core.client.internal.user;
+
+import org.eclipse.osee.ats.api.user.IAtsUser;
+import org.eclipse.osee.framework.jdk.core.type.Identity;
+import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.User;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsUserByValues implements IAtsUser {
+
+ private final String userId;
+ private final String name;
+ private final String email;
+ private final boolean active;
+ private final boolean admin;
+
+ public AtsUserByValues(String userId, String name, String email, boolean active, boolean admin) {
+ this.userId = userId;
+ this.name = name;
+ this.email = email;
+ this.active = active;
+ this.admin = admin;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String getGuid() {
+ return userId;
+ }
+
+ @Override
+ public String getDescription() {
+ return "";
+ }
+
+ @Override
+ public int compareTo(Object other) {
+ int result = other != null ? -1 : 1;
+ if (other instanceof IAtsUser) {
+ String otherName = ((IAtsUser) other).getName();
+ String thisName = getName();
+ if (thisName == null && otherName == null) {
+ result = 0;
+ } else if (thisName != null && otherName == null) {
+ result = 1;
+ } else if (thisName != null && otherName != null) {
+ result = thisName.compareTo(otherName);
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 0;
+ int userIdHashCode = 0;
+ try {
+ userIdHashCode = (getUserId() == null) ? 0 : getUserId().hashCode();
+ } catch (OseeCoreException ex) {
+ // Do nothing;
+ }
+ result = prime * result + userIdHashCode;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ try {
+ String objUserId = null;
+ if (obj instanceof IAtsUser) {
+ objUserId = ((IAtsUser) obj).getUserId();
+ } else if (obj instanceof User) {
+ objUserId = ((User) obj).getUserId();
+ } else {
+ return false;
+ }
+ String thisUserId = getUserId();
+ if (thisUserId == null) {
+ if (objUserId != null) {
+ return false;
+ }
+ } else if (!thisUserId.equals(objUserId)) {
+ return false;
+ }
+ } catch (OseeCoreException ex) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String getUserId() throws OseeCoreException {
+ return userId;
+ }
+
+ @Override
+ public String getEmail() throws OseeCoreException {
+ return email;
+ }
+
+ @Override
+ public boolean isActive() throws OseeCoreException {
+ return active;
+ }
+
+ @Override
+ public String toString() {
+ try {
+ return String.format("%s (%s)", getName(), getUserId());
+ } catch (Exception ex) {
+ return "Exception: " + ex.getLocalizedMessage();
+ }
+ }
+
+ @Override
+ public boolean matches(Identity<?>... identities) {
+ for (Identity<?> identity : identities) {
+ if (equals(identity)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String toStringWithId() {
+ return String.format("[%s][%s]", getName(), getGuid());
+ }
+
+ @Override
+ public Object getStoreObject() {
+ return null;
+ }
+
+ @Override
+ public void setStoreObject(Object object) {
+ throw new OseeArgumentException("Not valid for AtsUserByValues");
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/workflow/AtsAttributeResolverServiceImpl.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/workflow/AtsAttributeResolverServiceImpl.java
index afc2c7e64c..a6f3717e3a 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/workflow/AtsAttributeResolverServiceImpl.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/workflow/AtsAttributeResolverServiceImpl.java
@@ -22,7 +22,9 @@ import org.eclipse.osee.ats.api.workflow.IAttribute;
import org.eclipse.osee.ats.core.client.internal.Activator;
import org.eclipse.osee.ats.core.client.internal.AtsClientService;
import org.eclipse.osee.ats.core.client.internal.workdef.AttributeWrapper;
+import org.eclipse.osee.framework.core.data.IArtifactToken;
import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.model.type.AttributeType;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Strings;
@@ -207,4 +209,25 @@ public class AtsAttributeResolverServiceImpl implements IAttributeResolver {
attributeById.delete();
}
}
+
+ @SuppressWarnings({"unchecked", "deprecation"})
+ @Override
+ public <T> Collection<IAttribute<T>> getAttributes(IOseeBranch branch, IArtifactToken artifact, IAttributeType attributeType) {
+ List<IAttribute<T>> attrs = new ArrayList<IAttribute<T>>();
+ for (Attribute<Object> attr : AtsClientService.get().getArtifact(artifact, branch).getAttributes(attributeType)) {
+ attrs.add(new AttributeWrapper<T>((Attribute<T>) attr));
+ }
+ return attrs;
+ }
+
+ @Override
+ public void addAttribute(IOseeBranch branch, IArtifactToken artifact, IAttributeType attributeType, String value) {
+ AtsClientService.get().getArtifact(artifact, branch).addAttribute(attributeType, value);
+ }
+
+ @Override
+ public List<String> getAttributesToStringList(IOseeBranch branch, IArtifactToken artifactToken, IAttributeType attributeType) {
+ return AtsClientService.get().getArtifact(artifactToken, branch).getAttributesToStringList(attributeType);
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/AtsBranchServiceImpl.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/AtsBranchServiceImpl.java
index 3bb9aeb0b1..c4662fff92 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/AtsBranchServiceImpl.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/AtsBranchServiceImpl.java
@@ -89,4 +89,9 @@ public class AtsBranchServiceImpl extends AbstractAtsBranchService {
return branch;
}
+ @Override
+ public IOseeBranch getBranch(Long uuidL) {
+ return BranchManager.getBranch(uuidL);
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF
index 5cc93e8bc6..7b18bc947f 100644
--- a/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF
@@ -16,6 +16,7 @@ Import-Package: com.google.inject,
org.eclipse.osee.ats.api,
org.eclipse.osee.ats.api.ai,
org.eclipse.osee.ats.api.commit,
+ org.eclipse.osee.ats.api.context,
org.eclipse.osee.ats.api.data,
org.eclipse.osee.ats.api.ev,
org.eclipse.osee.ats.api.notify,
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/AtsCore.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/AtsCore.java
index 24cf2e81cb..feb642cbf5 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/AtsCore.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/AtsCore.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.ats.core;
+import org.eclipse.osee.ats.api.context.IAtsContextService;
import org.eclipse.osee.ats.api.notify.IAtsNotificationService;
import org.eclipse.osee.ats.api.notify.IAtsNotificationServiceProvider;
import org.eclipse.osee.ats.api.review.IAtsReviewService;
@@ -27,6 +28,7 @@ import org.eclipse.osee.ats.api.workflow.state.IAtsWorkStateFactory;
import org.eclipse.osee.ats.core.column.IAtsColumnUtilities;
import org.eclipse.osee.ats.core.config.IAtsConfig;
import org.eclipse.osee.ats.core.config.IAtsConfigProvider;
+import org.eclipse.osee.ats.core.context.AtsContextService;
import org.eclipse.osee.ats.core.internal.AtsEarnedValueService;
import org.eclipse.osee.ats.core.internal.column.ev.AtsColumnUtilities;
import org.eclipse.osee.ats.core.internal.log.AtsLogFactory;
@@ -55,6 +57,7 @@ public class AtsCore {
private static IAtsReviewServiceProvider reviewServiceProvider;
private static AtsWorkStateFactory workStateFactory;
private static IAtsConfigProvider atsConfigProvider;
+ private static IAtsContextService atsContextService;
public void setAtsConfigProvider(IAtsConfigProvider atsConfigProvider) {
AtsCore.atsConfigProvider = atsConfigProvider;
@@ -131,6 +134,14 @@ public class AtsCore {
return userService;
}
+ public static IAtsContextService getContextService() throws OseeStateException {
+ checkStarted();
+ if (atsContextService == null) {
+ atsContextService = new AtsContextService(getAttrResolver());
+ }
+ return atsContextService;
+ }
+
public static IAtsColumnUtilities getColumnUtilities() {
if (columnUtilities == null) {
columnUtilities =
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/context/AtsContext.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/context/AtsContext.java
new file mode 100644
index 0000000000..83e77e3d91
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/context/AtsContext.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.ats.core.context;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsContext {
+
+ private final Map<String, String> contextUuidsToNameMap = new HashMap<String, String>();
+ private final Map<String, String> userIdtoContextUuid = new HashMap<String, String>();
+
+ public AtsContext() {
+ }
+
+ public void addContext(String uuid, String name) {
+ contextUuidsToNameMap.put(uuid, name);
+ }
+
+ public Set<String> getContextUuids() {
+ return contextUuidsToNameMap.keySet();
+ }
+
+ public String getContextName(String uuid) {
+ return contextUuidsToNameMap.get(uuid);
+ }
+
+ public String getUserContextUuid(String userId) {
+ return userIdtoContextUuid.get(userId);
+ }
+
+ public void setUserContextUuid(String userId, String uuid) {
+ userIdtoContextUuid.put(userId, uuid);
+ }
+
+ public Set<String> getUserIds() {
+ return userIdtoContextUuid.keySet();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/context/AtsContextService.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/context/AtsContextService.java
new file mode 100644
index 0000000000..cda4f1bb2f
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/context/AtsContextService.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.ats.core.context;
+
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.osee.ats.api.context.IAtsContextService;
+import org.eclipse.osee.ats.api.workdef.IAttributeResolver;
+import org.eclipse.osee.ats.core.AtsCore;
+import org.eclipse.osee.ats.core.internal.Activator;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.logging.OseeLog;
+
+public class AtsContextService implements IAtsContextService {
+
+ AtsContext atsContext = null;
+ private final IAttributeResolver attrResolver;
+
+ public AtsContextService(IAttributeResolver attrResolver) {
+ this.attrResolver = attrResolver;
+ }
+
+ private AtsContext getAtsContext() {
+ if (atsContext == null) {
+ AtsContextStore store = new AtsContextStore(attrResolver);
+ try {
+ atsContext = store.read();
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ }
+ return atsContext;
+ }
+
+ @Override
+ public void addContext(String uuid, String name) {
+ getAtsContext().addContext(uuid, name);
+ }
+
+ @Override
+ public Set<String> getContextUuids() {
+ return getAtsContext().getContextUuids();
+ }
+
+ @Override
+ public String getContextName(String uuid) {
+ return getAtsContext().getContextName(uuid);
+ }
+
+ @Override
+ public String getUserContextUuid(String userId) {
+ return getAtsContext().getUserContextUuid(userId);
+ }
+
+ @Override
+ public void setUserContextUuid(String userId, String uuid) {
+ getAtsContext().setUserContextUuid(userId, uuid);
+ if (userId.equals(AtsCore.getUserService().getCurrentUser().getUserId())) {
+ Long uuidL = Long.valueOf(uuid);
+ IOseeBranch newBranch = AtsCore.getBranchService().getBranch(uuidL);
+ if (newBranch != null) {
+ // AtsUtilCore.setBranch(uuidL);
+ }
+ }
+ }
+
+ @Override
+ public Set<String> getUserIds() {
+ return getAtsContext().getUserIds();
+ }
+
+ @Override
+ public void writeToStore() throws Exception {
+ AtsContextStore store = new AtsContextStore(attrResolver);
+ try {
+ store.write(atsContext);
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ }
+
+ @Override
+ public void read() throws Exception {
+ atsContext = null;
+ getAtsContext();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/context/AtsContextStore.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/context/AtsContextStore.java
new file mode 100644
index 0000000000..0ac9e71ca3
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/context/AtsContextStore.java
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.ats.core.context;
+
+import org.eclipse.osee.ats.api.workdef.IAttributeResolver;
+import org.eclipse.osee.ats.api.workflow.IAttribute;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTokens;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.enums.CoreBranches;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+
+/**
+ * ATS Context stores the context configuration and user selection on the Common branch. It should not change based on
+ * which ATS Branch is selected.
+ *
+ * @author Donald G. Dunne
+ */
+public class AtsContextStore {
+
+ private static final String ATS_CONTEXT_USER_DEFAULT_UUID_STATIC_ID = "atsContextUser:";
+ private static final String ATS_CONTEXT_CONFIG_STATIC_ID = "atsContextConfig:";
+
+ // Property Store Uuid array
+ private static String CONTEXT_UUIDS = "atsContextBranchUuids";
+ // Property Store id
+ private static String CONFIG_STORE_ID = "AtsConfigStore";
+ private final IAttributeResolver attrResolver;
+
+ public AtsContextStore(IAttributeResolver attrResolver) {
+ super();
+ this.attrResolver = attrResolver;
+ }
+
+ public void write(AtsContext context) throws Exception {
+ writeAtsConfig(context);
+ writeUserToDefaultId(context);
+ }
+
+ private void writeUserToDefaultId(AtsContext context) {
+ for (String userId : context.getUserIds()) {
+ boolean found = false;
+ String contextUuid = context.getUserContextUuid(userId);
+ for (IAttribute<Object> attr : attrResolver.getAttributes(CoreBranches.COMMON,
+ CoreArtifactTokens.GlobalPreferences, CoreAttributeTypes.StaticId)) {
+ if (((String) attr.getValue()).startsWith(ATS_CONTEXT_USER_DEFAULT_UUID_STATIC_ID)) {
+ attr.setValue(getUserStoreStr(userId, contextUuid));
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ attrResolver.addAttribute(CoreBranches.COMMON, CoreArtifactTokens.GlobalPreferences,
+ CoreAttributeTypes.StaticId, getUserStoreStr(userId, contextUuid));
+ }
+ }
+ }
+
+ private String getUserStoreStr(String userId, String contextUuid) {
+ return String.format("%s%s:%s", ATS_CONTEXT_USER_DEFAULT_UUID_STATIC_ID, userId, contextUuid);
+ }
+
+ private void writeAtsConfig(AtsContext context) throws Exception {
+ PropertyStore store = new PropertyStore(CONFIG_STORE_ID);
+ store.put(CONTEXT_UUIDS, context.getContextUuids().toArray(new String[context.getContextUuids().size()]));
+ for (String uuid : context.getContextUuids()) {
+ store.put(uuid, context.getContextName(uuid));
+ }
+ writeAtsConfigStr(store.save());
+ }
+
+ public void writeAtsConfigStr(String string) {
+ IAttribute<Object> foundAttr = null;
+ for (IAttribute<Object> attr : attrResolver.getAttributes(CoreBranches.COMMON,
+ CoreArtifactTokens.GlobalPreferences, CoreAttributeTypes.StaticId)) {
+ if (((String) attr.getValue()).startsWith(ATS_CONTEXT_CONFIG_STATIC_ID)) {
+ attr.setValue(getConfigStoreStr(string));
+ foundAttr = attr;
+ break;
+ }
+ }
+ if (foundAttr == null) {
+ attrResolver.addAttribute(CoreBranches.COMMON, CoreArtifactTokens.GlobalPreferences,
+ CoreAttributeTypes.StaticId, getConfigStoreStr(string));
+ }
+ }
+
+ private String getConfigStoreStr(String string) {
+ return ATS_CONTEXT_CONFIG_STATIC_ID + string;
+ }
+
+ public AtsContext read() throws Exception {
+ AtsContext context = new AtsContext();
+ readAtsConfig(context);
+ readUserToDefaultId(context);
+ return context;
+ }
+
+ private PropertyStore readAtsConfig(AtsContext context) throws Exception {
+ PropertyStore store = readAtsConfigStore();
+ for (String uuid : store.getArray(CONTEXT_UUIDS)) {
+ context.addContext(uuid, store.get(uuid));
+ }
+ return store;
+ }
+
+ public void readUserToDefaultId(AtsContext context) {
+ for (String str : attrResolver.getAttributesToStringList(CoreBranches.COMMON,
+ CoreArtifactTokens.GlobalPreferences, CoreAttributeTypes.StaticId)) {
+ if (str.startsWith(ATS_CONTEXT_USER_DEFAULT_UUID_STATIC_ID)) {
+ String values[] = str.split(":");
+ context.setUserContextUuid(values[1], values[2]);
+ break;
+ }
+ }
+ }
+
+ private String readAtsConfigStr() {
+ String result = null;
+ for (String str : attrResolver.getAttributesToStringList(CoreBranches.COMMON,
+ CoreArtifactTokens.GlobalPreferences, CoreAttributeTypes.StaticId)) {
+ if (str.startsWith(ATS_CONTEXT_CONFIG_STATIC_ID)) {
+ result = str.replaceFirst(ATS_CONTEXT_CONFIG_STATIC_ID, "");
+ break;
+ }
+ }
+ return result;
+ }
+
+ private PropertyStore readAtsConfigStore() throws Exception {
+ PropertyStore store = null;
+ String atsContextConfigStr = readAtsConfigStr();
+ if (Strings.isValid(atsContextConfigStr)) {
+ store = new PropertyStore(CONFIG_STORE_ID);
+ store.load(atsContextConfigStr);
+ } else {
+ store = getDefaultConfigStore();
+ }
+ return store;
+ }
+
+ private PropertyStore getDefaultConfigStore() {
+ PropertyStore configStore = new PropertyStore(CONFIG_STORE_ID);
+ String commonUuidStr = String.valueOf(CoreBranches.COMMON.getUuid());
+ configStore.put(CONTEXT_UUIDS, new String[] {commonUuidStr});
+ configStore.put(commonUuidStr, CoreBranches.COMMON.getName());
+ return configStore;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsUtilCore.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsUtilCore.java
index 689e50a0d5..c281b1e03c 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsUtilCore.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsUtilCore.java
@@ -13,7 +13,9 @@ package org.eclipse.osee.ats.core.util;
import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.workflow.IAttribute;
import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.core.enums.CoreBranches;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.orcs.data.ArtifactId;
import org.eclipse.osee.orcs.data.AttributeId;
@@ -23,9 +25,28 @@ import org.eclipse.osee.orcs.data.AttributeId;
public class AtsUtilCore {
public final static double DEFAULT_HOURS_PER_WORK_DAY = 8;
+ private static IOseeBranch branch = null;
public static IOseeBranch getAtsBranch() {
- return CoreBranches.COMMON;
+ if (branch == null) {
+ String branchGuid = System.getProperty("AtsBranch");
+ if (Strings.isValid(branchGuid)) {
+ branch = TokenFactory.createBranch(branchGuid, "ATSBranch - fromConfig");
+ }
+ if (branch == null) {
+ branch = CoreBranches.COMMON;
+ }
+ }
+ System.err.println("ATS Branch " + branch);
+ return branch;
+ }
+
+ public static void setBranch(String guid) {
+ setBranch(TokenFactory.createBranch(guid, "Set Branch"));
+ }
+
+ public static void setBranch(IOseeBranch branch) {
+ AtsUtilCore.branch = branch;
}
public static boolean isInTest() {
@@ -55,4 +76,17 @@ public class AtsUtilCore {
public static AttributeId toAttributeId(IAttribute<?> attr) {
return new AttributeIdWrapper(attr);
}
+
+ /**
+ * @return true if ATS Config is stored as separeate artifacts. false if it comes from ATS xtext.
+ */
+ public static boolean isArtifactConfig() {
+ boolean artifactConfig = true;
+ String atsBranchGuid = System.getProperty("AtsBranch");
+ if (!CoreBranches.COMMON.getGuid().equals(atsBranchGuid)) {
+ artifactConfig = false;
+ }
+ return artifactConfig;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsAttributeResolverServiceImpl.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsAttributeResolverServiceImpl.java
index dfc3c500cf..f536d617cb 100644
--- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsAttributeResolverServiceImpl.java
+++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsAttributeResolverServiceImpl.java
@@ -12,13 +12,16 @@ package org.eclipse.osee.ats.impl.internal.util;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.List;
import org.eclipse.osee.ats.api.IAtsObject;
import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinition;
import org.eclipse.osee.ats.api.workdef.IAttributeResolver;
import org.eclipse.osee.ats.api.workflow.IAttribute;
+import org.eclipse.osee.framework.core.data.IArtifactToken;
import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
@@ -48,6 +51,10 @@ public class AtsAttributeResolverServiceImpl implements IAttributeResolver {
return AtsUtilServer.getArtifact(orcsApi, atsObject);
}
+ public ArtifactReadable getArtifact(IOseeBranch branch, IArtifactToken artifactToken) {
+ return AtsUtilServer.getArtifact(orcsApi, branch, artifactToken);
+ }
+
public void start() throws OseeCoreException {
Conditions.checkNotNull(orcsApi, "OrcsApi");
System.out.println("ATS - AtsAttributeResolverServiceImpl started");
@@ -199,4 +206,26 @@ public class AtsAttributeResolverServiceImpl implements IAttributeResolver {
"Invalid: Must use deleteSoleAttribute(IAtsWorkItem workItem, IAttributeType attributeType, IAtsChangeSet changes)");
}
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> Collection<IAttribute<T>> getAttributes(IOseeBranch branch, IArtifactToken artifact, IAttributeType attributeType) {
+ Collection<IAttribute<T>> attrs = new ArrayList<IAttribute<T>>();
+ for (AttributeReadable<Object> attr : getArtifact(branch, artifact).getAttributes(attributeType)) {
+ attrs.add(new AttributeWrapper<T>((AttributeReadable<T>) attr));
+ }
+ return attrs;
+ }
+
+ @Override
+ public void addAttribute(IOseeBranch branch, IArtifactToken artifact, IAttributeType attributeType, String value) {
+ // Sets on Server need to be through transaction
+ throw new OseeStateException(
+ "Invalid: Must use addAttribute(IAtsWorkItem workItem, IAttributeType attributeType, IAtsChangeSet changes)");
+ }
+
+ @Override
+ public List<String> getAttributesToStringList(IOseeBranch branch, IArtifactToken artifact, IAttributeType attributeType) {
+ return getArtifact(branch, artifact).getAttributeValues(attributeType);
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsBranchServiceImpl.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsBranchServiceImpl.java
index a75eb05746..86a445a34b 100644
--- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsBranchServiceImpl.java
+++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsBranchServiceImpl.java
@@ -118,4 +118,11 @@ public class AtsBranchServiceImpl extends AbstractAtsBranchService {
return branch;
}
+ @Override
+ public IOseeBranch getBranch(Long uuidL) {
+ BranchQuery query = orcsApi.getQueryFactory(null).branchQuery();
+ BranchReadable branchReadable = query.andLocalId(uuidL.intValue()).getResults().getExactlyOne();
+ return branchReadable;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsUtilServer.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsUtilServer.java
index 525b941b5d..55dbab167c 100644
--- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsUtilServer.java
+++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsUtilServer.java
@@ -15,6 +15,7 @@ import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.workflow.IAttribute;
import org.eclipse.osee.ats.core.util.ArtifactIdWrapper;
import org.eclipse.osee.ats.core.util.AttributeIdWrapper;
+import org.eclipse.osee.framework.core.data.IArtifactToken;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -61,4 +62,8 @@ public class AtsUtilServer {
return orcsApi.getQueryFactory(null).fromBranch(AtsUtilServer.getAtsBranch()).andGuid(guid).getResults().getExactlyOne();
}
+ public static ArtifactReadable getArtifact(OrcsApi orcsApi, IOseeBranch branch, IArtifactToken artifactToken) {
+ return orcsApi.getQueryFactory(null).fromBranch(branch).andGuid(artifactToken.getGuid()).getResults().getExactlyOne();
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF
index 3b02924699..158ab3abde 100644
--- a/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF
@@ -71,6 +71,7 @@ Import-Package: com.google.inject,
org.eclipse.osee.ats.api,
org.eclipse.osee.ats.api.ai,
org.eclipse.osee.ats.api.commit,
+ org.eclipse.osee.ats.api.context,
org.eclipse.osee.ats.api.data,
org.eclipse.osee.ats.api.ev,
org.eclipse.osee.ats.api.notify,
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AbstractAtsConfig2Data.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AbstractAtsConfig2Data.java
index fddfd4fbf9..c0f9484ffa 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AbstractAtsConfig2Data.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AbstractAtsConfig2Data.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.ats.config;
import java.util.Collection;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
+import org.eclipse.osee.ats.core.client.util.AtsChangeSet;
import org.eclipse.osee.ats.core.workdef.WorkDefinitionSheet;
import org.eclipse.osee.framework.core.util.XResultData;
@@ -49,4 +50,8 @@ public abstract class AbstractAtsConfig2Data {
public abstract void performPostConfig(IAtsChangeSet changes, AbstractAtsConfig2Data data);
+ public void performPreConfig(AtsChangeSet changes, AbstractAtsConfig2Data data) {
+ // for extension
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsDatabaseConfig.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsDatabaseConfig.java
index 6818b6a237..ee1673572f 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsDatabaseConfig.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsDatabaseConfig.java
@@ -66,6 +66,10 @@ public class AtsDatabaseConfig implements IDbInitializationTask {
public static void createAtsFolders() throws OseeCoreException {
IOseeBranch atsBranch = AtsUtilCore.getAtsBranch();
+ createAtsFolders(atsBranch);
+ }
+
+ public static void createAtsFolders(IOseeBranch atsBranch) throws OseeCoreException {
SkynetTransaction transaction = TransactionManager.createTransaction(atsBranch, "Create ATS Folders");
Artifact headingArt = OseeSystemArtifacts.getOrCreateArtifact(AtsArtifactToken.HeadingFolder, atsBranch);
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsNewBranchConfigNavigateItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsNewBranchConfigNavigateItem.java
new file mode 100644
index 0000000000..d19fbf0e92
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsNewBranchConfigNavigateItem.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.ats.config;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.osee.ats.core.client.config.AtsArtifactToken;
+import org.eclipse.osee.ats.core.client.util.AtsChangeSet;
+import org.eclipse.osee.ats.core.util.AtsUtilCore;
+import org.eclipse.osee.ats.core.workdef.WorkDefinitionSheet;
+import org.eclipse.osee.ats.internal.Activator;
+import org.eclipse.osee.ats.workdef.AtsWorkDefinitionSheetProviders;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.data.TokenFactory;
+import org.eclipse.osee.framework.core.enums.CoreBranches;
+import org.eclipse.osee.framework.core.util.XResultData;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.OseeSystemArtifacts;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItemAction;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+
+/**
+ * Create ATS Configuration. See {@link AtsConfig2DataExample} for details.
+ *
+ * @author Donald G. Dunne
+ */
+public class AtsNewBranchConfigNavigateItem extends XNavigateItemAction {
+
+ public AtsNewBranchConfigNavigateItem(XNavigateItem parent) {
+ super(parent, "ATS New Branch Config", FrameworkImage.GEAR);
+ }
+
+ @Override
+ public void run(TableLoadOption... tableLoadOptions) throws Exception {
+
+ IOseeBranch branch = TokenFactory.createBranch("AAMrhl4ycAhM26BblpwA", "ATS Test");
+ AtsUtilCore.setBranch(branch);
+
+ AtsChangeSet changes = new AtsChangeSet(getName());
+ XResultData results = new XResultData(false);
+ Artifact folder = createAtsFolders(branch, changes);
+
+ List<WorkDefinitionSheet> sheets = new ArrayList<WorkDefinitionSheet>();
+
+ File supportFile =
+ AtsWorkDefinitionSheetProviders.getSupportFile(Activator.PLUGIN_ID, "support/AtsBranchConfig.ats");
+ sheets.add(new WorkDefinitionSheet("AtsBranchConfig", supportFile,
+ org.eclipse.osee.ats.api.data.AtsArtifactToken.AtsBranchConfig));
+
+ Set<String> stateNames = new HashSet<String>();
+ AtsWorkDefinitionSheetProviders.importWorkDefinitionSheets(results, changes, folder, sheets, stateNames);
+ AtsWorkDefinitionSheetProviders.createStateNameArtifact(stateNames, folder, changes);
+ changes.execute();
+
+ AtsUtilCore.setBranch(CoreBranches.COMMON);
+ }
+
+ public static Artifact createAtsFolders(IOseeBranch atsBranch, AtsChangeSet changes) throws OseeCoreException {
+
+ Artifact headingArt = OseeSystemArtifacts.getOrCreateArtifact(AtsArtifactToken.HeadingFolder, atsBranch);
+ if (!headingArt.hasParent()) {
+ Artifact rootArt = OseeSystemArtifacts.getDefaultHierarchyRootArtifact(atsBranch);
+ rootArt.addChild(headingArt);
+ changes.add(rootArt);
+ }
+ return headingArt;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/context/AtsContextLoadListener.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/context/AtsContextLoadListener.java
new file mode 100644
index 0000000000..e202d47e26
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/context/AtsContextLoadListener.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.ats.context;
+
+import org.eclipse.osee.ats.api.context.AtsContextUtil;
+import org.eclipse.osee.ats.api.context.IAtsContextLoadListener;
+import org.eclipse.osee.ats.core.AtsCore;
+import org.eclipse.osee.ats.internal.AtsClientService;
+import org.eclipse.osee.framework.skynet.core.OseeSystemArtifacts;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsContextLoadListener implements IAtsContextLoadListener {
+
+ @Override
+ public void switchToContext(String contextUuid, String contextName) {
+ // decache ats objects
+ System.setProperty(AtsContextUtil.ATS_SYSTEM_CURRENT_CONTEXT_UUID, contextUuid);
+ }
+
+ @Override
+ public void createNewContextBranch() {
+ // create baseline branch
+ // copy over user artifacts
+ // create default work definitions
+ // create default configuration
+ // loadContext(branch.getUuid(), contextName);
+ }
+
+ @Override
+ public void store() throws Exception {
+ AtsCore.getContextService().writeToStore();
+ OseeSystemArtifacts.getGlobalPreferenceArtifact().persist("Persiste AtsContext config");
+ }
+
+ @Override
+ public void storeAsDefault(String uuid) throws Exception {
+ AtsCore.getContextService().read();
+ AtsCore.getContextService().setUserContextUuid(
+ AtsClientService.get().getUserAdmin().getCurrentUser().getUserId(), uuid);
+ AtsCore.getContextService().writeToStore();
+ OseeSystemArtifacts.getGlobalPreferenceArtifact().persist("Persist AtsContext user default");
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/context/AtsContextUi.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/context/AtsContextUi.java
new file mode 100644
index 0000000000..2df41c394d
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/context/AtsContextUi.java
@@ -0,0 +1,155 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.ats.context;
+
+import java.util.Set;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.osee.ats.AtsImage;
+import org.eclipse.osee.ats.api.context.AtsContextUtil;
+import org.eclipse.osee.ats.api.context.IAtsContextLoadListener;
+import org.eclipse.osee.ats.api.context.IAtsContextService;
+import org.eclipse.osee.ats.core.client.util.AtsUtilClient;
+import org.eclipse.osee.ats.internal.Activator;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryDialogWithBranchSelect;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+
+public class AtsContextUi {
+
+ private final IAtsContextService context;
+ private final IAtsContextLoadListener loadListener;
+
+ public AtsContextUi(IAtsContextService context, IAtsContextLoadListener loadListener) {
+ this.context = context;
+ this.loadListener = loadListener;
+ }
+
+ public void createContextAction(final IMenuManager mm) {
+ for (String uuid : context.getContextUuids()) {
+ createContextActionItem(mm, uuid, context.getContextName(uuid));
+ }
+
+ mm.add(new Separator());
+
+ Action action2 = new Action("Store Current Context as Default") {
+ @Override
+ public void run() {
+ storeCurrentAsDefault();
+ }
+ };
+ action2.setImageDescriptor(ImageManager.getImageDescriptor(AtsImage.CENTER));
+ mm.add(action2);
+
+ mm.add(new Separator());
+
+ Action action = new Action("Configure Context Branch") {
+ @Override
+ public void run() {
+ if (configureContextBranch()) {
+ try {
+ loadListener.store();
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, "Exception configuring context branch", ex);
+ }
+ }
+ }
+ };
+ action.setImageDescriptor(ImageManager.getImageDescriptor(AtsImage.CENTER));
+ mm.add(action);
+
+ action = new Action("Remove Context Branch Configuration") {
+ @Override
+ public void run() {
+ removeContext();
+ }
+ };
+ action.setImageDescriptor(ImageManager.getImageDescriptor(AtsImage.CENTER));
+ mm.add(action);
+
+ mm.add(new Separator());
+
+ action = new Action("Create New Context Branch") {
+ @Override
+ public void run() {
+ if (!AtsUtilClient.isAtsAdmin()) {
+ AWorkbench.popup("Admin-Only Function");
+ return;
+ }
+ loadListener.createNewContextBranch();
+ }
+ };
+ action.setImageDescriptor(ImageManager.getImageDescriptor(AtsImage.CENTER));
+ mm.add(action);
+
+ }
+
+ protected void storeCurrentAsDefault() {
+ String currentUuid = System.getProperty(AtsContextUtil.ATS_SYSTEM_CURRENT_CONTEXT_UUID);
+ try {
+ loadListener.storeAsDefault(currentUuid);
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, "Exception storing default context branch", ex);
+ }
+ }
+
+ protected void removeContext() {
+ if (!AtsUtilClient.isAtsAdmin()) {
+ AWorkbench.popup("Admin-Only Function");
+ return;
+ }
+ AWorkbench.popup("No Implemented");
+ }
+
+ protected boolean configureContextBranch() {
+ boolean success = false;
+ if (!AtsUtilClient.isAtsAdmin()) {
+ AWorkbench.popup("Admin-Only Function");
+ } else {
+ EntryDialogWithBranchSelect dialog =
+ new EntryDialogWithBranchSelect("Configure ATS Context Branch",
+ "Enter Unique Context Name and Select Existing Branch");
+ if (dialog.open() == 0) {
+ Set<String> ids = context.getContextUuids();
+ IOseeBranch branch = dialog.getBranch();
+ String contextUuid = String.valueOf(branch.getUuid());
+ String contextName = dialog.getEntry();
+ if (!Strings.isValid(contextName)) {
+ AWorkbench.popup("Invalid Ats Context Name: [" + contextName + "]");
+ } else if (ids.contains(contextUuid)) {
+ AWorkbench.popup("Branch already an Ats Context with id: " + contextUuid);
+ } else if (context.getContextName(contextUuid) != null) {
+ AWorkbench.popup("Branch already an Ats Context named: " + context.getContextName(contextUuid));
+ } else {
+ context.addContext(contextUuid, contextName);
+ success = true;
+ }
+ }
+ }
+ return success;
+ }
+
+ private void createContextActionItem(final IMenuManager mm, final String contextUuid, final String contextName) {
+ Action action = new Action(String.format("Select Context: %s (%s)", contextName, contextUuid)) {
+ @Override
+ public void run() {
+ loadListener.switchToContext(contextUuid, contextName);
+ }
+ };
+ action.setImageDescriptor(ImageManager.getImageDescriptor(AtsImage.CENTER));
+ mm.add(action);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java
index 8ef8144999..a486d61359 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java
@@ -30,6 +30,7 @@ import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.config.AtsConfig2ExampleNavigateItem;
+import org.eclipse.osee.ats.config.AtsNewBranchConfigNavigateItem;
import org.eclipse.osee.ats.config.ValidateAtsConfiguration;
import org.eclipse.osee.ats.config.editor.AtsConfigResultsEditorNavigateItem;
import org.eclipse.osee.ats.core.client.util.AtsUtilClient;
@@ -218,6 +219,7 @@ public final class AtsNavigateViewItems implements XNavigateViewItems, IXNavigat
new CreateActionUsingAllActionableItems(adminItems);
new AtsConfig2ExampleNavigateItem(adminItems);
+ new AtsNewBranchConfigNavigateItem(adminItems);
new DoesNotWorkItemAts(adminItems);
new XNavigateItemAction(adminItems, new OpenChangeReportByTransactionIdAction(), FrameworkImage.BRANCH_CHANGE);
new XNavigateItemAction(adminItems, new PurgeTransactionAction(), FrameworkImage.PURGE);
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/NavigateView.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/NavigateView.java
index caf1323a77..bc17c61301 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/NavigateView.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/NavigateView.java
@@ -22,8 +22,10 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osee.ats.actions.MyFavoritesAction;
import org.eclipse.osee.ats.actions.MyWorldAction;
@@ -32,8 +34,12 @@ import org.eclipse.osee.ats.actions.NewGoal;
import org.eclipse.osee.ats.actions.OpenChangeReportByIdAction;
import org.eclipse.osee.ats.actions.OpenWorkflowByIdAction;
import org.eclipse.osee.ats.actions.OpenWorldByIdAction;
+import org.eclipse.osee.ats.context.AtsContextLoadListener;
+import org.eclipse.osee.ats.context.AtsContextUi;
+import org.eclipse.osee.ats.core.AtsCore;
import org.eclipse.osee.ats.core.client.config.AtsBulkLoad;
import org.eclipse.osee.ats.core.client.util.AtsUtilClient;
+import org.eclipse.osee.ats.core.util.AtsUtilCore;
import org.eclipse.osee.ats.help.ui.AtsHelpContext;
import org.eclipse.osee.ats.internal.Activator;
import org.eclipse.osee.ats.internal.AtsClientService;
@@ -41,7 +47,9 @@ import org.eclipse.osee.ats.search.AtsQuickSearchComposite;
import org.eclipse.osee.framework.core.client.ClientSessionManager;
import org.eclipse.osee.framework.core.operation.OperationBuilder;
import org.eclipse.osee.framework.core.operation.Operations;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
import org.eclipse.osee.framework.ui.plugin.util.HelpUtil;
import org.eclipse.osee.framework.ui.plugin.xnavigate.IXNavigateEventListener;
import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateEventManager;
@@ -84,6 +92,7 @@ public class NavigateView extends ViewPart implements IXNavigateEventListener {
private String savedFilterStr;
private AtsNavigateComposite xNavComp;
private Composite parent;
+ private Label contextLabel;
private LoadingComposite loadingComposite;
@Override
@@ -193,12 +202,46 @@ public class NavigateView extends ViewPart implements IXNavigateEventListener {
}
userLabel.setText(str);
userLabel.setToolTipText(str);
+
+ boolean changed = updateContextName();
+ if (changed) {
+ parent.getParent().layout(true);
+ parent.layout(true);
+ }
}
};
Operations.scheduleJob(job, false, Job.SHORT, null);
}
}
+ /**
+ * @return true if label updated or deleted
+ */
+ private boolean updateContextName() {
+ String contextName = null;
+ if (!AtsUtilCore.isArtifactConfig()) {
+ contextName = BranchManager.getBranch(AtsUtilCore.getAtsBranch()).getName();
+ }
+ // AtsCore.getContextService().getContextName(
+ // AtsCore.getContextService().getUserContextUuid(
+ // AtsClientService.get().getUserAdmin().getCurrentUser().getUserId()));
+ boolean labelAddOrDeleted = false;
+ if (Strings.isValid(contextName)) {
+ if (contextLabel == null) {
+ contextLabel = new Label(xNavComp, SWT.None);
+ contextLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false));
+ labelAddOrDeleted = true;
+ }
+ contextLabel.setText(contextName);
+ } else {
+ if (contextLabel != null) {
+ contextLabel.dispose();
+ labelAddOrDeleted = true;
+ }
+ }
+ return labelAddOrDeleted;
+ }
+
@Override
public void refresh(XNavigateItem item) {
if (xNavComp != null && Widgets.isAccessible(xNavComp.getFilteredTree()) && Widgets.isAccessible(xNavComp.getFilteredTree().getViewer().getTree())) {
@@ -252,14 +295,28 @@ public class NavigateView extends ViewPart implements IXNavigateEventListener {
toolbarManager.add(new OpenWorldByIdAction());
toolbarManager.add(new OpenWorkflowByIdAction());
toolbarManager.add(new NewAction());
- getViewSite().getActionBars().updateActionBars();
+ toolbarManager.update(true);
IActionBars bars = getViewSite().getActionBars();
IMenuManager mm = bars.getMenuManager();
+ mm.removeAll();
mm.add(new NewAction());
mm.add(new NewGoal());
- toolbarManager.update(true);
+ MenuManager subMenu = new MenuManager("ATS Context", null);
+ subMenu.setRemoveAllWhenShown(true);
+ subMenu.addMenuListener(new IMenuListener() {
+
+ @Override
+ public void menuAboutToShow(IMenuManager manager) {
+ manager.removeAll();
+ AtsContextUi contextUi = new AtsContextUi(AtsCore.getContextService(), new AtsContextLoadListener());
+ contextUi.createContextAction(manager);
+ }
+ });
+ mm.add(subMenu);
+
+ getViewSite().getActionBars().updateActionBars();
}
public static NavigateView getNavigateView() {
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/AtsWorkDefinitionSheetProviders.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/AtsWorkDefinitionSheetProviders.java
index b46ba1f27d..6c8245b33f 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/AtsWorkDefinitionSheetProviders.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/AtsWorkDefinitionSheetProviders.java
@@ -128,7 +128,7 @@ public final class AtsWorkDefinitionSheetProviders {
trans.addArtifact(stateNameArt);
}
- private static Artifact createStateNameArtifact(Set<String> stateNames, Artifact folder, IAtsChangeSet changes) throws OseeCoreException {
+ public static Artifact createStateNameArtifact(Set<String> stateNames, Artifact folder, IAtsChangeSet changes) throws OseeCoreException {
Artifact stateNameArt =
ArtifactTypeManager.addArtifact(org.eclipse.osee.ats.api.data.AtsArtifactToken.WorkDef_State_Names,
AtsUtilCore.getAtsBranch());
diff --git a/plugins/org.eclipse.osee.ats/support/AtsBranchConfig.ats b/plugins/org.eclipse.osee.ats/support/AtsBranchConfig.ats
new file mode 100644
index 0000000000..884e14e87e
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/support/AtsBranchConfig.ats
@@ -0,0 +1,148 @@
+
+userDefinition "Joe Smith" GetOrCreate {
+ userId "Joe Smith"
+}
+
+userDefinition "Kay Jones" GetOrCreate {
+ userId "Kay Jones"
+}
+
+teamDefinition "Teams" GetOrCreate {
+ guid "AAABER+35b4A8O7WHrXTiA"
+ children {
+ teamDefinition "AtsBranchConfig" GetOrCreate {
+ guid "AGZs2EW4tWRkIv3OqfAA"
+ children {
+
+ teamDefinition "AtsBranchConfig Software" {
+ guid "AGZs2EW0tWRkIv3OqfAA"
+ lead named "Smith, Joe"
+ member named "Smith, Joe"
+ workDefinition "WorkDef_Team_AtsBranchConfigExample"
+ }
+ teamDefinition "AtsBranchConfig Requirements" {
+ guid "AGZs2EU1d3db9M57WJQA"
+ lead named "Smith, Joe"
+ member named "Smith, Joe"
+ workDefinition "WorkDef_Team_AtsBranchConfigExample"
+ }
+ }
+ }
+ }
+}
+
+
+actionableItem "Actionable Items" GetOrCreate {
+ guid "AAABER+37QEA8O7WSQaqJQ"
+ actionable False
+ children {
+ actionableItem "AtsBranchConfig" GetOrCreate {
+ guid "ATujHGY1XBYDqS69o7gA"
+ children {
+ actionableItem "AtsBranchConfig Software" {
+ guid "ATujHGZtIyQY9FsY3LQA"
+ team "AtsBranchConfig Software"
+ }
+ actionableItem "AtsBranchConfig Test" {
+ guid "ATujHGafr1VA3ARazkQA"
+ team "AtsBranchConfig Software"
+ }
+ actionableItem "AtsBranchConfig Requirements" {
+ guid "ATujHGbSOyXT3RIHWSQA"
+ team "AtsBranchConfig Requirements"
+ }
+ }
+ }
+ }
+}
+
+workDefinition "WorkDef_AtsBranchConfig" {
+ id "WorkDef_AtsBranchConfig"
+ startState "Analyze"
+
+ widgetDefinition "Need By" {
+ attributeName "ats.Need By"
+ xWidgetName "XDateDam"
+ option HORIZONTAL_LABEL
+ }
+
+ widgetDefinition "Estimated Hours" {
+ attributeName "ats.Estimated Hours"
+ xWidgetName "XFloatDam"
+ option REQUIRED_FOR_TRANSITION
+ }
+
+ widgetDefinition "Title" {
+ attributeName "Name"
+ xWidgetName "XTextDam"
+ option REQUIRED_FOR_TRANSITION
+ }
+
+ widgetDefinition "Description" {
+ attributeName "ats.Description"
+ xWidgetName "XTextDam"
+ option FILL_VERTICALLY
+ option REQUIRED_FOR_TRANSITION
+ }
+
+ widgetDefinition "Resolution" {
+ attributeName "ats.Resolution"
+ xWidgetName "XTextDam"
+ option FILL_VERTICALLY
+ }
+
+ widgetDefinition "Proposed Resolution" {
+ attributeName "ats.Proposed Resolution"
+ xWidgetName "XTextDam"
+ option FILL_VERTICALLY
+ }
+
+ state "Analyze" {
+ type Working
+ ordinal 1
+ to "Cancelled"
+ to "Implement" AsDefault
+ rule RequireStateHourSpentPrompt
+ layout {
+ widget "Title"
+ widget "Description"
+ widget "Proposed Resolution"
+ composite {
+ numColumns 6
+ attributeWidget "ats.Change Type"
+ attributeWidget "ats.Priority"
+ attributeWidget "ats.Need By"
+ }
+ attributeWidget "ats.Estimated Hours"
+ }
+ }
+
+ state "Implement" {
+ type Working
+ ordinal 2
+ to "Cancelled"
+ to "Completed" AsDefault
+ to "Analyze" OverrideAttributeValidation
+ rule RequireStateHourSpentPrompt
+ layout {
+ attributeWidget "ats.Work Package"
+ attributeWidget "ats.Estimated Completion Date"
+ widget "Resolution"
+ }
+ }
+
+ state "Completed" {
+ type Completed
+ ordinal 3
+ to "Implement" OverrideAttributeValidation
+ rule AddDecisionValidateBlockingReview
+ }
+
+ state "Cancelled" {
+ type Cancelled
+ ordinal 4
+ to "Analyze" OverrideAttributeValidation
+ to "Implement" OverrideAttributeValidation
+ }
+}
+
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreArtifactTokens.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreArtifactTokens.java
index a9669a3e14..21314c81d9 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreArtifactTokens.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreArtifactTokens.java
@@ -20,6 +20,7 @@ public final class CoreArtifactTokens {
public static IArtifactToken GroupRoot = TokenFactory.createArtifactToken("AExdLMeOTGhhPY4CyvQA", "Root Artifact", CoreArtifactTypes.UniversalGroup);
public static IArtifactToken Everyone = TokenFactory.createArtifactToken("AAABEbn4DKoAaR82FZsL3A", "Everyone", CoreArtifactTypes.UserGroup);
public static IArtifactToken OseeAdmin = TokenFactory.createArtifactToken("AAABHaItmnUAG6ZAYlFKag", "OseeAdmin", CoreArtifactTypes.UserGroup);
+ public static final IArtifactToken GlobalPreferences = TokenFactory.createArtifactToken("AAABE8T1j3AA8O7WNsu89A", "Global Preferences", CoreArtifactTypes.GlobalPreferences);;
// @formatter:on
private CoreArtifactTokens() {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/OseeSystemArtifacts.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/OseeSystemArtifacts.java
index 563599aefe..5aee35ca6e 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/OseeSystemArtifacts.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/OseeSystemArtifacts.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.framework.skynet.core;
import org.eclipse.osee.framework.core.data.IArtifactToken;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTokens;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
import org.eclipse.osee.framework.core.model.Branch;
@@ -43,8 +44,7 @@ public final class OseeSystemArtifacts {
}
public static Artifact createGlobalPreferenceArtifact() throws OseeCoreException {
- return ArtifactTypeManager.addArtifact(CoreArtifactTypes.GlobalPreferences, BranchManager.getCommonBranch(),
- CoreArtifactTypes.GlobalPreferences.getName());
+ return ArtifactTypeManager.addArtifact(CoreArtifactTokens.GlobalPreferences, BranchManager.getCommonBranch());
}
/**
diff --git a/plugins/org.eclipse.osee.support.config/launchConfig/OSEE_IDE_[localhost].launch b/plugins/org.eclipse.osee.support.config/launchConfig/OSEE_IDE_[localhost].launch
index 54446f74c5..ce4537e43b 100644
--- a/plugins/org.eclipse.osee.support.config/launchConfig/OSEE_IDE_[localhost].launch
+++ b/plugins/org.eclipse.osee.support.config/launchConfig/OSEE_IDE_[localhost].launch
@@ -23,7 +23,7 @@
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -debug"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx1024M&#13;&#10;-XX:MaxPermSize=256m&#13;&#10;-Dosee.log.default=INFO&#13;&#10;-Dosee.application.server=http://localhost:8089&#13;&#10;-Dosee.authentication.protocol=demo"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx1024M&#13;&#10;-XX:MaxPermSize=256m&#13;&#10;-Dosee.log.default=INFO&#13;&#10;-Dosee.application.server=http://localhost:8089&#13;&#10;-Dosee.authentication.protocol=demo&#13;&#10;-DAtsBranch=AAMrhl4ycAhM26BblpwA"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.osee.framework.ui.product.osee"/>
<booleanAttribute key="restart" value="false"/>

Back to the top