Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorddunne2009-05-21 20:31:31 +0000
committerddunne2009-05-21 20:31:31 +0000
commitecdde22adb9c74bb39ae56f54d47f170ad69025b (patch)
tree71cf37914bab5646e555c0da954d227fc9d504d5
parentce597adebb35bba16dc7fdad4f29690c1c9c0ab8 (diff)
downloadorg.eclipse.osee-ecdde22adb9c74bb39ae56f54d47f170ad69025b.tar.gz
org.eclipse.osee-ecdde22adb9c74bb39ae56f54d47f170ad69025b.tar.xz
org.eclipse.osee-ecdde22adb9c74bb39ae56f54d47f170ad69025b.zip
-rw-r--r--org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateAtsDatabase.java49
1 files changed, 32 insertions, 17 deletions
diff --git a/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateAtsDatabase.java b/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateAtsDatabase.java
index 8388229b6e6..ee7a87e5f66 100644
--- a/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateAtsDatabase.java
+++ b/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateAtsDatabase.java
@@ -57,6 +57,7 @@ import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
import org.eclipse.osee.framework.skynet.core.attribute.Attribute;
import org.eclipse.osee.framework.skynet.core.relation.CoreRelationEnumeration;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
import org.eclipse.osee.framework.ui.skynet.results.XResultData;
import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
@@ -244,6 +245,7 @@ public class ValidateAtsDatabase extends WorldXNavigateItemAction {
private void testAtsAttributeValues() throws OseeCoreException {
xResultData.log(monitor, "testAtsAttributeValues");
+ SkynetTransaction transaction = new SkynetTransaction(AtsPlugin.getAtsBranch());
for (Artifact artifact : artifacts) {
// Test for null attribute values
@@ -257,33 +259,46 @@ public class ValidateAtsDatabase extends WorldXNavigateItemAction {
}
// Test for ats.State Completed;;;<num> or Cancelled;;;<num> and cleanup
- XStateDam stateDam = new XStateDam((StateMachineArtifact) artifact);
- for (SMAState state : stateDam.getStates()) {
- if (state.getName().equals(DefaultTeamState.Completed.name()) || state.getName().equals(
- state.getName().equals(DefaultTeamState.Cancelled.name()))) {
- if (state.getHoursSpent() != 0.0) {
- xResultData.logError("ats.State error for SMA: " + artifact.getHumanReadableId() + " State: " + state.getName() + " Hours Spent: " + state.getHoursSpentStr());
- if (fixAttributeValues) {
- System.err.println("Not implemented yet");
+ if (artifact instanceof StateMachineArtifact) {
+ XStateDam stateDam = new XStateDam((StateMachineArtifact) artifact);
+ for (SMAState state : stateDam.getStates()) {
+ if (state.getName().equals(DefaultTeamState.Completed.name()) || state.getName().equals(
+ state.getName().equals(DefaultTeamState.Cancelled.name()))) {
+ if (state.getHoursSpent() != 0.0 || state.getPercentComplete() != 0) {
+ xResultData.logError("ats.State error for SMA: " + artifact.getHumanReadableId() + " State: " + state.getName() + " Hours Spent: " + state.getHoursSpentStr() + " Percent: " + state.getPercentComplete());
+ if (fixAttributeValues) {
+ state.setHoursSpent(0);
+ state.setPercentComplete(0);
+ stateDam.setState(state);
+ xResultData.log(monitor, "Fixed");
+ }
}
}
}
}
// Test for ats.CurrentState Completed;;;<num> or Cancelled;;;<num> and cleanup
- XCurrentStateDam currentStateDam = new XCurrentStateDam((StateMachineArtifact) artifact);
- SMAState state = currentStateDam.getState();
- if (state.getName().equals(DefaultTeamState.Completed.name()) || state.getName().equals(
- state.getName().equals(DefaultTeamState.Cancelled.name()))) {
- if (state.getHoursSpent() != 0.0) {
- xResultData.logError("ats.CurrentState error for SMA: " + artifact.getHumanReadableId() + " State: " + state.getName() + " Hours Spent: " + state.getHoursSpentStr());
- if (fixAttributeValues) {
- System.err.println("Not implemented yet");
+ if (artifact instanceof StateMachineArtifact) {
+ XCurrentStateDam currentStateDam = new XCurrentStateDam((StateMachineArtifact) artifact);
+ SMAState state = currentStateDam.getState();
+ if (state.getName().equals(DefaultTeamState.Completed.name()) || state.getName().equals(
+ state.getName().equals(DefaultTeamState.Cancelled.name()))) {
+ if (state.getHoursSpent() != 0.0 || state.getPercentComplete() != 0) {
+ xResultData.logError("ats.CurrentState error for SMA: " + artifact.getHumanReadableId() + " State: " + state.getName() + " Hours Spent: " + state.getHoursSpentStr() + " Percent: " + state.getPercentComplete());
+ if (fixAttributeValues) {
+ state.setHoursSpent(0);
+ state.setPercentComplete(0);
+ currentStateDam.setState(state);
+ xResultData.log(monitor, "Fixed");
+ }
}
}
}
- if (artifact.isDirty()) artifact.persistAttributes();
+ if (artifact.isDirty()) {
+ artifact.persistAttributes(transaction);
+ }
}
+ transaction.execute();
}
private void testAtsActionsHaveTeamWorkflow() throws OseeCoreException {

Back to the top