Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsWorkItemService.java3
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/log/IAtsLog.java25
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/log/IAtsLogFactory.java13
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/log/IAtsLogItem.java9
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/log/ILogStorageProvider.java2
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/state/IAtsStateManager.java2
-rw-r--r--plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/review/DecisionReviewDefinitionManagerTest.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/action/ActionManager.java2
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/workflow/AtsWorkItemServiceImpl.java7
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/DecisionReviewDefinitionManager.java9
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/DecisionReviewManager.java7
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/PeerReviewDefinitionManager.java5
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/PeerToPeerReviewManager.java10
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/role/UserRoleManager.java2
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/AbstractTaskableArtifact.java2
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/TaskManager.java3
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/team/TeamWorkFlowManager.java4
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/AbstractWorkflowArtifact.java39
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/log/ArtifactLog.java12
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/internal/log/AtsLogTest.java92
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/internal/log/AtsTest_Internal_Log_Suite.java2
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/internal/log/LogItemTest.java27
-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/internal/log/AtsLog.java169
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/AtsLogFactory.java23
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/AtsLogHtml.java75
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/AtsLogReader.java65
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/AtsLogWriter.java63
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/LogItem.java53
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/StateManager.java18
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/log/AtsLogUtility.java67
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/transition/TransitionManager.java16
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPrint.java4
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeStatus.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAWorkFlowSection.java7
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/WETransitionComposite.java1
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/log/column/LogAuthorColumn.java3
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateAtsDatabase.java7
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/DuplicateWorkflowBlam.java9
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsTaskArtifactExtractor.java3
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Overview.java4
42 files changed, 503 insertions, 367 deletions
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsWorkItemService.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsWorkItemService.java
index 18466e1291..8adde38de6 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsWorkItemService.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsWorkItemService.java
@@ -20,6 +20,7 @@ import org.eclipse.osee.ats.api.util.IAtsChangeSet;
import org.eclipse.osee.ats.api.workdef.IAtsStateDefinition;
import org.eclipse.osee.ats.api.workdef.IStateToken;
import org.eclipse.osee.ats.api.workdef.WidgetResult;
+import org.eclipse.osee.ats.api.workflow.log.ILogStorageProvider;
import org.eclipse.osee.ats.api.workflow.transition.ITransitionListener;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
@@ -75,4 +76,6 @@ public interface IAtsWorkItemService {
Collection<ITransitionListener> getTransitionListeners();
+ ILogStorageProvider getLogStorageProvider(IAtsWorkItem workItem);
+
}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/log/IAtsLog.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/log/IAtsLog.java
index 863430675b..60b178669f 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/log/IAtsLog.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/log/IAtsLog.java
@@ -20,25 +20,23 @@ import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
*/
public interface IAtsLog {
- public abstract String getHtml() throws OseeCoreException;
-
- public abstract String getHtml(boolean showLog) throws OseeCoreException;
-
public abstract List<IAtsLogItem> getLogItems() throws OseeCoreException;
public abstract Date getLastStatusDate() throws OseeCoreException;
- public abstract void putLogItems(List<IAtsLogItem> items);
-
public abstract List<IAtsLogItem> getLogItemsReversed() throws OseeCoreException;
/**
* Used to reset the original originated user. Only for internal use. Kept for backward compatibility.
+ *
+ * @param changes JavaTip
*/
public abstract void internalResetOriginator(IAtsUser user) throws OseeCoreException;
/**
* Used to reset the original originated user. Only for internal use. Kept for backward compatibility.
+ *
+ * @param changes JavaTip
*/
public abstract void internalResetCreatedDate(Date date) throws OseeCoreException;
@@ -51,21 +49,26 @@ public interface IAtsLog {
/**
* @param state name of state or null
+ * @param userId JavaTip
+ * @param changes JavaTip
*/
- public abstract void addLog(LogType type, String state, String msg) throws OseeCoreException;
+ public abstract void addLog(LogType type, String state, String msg, String userId) throws OseeCoreException;
public abstract void addLogItem(IAtsLogItem item) throws OseeCoreException;
- public abstract void addLog(LogType type, String state, String msg, Date date, IAtsUser user) throws OseeCoreException;
+ public abstract void addLog(LogType type, String state, String msg, Date date, String userId) throws OseeCoreException;
public abstract void clearLog();
- public abstract String getTable() throws OseeCoreException;
-
public abstract IAtsLogItem getLastEvent(LogType type) throws OseeCoreException;
public abstract IAtsLogItem getStateEvent(LogType type, String stateName) throws OseeCoreException;
public abstract IAtsLogItem getStateEvent(LogType type) throws OseeCoreException;
-} \ No newline at end of file
+ public abstract void setLogId(String logId);
+
+ public abstract void setDirty(boolean dirty);
+
+ public abstract boolean isDirty();
+}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/log/IAtsLogFactory.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/log/IAtsLogFactory.java
index 4a0bb08d0a..326d2019b4 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/log/IAtsLogFactory.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/log/IAtsLogFactory.java
@@ -1,7 +1,7 @@
/*******************************************************************************
* 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
+ * are made available under the terms of the Eclipse License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
@@ -11,8 +11,8 @@
package org.eclipse.osee.ats.api.workflow.log;
import java.util.Date;
+import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.user.IAtsUser;
-import org.eclipse.osee.ats.api.user.IAtsUserService;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
/**
@@ -20,11 +20,12 @@ import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
*/
public interface IAtsLogFactory {
- public IAtsLog getLog(ILogStorageProvider storageProvider, IAtsUserService userService) throws OseeCoreException;
+ IAtsLogItem newLogItem(LogType type, Date date, IAtsUser user, String state, String msg) throws OseeCoreException;
- public IAtsLogItem newLogItem(LogType type, Date date, IAtsUser user, String state, String msg, String hrid) throws OseeCoreException;
+ IAtsLog getLogLoaded(ILogStorageProvider storageProvider) throws OseeCoreException;
- public IAtsLogItem newLogItem(LogType type, String date, String userId, String state, String msg, String hrid) throws OseeCoreException;
+ void writeToStore(IAtsWorkItem workItem);
+
+ IAtsLog getLog();
- public IAtsLogItem newLogItem(String type, String date, String userId, String state, String msg, String hrid) throws OseeCoreException;
}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/log/IAtsLogItem.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/log/IAtsLogItem.java
index 20abee6fe3..dbc9c1d8c3 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/log/IAtsLogItem.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/log/IAtsLogItem.java
@@ -11,7 +11,6 @@
package org.eclipse.osee.ats.api.workflow.log;
import java.util.Date;
-import org.eclipse.osee.ats.api.user.IAtsUser;
/**
* @author Donald G. Dunne
@@ -26,20 +25,16 @@ public interface IAtsLogItem {
public abstract String getUserId();
+ public abstract String setUserId(String userId);
+
public abstract String getMsg();
public abstract void setMsg(String msg);
- public abstract IAtsUser getUser();
-
public abstract LogType getType();
public abstract void setType(LogType type);
- public abstract String toHTML(String labelFont);
-
- public abstract void setUser(IAtsUser user);
-
public abstract String getState();
public abstract void setState(String state);
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/log/ILogStorageProvider.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/log/ILogStorageProvider.java
index d79091163f..708854f58b 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/log/ILogStorageProvider.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/log/ILogStorageProvider.java
@@ -24,4 +24,6 @@ public interface ILogStorageProvider {
String getLogTitle();
String getLogId();
+
+ String getNameFromUserId(String userId);
}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/state/IAtsStateManager.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/state/IAtsStateManager.java
index f6d123ba70..574144d65f 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/state/IAtsStateManager.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/state/IAtsStateManager.java
@@ -41,8 +41,6 @@ public interface IAtsStateManager extends WorkStateProvider, WorkStateFactory {
public abstract void updateMetrics(IStateToken state, double additionalHours, int percentComplete, boolean logMetrics) throws OseeCoreException;
- public abstract void setMetrics(double hours, int percentComplete, boolean logMetrics, IAtsUser user, Date date) throws OseeCoreException;
-
/**
* Set metrics and log if changed
*/
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/review/DecisionReviewDefinitionManagerTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/review/DecisionReviewDefinitionManagerTest.java
index 9db4afc291..2e2de8d102 100644
--- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/review/DecisionReviewDefinitionManagerTest.java
+++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/review/DecisionReviewDefinitionManagerTest.java
@@ -78,6 +78,8 @@ public class DecisionReviewDefinitionManagerTest extends DecisionReviewDefinitio
TransitionResults results = transitionMgr.handleAll();
changes.execute();
+ Assert.assertFalse(teamArt.isDirty());
+ Assert.assertFalse(teamArt.getLog().isDirty());
Assert.assertTrue(results.toString(), results.isEmpty());
Assert.assertEquals("One review should be present", 1, ReviewManager.getReviews(teamArt).size());
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 91a7cd9d95..c907ea660e 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
@@ -44,6 +44,7 @@ Import-Package: com.google.inject,
org.eclipse.osee.ats.core.workdef,
org.eclipse.osee.ats.core.workdef.provider,
org.eclipse.osee.ats.core.workflow,
+ org.eclipse.osee.ats.core.workflow.log,
org.eclipse.osee.ats.core.workflow.state,
org.eclipse.osee.ats.core.workflow.transition,
org.eclipse.osee.ats.dsl,
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/action/ActionManager.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/action/ActionManager.java
index acb79af59a..9578a3c3f1 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/action/ActionManager.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/action/ActionManager.java
@@ -23,6 +23,7 @@ import org.eclipse.osee.ats.api.team.CreateTeamOption;
import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
+import org.eclipse.osee.ats.core.AtsCore;
import org.eclipse.osee.ats.core.client.internal.AtsClientService;
import org.eclipse.osee.ats.core.client.notify.AtsNotificationManager;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
@@ -79,6 +80,7 @@ public class ActionManager {
createTeamWorkflow(actionArt, teamDef, actionableItems, leads, changes, createdDate, createdBy,
newActionListener);
teamWf.getStateMgr().writeToStore();
+ AtsCore.getLogFactory().writeToStore(teamWf);
}
// Notify listener of action creation
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/workflow/AtsWorkItemServiceImpl.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/workflow/AtsWorkItemServiceImpl.java
index ddb61b37a2..b3b6a36696 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/workflow/AtsWorkItemServiceImpl.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/workflow/AtsWorkItemServiceImpl.java
@@ -26,6 +26,7 @@ import org.eclipse.osee.ats.api.workflow.IAtsTask;
import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
import org.eclipse.osee.ats.api.workflow.IAtsWorkData;
import org.eclipse.osee.ats.api.workflow.IAtsWorkItemService;
+import org.eclipse.osee.ats.api.workflow.log.ILogStorageProvider;
import org.eclipse.osee.ats.api.workflow.transition.ITransitionListener;
import org.eclipse.osee.ats.core.client.internal.Activator;
import org.eclipse.osee.ats.core.client.internal.AtsClientService;
@@ -35,6 +36,7 @@ import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.core.client.validator.AtsXWidgetValidateManagerClient;
import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
import org.eclipse.osee.ats.core.client.workflow.AtsWorkData;
+import org.eclipse.osee.ats.core.client.workflow.log.ArtifactLog;
import org.eclipse.osee.ats.core.client.workflow.transition.TransitionListeners;
import org.eclipse.osee.framework.access.AccessControlManager;
import org.eclipse.osee.framework.core.data.IArtifactType;
@@ -234,4 +236,9 @@ public class AtsWorkItemServiceImpl implements IAtsWorkItemService {
return TransitionListeners.getListeners();
}
+ @Override
+ public ILogStorageProvider getLogStorageProvider(IAtsWorkItem workItem) {
+ return new ArtifactLog(((AbstractWorkflowArtifact) workItem));
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/DecisionReviewDefinitionManager.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/DecisionReviewDefinitionManager.java
index 66ce2f7e5b..34bc23e623 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/DecisionReviewDefinitionManager.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/DecisionReviewDefinitionManager.java
@@ -23,6 +23,7 @@ import org.eclipse.osee.ats.api.workdef.StateEventType;
import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
import org.eclipse.osee.ats.api.workflow.log.LogType;
import org.eclipse.osee.ats.api.workflow.transition.TransitionAdapter;
+import org.eclipse.osee.ats.core.AtsCore;
import org.eclipse.osee.ats.core.client.internal.AtsClientService;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.core.users.AtsCoreUsers;
@@ -67,10 +68,12 @@ public class DecisionReviewDefinitionManager extends TransitionAdapter {
DecisionReviewManager.createNewDecisionReview(teamArt, revDef.getBlockingType(), revDef.getReviewTitle(),
revDef.getRelatedToState(), revDef.getDescription(), revDef.getOptions(), users, createdDate, createdBy);
}
- decArt.getLog().addLog(LogType.Note, null, String.format("Review [%s] auto-generated", revDef.getName()));
+ decArt.getLog().addLog(LogType.Note, null, String.format("Review [%s] auto-generated", revDef.getName()),
+ AtsCore.getUserService().getCurrentUser().getUserId());
for (IReviewProvider provider : ReviewProviders.getAtsReviewProviders()) {
provider.reviewCreated(decArt);
}
+ AtsCore.getLogFactory().writeToStore(decArt);
changes.add(decArt);
return decArt;
}
@@ -88,8 +91,8 @@ public class DecisionReviewDefinitionManager extends TransitionAdapter {
for (IAtsDecisionReviewDefinition decRevDef : teamArt.getStateDefinition().getDecisionReviews()) {
if (decRevDef.getStateEventType() != null && decRevDef.getStateEventType().equals(StateEventType.TransitionTo)) {
DecisionReviewArtifact decArt =
- DecisionReviewDefinitionManager.createNewDecisionReview(decRevDef, changes, teamArt,
- createdDate, createdBy);
+ DecisionReviewDefinitionManager.createNewDecisionReview(decRevDef, changes, teamArt, createdDate,
+ createdBy);
if (decArt != null) {
changes.add(decArt);
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/DecisionReviewManager.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/DecisionReviewManager.java
index bc0e8bb48e..89ab2f929a 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/DecisionReviewManager.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/DecisionReviewManager.java
@@ -27,6 +27,7 @@ import org.eclipse.osee.ats.api.workdef.ReviewBlockType;
import org.eclipse.osee.ats.api.workdef.StateType;
import org.eclipse.osee.ats.api.workflow.transition.TransitionOption;
import org.eclipse.osee.ats.api.workflow.transition.TransitionResults;
+import org.eclipse.osee.ats.core.AtsCore;
import org.eclipse.osee.ats.core.client.internal.AtsClientService;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.core.client.util.AtsUtilCore;
@@ -65,8 +66,7 @@ public class DecisionReviewManager {
return result;
}
result =
- transitionToState(toState.getStateType(), popup, DecisionReviewState.Decision, reviewArt, user,
- changes);
+ transitionToState(toState.getStateType(), popup, DecisionReviewState.Decision, reviewArt, user, changes);
if (result.isFalse()) {
return result;
}
@@ -99,6 +99,7 @@ public class DecisionReviewManager {
}
reviewArt.setSoleAttributeValue(AtsAttributeTypes.EstimatedHours, estimateHours);
reviewArt.getStateMgr().updateMetrics(reviewArt.getStateDefinition(), stateHoursSpent, statePercentComplete, true);
+ AtsCore.getLogFactory().writeToStore(reviewArt);
return Result.TrueResult;
}
@@ -125,6 +126,7 @@ public class DecisionReviewManager {
reviewArt.setSoleAttributeValue(AtsAttributeTypes.Decision, decision ? "Yes" : "No");
reviewArt.getStateMgr().updateMetrics(reviewArt.getStateDefinition(), stateHoursSpent, statePercentComplete, true);
+ AtsCore.getLogFactory().writeToStore(reviewArt);
return Result.TrueResult;
}
@@ -147,6 +149,7 @@ public class DecisionReviewManager {
}
// ensure assignees are as requested
decRev.getStateMgr().setAssignees(assignees);
+ AtsCore.getLogFactory().writeToStore(decRev);
changes.add(decRev);
return decRev;
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/PeerReviewDefinitionManager.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/PeerReviewDefinitionManager.java
index 8e7e601831..94bb41d702 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/PeerReviewDefinitionManager.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/PeerReviewDefinitionManager.java
@@ -22,6 +22,7 @@ import org.eclipse.osee.ats.api.workdef.ReviewBlockType;
import org.eclipse.osee.ats.api.workdef.StateEventType;
import org.eclipse.osee.ats.api.workflow.log.LogType;
import org.eclipse.osee.ats.api.workflow.transition.TransitionAdapter;
+import org.eclipse.osee.ats.core.AtsCore;
import org.eclipse.osee.ats.core.client.internal.AtsClientService;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
@@ -67,10 +68,12 @@ public class PeerReviewDefinitionManager extends TransitionAdapter {
if (assignees.size() > 0) {
peerArt.getStateMgr().setAssignees(assignees);
}
- peerArt.getLog().addLog(LogType.Note, null, String.format("Review [%s] auto-generated", peerRevDef.getName()));
+ peerArt.getLog().addLog(LogType.Note, null, String.format("Review [%s] auto-generated", peerRevDef.getName()),
+ AtsCore.getUserService().getCurrentUser().getUserId());
for (IReviewProvider provider : ReviewProviders.getAtsReviewProviders()) {
provider.reviewCreated(peerArt);
}
+ AtsCore.getLogFactory().writeToStore(peerArt);
return peerArt;
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/PeerToPeerReviewManager.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/PeerToPeerReviewManager.java
index 5d8c62df71..906c7cf2f6 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/PeerToPeerReviewManager.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/PeerToPeerReviewManager.java
@@ -26,6 +26,7 @@ import org.eclipse.osee.ats.api.workdef.ReviewBlockType;
import org.eclipse.osee.ats.api.workdef.StateType;
import org.eclipse.osee.ats.api.workflow.transition.TransitionOption;
import org.eclipse.osee.ats.api.workflow.transition.TransitionResults;
+import org.eclipse.osee.ats.core.AtsCore;
import org.eclipse.osee.ats.core.client.internal.AtsClientService;
import org.eclipse.osee.ats.core.client.review.defect.ReviewDefectItem;
import org.eclipse.osee.ats.core.client.review.defect.ReviewDefectManager;
@@ -93,8 +94,8 @@ public class PeerToPeerReviewManager {
private static Result transitionToState(StateType StateType, boolean popup, PeerToPeerReviewArtifact reviewArt, IStateToken toState, IAtsChangeSet changes) throws OseeCoreException {
TransitionHelper helper =
new TransitionHelper("Transition to " + toState.getName(), Arrays.asList(reviewArt), toState.getName(),
- Arrays.asList(reviewArt.getStateMgr().getAssignees().iterator().next()), null,
- changes, TransitionOption.OverrideAssigneeCheck);
+ Arrays.asList(reviewArt.getStateMgr().getAssignees().iterator().next()), null, changes,
+ TransitionOption.OverrideAssigneeCheck);
TransitionManager transitionMgr = new TransitionManager(helper);
TransitionResults results = transitionMgr.handleAll();
if (results.isEmpty()) {
@@ -121,6 +122,7 @@ public class PeerToPeerReviewManager {
reviewArt.setSoleAttributeValue(AtsAttributeTypes.Location, reviewMaterials);
reviewArt.setSoleAttributeValue(AtsAttributeTypes.ReviewFormalType, ReviewFormalType.InFormal.name());
reviewArt.getStateMgr().updateMetrics(reviewArt.getStateDefinition(), stateHoursSpent, statePercentComplete, true);
+ AtsCore.getLogFactory().writeToStore(reviewArt);
return Result.TrueResult;
}
@@ -140,6 +142,7 @@ public class PeerToPeerReviewManager {
defectManager.saveToArtifact(reviewArt);
}
reviewArt.getStateMgr().updateMetrics(reviewArt.getStateDefinition(), stateHoursSpent, statePercentComplete, true);
+ AtsCore.getLogFactory().writeToStore(reviewArt);
return Result.TrueResult;
}
@@ -163,8 +166,7 @@ public class PeerToPeerReviewManager {
PeerToPeerReviewArtifact peerArt =
createNewPeerToPeerReview(
AtsClientService.get().getWorkDefinitionAdmin().getWorkDefinitionForPeerToPeerReviewNotYetCreatedAndStandalone(
- actionableItem).getWorkDefinition(), null, reviewTitle, againstState, createdDate, createdBy,
- changes);
+ actionableItem).getWorkDefinition(), null, reviewTitle, againstState, createdDate, createdBy, changes);
peerArt.getActionableItemsDam().addActionableItem(actionableItem);
changes.add(peerArt);
return peerArt;
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/role/UserRoleManager.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/role/UserRoleManager.java
index 629b5b7252..a59a28a363 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/role/UserRoleManager.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/role/UserRoleManager.java
@@ -20,6 +20,7 @@ import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
import org.eclipse.osee.ats.api.notify.AtsNotifyType;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
+import org.eclipse.osee.ats.core.AtsCore;
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.notify.AtsNotificationManager;
@@ -256,5 +257,6 @@ public class UserRoleManager {
awa.getStateMgr().setMetrics(awa.getStateDefinition(), hoursSpent,
awa.getStateMgr().getPercentComplete(awa.getCurrentStateName()), true,
AtsClientService.get().getUserAdmin().getCurrentUser(), new Date());
+ AtsCore.getLogFactory().writeToStore(awa);
}
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/AbstractTaskableArtifact.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/AbstractTaskableArtifact.java
index b9bc82c15c..f7c27d6b0c 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/AbstractTaskableArtifact.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/AbstractTaskableArtifact.java
@@ -26,6 +26,7 @@ import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
import org.eclipse.osee.ats.api.workdef.IAtsStateDefinition;
import org.eclipse.osee.ats.api.workdef.IStateToken;
+import org.eclipse.osee.ats.core.AtsCore;
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.util.AtsTaskCache;
@@ -125,6 +126,7 @@ public abstract class AbstractTaskableArtifact extends AbstractWorkflowArtifact
if (Strings.isValid(relatedToState)) {
taskArt.setSoleAttributeValue(AtsAttributeTypes.RelatedToState, relatedToState);
}
+ AtsCore.getLogFactory().writeToStore(taskArt);
AtsTaskCache.decache(this);
return taskArt;
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/TaskManager.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/TaskManager.java
index 250e48a88f..df26b29e33 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/TaskManager.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/TaskManager.java
@@ -20,6 +20,7 @@ import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
import org.eclipse.osee.ats.api.workflow.transition.TransitionOption;
import org.eclipse.osee.ats.api.workflow.transition.TransitionResults;
+import org.eclipse.osee.ats.core.AtsCore;
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.team.TeamWorkFlowArtifact;
@@ -57,6 +58,7 @@ public class TaskManager {
taskArt.getStateMgr().setAssignee(AtsClientService.get().getUserAdmin().getCurrentUser());
}
taskArt.getStateMgr().updateMetrics(taskArt.getStateDefinition(), additionalHours, 100, true);
+ AtsCore.getLogFactory().writeToStore(taskArt);
if (estimatedHours > 0.0) {
taskArt.setSoleAttributeValue(AtsAttributeTypes.EstimatedHours, estimatedHours);
}
@@ -91,6 +93,7 @@ public class TaskManager {
}
if (taskArt.getStateMgr().getPercentComplete(taskArt.getCurrentStateName()) != percentComplete || additionalHours > 0) {
taskArt.getStateMgr().updateMetrics(taskArt.getStateDefinition(), additionalHours, percentComplete, true);
+ AtsCore.getLogFactory().writeToStore(taskArt);
}
if (changes != null) {
taskArt.saveSMA(changes);
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/team/TeamWorkFlowManager.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/team/TeamWorkFlowManager.java
index c6e4c5f6ab..88ca0d7485 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/team/TeamWorkFlowManager.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/team/TeamWorkFlowManager.java
@@ -30,6 +30,7 @@ import org.eclipse.osee.ats.api.workdef.IStateToken;
import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
import org.eclipse.osee.ats.api.workflow.transition.TransitionOption;
import org.eclipse.osee.ats.api.workflow.transition.TransitionResults;
+import org.eclipse.osee.ats.core.AtsCore;
import org.eclipse.osee.ats.core.client.internal.Activator;
import org.eclipse.osee.ats.core.client.util.AtsUtilCore;
import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
@@ -202,6 +203,7 @@ public class TeamWorkFlowManager {
}
teamArt.setSoleAttributeValue(AtsAttributeTypes.EstimatedHours, hourEstimate);
teamArt.getStateMgr().setMetrics(TeamState.Analyze, stateHoursSpent, statePercentComplete, true, user, date);
+ AtsCore.getLogFactory().writeToStore(teamArt);
return Result.TrueResult;
}
@@ -213,6 +215,7 @@ public class TeamWorkFlowManager {
}
}
teamArt.getStateMgr().setMetrics(TeamState.Authorize, stateHoursSpent, statePercentComplete, true, user, date);
+ AtsCore.getLogFactory().writeToStore(teamArt);
return Result.TrueResult;
}
@@ -224,6 +227,7 @@ public class TeamWorkFlowManager {
}
}
teamArt.getStateMgr().setMetrics(TeamState.Implement, stateHoursSpent, statePercentComplete, true, user, date);
+ AtsCore.getLogFactory().writeToStore(teamArt);
return Result.TrueResult;
}
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 7f321edcd9..f034d83184 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
@@ -91,7 +91,8 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
protected TeamWorkFlowArtifact parentTeamArt;
protected ActionArtifact parentAction;
private final IAtsStateManager stateMgr;
- private final IAtsLog atsLog;
+ private IAtsLog atsLog;
+ private int atsLogTransactionNumber;
private final AtsNote atsNote;
private boolean inTransition = false;
private IAtsWorkData atsWorkData;
@@ -99,7 +100,6 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
public AbstractWorkflowArtifact(String guid, Branch branch, IArtifactType artifactType) throws OseeCoreException {
super(guid, branch, artifactType);
stateMgr = AtsCore.getStateFactory().getStateManager(this);
- atsLog = AtsCore.getLogFactory().getLog(new ArtifactLog(this), AtsCore.getUserService());
atsNote = new AtsNote(new ArtifactNote(this));
}
@@ -314,10 +314,14 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
getSmaArtifactsOneLevel(this, artifacts);
for (Artifact artifact : artifacts) {
if (artifact instanceof AbstractWorkflowArtifact) {
- Result result = ((AbstractWorkflowArtifact) artifact).getStateMgr().isDirtyResult();
+ AbstractWorkflowArtifact awa = (AbstractWorkflowArtifact) artifact;
+ Result result = awa.getStateMgr().isDirtyResult();
if (result.isTrue()) {
return result;
}
+ if (awa.getLog().isDirty()) {
+ return new Result(true, "Log is dirty");
+ }
}
if (artifact.isDirty()) {
String rString = null;
@@ -362,7 +366,11 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
getSmaArtifactsOneLevel(this, artifacts);
for (Artifact artifact : artifacts) {
if (artifact instanceof AbstractWorkflowArtifact) {
- ((AbstractWorkflowArtifact) artifact).getStateMgr().writeToStore();
+ AbstractWorkflowArtifact awa = (AbstractWorkflowArtifact) artifact;
+ awa.getStateMgr().writeToStore();
+ if (awa.getLog().isDirty()) {
+ AtsCore.getLogFactory().writeToStore(awa);
+ }
}
artifact.persist(transaction);
}
@@ -378,7 +386,9 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
for (Artifact artifact : artifacts) {
artifact.reloadAttributesAndRelations();
if (artifact instanceof AbstractWorkflowArtifact) {
- ((AbstractWorkflowArtifact) artifact).getStateMgr().reload();
+ AbstractWorkflowArtifact awa = (AbstractWorkflowArtifact) artifact;
+ awa.getStateMgr().reload();
+ awa.atsLog = null;
}
}
} catch (Exception ex) {
@@ -428,6 +438,10 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
@Override
public IAtsLog getLog() {
+ if (atsLog == null || atsLogTransactionNumber != getTransactionNumber()) {
+ atsLog = AtsCore.getLogFactory().getLogLoaded(new ArtifactLog(this));
+ atsLogTransactionNumber = getTransactionNumber();
+ }
return atsLog;
}
@@ -522,12 +536,13 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
private void logCreatedByChange(IAtsUser user, Date date) throws OseeCoreException {
if (getSoleAttributeValue(AtsAttributeTypes.CreatedBy, null) == null) {
- atsLog.addLog(LogType.Originated, "", "", date, user);
+ getLog().addLog(LogType.Originated, "", "", date, user.getUserId());
} else {
- atsLog.addLog(LogType.Originated, "",
- "Changed by " + AtsClientService.get().getUserAdmin().getCurrentUser().getName(), date, user);
- atsLog.internalResetOriginator(user);
+ getLog().addLog(LogType.Originated, "",
+ "Changed by " + AtsClientService.get().getUserAdmin().getCurrentUser().getName(), date, user.getUserId());
+ getLog().internalResetOriginator(user);
}
+ AtsCore.getLogFactory().writeToStore(this);
}
public void setCreatedBy(IAtsUser user, boolean logChange) throws OseeCoreException {
@@ -542,14 +557,16 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
}
public void internalSetCreatedBy(IAtsUser user) throws OseeCoreException {
- atsLog.internalResetOriginator(user);
+ getLog().internalResetOriginator(user);
+ AtsCore.getLogFactory().writeToStore(this);
if (isAttributeTypeValid(AtsAttributeTypes.CreatedBy)) {
setSoleAttributeValue(AtsAttributeTypes.CreatedBy, user.getUserId());
}
}
public void internalSetCreatedDate(Date date) throws OseeCoreException {
- atsLog.internalResetCreatedDate(date);
+ getLog().internalResetCreatedDate(date);
+ AtsCore.getLogFactory().writeToStore(this);
if (isAttributeTypeValid(AtsAttributeTypes.CreatedDate)) {
setSoleAttributeValue(AtsAttributeTypes.CreatedDate, date);
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/log/ArtifactLog.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/log/ArtifactLog.java
index dc03f133e9..9431ad1c44 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/log/ArtifactLog.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/workflow/log/ArtifactLog.java
@@ -15,7 +15,9 @@ import java.util.logging.Level;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
+import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.workflow.log.ILogStorageProvider;
+import org.eclipse.osee.ats.core.AtsCore;
import org.eclipse.osee.ats.core.client.internal.Activator;
import org.eclipse.osee.ats.core.client.util.AtsUtilCore;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -81,4 +83,14 @@ public class ArtifactLog implements ILogStorageProvider {
return "unknown";
}
+ @Override
+ public String getNameFromUserId(String userId) {
+ String name = "unknown (" + userId + ")";
+ IAtsUser user = AtsCore.getUserService().getUserById(userId);
+ if (user != null) {
+ name = user.getName();
+ }
+ return name;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/internal/log/AtsLogTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/internal/log/AtsLogTest.java
deleted file mode 100644
index 64be62349f..0000000000
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/internal/log/AtsLogTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.internal.log;
-
-import static org.mockito.Mockito.when;
-import java.util.Date;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osee.ats.api.user.IAtsUser;
-import org.eclipse.osee.ats.api.user.IAtsUserService;
-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.ILogStorageProvider;
-import org.eclipse.osee.ats.core.AtsCore;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.GUID;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsLogTest {
-
- // @formatter:off
- @Mock IAtsUserService userService;
- @Mock IAtsUser user;
- // @formatter:on
-
- @Before
- public void setup() throws OseeCoreException {
- MockitoAnnotations.initMocks(this);
-
- when(user.getName()).thenReturn("joe");
- when(user.getUserId()).thenReturn("joe");
-
- when(userService.getUserById("joe")).thenReturn(user);
- }
-
- @Test
- public void testToAndFromStore() throws OseeCoreException {
- Date date = new Date();
- SimpleLogStore store = new SimpleLogStore();
- IAtsLog log = AtsCore.getLogFactory().getLog(store, userService);
- IAtsLogItem item = LogItemTest.getTestLogItem(date, user, userService);
- log.addLogItem(item);
-
- IAtsLog log2 = AtsCore.getLogFactory().getLog(store, userService);
- Assert.assertEquals(1, log2.getLogItems().size());
- IAtsLogItem loadItem = log2.getLogItems().iterator().next();
- LogItemTest.validateItem(user, loadItem, date);
- }
-
- public class SimpleLogStore implements ILogStorageProvider {
-
- String store = "";
-
- @Override
- public String getLogXml() {
- return store;
- }
-
- @Override
- public IStatus saveLogXml(String xml) {
- store = xml;
- return Status.OK_STATUS;
- }
-
- @Override
- public String getLogTitle() {
- return "This is the title";
- }
-
- @Override
- public String getLogId() {
- return GUID.create();
- }
-
- }
-
-}
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/internal/log/AtsTest_Internal_Log_Suite.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/internal/log/AtsTest_Internal_Log_Suite.java
index cc362df832..eb11f776f8 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/internal/log/AtsTest_Internal_Log_Suite.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/internal/log/AtsTest_Internal_Log_Suite.java
@@ -20,7 +20,7 @@ import org.junit.runners.Suite;
* @author Roberto E. Escobar
*/
@RunWith(Suite.class)
-@Suite.SuiteClasses({AtsLogTest.class, LogItemTest.class})
+@Suite.SuiteClasses({LogItemTest.class})
public class AtsTest_Internal_Log_Suite {
@BeforeClass
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/internal/log/LogItemTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/internal/log/LogItemTest.java
index fe5f058a41..ea9068b689 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/internal/log/LogItemTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/internal/log/LogItemTest.java
@@ -13,11 +13,9 @@ package org.eclipse.osee.ats.core.internal.log;
import static org.mockito.Mockito.when;
import java.util.Date;
import org.eclipse.osee.ats.api.user.IAtsUser;
-import org.eclipse.osee.ats.api.user.IAtsUserService;
import org.eclipse.osee.ats.api.workflow.log.IAtsLogItem;
import org.eclipse.osee.ats.api.workflow.log.LogType;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
import org.eclipse.osee.framework.jdk.core.util.DateUtil;
import org.junit.Assert;
import org.junit.Before;
@@ -31,7 +29,6 @@ import org.mockito.MockitoAnnotations;
public class LogItemTest {
// @formatter:off
- @Mock IAtsUserService userService;
@Mock IAtsUser user;
// @formatter:on
@@ -42,13 +39,12 @@ public class LogItemTest {
when(user.getName()).thenReturn("joe");
when(user.getUserId()).thenReturn("joe");
- when(userService.getUserById("joe")).thenReturn(user);
}
@Test
public void testLogItemLogTypeDateUserStringStringString() throws OseeCoreException {
Date date = new Date();
- IAtsLogItem item = getTestLogItem(date, user, userService);
+ IAtsLogItem item = getTestLogItem(date, user);
validateItem(user, item, date);
}
@@ -56,7 +52,6 @@ public class LogItemTest {
public static void validateItem(IAtsUser user, IAtsLogItem item, Date date) throws OseeCoreException {
Assert.assertEquals(LogType.Error, item.getType());
Assert.assertEquals(date, item.getDate());
- Assert.assertEquals(user, item.getUser());
Assert.assertEquals(user.getUserId(), item.getUserId());
Assert.assertEquals("Analyze", item.getState());
Assert.assertEquals("my msg", item.getMsg());
@@ -66,8 +61,7 @@ public class LogItemTest {
public void testLogItemLogTypeStringStringStringStringString() throws OseeCoreException {
Date date = new Date();
IAtsLogItem item =
- new LogItem(LogType.Error, String.valueOf(date.getTime()), user.getUserId(), "Analyze", "my msg", "ASDF4",
- userService);
+ new LogItem(LogType.Error, String.valueOf(date.getTime()), user.getUserId(), "Analyze", "my msg");
validateItem(user, item, date);
}
@@ -76,31 +70,22 @@ public class LogItemTest {
public void testLogItemStringStringStringStringStringString() throws OseeCoreException {
Date date = new Date();
IAtsLogItem item =
- new LogItem(LogType.Error.name(), String.valueOf(date.getTime()), user.getUserId(), "Analyze", "my msg",
- "ASDF4", userService);
+ new LogItem(LogType.Error.name(), String.valueOf(date.getTime()), user.getUserId(), "Analyze", "my msg");
validateItem(user, item, date);
}
- public static IAtsLogItem getTestLogItem(Date date, IAtsUser user, IAtsUserService userService) throws OseeCoreException {
- return new LogItem(LogType.Error, date, user, "Analyze", "my msg", "ASDF4", userService);
+ public static IAtsLogItem getTestLogItem(Date date, IAtsUser user) throws OseeCoreException {
+ return new LogItem(LogType.Error, date, user.getUserId(), "Analyze", "my msg");
}
@Test
public void testToString() throws OseeCoreException {
Date date = new Date();
- IAtsLogItem item = getTestLogItem(date, user, userService);
+ IAtsLogItem item = getTestLogItem(date, user);
Assert.assertEquals("my msg (Error)from Analyze by " + user.getName() + " on " + DateUtil.getMMDDYYHHMM(date),
item.toString());
}
- @Test
- public void testToHTML() throws OseeCoreException {
- Date date = new Date();
- IAtsLogItem item = getTestLogItem(date, user, userService);
-
- Assert.assertEquals("NOTE (Error): my msg (" + user.getName() + ")", item.toHTML(AHTML.LABEL_FONT));
- }
-
}
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 9114938595..1abd21cdec 100644
--- a/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF
@@ -64,6 +64,7 @@ Export-Package: org.eclipse.osee.ats.core,
org.eclipse.osee.ats.core.workdef,
org.eclipse.osee.ats.core.workdef.provider,
org.eclipse.osee.ats.core.workflow,
+ org.eclipse.osee.ats.core.workflow.log,
org.eclipse.osee.ats.core.workflow.state,
org.eclipse.osee.ats.core.workflow.transition
Bundle-Activator: org.eclipse.osee.ats.core.internal.Activator
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/AtsLog.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/AtsLog.java
index 1bc076c561..c09ac8972c 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/AtsLog.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/AtsLog.java
@@ -12,48 +12,26 @@
package org.eclipse.osee.ats.core.internal.log;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import org.eclipse.osee.ats.api.user.IAtsUser;
-import org.eclipse.osee.ats.api.user.IAtsUserService;
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.ILogStorageProvider;
import org.eclipse.osee.ats.api.workflow.log.LogType;
import org.eclipse.osee.ats.core.AtsCore;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.jdk.core.util.AXml;
-import org.eclipse.osee.framework.jdk.core.util.DateUtil;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp;
-import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
/**
* @author Donald G. Dunne
*/
public class AtsLog implements IAtsLog {
- private final static String ATS_LOG_TAG = "AtsLog";
- private final static String LOG_ITEM_TAG = "Item";
- private final ILogStorageProvider storeProvider;
- private final static Pattern LOG_ITEM_PATTERN =
- Pattern.compile("<Item date=\"(.*?)\" msg=\"(.*?)\" state=\"(.*?)\" type=\"(.*?)\" userId=\"(.*?)\"/>");
- private final static Pattern LOG_ITEM_TAG_PATTERN = Pattern.compile("<Item ");
- private final IAtsUserService userService;
-
- public AtsLog(ILogStorageProvider storeProvider, IAtsUserService userService) {
- this.storeProvider = storeProvider;
- this.userService = userService;
- }
+ private boolean dirty = false;
+ private final List<IAtsLogItem> logItems = new ArrayList<IAtsLogItem>();
+ private String logId = "none";
@Override
public String toString() {
@@ -66,55 +44,6 @@ public class AtsLog implements IAtsLog {
}
@Override
- public String getHtml() throws OseeCoreException {
- return getHtml(true);
- }
-
- @Override
- public String getHtml(boolean showLog) throws OseeCoreException {
- if (getLogItems().isEmpty()) {
- return "";
- }
- StringBuffer sb = new StringBuffer();
- if (showLog) {
- sb.append(AHTML.addSpace(1) + AHTML.getLabelStr(AHTML.LABEL_FONT, storeProvider.getLogTitle()));
- }
- sb.append(getTable());
- return sb.toString();
- }
-
- @Override
- public List<IAtsLogItem> getLogItems() throws OseeCoreException {
- String xml = storeProvider.getLogXml();
- return getLogItems(xml, storeProvider.getLogId());
- }
-
- private List<IAtsLogItem> getLogItems(String xml, String id) throws OseeCoreException {
- List<IAtsLogItem> logItems = new ArrayList<IAtsLogItem>();
- if (!xml.isEmpty()) {
- Matcher m = LOG_ITEM_PATTERN.matcher(xml);
- while (m.find()) {
- IAtsLogItem item =
- new LogItem(m.group(4), m.group(1), Strings.intern(m.group(5)), Strings.intern(m.group(3)), // NOPMD by b0727536 on 9/29/10 8:52 AM
- AXml.xmlToText(m.group(2)), id, userService);
- logItems.add(item);
- }
-
- Matcher m2 = LOG_ITEM_TAG_PATTERN.matcher(xml);
- int openTagsFound = 0;
- while (m2.find()) {
- openTagsFound++;
- }
- if (logItems.size() != openTagsFound) {
- OseeLog.logf(AtsCore.class, Level.SEVERE,
- "ATS Log: open tags found %d doesn't match log items parsed %d for %s", openTagsFound, logItems.size(),
- id);
- }
- }
- return logItems;
- }
-
- @Override
public Date getLastStatusDate() throws OseeCoreException {
IAtsLogItem logItem = getLastEvent(LogType.Metrics);
if (logItem == null) {
@@ -124,27 +53,6 @@ public class AtsLog implements IAtsLog {
}
@Override
- public void putLogItems(List<IAtsLogItem> items) {
- try {
- Document doc = Jaxp.newDocumentNamespaceAware();
- Element rootElement = doc.createElement(ATS_LOG_TAG);
- doc.appendChild(rootElement);
- for (IAtsLogItem item : items) {
- Element element = doc.createElement(LOG_ITEM_TAG);
- element.setAttribute("type", item.getType().name());
- element.setAttribute("date", String.valueOf(item.getDate().getTime()));
- element.setAttribute("userId", item.getUser().getUserId());
- element.setAttribute("state", item.getState());
- element.setAttribute("msg", item.getMsg());
- rootElement.appendChild(element);
- }
- storeProvider.saveLogXml(Jaxp.getDocumentXml(doc));
- } catch (Exception ex) {
- OseeLog.log(AtsCore.class, OseeLevel.SEVERE_POPUP, "Can't create ats log document", ex);
- }
- }
-
- @Override
public List<IAtsLogItem> getLogItemsReversed() throws OseeCoreException {
List<IAtsLogItem> logItems = getLogItems();
Collections.reverse(logItems);
@@ -159,8 +67,8 @@ public class AtsLog implements IAtsLog {
List<IAtsLogItem> logItems = getLogItems();
for (IAtsLogItem item : logItems) {
if (item.getType() == LogType.Originated) {
- item.setUser(user);
- putLogItems(logItems);
+ item.setUserId(user.getUserId());
+ dirty = true;
return;
}
}
@@ -175,7 +83,7 @@ public class AtsLog implements IAtsLog {
for (IAtsLogItem item : logItems) {
if (item.getType() == LogType.Originated) {
item.setDate(date);
- putLogItems(logItems);
+ dirty = true;
return;
}
}
@@ -202,52 +110,27 @@ public class AtsLog implements IAtsLog {
return item.getState();
}
- /**
- * @param state name of state or null
- */
@Override
- public void addLog(LogType type, String state, String msg) throws OseeCoreException {
- addLog(type, state, msg, new Date(), userService.getCurrentUser());
+ public void addLogItem(IAtsLogItem item) throws OseeCoreException {
+ addLog(item.getType(), item.getState(), item.getMsg(), item.getDate(), item.getUserId());
}
@Override
- public void addLogItem(IAtsLogItem item) throws OseeCoreException {
- addLog(item.getType(), item.getState(), item.getMsg(), item.getDate(), item.getUser());
+ public void addLog(LogType type, String state, String msg, String userId) throws OseeCoreException {
+ addLog(type, state, msg, new Date(), userId);
}
@Override
- public void addLog(LogType type, String state, String msg, Date date, IAtsUser user) throws OseeCoreException {
- LogItem logItem = new LogItem(type, date, user, state, msg, storeProvider.getLogId(), userService);
+ public void addLog(LogType type, String state, String msg, Date date, String userId) throws OseeCoreException {
+ LogItem logItem = new LogItem(type, date, userId, state, msg);
List<IAtsLogItem> logItems = getLogItems();
logItems.add(logItem);
- putLogItems(logItems);
+ dirty = true;
}
@Override
public void clearLog() {
- putLogItems(new ArrayList<IAtsLogItem>());
- }
-
- @Override
- public String getTable() throws OseeCoreException {
- StringBuilder builder = new StringBuilder();
- List<IAtsLogItem> logItems = getLogItems();
- builder.append(AHTML.beginMultiColumnTable(100, 1));
- builder.append(AHTML.addHeaderRowMultiColumnTable(Arrays.asList("Event", "State", "Message", "User", "Date")));
- for (IAtsLogItem item : logItems) {
- IAtsUser user = item.getUser();
- String userStr = null;
- if (user == null) {
- userStr = item.getUserId();
- } else {
- userStr = user.getName();
- }
- builder.append(AHTML.addRowMultiColumnTable(String.valueOf(item.getType()),
- (item.getState().equals("") ? "." : item.getState()), (item.getMsg().equals("") ? "." : item.getMsg()),
- userStr, item.getDate(DateUtil.MMDDYYHHMM)));
- }
- builder.append(AHTML.endMultiColumnTable());
- return builder.toString();
+ logItems.clear();
}
@Override
@@ -280,4 +163,28 @@ public class AtsLog implements IAtsLog {
return null;
}
+ @Override
+ public List<IAtsLogItem> getLogItems() throws OseeCoreException {
+ return logItems;
+ }
+
+ @Override
+ public boolean isDirty() {
+ return dirty;
+ }
+
+ @Override
+ public void setDirty(boolean dirty) {
+ this.dirty = dirty;
+ }
+
+ @Override
+ public void setLogId(String logId) {
+ this.logId = logId;
+ }
+
+ public String getLogId() {
+ return logId;
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/AtsLogFactory.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/AtsLogFactory.java
index 8ebe6a416a..e0d8105b7d 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/AtsLogFactory.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/AtsLogFactory.java
@@ -11,8 +11,8 @@
package org.eclipse.osee.ats.core.internal.log;
import java.util.Date;
+import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.user.IAtsUser;
-import org.eclipse.osee.ats.api.user.IAtsUserService;
import org.eclipse.osee.ats.api.workflow.log.IAtsLog;
import org.eclipse.osee.ats.api.workflow.log.IAtsLogFactory;
import org.eclipse.osee.ats.api.workflow.log.IAtsLogItem;
@@ -27,23 +27,28 @@ import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
public class AtsLogFactory implements IAtsLogFactory {
@Override
- public IAtsLog getLog(ILogStorageProvider storageProvider, IAtsUserService userService) {
- return new AtsLog(storageProvider, userService);
+ public IAtsLog getLog() {
+ return new AtsLog();
}
@Override
- public IAtsLogItem newLogItem(LogType type, Date date, IAtsUser user, String state, String msg, String hrid) throws OseeCoreException {
- return new LogItem(type, date, user, state, msg, hrid, AtsCore.getUserService());
+ public IAtsLog getLogLoaded(ILogStorageProvider storageProvider) {
+ IAtsLog log = getLog();
+ AtsLogReader reader = new AtsLogReader(log, storageProvider);
+ reader.load();
+ return log;
}
@Override
- public IAtsLogItem newLogItem(LogType type, String date, String userId, String state, String msg, String hrid) throws OseeCoreException {
- return new LogItem(type, date, userId, state, msg, hrid, AtsCore.getUserService());
+ public IAtsLogItem newLogItem(LogType type, Date date, IAtsUser user, String state, String msg) throws OseeCoreException {
+ return new LogItem(type, date, user.getUserId(), state, msg);
}
@Override
- public IAtsLogItem newLogItem(String type, String date, String userId, String state, String msg, String hrid) throws OseeCoreException {
- return new LogItem(type, date, userId, state, msg, hrid, AtsCore.getUserService());
+ public void writeToStore(IAtsWorkItem workItem) {
+ ILogStorageProvider storageProvider = AtsCore.getWorkItemService().getLogStorageProvider(workItem);
+ AtsLogWriter writer = new AtsLogWriter(workItem.getLog(), storageProvider);
+ writer.save();
}
}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/AtsLogHtml.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/AtsLogHtml.java
new file mode 100644
index 0000000000..883a9e39da
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/AtsLogHtml.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * 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.internal.log;
+
+import java.util.Arrays;
+import java.util.List;
+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.ILogStorageProvider;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.jdk.core.util.DateUtil;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsLogHtml {
+
+ private final IAtsLog atsLog;
+ private final boolean showLogTitle;
+ private final ILogStorageProvider storeProvider;
+
+ public AtsLogHtml(IAtsLog atsLog, ILogStorageProvider storeProvider, boolean showLogTitle) {
+ this.storeProvider = storeProvider;
+ this.showLogTitle = showLogTitle;
+ this.atsLog = atsLog;
+ }
+
+ public String get() throws OseeCoreException {
+ if (atsLog.getLogItems().isEmpty()) {
+ return "";
+ }
+ StringBuffer sb = new StringBuffer();
+ if (showLogTitle) {
+ sb.append(AHTML.addSpace(1) + AHTML.getLabelStr(AHTML.LABEL_FONT, storeProvider.getLogTitle()));
+ }
+ sb.append(getTable());
+ return sb.toString();
+ }
+
+ public String getTable() throws OseeCoreException {
+ StringBuilder builder = new StringBuilder();
+ List<IAtsLogItem> logItems = atsLog.getLogItems();
+ builder.append(AHTML.beginMultiColumnTable(100, 1));
+ builder.append(AHTML.addHeaderRowMultiColumnTable(Arrays.asList("Event", "State", "Message", "User", "Date")));
+ for (IAtsLogItem item : logItems) {
+ builder.append(AHTML.addRowMultiColumnTable(String.valueOf(item.getType()),
+ (item.getState().equals("") ? "." : item.getState()), (item.getMsg().equals("") ? "." : item.getMsg()),
+ getUserName(item.getUserId()), item.getDate(DateUtil.MMDDYYHHMM)));
+ }
+ builder.append(AHTML.endMultiColumnTable());
+ return builder.toString();
+ }
+
+ private String getUserName(String userId) {
+ String name = userId;
+ if (storeProvider != null) {
+ String userName = storeProvider.getNameFromUserId(userId);
+ if (Strings.isValid(userName)) {
+ name = userName;
+ }
+ }
+ return name;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/AtsLogReader.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/AtsLogReader.java
new file mode 100644
index 0000000000..4234561fe7
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/AtsLogReader.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.internal.log;
+
+import java.util.logging.Level;
+import java.util.regex.Matcher;
+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.ILogStorageProvider;
+import org.eclipse.osee.ats.core.AtsCore;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.AXml;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.OseeLog;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsLogReader {
+
+ private final ILogStorageProvider storeProvider;
+ private final IAtsLog atsLog;
+
+ public AtsLogReader(IAtsLog atsLog, ILogStorageProvider storeProvider) {
+ this.atsLog = atsLog;
+ this.storeProvider = storeProvider;
+ }
+
+ public void load() throws OseeCoreException {
+ atsLog.clearLog();
+ atsLog.setLogId(storeProvider.getLogId());
+ String xml = storeProvider.getLogXml();
+ if (!xml.isEmpty()) {
+ Matcher m = AtsLogWriter.LOG_ITEM_PATTERN.matcher(xml);
+ while (m.find()) {
+ IAtsLogItem item =
+ new LogItem(m.group(4), m.group(1), Strings.intern(m.group(5)), Strings.intern(m.group(3)),
+ AXml.xmlToText(m.group(2)));
+ atsLog.addLogItem(item);
+ }
+
+ Matcher m2 = AtsLogWriter.LOG_ITEM_TAG_PATTERN.matcher(xml);
+ int openTagsFound = 0;
+ while (m2.find()) {
+ openTagsFound++;
+ }
+ int size = atsLog.getLogItems().size();
+ if (size != openTagsFound) {
+ OseeLog.logf(AtsCore.class, Level.SEVERE,
+ "ATS Log: open tags found %d doesn't match log items parsed %d for %s", openTagsFound, size,
+ storeProvider.getLogId());
+ }
+ }
+ atsLog.setDirty(false);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/AtsLogWriter.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/AtsLogWriter.java
new file mode 100644
index 0000000000..97eb9006a1
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/AtsLogWriter.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * 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.internal.log;
+
+import java.util.regex.Pattern;
+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.ILogStorageProvider;
+import org.eclipse.osee.ats.core.AtsCore;
+import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsLogWriter {
+
+ private final ILogStorageProvider storageProvider;
+ public final static String ATS_LOG_TAG = "AtsLog";
+ public final static String LOG_ITEM_TAG = "Item";
+ public final static Pattern LOG_ITEM_PATTERN =
+ Pattern.compile("<Item date=\"(.*?)\" msg=\"(.*?)\" state=\"(.*?)\" type=\"(.*?)\" userId=\"(.*?)\"/>");
+ public final static Pattern LOG_ITEM_TAG_PATTERN = Pattern.compile("<Item ");
+ private final IAtsLog atsLog;
+
+ public AtsLogWriter(IAtsLog atsLog, ILogStorageProvider storageProvider) {
+ this.atsLog = atsLog;
+ this.storageProvider = storageProvider;
+ }
+
+ public void save() {
+ try {
+ Document doc = Jaxp.newDocumentNamespaceAware();
+ Element rootElement = doc.createElement(ATS_LOG_TAG);
+ doc.appendChild(rootElement);
+ for (IAtsLogItem item : atsLog.getLogItems()) {
+ Element element = doc.createElement(LOG_ITEM_TAG);
+ element.setAttribute("type", item.getType().name());
+ element.setAttribute("date", String.valueOf(item.getDate().getTime()));
+ element.setAttribute("userId", item.getUserId());
+ element.setAttribute("state", item.getState());
+ element.setAttribute("msg", item.getMsg());
+ rootElement.appendChild(element);
+ }
+ storageProvider.saveLogXml(Jaxp.getDocumentXml(doc));
+ } catch (Exception ex) {
+ OseeLog.log(AtsCore.class, OseeLevel.SEVERE_POPUP, "Can't create ats log document", ex);
+ }
+ atsLog.setDirty(false);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/LogItem.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/LogItem.java
index 01eaa89994..ad5e18db2e 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/LogItem.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/log/LogItem.java
@@ -14,10 +14,9 @@ import static org.eclipse.osee.framework.jdk.core.util.Strings.intern;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
-import org.eclipse.osee.ats.api.user.IAtsUser;
-import org.eclipse.osee.ats.api.user.IAtsUserService;
import org.eclipse.osee.ats.api.workflow.log.IAtsLogItem;
import org.eclipse.osee.ats.api.workflow.log.LogType;
+import org.eclipse.osee.ats.core.workflow.log.AtsLogUtility;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.DateUtil;
@@ -29,26 +28,24 @@ public class LogItem implements IAtsLogItem {
private Date date;
private String msg;
private String state;
- private IAtsUser user;
+ private String userId;
private LogType type = LogType.None;
- private final String userId;
- public LogItem(LogType type, Date date, IAtsUser user, String state, String msg, String atsId, IAtsUserService userService) throws OseeCoreException {
- this(type.name(), String.valueOf(date.getTime()), user.getUserId(), state, msg, atsId, userService);
+ public LogItem(LogType type, Date date, String userId, String state, String msg) throws OseeCoreException {
+ this(type.name(), String.valueOf(date.getTime()), userId, state, msg);
}
- public LogItem(LogType type, String date, String userId, String state, String msg, String atsId, IAtsUserService userService) throws OseeCoreException {
+ public LogItem(LogType type, String date, String userId, String state, String msg) throws OseeCoreException {
Long dateLong = Long.valueOf(date);
this.date = new Date(dateLong.longValue());
this.msg = msg;
this.state = intern(state);
this.userId = intern(userId);
- this.user = userService.getUserById(userId);
this.type = type;
}
- public LogItem(String type, String date, String userId, String state, String msg, String atsId, IAtsUserService userService) throws OseeCoreException {
- this(LogType.getType(type), date, userId, state, msg, atsId, userService);
+ public LogItem(String type, String date, String userId, String state, String msg) throws OseeCoreException {
+ this(LogType.getType(type), date, userId, state, msg);
}
@Override
@@ -86,25 +83,8 @@ public class LogItem implements IAtsLogItem {
@Override
public String toString() {
- return String.format("%s (%s)%s by %s on %s", getToStringMsg(), type, getToStringState(), getToStringUser(),
- DateUtil.getMMDDYYHHMM(date));
- }
-
- private String getToStringUser() {
- return user == null ? "unknown" : user.getName();
- }
-
- private String getToStringState() {
- return state.isEmpty() ? "" : "from " + state;
- }
-
- private String getToStringMsg() {
- return msg.isEmpty() ? "" : msg;
- }
-
- @Override
- public IAtsUser getUser() {
- return user;
+ return String.format("%s (%s)%s by %s on %s", AtsLogUtility.getToStringMsg(this), type,
+ AtsLogUtility.getToStringState(this), getUserId(), DateUtil.getMMDDYYHHMM(date));
}
@Override
@@ -118,16 +98,6 @@ public class LogItem implements IAtsLogItem {
}
@Override
- public String toHTML(String labelFont) {
- return "NOTE (" + type + "): " + msg + " (" + user.getName() + ")";
- }
-
- @Override
- public void setUser(IAtsUser user) {
- this.user = user;
- }
-
- @Override
public String getState() {
return state;
}
@@ -136,4 +106,9 @@ public class LogItem implements IAtsLogItem {
public void setState(String state) {
this.state = state;
}
+
+ @Override
+ public String setUserId(String userId) {
+ return this.userId = userId;
+ }
}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/StateManager.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/StateManager.java
index ef0ded4455..59aa45cfc5 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/StateManager.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/internal/state/StateManager.java
@@ -173,22 +173,16 @@ public class StateManager implements IAtsNotificationListener, IAtsStateManager
protected void logMetrics(IStateToken state, IAtsUser user, Date date) throws OseeCoreException {
String hoursSpent = AtsUtilCore.doubleToI18nString(HoursSpentUtil.getHoursSpentTotal(workItem));
- logMetrics(workItem, PercentCompleteTotalUtil.getPercentCompleteTotal(workItem) + "", hoursSpent, state, user,
- date);
- }
-
- public static void logMetrics(IAtsWorkItem workItem, String percent, String hours, IStateToken state, IAtsUser user, Date date) throws OseeCoreException {
IAtsLogItem logItem =
- AtsCore.getLogFactory().newLogItem(LogType.Metrics, date, user, state.getName(),
- String.format("Percent %s Hours %s", percent, hours), workItem.getAtsId());
+ AtsCore.getLogFactory().newLogItem(
+ LogType.Metrics,
+ date,
+ user,
+ state.getName(),
+ String.format("Percent %s Hours %s", PercentCompleteTotalUtil.getPercentCompleteTotal(workItem), hoursSpent));
workItem.getLog().addLogItem(logItem);
}
- @Override
- public void setMetrics(double hours, int percentComplete, boolean logMetrics, IAtsUser user, Date date) throws OseeCoreException {
- setMetrics(getCurrentState(), hours, percentComplete, logMetrics, user, date);
- }
-
/**
* @return true if hours difference is > than .01
*/
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/log/AtsLogUtility.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/log/AtsLogUtility.java
new file mode 100644
index 0000000000..602e338a1a
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/log/AtsLogUtility.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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.workflow.log;
+
+import org.eclipse.osee.ats.api.user.IAtsUser;
+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.ILogStorageProvider;
+import org.eclipse.osee.ats.core.AtsCore;
+import org.eclipse.osee.ats.core.internal.log.AtsLogHtml;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.DateUtil;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsLogUtility {
+
+ public static String getHtml(IAtsLog atsLog, ILogStorageProvider storageProvider) throws OseeCoreException {
+ return getHtml(atsLog, storageProvider, true);
+ }
+
+ public static String getHtml(IAtsLog atsLog, ILogStorageProvider storageProvider, boolean showLogTitle) throws OseeCoreException {
+ return (new AtsLogHtml(atsLog, storageProvider, showLogTitle)).get();
+ }
+
+ public static String getTable(IAtsLog atsLog, ILogStorageProvider storageProvider) throws OseeCoreException {
+ return (new AtsLogHtml(atsLog, storageProvider, true)).getTable();
+ }
+
+ public static String getToStringUser(IAtsLogItem item) {
+ IAtsUser user = AtsCore.getUserService().getUserById(item.getUserId());
+ return user == null ? "unknown" : user.getName();
+ }
+
+ public static String toString(IAtsLogItem item) {
+ IAtsUser user = AtsCore.getUserService().getUserById(item.getUserId());
+ return String.format("%s (%s)%s by %s on %s", getToStringMsg(item), item.getType(), getToStringState(item),
+ user.getName(), DateUtil.getMMDDYYHHMM(item.getDate()));
+ }
+
+ public static String getToStringState(IAtsLogItem item) {
+ return item.getState().isEmpty() ? "" : "from " + item.getState();
+ }
+
+ public static String getToStringMsg(IAtsLogItem item) {
+ return item.getMsg().isEmpty() ? "" : item.getMsg();
+ }
+
+ public static String getUserName(String userId) {
+ String name = "unknown (" + userId + ")";
+ IAtsUser user = AtsCore.getUserService().getUserById(userId);
+ if (user != null) {
+ name = user.getName();
+ }
+ return name;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/transition/TransitionManager.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/transition/TransitionManager.java
index a772bcdf54..ef7bf99db0 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/transition/TransitionManager.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/transition/TransitionManager.java
@@ -431,7 +431,7 @@ public class TransitionManager {
}
public static void logWorkflowCancelledEvent(IAtsWorkItem workItem, IAtsStateDefinition fromState, IAtsStateDefinition toState, String reason, Date cancelDate, IAtsUser cancelBy) throws OseeCoreException {
- workItem.getLog().addLog(LogType.StateCancelled, fromState.getName(), reason, cancelDate, cancelBy);
+ workItem.getLog().addLog(LogType.StateCancelled, fromState.getName(), reason, cancelDate, cancelBy.getUserId());
if (AtsCore.getAttrResolver().isAttributeTypeValid(workItem, AtsAttributeTypes.CreatedBy)) {
AtsCore.getAttrResolver().setSoleAttributeValue(workItem, AtsAttributeTypes.CancelledBy, cancelBy.getUserId());
AtsCore.getAttrResolver().setSoleAttributeValue(workItem, AtsAttributeTypes.CancelledDate, cancelDate);
@@ -440,6 +440,8 @@ public class TransitionManager {
fromState.getName());
}
validateUpdatePercentCompleteAttribute(workItem, toState);
+ AtsCore.getLogFactory().writeToStore(workItem);
+
}
public static void logWorkflowUnCancelledEvent(IAtsWorkItem workItem, IAtsStateDefinition toState) throws OseeCoreException {
@@ -450,11 +452,12 @@ public class TransitionManager {
AtsCore.getAttrResolver().deleteSoleAttribute(workItem, AtsAttributeTypes.CancelledFromState);
}
validateUpdatePercentCompleteAttribute(workItem, toState);
+ AtsCore.getLogFactory().writeToStore(workItem);
}
private void logWorkflowCompletedEvent(IAtsWorkItem workItem, IAtsStateDefinition fromState, IAtsStateDefinition toState, String reason, Date cancelDate, IAtsUser cancelBy) throws OseeCoreException {
workItem.getLog().addLog(LogType.StateComplete, fromState.getName(), Strings.isValid(reason) ? reason : "",
- cancelDate, cancelBy);
+ cancelDate, cancelBy.getUserId());
if (AtsCore.getAttrResolver().isAttributeTypeValid(workItem, AtsAttributeTypes.CreatedBy)) {
AtsCore.getAttrResolver().setSoleAttributeValue(workItem, AtsAttributeTypes.CompletedBy, cancelBy.getUserId());
AtsCore.getAttrResolver().setSoleAttributeValue(workItem, AtsAttributeTypes.CompletedDate, cancelDate);
@@ -462,6 +465,7 @@ public class TransitionManager {
fromState.getName());
}
validateUpdatePercentCompleteAttribute(workItem, toState);
+ AtsCore.getLogFactory().writeToStore(workItem);
}
public static void logWorkflowUnCompletedEvent(IAtsWorkItem workItem, IAtsStateDefinition toState) throws OseeCoreException {
@@ -471,6 +475,7 @@ public class TransitionManager {
AtsCore.getAttrResolver().deleteSoleAttribute(workItem, AtsAttributeTypes.CompletedFromState);
}
validateUpdatePercentCompleteAttribute(workItem, toState);
+ AtsCore.getLogFactory().writeToStore(workItem);
}
private static void validateUpdatePercentCompleteAttribute(IAtsWorkItem workItem, IAtsStateDefinition toState) throws OseeCoreException {
@@ -483,11 +488,14 @@ public class TransitionManager {
}
private void logStateCompletedEvent(IAtsWorkItem workItem, String fromStateName, String reason, Date date, IAtsUser user) throws OseeCoreException {
- workItem.getLog().addLog(LogType.StateComplete, fromStateName, Strings.isValid(reason) ? reason : "", date, user);
+ workItem.getLog().addLog(LogType.StateComplete, fromStateName, Strings.isValid(reason) ? reason : "", date,
+ user.getUserId());
+ AtsCore.getLogFactory().writeToStore(workItem);
}
public static void logStateStartedEvent(IAtsWorkItem workItem, IStateToken state, Date date, IAtsUser user) throws OseeCoreException {
- workItem.getLog().addLog(LogType.StateEntered, state.getName(), "", date, user);
+ workItem.getLog().addLog(LogType.StateEntered, state.getName(), "", date, user.getUserId());
+ AtsCore.getLogFactory().writeToStore(workItem);
}
/**
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPrint.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPrint.java
index dae49a8e4f..bb265c6591 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPrint.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPrint.java
@@ -27,10 +27,12 @@ import org.eclipse.osee.ats.core.client.util.AtsUtilCore;
import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
import org.eclipse.osee.ats.core.client.workflow.ChangeTypeUtil;
import org.eclipse.osee.ats.core.client.workflow.PriorityUtil;
+import org.eclipse.osee.ats.core.client.workflow.log.ArtifactLog;
import org.eclipse.osee.ats.core.client.workflow.note.NoteItem;
import org.eclipse.osee.ats.core.column.AssigneeColumn;
import org.eclipse.osee.ats.core.util.HoursSpentUtil;
import org.eclipse.osee.ats.core.util.PercentCompleteTotalUtil;
+import org.eclipse.osee.ats.core.workflow.log.AtsLogUtility;
import org.eclipse.osee.ats.editor.widget.ReviewInfoXWidget;
import org.eclipse.osee.ats.internal.Activator;
import org.eclipse.osee.ats.util.AtsUtil;
@@ -114,7 +116,7 @@ public class SMAPrint extends Action {
getTaskHtml(resultData);
}
resultData.addRaw(AHTML.newline());
- resultData.addRaw(sma.getLog().getHtml());
+ resultData.addRaw(AtsLogUtility.getHtml(sma.getLog(), new ArtifactLog(sma)));
XResultData rd = new XResultData();
rd.addRaw(AHTML.beginMultiColumnTable(100, 1));
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeStatus.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeStatus.java
index 009bfaf1b8..c5fa106262 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeStatus.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeStatus.java
@@ -15,6 +15,7 @@ import java.util.Collection;
import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
+import org.eclipse.osee.ats.core.AtsCore;
import org.eclipse.osee.ats.core.client.task.TaskArtifact;
import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
import org.eclipse.osee.ats.core.users.AtsCoreUsers;
@@ -111,6 +112,7 @@ public class SMAPromptChangeStatus {
workItem.getStateMgr().addAssignee(AtsClientService.get().getUserAdmin().getCurrentUser());
}
workItem.getStateMgr().updateMetrics(workItem.getStateDefinition(), hours, percent, true);
+ AtsCore.getLogFactory().writeToStore(workItem);
if (persist) {
AtsClientService.get().getArtifact(workItem).persist(transaction);
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAWorkFlowSection.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAWorkFlowSection.java
index b19ce49c26..a2c6ab2c48 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAWorkFlowSection.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAWorkFlowSection.java
@@ -21,6 +21,7 @@ import org.eclipse.osee.ats.core.client.task.AbstractTaskableArtifact;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
import org.eclipse.osee.ats.core.workflow.WorkflowManagerCore;
+import org.eclipse.osee.ats.core.workflow.log.AtsLogUtility;
import org.eclipse.osee.ats.editor.stateItem.AtsStateItemManager;
import org.eclipse.osee.ats.editor.stateItem.IAtsStateItem;
import org.eclipse.osee.ats.editor.widget.ReviewInfoXWidget;
@@ -366,7 +367,7 @@ public class SMAWorkFlowSection extends SectionPart {
IAtsLogItem item = sma.getStateStartedData(statePageName);
if (item != null) {
sb.append(" by ");
- sb.append(item.getUser().getName());
+ sb.append(AtsLogUtility.getUserName(item.getUserId()));
}
} else if (sma.isCancelled()) {
if (!sma.getCurrentStateName().equals(StateType.Cancelled.toString())) {
@@ -377,7 +378,7 @@ public class SMAWorkFlowSection extends SectionPart {
IAtsLogItem item = sma.getStateStartedData(statePageName);
if (item != null) {
sb.append(" by ");
- sb.append(item.getUser().getName());
+ sb.append(AtsLogUtility.getUserName(item.getUserId()));
}
}
if (sma.getStateMgr().getAssignees().size() > 0) {
@@ -396,7 +397,7 @@ public class SMAWorkFlowSection extends SectionPart {
if (item != null) {
sb.append(item.getDate(DateUtil.MMDDYYHHMM));
sb.append(" by ");
- sb.append(item.getUser().getName());
+ sb.append(AtsLogUtility.getUserName(item.getUserId()));
}
}
return sb.toString();
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/WETransitionComposite.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/WETransitionComposite.java
index 0a14492540..c5ac1cc361 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/WETransitionComposite.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/WETransitionComposite.java
@@ -339,6 +339,7 @@ public class WETransitionComposite extends Composite {
}
}
awa.getStateMgr().updateMetrics(awa.getStateDefinition(), additionalHours, percent, true);
+ AtsCore.getLogFactory().writeToStore(awa);
return true;
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/log/column/LogAuthorColumn.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/log/column/LogAuthorColumn.java
index be336ce10c..9432b2b14e 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/log/column/LogAuthorColumn.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/log/column/LogAuthorColumn.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.ats.editor.log.column;
import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
import org.eclipse.nebula.widgets.xviewer.XViewerValueColumn;
import org.eclipse.osee.ats.api.workflow.log.IAtsLogItem;
+import org.eclipse.osee.ats.core.workflow.log.AtsLogUtility;
import org.eclipse.swt.SWT;
/**
@@ -43,7 +44,7 @@ public class LogAuthorColumn extends XViewerValueColumn {
@Override
public String getColumnText(Object element, XViewerColumn column, int columnIndex) {
if (element instanceof IAtsLogItem) {
- return ((IAtsLogItem) element).getUser().getName();
+ return AtsLogUtility.getUserName(((IAtsLogItem) element).getUserId());
}
return "";
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateAtsDatabase.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateAtsDatabase.java
index 44d749fd02..3719398e3a 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateAtsDatabase.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/health/ValidateAtsDatabase.java
@@ -51,10 +51,12 @@ import org.eclipse.osee.ats.core.client.task.TaskArtifact;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.core.client.util.AtsTaskCache;
import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
+import org.eclipse.osee.ats.core.client.workflow.log.ArtifactLog;
import org.eclipse.osee.ats.core.config.AtsVersionService;
import org.eclipse.osee.ats.core.config.TeamDefinitions;
import org.eclipse.osee.ats.core.users.AtsCoreUsers;
import org.eclipse.osee.ats.core.util.AtsObjects;
+import org.eclipse.osee.ats.core.workflow.log.AtsLogUtility;
import org.eclipse.osee.ats.core.workflow.state.TeamState;
import org.eclipse.osee.ats.core.workflow.transition.TransitionManager;
import org.eclipse.osee.ats.internal.Activator;
@@ -1162,10 +1164,10 @@ public class ValidateAtsDatabase extends WorldXNavigateItemAction {
}
}
// Generate html log which will exercise all the conversions
- log.getHtml();
+ AtsLogUtility.getHtml(awa.getLog(), new ArtifactLog(awa), true);
// Verify that all users are resolved
for (IAtsLogItem logItem : awa.getLog().getLogItems()) {
- if (logItem.getUser() == null) {
+ if (logItem.getUserId() == null) {
testNameToResultsMap.put(
"testAtsLogs",
"Error: " + awa.getArtifactTypeName() + " " + XResultDataUI.getHyperlink(awa) + " user == null for userId \"" + logItem.getUserId() + "\"");
@@ -1186,7 +1188,6 @@ public class ValidateAtsDatabase extends WorldXNavigateItemAction {
}
logTestTimeSpent(date, "testAtsLogs", testNameToTimeSpentMap);
}
-
private static IAtsUser unAssignedUser;
private static IAtsUser oseeSystemUser;
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/DuplicateWorkflowBlam.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/DuplicateWorkflowBlam.java
index 343a813c53..2645e14122 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/DuplicateWorkflowBlam.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/DuplicateWorkflowBlam.java
@@ -24,6 +24,7 @@ import org.eclipse.osee.ats.api.data.AtsRelationTypes;
import org.eclipse.osee.ats.api.team.CreateTeamOption;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.workflow.log.LogType;
+import org.eclipse.osee.ats.core.AtsCore;
import org.eclipse.osee.ats.core.client.action.ActionManager;
import org.eclipse.osee.ats.core.client.task.AbstractTaskableArtifact;
import org.eclipse.osee.ats.core.client.task.TaskArtifact;
@@ -163,11 +164,15 @@ public class DuplicateWorkflowBlam extends AbstractBlam {
dupArt.setName(title);
}
dupArt.addRelation(AtsRelationTypes.ActionToWorkflow_Action, teamArt.getParentActionArtifact());
- dupArt.getLog().addLog(LogType.Note, null, "Workflow duplicated from " + teamArt.getAtsId());
+ dupArt.getLog().addLog(LogType.Note, null, "Workflow duplicated from " + teamArt.getAtsId(),
+ AtsCore.getUserService().getCurrentUser().getUserId());
+ AtsCore.getLogFactory().writeToStore(dupArt);
if (duplicateTasks) {
for (TaskArtifact taskArt : teamArt.getTaskArtifacts()) {
TaskArtifact dupTaskArt = (TaskArtifact) taskArt.duplicate(AtsUtil.getAtsBranch());
- dupTaskArt.getLog().addLog(LogType.Note, null, "Task duplicated from " + taskArt.getAtsId());
+ dupTaskArt.getLog().addLog(LogType.Note, null, "Task duplicated from " + taskArt.getAtsId(),
+ AtsCore.getUserService().getCurrentUser().getUserId());
+ AtsCore.getLogFactory().writeToStore(dupTaskArt);
dupArt.addRelation(AtsRelationTypes.TeamWfToTask_Task, dupTaskArt);
dupArt.persist(transaction);
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsTaskArtifactExtractor.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsTaskArtifactExtractor.java
index e83802ca53..ae609adc4c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsTaskArtifactExtractor.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsTaskArtifactExtractor.java
@@ -24,6 +24,7 @@ import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
import org.eclipse.osee.ats.api.notify.AtsNotifyType;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
+import org.eclipse.osee.ats.core.AtsCore;
import org.eclipse.osee.ats.core.client.notify.AtsNotificationManager;
import org.eclipse.osee.ats.core.client.task.AbstractTaskableArtifact;
import org.eclipse.osee.ats.core.client.task.TaskArtifact;
@@ -274,6 +275,7 @@ public class ExcelAtsTaskArtifactExtractor {
}
sma.getStateMgr().updateMetrics(sma.getStateDefinition(), hours,
sma.getStateMgr().getPercentComplete(sma.getCurrentStateName()), true);
+ AtsCore.getLogFactory().writeToStore(sma);
}
}
@@ -291,6 +293,7 @@ public class ExcelAtsTaskArtifactExtractor {
}
int percentInt = percent.intValue();
sma.getStateMgr().updateMetrics(sma.getStateDefinition(), 0, percentInt, true);
+ AtsCore.getLogFactory().writeToStore(sma);
}
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Overview.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Overview.java
index 128df84c97..49558dfbff 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Overview.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Overview.java
@@ -21,7 +21,9 @@ import org.eclipse.osee.ats.core.client.artifact.AbstractAtsArtifact;
import org.eclipse.osee.ats.core.client.task.TaskArtifact;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
+import org.eclipse.osee.ats.core.client.workflow.log.ArtifactLog;
import org.eclipse.osee.ats.core.util.AtsObjects;
+import org.eclipse.osee.ats.core.workflow.log.AtsLogUtility;
import org.eclipse.osee.ats.internal.Activator;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
@@ -252,7 +254,7 @@ public class Overview {
public void addLog(AbstractWorkflowArtifact artifact) throws OseeCoreException {
IAtsLog artifactLog = artifact.getLog();
if (artifactLog != null && artifactLog.getLogItems().size() > 0) {
- addTable(artifact.getLog().getTable());
+ AtsLogUtility.getTable(artifactLog, new ArtifactLog(artifact));
}
}

Back to the top