Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormegumi.telles2016-08-30 09:54:06 -0400
committerdonald.g.dunne2016-09-01 20:21:31 -0400
commit0e556913e81708d8c1b4d88768e03793ed92b113 (patch)
treedce8f075a0d3bd71a0d4db8abd8d9bac318ab0d2
parent1f3d1806c2e0caeb92dc9387d39fbde91c1b84d9 (diff)
downloadorg.eclipse.osee-0e556913e81708d8c1b4d88768e03793ed92b113.tar.gz
org.eclipse.osee-0e556913e81708d8c1b4d88768e03793ed92b113.tar.xz
org.eclipse.osee-0e556913e81708d8c1b4d88768e03793ed92b113.zip
bug[ats_ATS312064]: Add tracked changes check on save
-- On save the artifacts with tracked changes are captured and displayed in a result viewer for the user to correct -- While the save should catch tracked changes, the check on commit still exists and has been updated to capture all artifacts then provide the list Change-Id: Idf2a184d3dd77c658a429c899b4f0c1e4a928bd2
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordTrackedChangesTest.java10
-rw-r--r--plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/WordUpdateChange.java12
-rw-r--r--plugins/org.eclipse.osee.define.report/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordUpdateArtifact.java9
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/WordCoreUtil.java39
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/WordAttribute.java7
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/actions/CatchTrackedChanges.java14
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/word/WordUtil.java18
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/PlainTextRenderer.java4
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/UpdateArtifactOperation.java74
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WholeWordRenderer.java7
11 files changed, 142 insertions, 53 deletions
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordTrackedChangesTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordTrackedChangesTest.java
index ccea1f92b7..bf1da1d898 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordTrackedChangesTest.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordTrackedChangesTest.java
@@ -17,12 +17,12 @@ import static org.junit.Assert.assertTrue;
import org.eclipse.osee.client.test.framework.OseeClientIntegrationRule;
import org.eclipse.osee.client.test.framework.OseeLogMonitorRule;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.util.WordCoreUtil;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
import org.eclipse.osee.framework.skynet.core.linking.LinkType;
import org.eclipse.osee.framework.skynet.core.linking.WordMlLinkHandler;
-import org.eclipse.osee.framework.skynet.core.word.WordUtil;
import org.junit.Rule;
import org.junit.Test;
@@ -42,14 +42,14 @@ public class WordTrackedChangesTest {
@Test
public void testFindTrackChanges() throws Exception {
String content = Lib.fileToString(getClass(), TEST_WORD_EDIT_FILE_NAME);
- assertTrue(WordUtil.containsWordAnnotations(content));
+ assertTrue(WordCoreUtil.containsWordAnnotations(content));
}
@Test
public void testRemoveTrackChanges() throws Exception {
String content = Lib.fileToString(getClass(), TEST_WORD_EDIT_FILE_NAME);
- content = WordUtil.removeAnnotations(content);
- assertFalse(WordUtil.containsWordAnnotations(content));
+ content = WordCoreUtil.removeAnnotations(content);
+ assertFalse(WordCoreUtil.containsWordAnnotations(content));
}
@Test
@@ -62,7 +62,7 @@ public class WordTrackedChangesTest {
ArtifactTypeManager.addArtifact(CoreArtifactTypes.TestProcedureWML, SAW_Bld_1, getClass().getSimpleName());
newArt.persist(getClass().getSimpleName());
String unlinkedContent = WordMlLinkHandler.unlink(linkType, newArt, content);
- assertTrue(WordUtil.containsWordAnnotations(unlinkedContent));
+ assertTrue(WordCoreUtil.containsWordAnnotations(unlinkedContent));
} finally {
if (newArt != null) {
newArt.purgeFromBranch();
diff --git a/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/WordUpdateChange.java b/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/WordUpdateChange.java
index 32de361708..37582b6d97 100644
--- a/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/WordUpdateChange.java
+++ b/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/WordUpdateChange.java
@@ -10,8 +10,10 @@
*******************************************************************************/
package org.eclipse.osee.define.report.api;
+import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.TransactionId;
@@ -21,6 +23,7 @@ import org.eclipse.osee.framework.core.data.TransactionId;
public class WordUpdateChange {
private TransactionId tx;
private List<WordArtifactChange> changedArts = new LinkedList<>();
+ private final Map<Long, String> trackedChangeArts = new HashMap<>();
private BranchId branch;
public TransactionId getTx() {
@@ -78,4 +81,13 @@ public class WordUpdateChange {
}
return hasRelatedChange;
}
+
+ public Map<Long, String> getTrackedChangeArts() {
+ return trackedChangeArts;
+ }
+
+ public void setTrackedChangeArts(Long artId, String name) {
+ trackedChangeArts.put(artId, name);
+ }
+
}
diff --git a/plugins/org.eclipse.osee.define.report/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.define.report/META-INF/MANIFEST.MF
index 4a9bf11b49..e3a6c1729b 100644
--- a/plugins/org.eclipse.osee.define.report/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.define.report/META-INF/MANIFEST.MF
@@ -19,6 +19,7 @@ Import-Package: com.google.common.base;version="15.0.0",
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.exception,
org.eclipse.osee.framework.core.model,
+ org.eclipse.osee.framework.core.util,
org.eclipse.osee.framework.jdk.core.text,
org.eclipse.osee.framework.jdk.core.text.change,
org.eclipse.osee.framework.jdk.core.type,
diff --git a/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordUpdateArtifact.java b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordUpdateArtifact.java
index 6d40872568..4ea48f7f67 100644
--- a/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordUpdateArtifact.java
+++ b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordUpdateArtifact.java
@@ -11,7 +11,6 @@
package org.eclipse.osee.define.report.internal.wordupdate;
import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON_ID;
-import com.google.common.collect.Lists;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -25,6 +24,7 @@ import org.eclipse.osee.define.report.api.WordUpdateData;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.util.WordCoreUtil;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
import org.eclipse.osee.framework.jdk.core.util.Collections;
@@ -42,6 +42,7 @@ import org.osgi.service.event.EventAdmin;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
+import com.google.common.collect.Lists;
/**
* @author Ryan D. Brooks
@@ -138,13 +139,13 @@ public class WordUpdateArtifact {
String content = Lib.inputStreamToString(
new ByteArrayInputStream(WordUtilities.getFormattedContent(extractorData.getParentEelement())));
+ boolean hasTrackedChanges = WordCoreUtil.containsWordAnnotations(content);
/**
* Only update if: a. editing a single artifact or b. in multi-edit mode only update if the artifact has
* at least one textual change (if the MUTI_EDIT_SAVE_ALL_CHANGES preference is not set).
*/
-
boolean multiSave = data.isMultiEdit() || hasChangedContent(artifact, content);
- if (singleArtifact || multiSave) {
+ if (!hasTrackedChanges && (singleArtifact || multiSave)) {
if (extractorData.getParentEelement().getNodeName().endsWith("body")) {
/*
* This code pulls out all of the stuff after the inserted listnum reordering stuff. This needs to
@@ -160,6 +161,8 @@ public class WordUpdateArtifact {
artChange.setCreated(true);
}
artChange.addChangedAttrType(CoreAttributeTypes.WordTemplateContent.getGuid());
+ } else {
+ updateChange.setTrackedChangeArts(artifact.getId(), artifact.getName());
}
if (artChange.isChanged()) {
artChange.setSafetyRelated(checkIfSafetyRelated(artifact,
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/WordCoreUtil.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/WordCoreUtil.java
new file mode 100644
index 0000000000..b5ec25d702
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/WordCoreUtil.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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.framework.core.util;
+
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+
+/**
+ * @author Megumi Telles
+ */
+
+public class WordCoreUtil {
+ private static final String AML_ANNOTATION = "<.??aml:annotation.*?>";
+ private static final String AML_CONTENT = "<.??aml:content.*?>";
+ private static final String DELETIONS = "<w:delText>.*?</w:delText>";
+
+ public static boolean containsWordAnnotations(String wordml) {
+ return wordml.contains("<w:delText>") || wordml.contains("w:type=\"Word.Insertion\"") || wordml.contains(
+ "w:type=\"Word.Formatting\"") || wordml.contains("w:type=\"Word.Deletion\"");
+ }
+
+ public static String removeAnnotations(String wordml) {
+ String response = wordml;
+ if (Strings.isValid(response)) {
+ response = response.replaceAll(AML_ANNOTATION, "");
+ response = response.replaceAll(AML_CONTENT, "");
+ response = response.replaceAll(DELETIONS, "");
+ }
+ return response;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/WordAttribute.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/WordAttribute.java
index 533ba5f64e..7ed67ddabf 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/WordAttribute.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/WordAttribute.java
@@ -17,6 +17,7 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IStatusHandler;
import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.util.WordCoreUtil;
import org.eclipse.osee.framework.jdk.core.type.MutableBoolean;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.Pair;
@@ -46,7 +47,7 @@ public class WordAttribute extends StringAttribute {
Artifact art = getArtifact();
BranchId branch = art.getBranch();
- if (WordUtil.containsWordAnnotations(value) && !BranchManager.getType(branch).isMergeBranch()) {
+ if (WordCoreUtil.containsWordAnnotations(value) && !BranchManager.getType(branch).isMergeBranch()) {
try {
String message =
"This document contains track changes and cannot be saved with them. Do you want OSEE to remove them?" + "\n\nNote:You will need to reopen this artifact in OSEE to see the final result.";
@@ -57,7 +58,7 @@ public class WordAttribute extends StringAttribute {
MutableBoolean first = answer.getFirst();
boolean isOkToRemove = first.getValue();
if (isOkToRemove) {
- returnValue = WordUtil.removeAnnotations(value);
+ returnValue = WordCoreUtil.removeAnnotations(value);
} else {
throw new OseeCoreException(
"Artifact %s [%s], Branch[%s] contains track changes. Please remove them and save again.",
@@ -74,7 +75,7 @@ public class WordAttribute extends StringAttribute {
public boolean containsWordAnnotations() throws OseeCoreException {
String temp = getValue();
- return WordUtil.containsWordAnnotations(temp);
+ return WordCoreUtil.containsWordAnnotations(temp);
}
@Override
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/actions/CatchTrackedChanges.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/actions/CatchTrackedChanges.java
index 14603a8592..e17771edbf 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/actions/CatchTrackedChanges.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/actions/CatchTrackedChanges.java
@@ -12,7 +12,9 @@ package org.eclipse.osee.framework.skynet.core.commit.actions;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.osee.framework.core.data.BranchId;
@@ -47,6 +49,7 @@ public class CatchTrackedChanges implements CommitAction {
IOperation operation = ChangeManager.compareTwoBranchesHead(sourceBranch, destinationBranch, changes);
Operations.executeWorkAndCheckStatus(operation);
+ Map<Integer, String> trackedChanges = new HashMap<Integer, String>();
for (Change change : changes) {
if (!change.getModificationType().isDeleted()) {
if (change.getChangeType() == LoadChangeType.attribute) {
@@ -54,9 +57,7 @@ public class CatchTrackedChanges implements CommitAction {
if (attribute instanceof WordAttribute) {
if (((WordAttribute) attribute).containsWordAnnotations()) {
- throw new OseeCoreException(String.format(
- "Commit Branch Failed Artifact \"%s\" Art_ID \"%d\" contains Tracked Changes. Accept all revision changes and then recommit",
- attribute.getArtifact().getSafeName(), attribute.getArtifact().getArtId()));
+ trackedChanges.put(attribute.getArtifact().getArtId(), attribute.getArtifact().getSafeName());
}
}
}
@@ -69,6 +70,13 @@ public class CatchTrackedChanges implements CommitAction {
}
}
+ if (!trackedChanges.isEmpty()) {
+ throw new OseeCoreException(String.format(
+ "Commit Branch Failed. The following artifacts contain Tracked Changes. " //
+ + " Please accept or reject and turn off track changes, then recommit : [%s]",
+ trackedChanges.toString()));
+ }
+
OseeValidator validator = OseeValidator.getInstance();
for (Artifact artifactChanged : changedArtifacts) {
if (!artifactChanged.isDeleted()) {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/word/WordUtil.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/word/WordUtil.java
index dbc7bf534a..51514b8f2a 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/word/WordUtil.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/word/WordUtil.java
@@ -33,7 +33,6 @@ import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.Pair;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.jdk.core.util.io.Streams;
import org.eclipse.osee.framework.jdk.core.util.xml.Xml;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
@@ -47,9 +46,6 @@ import org.eclipse.osee.jdbc.JdbcStatement;
* @author Paul K. Waldfogel
*/
public class WordUtil {
- private static final String AML_ANNOTATION = "<.??aml:annotation.*?>";
- private static final String AML_CONTENT = "<.??aml:content.*?>";
- private static final String DELETIONS = "<w:delText>.*?</w:delText>";
public static final String BODY_START = "<w:body>";
public static final String BODY_END = "</w:body>";
private static final String[] NUMBER =
@@ -292,18 +288,4 @@ public class WordUtil {
return newTemplate;
}
- public static boolean containsWordAnnotations(String wordml) {
- return wordml.contains("<w:delText>") || wordml.contains("w:type=\"Word.Insertion\"") || wordml.contains(
- "w:type=\"Word.Formatting\"") || wordml.contains("w:type=\"Word.Deletion\"");
- }
-
- public static String removeAnnotations(String wordml) {
- String response = wordml;
- if (Strings.isValid(response)) {
- response = response.replaceAll(AML_ANNOTATION, "");
- response = response.replaceAll(AML_CONTENT, "");
- response = response.replaceAll(DELETIONS, "");
- }
- return response;
- }
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/PlainTextRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/PlainTextRenderer.java
index 55571469a5..6cdcbf810d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/PlainTextRenderer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/PlainTextRenderer.java
@@ -25,13 +25,13 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.operation.IOperation;
+import org.eclipse.osee.framework.core.util.WordCoreUtil;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
import org.eclipse.osee.framework.jdk.core.util.io.Streams;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.types.IArtifact;
-import org.eclipse.osee.framework.skynet.core.word.WordUtil;
import org.eclipse.osee.framework.ui.skynet.MenuCmdDef;
import org.eclipse.osee.framework.ui.skynet.render.compare.IComparator;
import org.eclipse.osee.framework.ui.swt.ImageManager;
@@ -73,7 +73,7 @@ public class PlainTextRenderer extends FileSystemRenderer {
} else {
Artifact artifact = artifacts.iterator().next();
String content = artifact.getOrInitializeSoleAttributeValue(CoreAttributeTypes.PlainTextContent);
- if (presentationType == PresentationType.DIFF && WordUtil.containsWordAnnotations(content)) {
+ if (presentationType == PresentationType.DIFF && WordCoreUtil.containsWordAnnotations(content)) {
throw new OseeStateException(
"Trying to diff the [%s] artifact on the [%s] branch, which has tracked changes turned on. All tracked changes must be removed before the artifacts can be compared.",
artifact.getName(), artifact.getBranchToken().getName());
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/UpdateArtifactOperation.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/UpdateArtifactOperation.java
index 29fee2ae66..5e2e5c44cf 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/UpdateArtifactOperation.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/UpdateArtifactOperation.java
@@ -11,11 +11,11 @@
package org.eclipse.osee.framework.ui.skynet.render;
-import com.google.common.collect.Lists;
import java.io.File;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.define.report.api.WordArtifactChange;
import org.eclipse.osee.define.report.api.WordUpdateChange;
@@ -24,6 +24,7 @@ import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.TransactionToken;
import org.eclipse.osee.framework.core.model.type.AttributeType;
import org.eclipse.osee.framework.core.operation.AbstractOperation;
+import org.eclipse.osee.framework.core.util.XResultData;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.skynet.core.UserManager;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
@@ -36,6 +37,9 @@ import org.eclipse.osee.framework.skynet.core.event.model.EventModifiedBasicGuid
import org.eclipse.osee.framework.skynet.core.httpRequests.HttpWordUpdateRequest;
import org.eclipse.osee.framework.ui.skynet.internal.Activator;
import org.eclipse.osee.framework.ui.skynet.preferences.MsWordPreferencePage;
+import org.eclipse.osee.framework.ui.skynet.results.XResultDataUI;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import com.google.common.collect.Lists;
/**
* @author Ryan D. Brooks
@@ -75,26 +79,30 @@ public class UpdateArtifactOperation extends AbstractOperation {
WordUpdateChange change = HttpWordUpdateRequest.updateWordArtifacts(wud);
postProcessChange(change);
+ TrackedChangesDialog trackedChanges = new TrackedChangesDialog(change);
+ trackedChanges.doWork(null);
}
private void postProcessChange(WordUpdateChange change) {
- // Collect attribute events
- ArtifactEvent artifactEvent = new ArtifactEvent(TransactionToken.valueOf(change.getTx(), branch));
-
- for (Artifact artifact : artifacts) {
- WordArtifactChange artChange = change.getWordArtifactChange(artifact.getArtId());
- if (artChange != null) {
- artifact.reloadAttributesAndRelations();
- Collection<AttributeChange> attrChanges = getAttributeChanges(artifact, artChange);
- if (!attrChanges.isEmpty()) {
- EventModifiedBasicGuidArtifact guidArt = new EventModifiedBasicGuidArtifact(artifact.getBranch(),
- artifact.getArtifactType().getGuid(), artifact.getGuid(), attrChanges);
- artifactEvent.getArtifacts().add(guidArt);
+ if (change.getTx() != null && change.getBranch() != null) {
+ // Collect attribute events
+ ArtifactEvent artifactEvent = new ArtifactEvent(TransactionToken.valueOf(change.getTx(), branch));
+
+ for (Artifact artifact : artifacts) {
+ WordArtifactChange artChange = change.getWordArtifactChange(artifact.getArtId());
+ if (artChange != null) {
+ artifact.reloadAttributesAndRelations();
+ Collection<AttributeChange> attrChanges = getAttributeChanges(artifact, artChange);
+ if (!attrChanges.isEmpty()) {
+ EventModifiedBasicGuidArtifact guidArt = new EventModifiedBasicGuidArtifact(artifact.getBranch(),
+ artifact.getArtifactType().getGuid(), artifact.getGuid(), attrChanges);
+ artifactEvent.getArtifacts().add(guidArt);
+ }
}
}
- }
- if (!artifactEvent.getArtifacts().isEmpty()) {
- OseeEventManager.kickPersistEvent(this, artifactEvent);
+ if (!artifactEvent.getArtifacts().isEmpty()) {
+ OseeEventManager.kickPersistEvent(this, artifactEvent);
+ }
}
}
@@ -123,4 +131,38 @@ public class UpdateArtifactOperation extends AbstractOperation {
}
return sb.toString();
}
+
+ private static final class TrackedChangesDialog extends AbstractOperation {
+
+ private final WordUpdateChange change;
+
+ public TrackedChangesDialog(WordUpdateChange change) {
+ super("Tracked Changes Dialog", Activator.PLUGIN_ID);
+ this.change = change;
+ }
+
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ Displays.ensureInDisplayThread(new Runnable() {
+
+ @Override
+ public void run() {
+ XResultData resultData = new XResultData(false);
+ if (change != null && !change.getTrackedChangeArts().isEmpty()) {
+ resultData.setTitle("Artifacts with Tracked Changes");
+ resultData.addRaw("The following artifacts contain tracked changes and could not be saved." //
+ + "\nPlease accept or reject and turn off tracked changes, then save the artifact.\n\n");
+ for (Map.Entry<Long, String> entry : change.getTrackedChangeArts().entrySet()) {
+ resultData.addRaw("Artifact ");
+ resultData.addRaw("id: " + entry.getKey() + ", ");
+ resultData.addRaw("name: " + entry.getValue() + "\n");
+ }
+ XResultDataUI.report(resultData, resultData.getTitle());
+ }
+ }
+ });
+ }
+
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WholeWordRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WholeWordRenderer.java
index 13ffb7c24e..5280e03090 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WholeWordRenderer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WholeWordRenderer.java
@@ -33,6 +33,7 @@ import org.eclipse.osee.define.report.api.PageOrientation;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.operation.IOperation;
+import org.eclipse.osee.framework.core.util.WordCoreUtil;
import org.eclipse.osee.framework.jdk.core.text.change.ChangeSet;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
@@ -43,7 +44,6 @@ import org.eclipse.osee.framework.skynet.core.attribute.WordWholeDocumentAttribu
import org.eclipse.osee.framework.skynet.core.linking.LinkType;
import org.eclipse.osee.framework.skynet.core.linking.WordMlLinkHandler;
import org.eclipse.osee.framework.skynet.core.types.IArtifact;
-import org.eclipse.osee.framework.skynet.core.word.WordUtil;
import org.eclipse.osee.framework.ui.skynet.MenuCmdDef;
import org.eclipse.osee.framework.ui.skynet.render.compare.IComparator;
import org.eclipse.osee.framework.ui.skynet.render.compare.WholeWordCompare;
@@ -98,7 +98,7 @@ public class WholeWordRenderer extends WordRenderer {
} else {
Artifact artifact = artifacts.iterator().next();
String content = artifact.getOrInitializeSoleAttributeValue(CoreAttributeTypes.WholeWordContent);
- if (presentationType == PresentationType.DIFF && WordUtil.containsWordAnnotations(content)) {
+ if (presentationType == PresentationType.DIFF && WordCoreUtil.containsWordAnnotations(content)) {
throw new OseeStateException(
"Trying to diff the [%s] artifact on the [%s] branch, which has tracked changes turned on. All tracked changes must be removed before the artifacts can be compared.",
artifact.getName(), artifact.getBranchToken().getName());
@@ -109,7 +109,8 @@ public class WholeWordRenderer extends WordRenderer {
content = WordMlLinkHandler.link(linkType, artifact, content, unknownGuids);
WordUiUtil.displayUnknownGuids(artifact, unknownGuids);
- String classification = artifact.getSoleAttributeValueAsString(CoreAttributeTypes.DataRightsClassification, "");
+ String classification =
+ artifact.getSoleAttributeValueAsString(CoreAttributeTypes.DataRightsClassification, "");
if (Strings.isValid(classification)) {
content = addDataRights(content, classification, artifact);
}

Back to the top