summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2017-12-08 12:55:19 -0500
committerdonald.g.dunne2017-12-08 12:55:19 -0500
commit290acdd6cf24fdf0a23949d3c0a508b2fcabb920 (patch)
tree1f115e273edadc1d158a418e1108bea479a69394
parentecfe2fa4e47a2b22a57e49f7843ac1e921c6d586 (diff)
downloadorg.eclipse.osee-290acdd6cf24fdf0a23949d3c0a508b2fcabb920.zip
org.eclipse.osee-290acdd6cf24fdf0a23949d3c0a508b2fcabb920.tar.gz
org.eclipse.osee-290acdd6cf24fdf0a23949d3c0a508b2fcabb920.tar.xz
Revert "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, 45 insertions, 67 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 2daf715..6d2dc98 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,7 +22,6 @@ 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 {
@@ -72,5 +71,4 @@ 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 53ada64..30a794e 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,21 +13,19 @@ 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.Id;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
/**
* @author Donald G Dunne
*/
public interface IAtsStateFactory {
- IAtsStateManager getStateManager(IAtsWorkItem workItem);
+ IAtsStateManager getStateManager(IAtsWorkItem workItem) throws OseeCoreException;
- void writeToStore(IAtsUser atsUser, IAtsWorkItem workItem, IAtsChangeSet changes);
+ IAtsStateManager getStateManager(IAtsWorkItem workItem, boolean load);
- void load(IAtsWorkItem workItem, IAtsStateManager stateMgr);
-
- void clearStateManager(Id id);
+ void writeToStore(IAtsUser atsUser, IAtsWorkItem workItem, IAtsChangeSet changes) throws OseeCoreException;
- void setStateMgr(IAtsWorkItem workItem, IAtsStateManager stateMgr);
+ void load(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 4dcd4c2..2c237fc 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, this);
+ storeService = new AtsStoreService(workItemFactory, getUserServiceClient(), jdbcService);
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 b685951..3eec45f 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,7 +20,6 @@ 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;
@@ -34,7 +33,6 @@ 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;
@@ -51,13 +49,11 @@ 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, IAtsServices services) {
+ public AtsStoreService(IAtsWorkItemFactory workItemFactory, IAtsUserService userService, JdbcService jdbcService) {
this.workItemFactory = workItemFactory;
this.userService = userService;
this.jdbcService = jdbcService;
- this.services = services;
}
@Override
@@ -199,14 +195,4 @@ 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 9f74a1f..3d96e1a 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,6 +36,7 @@ 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;
@@ -87,6 +88,9 @@ 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);
@@ -155,6 +159,7 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
parentAction = null;
parentAwa = null;
parentTeamArt = null;
+ stateMgr = null;
atsLog = null;
}
@@ -680,7 +685,15 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
@Override
public IAtsStateManager getStateMgr() {
- return AtsClientService.get().getStateFactory().getStateManager(this);
+ 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;
}
@Override
@@ -773,9 +786,8 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
}
@Override
- public void setStateManager(IAtsStateManager stateMgr) {
- Conditions.assertNotNull(stateMgr, "StateManager");
- AtsClientService.get().getStateFactory().setStateMgr(this, stateMgr);
+ public void setStateManager(IAtsStateManager stateManager) {
+ this.stateMgr = stateManager;
}
/**
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 c35c3ac..862d967 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,8 +10,6 @@
*******************************************************************************/
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;
@@ -20,8 +18,7 @@ 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.core.data.TransactionId;
-import org.eclipse.osee.framework.jdk.core.type.Id;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
/**
* @author Donald G. Dunne
@@ -31,8 +28,6 @@ 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;
@@ -42,20 +37,21 @@ public class AtsStateFactory implements IAtsStateFactory {
@Override
public IAtsStateManager getStateManager(IAtsWorkItem workItem) {
- 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));
+ 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) {
StateManagerStore.load(workItem, stateMgr, services.getAttributeResolver(), workStateFactory);
}
return stateMgr;
}
@Override
- public void writeToStore(IAtsUser asUser, IAtsWorkItem workItem, IAtsChangeSet changes) {
+ public void writeToStore(IAtsUser asUser, IAtsWorkItem workItem, IAtsChangeSet changes) throws OseeCoreException {
StateManagerStore.writeToStore(asUser, workItem, (StateManager) workItem.getStateMgr(),
services.getAttributeResolver(), changes, workStateFactory);
}
@@ -65,15 +61,4 @@ 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 8d9b7e0..4908220 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,6 +37,7 @@ 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;
/**
@@ -45,6 +46,7 @@ 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;
@@ -135,12 +137,20 @@ public class WorkItem extends AtsObject implements IAtsWorkItem {
@Override
public IAtsStateManager getStateMgr() {
- return services.getStateFactory().getStateManager(this);
+ 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;
}
@Override
public void setStateManager(IAtsStateManager stateMgr) {
- services.getStateFactory().setStateMgr(this, stateMgr);
+ Conditions.assertNotNull(stateMgr, "stateMgr");
+ this.stateMgr = 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 6fb6aef..dba4c28 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,7 +36,6 @@ 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;
@@ -188,14 +187,4 @@ 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;
- }
-
}