Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2017-12-07 23:09:34 -0500
committerdonald.g.dunne2017-12-07 23:09:34 -0500
commitfa064121111ef5bc4e76194c8cd151350aa6c795 (patch)
tree325fca89a3bc83b54cc5c9517795834858f0ead7
parentfcb73beefcc2ad8a87598624ec3efdc4850f0997 (diff)
downloadorg.eclipse.osee-fa064121111ef5bc4e76194c8cd151350aa6c795.tar.gz
org.eclipse.osee-fa064121111ef5bc4e76194c8cd151350aa6c795.tar.xz
org.eclipse.osee-fa064121111ef5bc4e76194c8cd151350aa6c795.zip
bug[ats_TW5390]: Task generation results in missing attributes
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsStoreService.java2
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/state/IAtsStateFactory.java12
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java2
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsStoreService.java16
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/AbstractWorkflowArtifact.java20
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/AtsStateFactory.java35
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/WorkItem.java14
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsStoreServiceImpl.java11
8 files changed, 67 insertions, 45 deletions
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsStoreService.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsStoreService.java
index 6d2dc9873f..2daf7151a6 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsStoreService.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsStoreService.java
@@ -22,6 +22,7 @@ import org.eclipse.osee.framework.core.data.ArtifactTypeId;
import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.data.AttributeTypeToken;
import org.eclipse.osee.framework.core.data.IArtifactType;
+import org.eclipse.osee.framework.core.data.TransactionId;
public interface IAtsStoreService {
@@ -71,4 +72,5 @@ public interface IAtsStoreService {
boolean isArtifactTypeInheritsFrom(IArtifactType artifactType, IArtifactType baseArtifactType);
+ TransactionId getTransactionId(IAtsWorkItem workItem);
}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/state/IAtsStateFactory.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/state/IAtsStateFactory.java
index 30a794e5b3..53ada64ceb 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/state/IAtsStateFactory.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/state/IAtsStateFactory.java
@@ -13,19 +13,21 @@ package org.eclipse.osee.ats.api.workflow.state;
import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.type.Id;
/**
* @author Donald G Dunne
*/
public interface IAtsStateFactory {
- IAtsStateManager getStateManager(IAtsWorkItem workItem) throws OseeCoreException;
+ IAtsStateManager getStateManager(IAtsWorkItem workItem);
- IAtsStateManager getStateManager(IAtsWorkItem workItem, boolean load);
-
- void writeToStore(IAtsUser atsUser, IAtsWorkItem workItem, IAtsChangeSet changes) throws OseeCoreException;
+ void writeToStore(IAtsUser atsUser, IAtsWorkItem workItem, IAtsChangeSet changes);
void load(IAtsWorkItem workItem, IAtsStateManager stateMgr);
+ void clearStateManager(Id id);
+
+ void setStateMgr(IAtsWorkItem workItem, IAtsStateManager stateMgr);
+
}
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 2c237fc7a1..4dcd4c24f5 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
@@ -132,7 +132,7 @@ public class AtsClientImpl extends AtsCoreServiceImpl implements IAtsClient {
logFactory = AtsCoreFactory.newLogFactory();
stateFactory = AtsCoreFactory.newStateFactory(getServices(), logFactory);
- storeService = new AtsStoreService(workItemFactory, getUserServiceClient(), jdbcService);
+ storeService = new AtsStoreService(workItemFactory, getUserServiceClient(), jdbcService, this);
queryService = new AtsQueryServiceImpl(this, jdbcService);
actionableItemManager = new ActionableItemManager(attributeResolverService, storeService, this);
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsStoreService.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsStoreService.java
index 3eec45f438..b685951ce1 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsStoreService.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsStoreService.java
@@ -20,6 +20,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.osee.ats.api.IAtsObject;
+import org.eclipse.osee.ats.api.IAtsServices;
import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.api.team.IAtsWorkItemFactory;
@@ -33,6 +34,7 @@ import org.eclipse.osee.framework.core.data.ArtifactTypeId;
import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.data.AttributeTypeToken;
import org.eclipse.osee.framework.core.data.IArtifactType;
+import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.model.type.ArtifactType;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
@@ -49,11 +51,13 @@ public class AtsStoreService implements IAtsStoreService {
private final IAtsWorkItemFactory workItemFactory;
private final IAtsUserService userService;
private final JdbcService jdbcService;
+ private final IAtsServices services;
- public AtsStoreService(IAtsWorkItemFactory workItemFactory, IAtsUserService userService, JdbcService jdbcService) {
+ public AtsStoreService(IAtsWorkItemFactory workItemFactory, IAtsUserService userService, JdbcService jdbcService, IAtsServices services) {
this.workItemFactory = workItemFactory;
this.userService = userService;
this.jdbcService = jdbcService;
+ this.services = services;
}
@Override
@@ -195,4 +199,14 @@ public class AtsStoreService implements IAtsStoreService {
return ArtifactTypeManager.inheritsFrom(artifactType, baseArtifactType);
}
+ @Override
+ public TransactionId getTransactionId(IAtsWorkItem workItem) {
+ TransactionId transId = TransactionId.SENTINEL;
+ ArtifactId artifact = services.getArtifact(workItem.getStoreObject());
+ if (artifact instanceof Artifact) {
+ transId = ((Artifact) artifact).getTransaction();
+ }
+ return transId;
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/AbstractWorkflowArtifact.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/AbstractWorkflowArtifact.java
index 3d96e1ae60..9f74a1f7f4 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/AbstractWorkflowArtifact.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/AbstractWorkflowArtifact.java
@@ -36,7 +36,6 @@ import org.eclipse.osee.ats.api.workflow.IAtsGoal;
import org.eclipse.osee.ats.api.workflow.log.IAtsLog;
import org.eclipse.osee.ats.api.workflow.log.IAtsLogItem;
import org.eclipse.osee.ats.api.workflow.log.LogType;
-import org.eclipse.osee.ats.api.workflow.note.IAtsWorkItemNotes;
import org.eclipse.osee.ats.api.workflow.state.IAtsStateManager;
import org.eclipse.osee.ats.core.client.action.ActionArtifact;
import org.eclipse.osee.ats.core.client.artifact.AbstractAtsArtifact;
@@ -88,9 +87,6 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
protected ActionArtifact parentAction;
private IAtsLog atsLog;
private TransactionId atsLogTx;
- private TransactionId stateMgrTransactionNumber;
- private IAtsWorkItemNotes atsNote;
- private IAtsStateManager stateMgr;
public AbstractWorkflowArtifact(String guid, BranchId branch, ArtifactTypeId artifactType) {
super(guid, branch, artifactType);
@@ -159,7 +155,6 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
parentAction = null;
parentAwa = null;
parentTeamArt = null;
- stateMgr = null;
atsLog = null;
}
@@ -685,15 +680,7 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
@Override
public IAtsStateManager getStateMgr() {
- if (stateMgr == null || getTransaction().notEqual(stateMgrTransactionNumber)) {
- try {
- stateMgr = AtsClientService.get().getStateFactory().getStateManager(this, isInDb());
- stateMgrTransactionNumber = getTransaction();
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
- return stateMgr;
+ return AtsClientService.get().getStateFactory().getStateManager(this);
}
@Override
@@ -786,8 +773,9 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
}
@Override
- public void setStateManager(IAtsStateManager stateManager) {
- this.stateMgr = stateManager;
+ public void setStateManager(IAtsStateManager stateMgr) {
+ Conditions.assertNotNull(stateMgr, "StateManager");
+ AtsClientService.get().getStateFactory().setStateMgr(this, stateMgr);
}
/**
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/AtsStateFactory.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/AtsStateFactory.java
index 862d96721f..c35c3aca96 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/AtsStateFactory.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/AtsStateFactory.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.osee.ats.core.internal.state;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.osee.ats.api.IAtsServices;
import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.user.IAtsUser;
@@ -18,7 +20,8 @@ import org.eclipse.osee.ats.api.workflow.log.IAtsLogFactory;
import org.eclipse.osee.ats.api.workflow.state.IAtsStateFactory;
import org.eclipse.osee.ats.api.workflow.state.IAtsStateManager;
import org.eclipse.osee.ats.api.workflow.state.IAtsWorkStateFactory;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.core.data.TransactionId;
+import org.eclipse.osee.framework.jdk.core.type.Id;
/**
* @author Donald G. Dunne
@@ -28,6 +31,8 @@ public class AtsStateFactory implements IAtsStateFactory {
private final IAtsWorkStateFactory workStateFactory;
private final IAtsLogFactory logFactory;
private final IAtsServices services;
+ Map<Id, IAtsStateManager> idToStateManager = new HashMap<>();
+ Map<Id, TransactionId> idToTransactionId = new HashMap<>();
public AtsStateFactory(IAtsServices services, IAtsWorkStateFactory workStateFactory, IAtsLogFactory logFactory) {
this.services = services;
@@ -37,21 +42,20 @@ public class AtsStateFactory implements IAtsStateFactory {
@Override
public IAtsStateManager getStateManager(IAtsWorkItem workItem) {
- StateManager stateMgr = new StateManager(workItem, logFactory, services);
- return stateMgr;
- }
-
- @Override
- public IAtsStateManager getStateManager(IAtsWorkItem workItem, boolean load) throws OseeCoreException {
- IAtsStateManager stateMgr = getStateManager(workItem);
- if (load) {
+ IAtsStateManager stateMgr = idToStateManager.get(workItem);
+ TransactionId transId = idToTransactionId.get(workItem);
+ TransactionId workItemTransaction = services.getStoreService().getTransactionId(workItem);
+ if (stateMgr == null || (workItemTransaction.isValid() && workItemTransaction.notEqual(transId))) {
+ stateMgr = new StateManager(workItem, logFactory, services);
+ idToStateManager.put(workItem, stateMgr);
+ idToTransactionId.put(workItem, services.getStoreService().getTransactionId(workItem));
StateManagerStore.load(workItem, stateMgr, services.getAttributeResolver(), workStateFactory);
}
return stateMgr;
}
@Override
- public void writeToStore(IAtsUser asUser, IAtsWorkItem workItem, IAtsChangeSet changes) throws OseeCoreException {
+ public void writeToStore(IAtsUser asUser, IAtsWorkItem workItem, IAtsChangeSet changes) {
StateManagerStore.writeToStore(asUser, workItem, (StateManager) workItem.getStateMgr(),
services.getAttributeResolver(), changes, workStateFactory);
}
@@ -61,4 +65,15 @@ public class AtsStateFactory implements IAtsStateFactory {
StateManagerStore.load(workItem, stateMgr, services.getAttributeResolver(), workStateFactory);
}
+ @Override
+ public void clearStateManager(Id id) {
+ idToStateManager.put(id, null);
+ }
+
+ @Override
+ public void setStateMgr(IAtsWorkItem workItem, IAtsStateManager stateMgr) {
+ idToStateManager.put(workItem, stateMgr);
+ idToTransactionId.put(workItem, services.getStoreService().getTransactionId(workItem));
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/WorkItem.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/WorkItem.java
index 4908220411..8d9b7e072b 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/WorkItem.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/WorkItem.java
@@ -37,7 +37,6 @@ import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.ArtifactToken;
import org.eclipse.osee.framework.core.data.ArtifactTypeId;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.logger.Log;
/**
@@ -46,7 +45,6 @@ import org.eclipse.osee.logger.Log;
public class WorkItem extends AtsObject implements IAtsWorkItem {
protected final ArtifactToken artifact;
- private IAtsStateManager stateMgr;
private IAtsLog atsLog;
private IWorkDefinitionMatch match;
protected final IAtsServices services;
@@ -137,20 +135,12 @@ public class WorkItem extends AtsObject implements IAtsWorkItem {
@Override
public IAtsStateManager getStateMgr() {
- if (stateMgr == null) {
- try {
- stateMgr = services.getStateFactory().getStateManager(this, true);
- } catch (OseeCoreException ex) {
- logger.error(ex, "Error getting stateManager for artifact[%s]", artifact);
- }
- }
- return stateMgr;
+ return services.getStateFactory().getStateManager(this);
}
@Override
public void setStateManager(IAtsStateManager stateMgr) {
- Conditions.assertNotNull(stateMgr, "stateMgr");
- this.stateMgr = stateMgr;
+ services.getStateFactory().setStateMgr(this, stateMgr);
}
@Override
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsStoreServiceImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsStoreServiceImpl.java
index dba4c286e1..6fb6aefc7e 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsStoreServiceImpl.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsStoreServiceImpl.java
@@ -36,6 +36,7 @@ import org.eclipse.osee.framework.core.data.ArtifactTypeId;
import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.data.AttributeTypeToken;
import org.eclipse.osee.framework.core.data.IArtifactType;
+import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.jdbc.JdbcService;
import org.eclipse.osee.orcs.data.ArtifactReadable;
@@ -187,4 +188,14 @@ public class AtsStoreServiceImpl implements IAtsStoreService {
return atsServer.getOrcsApi().getOrcsTypes().getArtifactTypes().inheritsFrom(artifactType, baseArtifactType);
}
+ @Override
+ public TransactionId getTransactionId(IAtsWorkItem workItem) {
+ TransactionId transId = TransactionId.SENTINEL;
+ ArtifactId artifact = atsServer.getArtifact(workItem.getStoreObject());
+ if (artifact instanceof ArtifactReadable) {
+ transId = ((ArtifactReadable) artifact).getTransaction();
+ }
+ return transId;
+ }
+
}

Back to the top