diff options
author | donald.g.dunne | 2016-08-31 15:18:06 +0000 |
---|---|---|
committer | Donald Dunne | 2016-09-06 22:07:04 +0000 |
commit | 1154a973ad7343dd863de638843e6faad3e3eafb (patch) | |
tree | 7419c524b812a9e83ae1186f0c27f3cf5f72a831 /plugins/org.eclipse.osee.ats.dsl.integration | |
parent | ecb158cc683dea1e5fca2d27399edee5327c4c19 (diff) | |
download | org.eclipse.osee-1154a973ad7343dd863de638843e6faad3e3eafb.tar.gz org.eclipse.osee-1154a973ad7343dd863de638843e6faad3e3eafb.tar.xz org.eclipse.osee-1154a973ad7343dd863de638843e6faad3e3eafb.zip |
bug[ats_ATS302825]: NR Alpha - Search by id is loading slower than release
- Move AtsAdmin to AtsConfigurations rest call
- Move WorkDef loading to AtsConfigurations
- Move AtsUser cache to AtsConfigurations
- Move Valid State Loading to AtsConfig and AtsConfigurations
- Remove need for separete valid state Artifact
- Improve loading of ATS Config Objects
Change-Id: I3c2119778c135678306e4464f18c4ab023823ab1
Diffstat (limited to 'plugins/org.eclipse.osee.ats.dsl.integration')
2 files changed, 38 insertions, 7 deletions
diff --git a/plugins/org.eclipse.osee.ats.dsl.integration/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.dsl.integration/META-INF/MANIFEST.MF index d159de0ffdf..265e1768fd4 100644 --- a/plugins/org.eclipse.osee.ats.dsl.integration/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.ats.dsl.integration/META-INF/MANIFEST.MF @@ -10,6 +10,7 @@ Bundle-ActivationPolicy: lazy Import-Package: org.eclipse.emf.common.util, org.eclipse.emf.ecore, org.eclipse.osee.ats.api, + org.eclipse.osee.ats.api.config, org.eclipse.osee.ats.api.review, org.eclipse.osee.ats.api.rule, org.eclipse.osee.ats.api.team, diff --git a/plugins/org.eclipse.osee.ats.dsl.integration/src/org/eclipse/osee/ats/dsl/integration/internal/AtsWorkDefinitionServiceImpl.java b/plugins/org.eclipse.osee.ats.dsl.integration/src/org/eclipse/osee/ats/dsl/integration/internal/AtsWorkDefinitionServiceImpl.java index 2a6904ecedb..09b1b4d43a7 100644 --- a/plugins/org.eclipse.osee.ats.dsl.integration/src/org/eclipse/osee/ats/dsl/integration/internal/AtsWorkDefinitionServiceImpl.java +++ b/plugins/org.eclipse.osee.ats.dsl.integration/src/org/eclipse/osee/ats/dsl/integration/internal/AtsWorkDefinitionServiceImpl.java @@ -14,9 +14,11 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.List; +import java.util.Map.Entry; import java.util.Set; import java.util.logging.Level; import org.eclipse.osee.ats.api.IAtsWorkItem; +import org.eclipse.osee.ats.api.config.IWorkDefinitionStringProvider; import org.eclipse.osee.ats.api.review.IAtsAbstractReview; import org.eclipse.osee.ats.api.user.IAtsUserService; import org.eclipse.osee.ats.api.workdef.IAtsCompositeLayoutItem; @@ -53,6 +55,7 @@ public class AtsWorkDefinitionServiceImpl implements IAtsWorkDefinitionService { private IAttributeResolver attrResolver; private IAtsUserService userService; private Log logger; + private IWorkDefinitionStringProvider workDefinitionStringProvider; public void setLogger(Log logger) { this.logger = logger; @@ -115,7 +118,13 @@ public class AtsWorkDefinitionServiceImpl implements IAtsWorkDefinitionService { @Override public IAtsWorkDefinition getWorkDef(String workDefId, XResultData resultData) throws Exception { Conditions.checkNotNullOrEmpty(workDefId, "workDefId"); - String workDefStr = workDefStore.loadWorkDefinitionString(workDefId); + String workDefStr = null; + if (workDefinitionStringProvider != null && workDefinitionStringProvider.getWorkDefIdToWorkDef() != null) { + workDefStr = workDefinitionStringProvider.getWorkDefIdToWorkDef().get(workDefId); + } + if (workDefStr == null) { + workDefStr = workDefStore.loadWorkDefinitionString(workDefId); + } Conditions.checkNotNullOrEmpty(workDefStr, "workDefStr"); AtsDsl atsDsl = ModelUtil.loadModel(workDefId + ".ats", workDefStr); ConvertAtsDslToWorkDefinition convert = @@ -253,23 +262,39 @@ public class AtsWorkDefinitionServiceImpl implements IAtsWorkDefinitionService { } @Override - public Collection<IAtsWorkDefinition> getAllWorkDefinitions(XResultData resultData) throws Exception { + public Collection<IAtsWorkDefinition> getAllWorkDefinitions(XResultData resultData) { List<IAtsWorkDefinition> workDefs = new ArrayList<>(); - for (Pair<String, String> entry : workDefStore.getWorkDefinitionStrings()) { - String name = entry.getFirst(); - String workDefStr = entry.getSecond(); + if (workDefinitionStringProvider != null && workDefinitionStringProvider.getWorkDefIdToWorkDef() != null) { + for (Entry<String, String> entry : workDefinitionStringProvider.getWorkDefIdToWorkDef().entrySet()) { + String name = entry.getKey(); + String workDefStr = entry.getValue(); + processWorkDef(resultData, workDefs, name, workDefStr); + } + } else { + for (Pair<String, String> entry : workDefStore.getWorkDefinitionStrings()) { + String name = entry.getFirst(); + String workDefStr = entry.getSecond(); + processWorkDef(resultData, workDefs, name, workDefStr); + } + } + return workDefs; + } + + private void processWorkDef(XResultData resultData, List<IAtsWorkDefinition> workDefs, String name, String workDefStr) { + try { AtsDsl atsDsl = ModelUtil.loadModel(name + ".ats", workDefStr); ConvertAtsDslToWorkDefinition convert = new ConvertAtsDslToWorkDefinition(name, atsDsl, resultData, attrResolver, userService); for (IAtsWorkDefinition workDef : convert.convert()) { workDefs.add(workDef); } + } catch (Exception ex) { + throw new OseeCoreException(ex); } - return workDefs; } @Override - public Collection<String> getAllValidStateNames(XResultData resultData) throws Exception { + public Collection<String> getAllValidStateNames(XResultData resultData) { Set<String> allValidStateNames = new HashSet<>(); for (IAtsWorkDefinition workDef : getAllWorkDefinitions(resultData)) { for (String stateName : getStateNames(workDef)) { @@ -281,4 +306,9 @@ public class AtsWorkDefinitionServiceImpl implements IAtsWorkDefinitionService { return allValidStateNames; } + @Override + public void setWorkDefinitionStringProvider(IWorkDefinitionStringProvider workDefinitionStringProvider) { + this.workDefinitionStringProvider = workDefinitionStringProvider; + } + } |