Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrbrooks2011-01-19 18:02:41 -0500
committerRyan D. Brooks2011-01-19 18:02:41 -0500
commit2e8baee6dbfaf7b5065cd5f4e6f3bcdcd00e5ffa (patch)
tree153cab028139e7566c3bc81b966704db75ce2b46
parentd1bfbe55c7af2302ea5eba86c46d9356849d7fa8 (diff)
downloadorg.eclipse.osee-2e8baee6dbfaf7b5065cd5f4e6f3bcdcd00e5ffa.tar.gz
org.eclipse.osee-2e8baee6dbfaf7b5065cd5f4e6f3bcdcd00e5ffa.tar.xz
org.eclipse.osee-2e8baee6dbfaf7b5065cd5f4e6f3bcdcd00e5ffa.zip
refactor: Remove obsolete rendering utility code
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Suite.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/branch/BranchTestSuite.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/branch/BranchUtilityTest.java153
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java35
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchUtility.java91
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/FrameworkUi_TestDb_Suite.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/renderer/RendererTestSuite.java3
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/renderer/RenderingUtilTest.java60
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/FileSystemRenderer.java3
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java65
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateProcessor.java3
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/FileUiUtil.java63
12 files changed, 151 insertions, 331 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Suite.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Suite.java
index 69494f3193..8bf5db21f0 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Suite.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Suite.java
@@ -12,7 +12,6 @@ package org.eclipse.osee.framework.skynet.core.test;
import static org.junit.Assert.assertTrue;
import org.eclipse.osee.framework.core.client.ClientSessionManager;
-import org.eclipse.osee.framework.skynet.core.test.branch.BranchManagerTest;
import org.eclipse.osee.framework.skynet.core.test.branch.BranchTestSuite;
import org.eclipse.osee.framework.skynet.core.test.cases.ArtifactLoaderTest;
import org.eclipse.osee.framework.skynet.core.test.cases.ArtifactPurgeTest;
@@ -72,7 +71,6 @@ import org.junit.runners.Suite;
ArtifactQueryTestDemo.class,
TransactionManagerTest.class,
BranchTestSuite.class,
- BranchManagerTest.class,
RelationTestSuite.class,
ArtifactTypeInheritanceTest.class,
ArtifactPurgeTest.class,
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/branch/BranchTestSuite.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/branch/BranchTestSuite.java
index 6a74d60696..b1248ff689 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/branch/BranchTestSuite.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/branch/BranchTestSuite.java
@@ -15,7 +15,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
-@Suite.SuiteClasses({BranchUtilityTest.class})
+@Suite.SuiteClasses({BranchManagerTest.class})
/**
* @author Roberto E. Escobar
*
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/branch/BranchUtilityTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/branch/BranchUtilityTest.java
deleted file mode 100644
index 074e437326..0000000000
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/branch/BranchUtilityTest.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.skynet.core.test.branch;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import junit.framework.Assert;
-import org.eclipse.osee.framework.core.enums.BranchState;
-import org.eclipse.osee.framework.core.enums.BranchType;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.BranchFactory;
-import org.eclipse.osee.framework.core.model.cache.AbstractOseeCache;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
-import org.eclipse.osee.framework.core.model.test.mocks.MockOseeDataAccessor;
-import org.eclipse.osee.framework.jdk.core.util.GUID;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchUtility;
-import org.junit.Test;
-
-/**
- * @author Roberto E. Escobar
- */
-public class BranchUtilityTest {
-
- @Test
- public void testBranchToFileName() throws Exception {
- AbstractOseeCache<Branch> cache = new TestCache();
- for (int index = 0; index < 100; index++) {
- String guid = GUID.create();
- Branch branch = createBranch(cache, guid, String.format("Test %s", index + 1), index);
-
- String actual = BranchUtility.toFileName(branch);
- Assert.assertEquals(encode(guid), actual);
- }
- }
-
- @Test
- public void testBranchToFileNameInvalidGuid() throws OseeCoreException {
- AbstractOseeCache<Branch> cache = new TestCache();
- Branch branch = createBranch(cache, "!#A", "Invalid Guid", 2);
- try {
- BranchUtility.toFileName(branch);
- Assert.assertFalse("This line should not be executed", true);
- } catch (Exception ex) {
- Assert.assertTrue(ex instanceof OseeStateException);
- }
- }
-
- @Test
- public void testBranchToFileNameNullBranch() {
- try {
- BranchUtility.toFileName(null);
- Assert.assertFalse("This line should not be executed", true);
- } catch (Exception ex) {
- Assert.assertTrue(ex instanceof OseeArgumentException);
- }
- }
-
- @Test
- public void testfromFileNameGuidNotFound() throws OseeCoreException {
- AbstractOseeCache<Branch> cache = new TestCache();
- cache.ensurePopulated();
- Assert.assertEquals(0, cache.size());
- try {
- String guid = GUID.create();
- BranchUtility.fromFileName(cache, encode(guid));
- } catch (Exception ex) {
- Assert.assertTrue(ex.getClass().getSimpleName(), ex instanceof OseeArgumentException);
- }
- }
-
- @Test
- public void testfromFileNameIdNotFound() throws OseeCoreException {
- AbstractOseeCache<Branch> cache = new TestCache();
- cache.ensurePopulated();
- Assert.assertEquals(0, cache.size());
- try {
- BranchUtility.fromFileName(cache, "hello.-2");
- } catch (Exception ex) {
- Assert.assertTrue(ex instanceof OseeArgumentException);
- }
- }
-
- @Test
- public void testfromFileNameNullArgs() {
- try {
- BranchUtility.fromFileName(null, "hello.-2");
- } catch (Exception ex) {
- Assert.assertTrue(ex instanceof OseeArgumentException);
- }
- AbstractOseeCache<Branch> cache = new TestCache();
- try {
- BranchUtility.fromFileName(cache, null);
- } catch (Exception ex) {
- Assert.assertTrue(ex instanceof OseeArgumentException);
- }
- }
-
- @Test
- public void testfromFileName() throws OseeCoreException, UnsupportedEncodingException {
- AbstractOseeCache<Branch> cache = new TestCache();
- cache.ensurePopulated();
- Assert.assertEquals(0, cache.size());
-
- Branch expectedBranch1 = createBranch(cache, "AyH_e52bdW+WUbdQUoQA", "Test 1", 1);
- Branch expectedBranch2 = createBranch(cache, "AyH_e52bdW+WUbdQUoQB", "Test 2", 2);
-
- cache.cache(expectedBranch1);
- cache.cache(expectedBranch2);
-
- Assert.assertEquals(2, cache.size());
-
- checkBranchFromFile(cache, expectedBranch1, encode("AyH_e52bdW+WUbdQUoQA"));
- checkBranchFromFile(cache, expectedBranch2, encode("AyH_e52bdW+WUbdQUoQB"));
-
- checkBranchFromFile(cache, expectedBranch1, encode("X.1"));
- checkBranchFromFile(cache, expectedBranch2, encode("X.2"));
- }
-
- private void checkBranchFromFile(AbstractOseeCache<Branch> cache, Branch expected, String fileName) throws OseeCoreException {
- Branch actual = BranchUtility.fromFileName(cache, fileName);
- Assert.assertNotNull(actual);
- Assert.assertEquals(expected, actual);
- }
-
- private String encode(String guid) throws UnsupportedEncodingException {
- return URLEncoder.encode(guid, "UTF-8");
- }
-
- private Branch createBranch(AbstractOseeCache<Branch> cache, String guid, String name, int id) throws OseeCoreException {
- Branch branch = new BranchFactory().create(guid, name, BranchType.WORKING, BranchState.MODIFIED, false);
- Assert.assertNotNull(branch);
- branch.setId(id);
- return branch;
- }
-
- private final class TestCache extends BranchCache {
- public TestCache() {
- super(new MockOseeDataAccessor<Branch>());
- }
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java
index ce51cfcf37..45c4642ed6 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java
@@ -11,6 +11,8 @@
package org.eclipse.osee.framework.skynet.core.artifact;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
@@ -30,6 +32,7 @@ import org.eclipse.osee.framework.core.enums.BranchType;
import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.exception.BranchDoesNotExist;
import org.eclipse.osee.framework.core.exception.MultipleBranchesExist;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.MergeBranch;
@@ -43,6 +46,7 @@ import org.eclipse.osee.framework.core.operation.Operations;
import org.eclipse.osee.framework.core.util.Conditions;
import org.eclipse.osee.framework.database.core.SQL3DataType;
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.time.GlobalTime;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -494,12 +498,35 @@ public class BranchManager {
getCache().storeItems(branches);
}
- public static String toFileName(IOseeBranch branch) throws OseeCoreException {
- return BranchUtility.toFileName(branch);
+ public static Branch fromFileName(String fileName) throws OseeCoreException {
+ if (!Strings.isValid(fileName)) {
+ throw new OseeArgumentException("file name cannot be null or empty");
+ }
+ Branch toReturn = null;
+ String branchGuid = decode(fileName);
+ if (GUID.isValid(branchGuid)) {
+ toReturn = getCache().getByGuid(branchGuid);
+ if (toReturn == null) {
+ throw new OseeArgumentException("Unable to find branch matching guid [%s]", branchGuid);
+ }
+ } else {
+ int branchId = Integer.parseInt(Lib.getExtension(fileName));
+ toReturn = getCache().getById(branchId);
+ if (toReturn == null) {
+ throw new OseeArgumentException("Unable to find branch matching id [%s]", branchId);
+ }
+ }
+ return toReturn;
}
- public static Branch fromFileName(String fileName) throws OseeCoreException {
- return BranchUtility.fromFileName(getCache(), fileName);
+ private static String decode(String name) {
+ String toReturn = name;
+ try {
+ toReturn = URLDecoder.decode(name, "UTF-8");
+ } catch (UnsupportedEncodingException ex) {
+ // Do Nothing
+ }
+ return toReturn;
}
public static void decache(Branch branch) throws OseeCoreException {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchUtility.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchUtility.java
deleted file mode 100644
index bf86711d91..0000000000
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchUtility.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.skynet.core.artifact;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-import org.eclipse.osee.framework.core.data.IOseeBranch;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.cache.AbstractOseeCache;
-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;
-
-/**
- * @author Roberto E. Escobar
- */
-public final class BranchUtility {
-
- public static String toFileName(IOseeBranch branch) throws OseeCoreException {
- if (branch == null) {
- throw new OseeArgumentException("branch cannot be null");
- }
- String branchGuid = branch.getGuid();
- if (!GUID.isValid(branchGuid)) {
- throw new OseeStateException("GUID for branch [%s] is invalid", branch.getName());
- }
- return encode(branchGuid);
- }
-
- private static String encode(String name) throws OseeCoreException {
- String toReturn = "";
- try {
- toReturn = URLEncoder.encode(name, "UTF-8");
- } catch (Exception ex) {
- if (ex instanceof OseeCoreException) {
- throw (OseeCoreException) ex;
- } else {
- OseeExceptions.wrapAndThrow(ex);
- }
- }
- return toReturn;
- }
-
- public static Branch fromFileName(AbstractOseeCache<Branch> cache, String fileName) throws OseeCoreException {
- if (cache == null) {
- throw new OseeArgumentException("cache cannot be null");
- }
- if (!Strings.isValid(fileName)) {
- throw new OseeArgumentException("file name cannot be null or empty");
- }
- Branch toReturn = null;
- String branchGuid = decode(fileName);
- if (GUID.isValid(branchGuid)) {
- toReturn = cache.getByGuid(branchGuid);
- if (toReturn == null) {
- throw new OseeArgumentException("Unable to find branch matching guid [%s]", branchGuid);
- }
- } else {
- int branchId = Integer.parseInt(Lib.getExtension(fileName));
- toReturn = cache.getById(branchId);
- if (toReturn == null) {
- throw new OseeArgumentException("Unable to find branch matching id [%s]", branchId);
- }
- }
- return toReturn;
- }
-
- private static String decode(String name) {
- String toReturn = name;
- try {
- toReturn = URLDecoder.decode(name, "UTF-8");
- } catch (UnsupportedEncodingException ex) {
- // Do Nothing
- }
- return toReturn;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/FrameworkUi_TestDb_Suite.java b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/FrameworkUi_TestDb_Suite.java
index d1bbcd66e2..a181a8fccd 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/FrameworkUi_TestDb_Suite.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/FrameworkUi_TestDb_Suite.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.test;
-import org.eclipse.osee.framework.skynet.core.test.branch.BranchManagerTest;
import org.eclipse.osee.framework.ui.skynet.test.blam.BlamXWidgetTest;
import org.eclipse.osee.framework.ui.skynet.test.blam.operation.EmailGroupsBlamTest;
import org.eclipse.osee.framework.ui.skynet.test.cases.PreviewAndMultiPreviewTest;
@@ -26,7 +25,6 @@ import org.junit.runners.Suite;
@Suite.SuiteClasses({//
BlamXWidgetTest.class, //
EmailGroupsBlamTest.class, //
- BranchManagerTest.class, //
WordEditTest.class, //
WordTrackedChangesTest.class, //
PreviewAndMultiPreviewTest.class, //
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/renderer/RendererTestSuite.java b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/renderer/RendererTestSuite.java
index acf859a9c7..a261f3bea8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/renderer/RendererTestSuite.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/renderer/RendererTestSuite.java
@@ -14,8 +14,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
-@Suite.SuiteClasses({//
-PresentationTypeTest.class})
+@Suite.SuiteClasses({RenderingUtilTest.class, PresentationTypeTest.class})
/**
* @author Roberto E. Escobar
*/
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/renderer/RenderingUtilTest.java b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/renderer/RenderingUtilTest.java
new file mode 100644
index 0000000000..c152873f09
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/renderer/RenderingUtilTest.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.ui.skynet.test.renderer;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.enums.BranchState;
+import org.eclipse.osee.framework.core.enums.BranchType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.BranchFactory;
+import org.eclipse.osee.framework.core.model.cache.AbstractOseeCache;
+import org.eclipse.osee.framework.core.model.cache.BranchCache;
+import org.eclipse.osee.framework.core.model.test.mocks.MockOseeDataAccessor;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.ui.skynet.render.RenderingUtil;
+import org.junit.Test;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class RenderingUtilTest {
+ @Test
+ public void testBranchToFileName() throws Exception {
+ AbstractOseeCache<Branch> cache = new TestCache();
+ for (int index = 0; index < 100; index++) {
+ String guid = GUID.create();
+ Branch branch = createBranch(cache, guid, String.format("Test %s", index + 1), index);
+
+ String actual = RenderingUtil.toFileName(branch);
+ Assert.assertEquals(encode(guid), actual);
+ }
+ }
+
+ private String encode(String guid) throws UnsupportedEncodingException {
+ return URLEncoder.encode(guid, "UTF-8");
+ }
+
+ private Branch createBranch(AbstractOseeCache<Branch> cache, String guid, String name, int id) throws OseeCoreException {
+ Branch branch = new BranchFactory().create(guid, name, BranchType.WORKING, BranchState.MODIFIED, false);
+ Assert.assertNotNull(branch);
+ branch.setId(id);
+ return branch;
+ }
+
+ private final class TestCache extends BranchCache {
+ public TestCache() {
+ super(new MockOseeDataAccessor<Branch>());
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/FileSystemRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/FileSystemRenderer.java
index 5abf74971c..260afe4c8c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/FileSystemRenderer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/FileSystemRenderer.java
@@ -29,7 +29,6 @@ import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.plugin.core.util.AIFile;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.util.FileUiUtil;
import org.eclipse.swt.program.Program;
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IWorkbench;
@@ -162,7 +161,7 @@ public abstract class FileSystemRenderer extends DefaultArtifactRenderer {
Artifact firstArtifact = artifacts.iterator().next();
try {
if (RenderingUtil.arePopupsAllowed()) {
- FileUiUtil.ensureFilenameLimit(file);
+ RenderingUtil.ensureFilenameLimit(file);
Program program = getAssociatedProgram(firstArtifact);
program.execute(file.getLocation().toFile().getAbsolutePath());
} else {
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java
index 98d585992d..5b20643d86 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java
@@ -10,28 +10,28 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.render;
+import java.net.URLEncoder;
import java.util.Date;
-import java.util.HashSet;
import java.util.Random;
-import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osee.framework.core.data.IOseeBranch;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
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.logging.OseeLog;
import org.eclipse.osee.framework.plugin.core.util.OseeData;
-import org.eclipse.osee.framework.skynet.core.UserManager;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchUtility;
import org.eclipse.osee.framework.skynet.core.change.ArtifactDelta;
-import org.eclipse.osee.framework.skynet.core.word.WordUtil;
-import org.eclipse.osee.framework.ui.skynet.preferences.MsWordPreferencePage;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.swt.Displays;
public final class RenderingUtil {
private static final Random generator = new Random();
@@ -46,6 +46,39 @@ public final class RenderingUtil {
arePopupsAllowed = popupsAllowed;
}
+ private static final String FILENAME_WARNING_MESSAGE =
+ "\n\nis approaching a large size which may cause the opening application to error. " + "\nSuggest moving your workspace to avoid potential errors. ";
+ private static final int FILENAME_LIMIT = 215;
+
+ private static boolean showAgain = true;
+
+ public static boolean ensureFilenameLimit(IFile file) {
+ boolean withinLimit = true;
+ if (Lib.isWindows()) {
+ String absPath = file.getLocation().toFile().getAbsolutePath();
+ if (absPath.length() > FILENAME_LIMIT) {
+ final String warningMessage = "Your filename: \n\n" + absPath + FILENAME_WARNING_MESSAGE;
+ // need to warn user that their filename size is large and may cause the program (Word, Excel, PPT) to error
+ if (showAgain && arePopupsAllowed()) {
+ //display warning once per session
+
+ Displays.pendInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ MessageDialog.openWarning(Displays.getActiveShell(), "Filename Size Warning", warningMessage);
+ }
+ });
+
+ showAgain = false;
+ }
+ //log the warning every time
+ OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, warningMessage);
+ withinLimit = false;
+ }
+ }
+ return withinLimit;
+ }
+
public static boolean arePopupsAllowed() {
return arePopupsAllowed;
}
@@ -122,7 +155,7 @@ public final class RenderingUtil {
public static IFolder getRenderFolder(IOseeBranch branch, PresentationType presentationType) throws OseeCoreException {
try {
IFolder baseFolder = ensureRenderFolderExists(presentationType);
- IFolder renderFolder = baseFolder.getFolder(BranchUtility.toFileName(branch));
+ IFolder renderFolder = baseFolder.getFolder(toFileName(branch));
if (!renderFolder.exists()) {
renderFolder.create(true, true, null);
}
@@ -133,6 +166,20 @@ public final class RenderingUtil {
}
}
+ public static String toFileName(IOseeBranch branch) throws OseeCoreException {
+ return encode(branch.getGuid());
+ }
+
+ private static String encode(String name) throws OseeCoreException {
+ String toReturn = null;
+ try {
+ toReturn = URLEncoder.encode(name, "UTF-8");
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ return toReturn;
+ }
+
public static IFolder ensureRenderFolderExists(PresentationType presentationType) throws OseeCoreException {
IFolder toReturn = null;
switch (presentationType) {
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateProcessor.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateProcessor.java
index 392e7f1c4a..a6e48601b5 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateProcessor.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateProcessor.java
@@ -57,7 +57,6 @@ import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
import org.eclipse.osee.framework.ui.skynet.render.RenderingUtil;
import org.eclipse.osee.framework.ui.skynet.render.WordTemplateRenderer;
-import org.eclipse.osee.framework.ui.skynet.util.FileUiUtil;
import org.eclipse.osee.framework.ui.skynet.util.WordUiUtil;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.swt.program.Program;
@@ -138,7 +137,7 @@ public class WordTemplateProcessor {
applyTemplate(variableMap, artifacts, masterTemplate, folder, null, null, PresentationType.PREVIEW));
if (variableMap.getBoolean("OpenDocument") && file != null) {
- FileUiUtil.ensureFilenameLimit(file);
+ RenderingUtil.ensureFilenameLimit(file);
wordApp.execute(file.getLocation().toFile().getAbsolutePath());
}
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/FileUiUtil.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/FileUiUtil.java
deleted file mode 100644
index 854a96c4ca..0000000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/FileUiUtil.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.ui.skynet.util;
-
-import java.util.logging.Level;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.render.RenderingUtil;
-import org.eclipse.osee.framework.ui.swt.Displays;
-
-/**
- * @author Megumi Telles
- */
-public final class FileUiUtil {
- private static final String FILENAME_WARNING_MESSAGE =
- "\n\nis approaching a large size which may cause the opening application to error. " + "\nSuggest moving your workspace to avoid potential errors. ";
- private static final int FILENAME_LIMIT = 215;
-
- private static boolean showAgain = true;
-
- private FileUiUtil() {
- // Utility class
- }
-
- public static boolean ensureFilenameLimit(IFile file) {
- boolean withinLimit = true;
- if (Lib.isWindows()) {
- String absPath = file.getLocation().toFile().getAbsolutePath();
- if (absPath.length() > FILENAME_LIMIT) {
- final String warningMessage = "Your filename: \n\n" + absPath + FILENAME_WARNING_MESSAGE;
- // need to warn user that their filename size is large and may cause the program (Word, Excel, PPT) to error
- if (showAgain && RenderingUtil.arePopupsAllowed()) {
- //display warning once per session
-
- Displays.pendInDisplayThread(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openWarning(Displays.getActiveShell(), "Filename Size Warning", warningMessage);
- }
- });
-
- showAgain = false;
- }
- //log the warning every time
- OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, warningMessage);
- withinLimit = false;
- }
- }
- return withinLimit;
- }
-
-}

Back to the top