diff options
19 files changed, 65 insertions, 205 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/column/ev/AbstractWorkPackageRelatedColumnUI.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/column/ev/AbstractWorkPackageRelatedColumnUI.java index fa3d7bd978b..5633276c1b4 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/column/ev/AbstractWorkPackageRelatedColumnUI.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/column/ev/AbstractWorkPackageRelatedColumnUI.java @@ -32,6 +32,7 @@ import org.eclipse.osee.ats.internal.Activator; import org.eclipse.osee.ats.internal.AtsClientService; import org.eclipse.osee.ats.util.AtsUtil; import org.eclipse.osee.ats.util.xviewer.column.XViewerAtsColumn; +import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.logging.OseeLevel; import org.eclipse.osee.framework.logging.OseeLog; @@ -102,24 +103,25 @@ public abstract class AbstractWorkPackageRelatedColumnUI extends XViewerAtsColum } private void openSelectedWorkPackages(Collection<AbstractWorkflowArtifact> awas) { - List<String> guids = new ArrayList<>(); + List<ArtifactId> ids = new ArrayList<>(); for (AbstractWorkflowArtifact awa : awas) { IAtsWorkPackage workPkg = AtsClientService.get().getEarnedValueService().getWorkPackage((IAtsWorkItem) awa); if (workPkg != null) { - if (!guids.contains(workPkg.getGuid())) { - guids.add(workPkg.getGuid()); + if (!ids.contains(workPkg)) { + ids.add(ArtifactId.valueOf(workPkg.getId())); } } } - if (guids.isEmpty()) { + if (ids.isEmpty()) { AWorkbench.popup("No Work Packages set for selected Work Items"); } else { - if (guids.size() == 1) { - AtsUtil.openArtifact(guids.iterator().next(), AtsClientService.get().getAtsBranch(), + if (ids.size() == 1) { + AtsUtil.openArtifact( + ArtifactQuery.getArtifactFromId(ids.iterator().next(), AtsClientService.get().getAtsBranch()), OseeCmEditor.ArtifactEditor); } else { - List<Artifact> artifacts = - ArtifactQuery.getArtifactListFromIds(guids, AtsClientService.get().getAtsBranch()); + List<Artifact> artifacts = ArtifactQuery.getArtifactListFrom(ids, AtsClientService.get().getAtsBranch()); + ArtifactQuery.getArtifactListFrom(ids, AtsClientService.get().getAtsBranch()); MassArtifactEditor.editArtifacts("Edit Work Packages", artifacts); } } diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsUtil.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsUtil.java index 312191f6d6f..a934fcae7cb 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsUtil.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsUtil.java @@ -49,7 +49,6 @@ import org.eclipse.osee.ats.world.WorldEditorUISearchItemProvider; import org.eclipse.osee.ats.world.search.GroupWorldSearchItem; import org.eclipse.osee.framework.core.client.ClientSessionManager; import org.eclipse.osee.framework.core.data.ArtifactId; -import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; import org.eclipse.osee.framework.core.enums.PresentationType; import org.eclipse.osee.framework.core.enums.QueryOption; @@ -171,15 +170,6 @@ public final class AtsUtil { new ModifyActionableItemAction(teamArt).run(); } - public static void openArtifact(String guid, BranchId branch, OseeCmEditor view) { - try { - Artifact artifact = ArtifactQuery.getArtifactFromId(guid, branch); - openATSAction(artifact, AtsOpenOption.OpenOneOrPopupSelect); - } catch (Exception ex) { - OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); - } - } - /** * Only to be used by browser. Use open (artifact) instead. */ diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/editor/AtsRuleDefinitionDslRenderer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/editor/AtsRuleDefinitionDslRenderer.java index 48e0da3f2c5..86e2576a2cd 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/editor/AtsRuleDefinitionDslRenderer.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/editor/AtsRuleDefinitionDslRenderer.java @@ -40,7 +40,6 @@ import org.eclipse.osee.framework.jdk.core.util.Lib; import org.eclipse.osee.framework.logging.OseeLevel; import org.eclipse.osee.framework.logging.OseeLog; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; -import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; import org.eclipse.osee.framework.ui.plugin.util.AWorkbench; import org.eclipse.osee.framework.ui.skynet.MenuCmdDef; import org.eclipse.osee.framework.ui.skynet.render.DefaultArtifactRenderer; @@ -183,14 +182,11 @@ public final class AtsRuleDefinitionDslRenderer extends FileSystemRenderer { return; } if (artifact.isOfType(AtsArtifactTypes.RuleDefinition)) { - Artifact saveArt = ArtifactQuery.getArtifactFromId(artifact.getGuid(), artifact.getBranch()); String dslStr = Lib.fileToString(file); - saveArt.setSoleAttributeValue(AtsAttributeTypes.DslSheet, dslStr); - saveArt.persist(getName()); + artifact.setSoleAttributeValue(AtsAttributeTypes.DslSheet, dslStr); + artifact.persist(getName()); AtsClientService.get().getWorkDefinitionService().clearCaches(); } - } - } -} +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/dsl/ui/integration/OseeDslRoleContextProviderTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/dsl/ui/integration/OseeDslRoleContextProviderTest.java index 5a641777ce9..bc67958d5d0 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/dsl/ui/integration/OseeDslRoleContextProviderTest.java +++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/dsl/ui/integration/OseeDslRoleContextProviderTest.java @@ -33,7 +33,7 @@ import org.junit.Test; /** * Test Case for {@link OseeDslRoleContextProvider} - * + * * @author John R. Misinco */ public class OseeDslRoleContextProviderTest { @@ -51,7 +51,7 @@ public class OseeDslRoleContextProviderTest { OseeDsl model = OseeDslResourceUtil.loadModel("osee:/text.osee", testSheet).getModel(); MockDslProvider dslProvider = new MockDslProvider(model); OseeDslRoleContextProvider contextProvider = new OseeDslRoleContextProvider(dslProvider); - Artifact user = ArtifactQuery.getArtifactFromId(SystemUser.Anonymous.getGuid(), CoreBranches.COMMON); + Artifact user = ArtifactQuery.getArtifactFromToken(SystemUser.Anonymous); Collection<? extends IAccessContextId> contextIds = contextProvider.getContextId(user); Assert.assertEquals(1, contextIds.size()); @@ -67,7 +67,7 @@ public class OseeDslRoleContextProviderTest { OseeDsl model = OseeDslResourceUtil.loadModel("osee:/text.osee", testSheet).getModel(); MockDslProvider dslProvider = new MockDslProvider(model); OseeDslRoleContextProvider contextProvider = new OseeDslRoleContextProvider(dslProvider); - Artifact user = ArtifactQuery.getArtifactFromId(SystemUser.Anonymous.getGuid(), CoreBranches.COMMON); + Artifact user = ArtifactQuery.getArtifactFromToken(SystemUser.Anonymous); Collection<? extends IAccessContextId> contextIds = contextProvider.getContextId(user); Assert.assertEquals(1, contextIds.size()); diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/AccessControlTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/AccessControlTest.java index bfb2f69974b..fb3419ab6a0 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/AccessControlTest.java +++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/AccessControlTest.java @@ -16,14 +16,11 @@ import org.eclipse.osee.client.test.framework.OseeLogMonitorRule; import org.eclipse.osee.client.test.framework.TestInfo; import org.eclipse.osee.framework.access.AccessControlManager; import org.eclipse.osee.framework.core.data.BranchId; -import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; import org.eclipse.osee.framework.core.enums.PermissionEnum; import org.eclipse.osee.framework.jdk.core.type.OseeStateException; -import org.eclipse.osee.framework.jdk.core.util.GUID; 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.BranchManager; -import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; import org.junit.After; import org.junit.Before; import org.junit.Rule; @@ -54,36 +51,28 @@ public class AccessControlTest { @Test(expected = OseeStateException.class) public void testNoWriteOnReadAccessOnBranch() { AccessControlManager.setPermission(UserManager.getUser(), branch, PermissionEnum.READ); - - String guid = GUID.create(); - artifact1 = ArtifactQuery.getOrCreate(guid, CoreArtifactTypes.GeneralData, branch); + artifact1 = new Artifact(branch, "New Name"); artifact1.persist(testInfo.getTestName()); } @Test(expected = OseeStateException.class) public void testNoWriteOnNoneAccessOnBranch() { AccessControlManager.setPermission(UserManager.getUser(), branch, PermissionEnum.NONE); - - String guid = GUID.create(); - artifact2 = ArtifactQuery.getOrCreate(guid, CoreArtifactTypes.GeneralData, branch); + artifact2 = new Artifact(branch, "New Name"); artifact2.persist(testInfo.getTestName()); } @Test public void testWriteAccessOnBranch() { AccessControlManager.setPermission(UserManager.getUser(), branch, PermissionEnum.WRITE); - - String guid = GUID.create(); - artifact3 = ArtifactQuery.getOrCreate(guid, CoreArtifactTypes.GeneralData, branch); + artifact3 = new Artifact(branch, "New Name"); artifact3.persist(testInfo.getTestName()); } @Test public void testWriteOnFullAccessOnBranch() { AccessControlManager.setPermission(UserManager.getUser(), branch, PermissionEnum.FULLACCESS); - - String guid = GUID.create(); - artifact4 = ArtifactQuery.getOrCreate(guid, CoreArtifactTypes.GeneralData, branch); + artifact4 = new Artifact(branch, "New Name"); artifact4.persist(testInfo.getTestName()); } @@ -91,10 +80,7 @@ public class AccessControlTest { public void testNoWriteOnDenyAccessOnBranch() { BranchId branch = BranchManager.createTopLevelBranch(testInfo.getTestName() + " branch"); AccessControlManager.setPermission(UserManager.getUser(), branch, PermissionEnum.DENY); - - String guid = GUID.create(); - artifact5 = ArtifactQuery.getOrCreate(guid, CoreArtifactTypes.GeneralData, branch); - artifact5.setName("New Name"); + artifact5 = new Artifact(branch, "New Name"); artifact5.persist(testInfo.getTestName()); } @@ -129,5 +115,4 @@ public class AccessControlTest { BranchManager.purgeBranch(branch); } } - -} +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactEventTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactEventTest.java index 312a8690b12..c907f072d09 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactEventTest.java +++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactEventTest.java @@ -327,7 +327,7 @@ public class ArtifactEventTest { Assert.assertEquals(CoreArtifactTypes.HeadingMSWord, guidArt.getArtifactType()); Assert.assertEquals(CoreArtifactTypes.GeneralData, guidArt.getFromArtTypeGuid()); // Reload artifact; since artifact cache cleared, it should be loaded as new artifact type - Artifact changedArt = ArtifactQuery.getArtifactFromId(newArt.getGuid(), newArt.getBranch()); + Artifact changedArt = ArtifactQuery.getArtifactFromToken(newArt); Assert.assertEquals(CoreArtifactTypes.HeadingMSWord, changedArt.getArtifactType()); } diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/BranchStateTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/BranchStateTest.java index 3e4ebf7931f..37cd576320e 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/BranchStateTest.java +++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/BranchStateTest.java @@ -285,7 +285,7 @@ public class BranchStateTest { workingBranch = BranchManager.createWorkingBranch(SAW_Bld_1, originalBranchName); // Modify same artifact on working branch - sameArtifact = ArtifactQuery.getArtifactFromId(baseArtifact.getGuid(), workingBranch); + sameArtifact = ArtifactQuery.getArtifactFromId(baseArtifact, workingBranch); sameArtifact.setSoleAttributeFromString(CoreAttributeTypes.Annotation, "This is the working branch update annotation"); sameArtifact.persist(getClass().getSimpleName()); diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/FrameworkEventToRemoteEventListenerTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/FrameworkEventToRemoteEventListenerTest.java index 63da61ba73d..ffabfc110b3 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/FrameworkEventToRemoteEventListenerTest.java +++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/FrameworkEventToRemoteEventListenerTest.java @@ -104,7 +104,7 @@ public class FrameworkEventToRemoteEventListenerTest { } Assert.assertTrue("Event completion was not received.", listener.wasUpdateReceived()); - Artifact artifactAfterUpdate = ArtifactQuery.getArtifactFromId(artifact.getGuid(), BRANCH); + Artifact artifactAfterUpdate = ArtifactQuery.getArtifactFromToken(artifact); Assert.assertEquals(newArtTx, artifactAfterUpdate.getTransaction()); //Reset artifact tx - just to be clean diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordTemplateProcessorTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordTemplateProcessorTest.java index 7f8b07290a1..f2007baeb3a 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordTemplateProcessorTest.java +++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordTemplateProcessorTest.java @@ -12,6 +12,8 @@ package org.eclipse.osee.client.integration.tests.integration.ui.skynet; import static org.eclipse.osee.client.demo.DemoChoice.OSEE_CLIENT_DEMO; +import static org.eclipse.osee.framework.core.enums.CoreArtifactTypes.RendererTemplate; +import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON; import static org.eclipse.osee.framework.core.enums.DemoBranches.SAW_Bld_1; import java.io.File; import java.io.IOException; @@ -26,11 +28,13 @@ import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; import org.eclipse.osee.framework.core.enums.PresentationType; import org.eclipse.osee.framework.core.util.RendererOption; +import org.eclipse.osee.framework.database.init.DefaultDbInitTasks; import org.eclipse.osee.framework.jdk.core.util.Lib; import org.eclipse.osee.framework.jdk.core.util.Strings; 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.artifact.BranchManager; +import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; import org.eclipse.osee.framework.ui.skynet.render.RendererManager; import org.junit.After; import org.junit.Assert; @@ -87,7 +91,8 @@ public class WordTemplateProcessorTest { BranchManager.createWorkingBranch(SAW_Bld_1, branch); - recurseTemplate = ArtifactId.valueOf(200007L); + recurseTemplate = + ArtifactQuery.getArtifactFromTypeAndName(RendererTemplate, DefaultDbInitTasks.PREVIEW_ALL_RECURSE, COMMON); myRootArtifact = ArtifactTypeManager.addArtifact(CoreArtifactTypes.Requirement, branch, "WordTemplateProcessorTest_Root"); diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordTemplateRendererTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordTemplateRendererTest.java index 11b606f24bd..4ab5168cd41 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordTemplateRendererTest.java +++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordTemplateRendererTest.java @@ -40,6 +40,7 @@ import org.eclipse.osee.client.test.framework.OseeClientIntegrationRule; import org.eclipse.osee.client.test.framework.OseeLogMonitorRule; import org.eclipse.osee.client.test.framework.TestInfo; import org.eclipse.osee.framework.access.AccessControlManager; +import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; @@ -221,12 +222,12 @@ public class WordTemplateRendererTest { tx.execute(); BranchId middleBr = BranchManager.createWorkingBranch(rootBr, "Middle Branch"); - Artifact middleVol4 = ArtifactQuery.getArtifactFromId(vol4.getGuid(), middleBr); + Artifact middleVol4 = ArtifactQuery.getArtifactFromId(vol4, middleBr); middleVol4.setSoleAttributeFromString(CoreAttributeTypes.WordTemplateContent, " "); middleVol4.persist("added blank content"); BranchId childBr = BranchManager.createWorkingBranch(middleBr, "Child Branch"); - vol4 = ArtifactQuery.getArtifactFromId(vol4.getGuid(), childBr); + vol4 = ArtifactQuery.getArtifactFromId(vol4, childBr); modifyOption(BRANCH, childBr); modifyOption(PUBLISH_DIFF, true); @@ -822,16 +823,15 @@ public class WordTemplateRendererTest { SkynetTransaction onChildTx = TransactionManager.createTransaction(updateBranch, "WORKING UPDATE"); - Artifact background = ArtifactQuery.getArtifactFromId(bckgrd.getGuid(), updateBranch); + Artifact background = ArtifactQuery.getArtifactFromId(bckgrd, updateBranch); Assert.assertNotNull("Cant find Background on update branch", background); background.setSoleAttributeValue(CoreAttributeTypes.WordTemplateContent, beginWordString + "This paragraph describes the background of the doc" + endWordString); background.persist(onChildTx); // 3. - String guid = - folder.getDescendant("Subsystem").getDescendant("Hardware").getDescendant("Hardware Functions").getGuid(); - Artifact hdwrFunc = ArtifactQuery.getArtifactFromId(guid, updateBranch); + Artifact hw = folder.getDescendant("Subsystem").getDescendant("Hardware").getDescendant("Hardware Functions"); + Artifact hdwrFunc = ArtifactQuery.getArtifactFromId(hw, updateBranch); Assert.assertNotNull("Cant find Hardware Functions on update branch", hdwrFunc); hdwrFunc.setSoleAttributeValue(CoreAttributeTypes.WordTemplateContent, beginWordString + "The first hardware function of importance is the power on switch." + endWordString); @@ -845,8 +845,7 @@ public class WordTemplateRendererTest { SkynetTransaction onChildTx = TransactionManager.createTransaction(updateBranch, "WORKING UPDATE"); String hdwrGuid = docFolder.getDescendant("Subsystem").getDescendant("Hardware").getDescendant("Hardware Functions").getGuid(); - String notesGuid = docFolder.getDescendant("Notes").getGuid(); - Artifact notes = ArtifactQuery.getArtifactFromId(notesGuid, updateBranch); + Artifact notes = ArtifactQuery.getArtifactFromId(docFolder.getDescendant("Notes"), updateBranch); notes.setSoleAttributeValue(CoreAttributeTypes.WordTemplateContent, beginWordString + "Notes are great for small topics, and the link " + beginLinkInsert + hdwrGuid + endLinkInsert + " too." + endWordString); diff --git a/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/AddCommonBranch.java b/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/AddCommonBranch.java index 627971f680b..29a22a6c5bb 100644 --- a/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/AddCommonBranch.java +++ b/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/AddCommonBranch.java @@ -17,7 +17,6 @@ import org.eclipse.osee.framework.core.data.OrcsTypeSheet; import org.eclipse.osee.framework.core.data.OrcsTypesData; import org.eclipse.osee.framework.core.data.UserToken; import org.eclipse.osee.framework.core.enums.CoreArtifactTokens; -import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; import org.eclipse.osee.framework.core.enums.CoreBranches; import org.eclipse.osee.framework.core.enums.SystemUser; @@ -29,7 +28,6 @@ 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.ArtifactTypeManager; import org.eclipse.osee.framework.skynet.core.artifact.BranchManager; -import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction; import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; @@ -105,13 +103,7 @@ public abstract class AddCommonBranch implements IDbInitializationTask { // Create OseeAdmin group SystemGroup.OseeAdmin.getArtifact().persist(transaction); - - // Need to set some Test Unit Table data - Artifact art = - ArtifactQuery.getOrCreate("Bs+PvSVQf3R5EHSTcyQA", CoreArtifactTypes.Artifact, CoreBranches.COMMON); - art.persist(transaction); - transaction.execute(); } } -} +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/DefaultDbInitTasks.java b/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/DefaultDbInitTasks.java index 7abb64ff9df..dc2e0c3bcde 100644 --- a/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/DefaultDbInitTasks.java +++ b/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/DefaultDbInitTasks.java @@ -14,7 +14,6 @@ package org.eclipse.osee.framework.database.init; * @author Roberto E. Escobar */ public enum DefaultDbInitTasks { - DB_INIT_TASK("org.eclipse.osee.framework.database.init.DatabaseInitializationTask"), BOOTSTRAP_TASK("org.eclipse.osee.framework.database.init.DbBootstrapTask"), DB_USER_CLEANUP("org.eclipse.osee.framework.database.init.PostDbUserCleanUp"), @@ -24,6 +23,7 @@ public enum DefaultDbInitTasks { SIMPLE_TEMPLATE_PROVIDER("org.eclipse.osee.framework.database.init.SimpleTemplateProviderTask"); private String extensionId; + public static final String PREVIEW_ALL_RECURSE = "PREVIEW_ALL_RECURSE"; private DefaultDbInitTasks(String extensionId) { this.extensionId = extensionId; @@ -32,4 +32,4 @@ public enum DefaultDbInitTasks { public String getExtensionId() { return extensionId; } -} +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/internal/SimpleTemplateProviderTask.java b/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/internal/SimpleTemplateProviderTask.java index 520f20b3f02..1534be3befa 100644 --- a/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/internal/SimpleTemplateProviderTask.java +++ b/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/internal/SimpleTemplateProviderTask.java @@ -21,6 +21,7 @@ import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.Platform; import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; +import org.eclipse.osee.framework.database.init.DefaultDbInitTasks; import org.eclipse.osee.framework.database.init.IDbInitializationTask; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.logging.OseeLog; @@ -30,7 +31,6 @@ import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; public class SimpleTemplateProviderTask implements IDbInitializationTask { - private static String EDIT_RENDERER_OPTIONS = "{\"ElementType\" : \"Artifact\", \"OutliningOptions\" : [ {\"Outlining\" : true, \"RecurseChildren\" : false, \"HeadingAttributeType\" : \"Name\", \"ArtifactName\" : \"Default\", \"OutlineNumber\" : \"\" }], \"AttributeOptions\" : [{\"AttrType\" : \"Word Template Content\", \"Label\" : \"\", \"FormatPre\" : \"\", \"FormatPost\" : \"\"}]}"; private static String RECURSIVE_RENDERER_OPTIONS = @@ -65,7 +65,7 @@ public class SimpleTemplateProviderTask implements IDbInitializationTask { if (name.equals("Word Edit Template")) { templateArtifact.setSoleAttributeFromString(CoreAttributeTypes.RendererOptions, EDIT_RENDERER_OPTIONS); - } else if (name.equals("PREVIEW_ALL_RECURSE")) { + } else if (name.equals(DefaultDbInitTasks.PREVIEW_ALL_RECURSE)) { templateArtifact.setSoleAttributeFromString(CoreAttributeTypes.RendererOptions, RECURSIVE_RENDERER_OPTIONS); } else if (name.equals("srsMasterTemplate")) { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java index 7137b1c2c99..fbb7c1434b1 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java @@ -81,6 +81,11 @@ public final class ArtifactLoader { BranchManager.isArchived(branch)); } + public static List<Artifact> loadArtifacts(List<ArtifactToken> toLoad, BranchId branch, LoadLevel loadLevel, LoadType reload, DeletionFlag allowDeleted, TransactionId transactionId) { + return loadSelectedArtifacts(toLoad, loadLevel, reload, allowDeleted, transactionId, + BranchManager.isArchived(branch)); + } + private static List<Artifact> loadSelectedArtifacts(List<ArtifactToken> toLoad, LoadLevel loadLevel, LoadType reload, DeletionFlag allowDeleted, TransactionId transactionId, boolean isArchived) { Set<Artifact> artifacts = new LinkedHashSet<>(); if (transactionId.isValid()) { diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml b/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml index 6ea1610b711..a4994f46022 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml +++ b/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml @@ -1568,12 +1568,6 @@ <extension point="org.eclipse.osee.framework.ui.skynet.BlamOperation"> <Operation - className="org.eclipse.osee.framework.ui.skynet.blam.CreateBranchGuidToUuidArtifactBlam"> - </Operation> - </extension> - <extension - point="org.eclipse.osee.framework.ui.skynet.BlamOperation"> - <Operation className="org.eclipse.osee.framework.ui.skynet.blam.operation.OrcsScriptBlam"> </Operation> </extension> diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/CreateBranchGuidToUuidArtifactBlam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/CreateBranchGuidToUuidArtifactBlam.java deleted file mode 100644 index 8c7bfbe375e..00000000000 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/CreateBranchGuidToUuidArtifactBlam.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 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.blam; - -import java.util.Collection; -import java.util.Collections; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; -import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; -import org.eclipse.osee.framework.core.enums.CoreBranches; -import org.eclipse.osee.framework.skynet.core.artifact.Artifact; -import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; -import org.eclipse.osee.framework.skynet.core.utility.ConnectionHandler; -import org.eclipse.osee.jdbc.JdbcStatement; - -/** - * @author John Misinco - */ -public class CreateBranchGuidToUuidArtifactBlam extends AbstractBlam { - - private static final String MAPPING_ART = "ABKY9QDQLSaHQBiRC7wA"; - - @Override - public String getXWidgetsXml() { - return "<xWidgets></xWidgets>"; - } - - @Override - public String getDescriptionUsage() { - return String.format("Creates and/or updates artifact [%s] with branch guid to uuid mapping", MAPPING_ART); - } - - @Override - public String getName() { - return "Create/Update Branch Guid to Uuid Artifact"; - } - - @Override - public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception { - JdbcStatement chStmt = ConnectionHandler.getStatement(); - StringBuilder sb = new StringBuilder(); - try { - chStmt.runPreparedQuery("select branch_guid, branch_id from osee_branch"); - while (chStmt.next()) { - sb.append(chStmt.getString("branch_guid")); - sb.append(":"); - sb.append(chStmt.getString("branch_id")); - sb.append(";"); - } - } finally { - chStmt.close(); - } - Artifact mappingArt = ArtifactQuery.getOrCreate(MAPPING_ART, CoreArtifactTypes.GeneralData, CoreBranches.COMMON); - mappingArt.setSoleAttributeFromString(CoreAttributeTypes.GeneralStringData, sb.toString()); - mappingArt.persist("Update Branch Guid to Uuid"); - } - - @Override - public Collection<String> getCategories() { - return Collections.singletonList("Admin"); - } - -} diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RepeatEnumerationAttributeValues.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RepeatEnumerationAttributeValues.java index e17320cdda0..539ce546ed0 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RepeatEnumerationAttributeValues.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RepeatEnumerationAttributeValues.java @@ -17,6 +17,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.core.enums.TxChange; @@ -40,7 +41,7 @@ import org.eclipse.osee.jdbc.JdbcStatement; public class RepeatEnumerationAttributeValues extends DatabaseHealthOperation { private final static String FIND_REPEAT_ENUMS = - "select DISTINCT(art1.guid), att1.art_id, att1.value, att1.attr_type_id from osee_attribute att1, osee_attribute att2, osee_txs txs1, osee_txs txs2, osee_artifact art1 where att1.gamma_id = txs1.gamma_id and txs1.branch_id = ? and att2.gamma_id = txs2.gamma_id and txs2.branch_id = ? and att1.art_id = att2.art_id and att1.attr_id <> att2.attr_id and att1.value = att2.value and txs1.tx_current = " + TxChange.CURRENT + " and txs2.tx_current = " + TxChange.CURRENT + " and att1.attr_type_id = att2.attr_type_id and art1.art_id = att1.art_id order by att1.art_id, att1.attr_type_id, att1.value"; + "select DISTINCT(art1.art_id), att1.art_id, att1.value, att1.attr_type_id from osee_attribute att1, osee_attribute att2, osee_txs txs1, osee_txs txs2, osee_artifact art1 where att1.gamma_id = txs1.gamma_id and txs1.branch_id = ? and att2.gamma_id = txs2.gamma_id and txs2.branch_id = ? and att1.art_id = att2.art_id and att1.attr_id <> att2.attr_id and att1.value = att2.value and txs1.tx_current = " + TxChange.CURRENT + " and txs2.tx_current = " + TxChange.CURRENT + " and att1.attr_type_id = att2.attr_type_id and art1.art_id = att1.art_id order by att1.art_id, att1.attr_type_id, att1.value"; public RepeatEnumerationAttributeValues() { super("Repeat Enumeration Attribute Values"); @@ -72,7 +73,7 @@ public class RepeatEnumerationAttributeValues extends DatabaseHealthOperation { appendToDetails(AHTML.addRowSpanMultiColumnTable(branch.getName(), 3)); for (AttrData attrData : attributesWithErrors.getValues(branch)) { appendToDetails(AHTML.addRowMultiColumnTable(new String[] { - attrData.getArtifactGuid(), + attrData.getArtifactId().toString(), AttributeTypeManager.getTypeByGuid(attrData.getAttributeTypeId()).getName(), attrData.getValue()})); } @@ -87,16 +88,16 @@ public class RepeatEnumerationAttributeValues extends DatabaseHealthOperation { if (isFixOperationEnabled() && hadItemsToFix()) { for (IOseeBranch branch : attributesWithErrors.keySet()) { Collection<AttrData> attributeData = attributesWithErrors.getValues(branch); - List<String> artifactGuids = new ArrayList<>(attributeData.size()); + List<ArtifactId> artifactIds = new ArrayList<>(attributeData.size()); for (AttrData attrData : attributeData) { - artifactGuids.add(attrData.getArtifactGuid()); + artifactIds.add(attrData.getArtifactId()); } - ArtifactQuery.getArtifactListFromIds(artifactGuids, branch, EXCLUDE_DELETED); // bulk load for speed + ArtifactQuery.getArtifactListFrom(artifactIds, branch, EXCLUDE_DELETED); // bulk load for speed SkynetTransaction transaction = TransactionManager.createTransaction(branch, "Delete Repeat Attribute Values for" + branch.getShortName()); for (AttrData attrData : attributeData) { - Artifact artifact = ArtifactQuery.getArtifactFromId(attrData.getArtifactGuid(), branch); + Artifact artifact = ArtifactQuery.getArtifactFromId(attrData.getArtifactId(), branch); AttributeType attributeType = AttributeTypeManager.getTypeByGuid(attrData.getAttributeTypeId()); if (attributeType.isEnumerated()) { artifact.setAttributeValues(attributeType, artifact.getAttributesToStringList(attributeType)); @@ -129,8 +130,8 @@ public class RepeatEnumerationAttributeValues extends DatabaseHealthOperation { chStmt.runPreparedQuery(FIND_REPEAT_ENUMS, branch, branch); while (chStmt.next()) { checkForCancelledStatus(monitor); - attrData.add( - new AttrData(chStmt.getString("guid"), chStmt.getLong("attr_type_id"), chStmt.getString("value"))); + attrData.add(new AttrData(ArtifactId.valueOf(chStmt.getLong("art_id")), chStmt.getLong("attr_type_id"), + chStmt.getString("value"))); } } finally { chStmt.close(); @@ -139,19 +140,18 @@ public class RepeatEnumerationAttributeValues extends DatabaseHealthOperation { } private final class AttrData { - private final String artifactGuid; + private final ArtifactId artifactId; private final Long attributeTypeId; private final String value; - public AttrData(String artifactGuid, long attributeTypeId, String value) { - super(); - this.artifactGuid = artifactGuid; + public AttrData(ArtifactId artifactId, long attributeTypeId, String value) { + this.artifactId = artifactId; this.attributeTypeId = attributeTypeId; this.value = value; } - public String getArtifactGuid() { - return artifactGuid; + public ArtifactId getArtifactId() { + return artifactId; } public long getAttributeTypeId() { @@ -161,41 +161,5 @@ public class RepeatEnumerationAttributeValues extends DatabaseHealthOperation { public String getValue() { return value; } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + (artifactGuid == null ? 0 : artifactGuid.hashCode()); - result = prime * result + attributeTypeId.hashCode(); - result = prime * result + (value == null ? 0 : value.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - AttrData other = (AttrData) obj; - if (artifactGuid == null) { - if (other.artifactGuid != null) { - return false; - } - } else if (!artifactGuid.equals(other.artifactGuid)) { - return false; - } - if (attributeTypeId != other.attributeTypeId) { - return false; - } - if (value == null) { - if (other.value != null) { - return false; - } - } else if (!value.equals(other.value)) { - return false; - } - return true; - } } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/links/LinkUtil.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/links/LinkUtil.java index 4375e7bc0c6..28f936370b5 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/links/LinkUtil.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/links/LinkUtil.java @@ -57,7 +57,7 @@ public class LinkUtil { */ public static void deleteLink(ArtifactId accountId, Link deleteLink) throws Exception { Artifact golbalArtifact = getStoreArtifact(true); - Conditions.checkNotNull(golbalArtifact, "Guest accountId: " + SystemUser.Anonymous.getUuid()); + Conditions.checkNotNull(golbalArtifact, "Guest accountId: " + SystemUser.Anonymous.getIdString()); deleteLink(deleteLink, true, golbalArtifact); Artifact userArt = ArtifactQuery.getArtifactFromId(accountId, CoreBranches.COMMON); diff --git a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTransactionTest.java b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTransactionTest.java index 7e5afc56854..ade4c705619 100644 --- a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTransactionTest.java +++ b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTransactionTest.java @@ -22,7 +22,6 @@ import static org.eclipse.osee.framework.core.enums.SystemUser.OseeSystem; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -215,7 +214,7 @@ public class OrcsTransactionTest { transaction1.commit(); ArtifactReadable userDup = query.fromBranch(COMMON).andId(duplicate).getResults().getExactlyOne(); - assertNotSame(SystemUser.Anonymous.getGuid(), userDup.getGuid()); + assertTrue(SystemUser.Anonymous.notEqual(userDup)); assertEquals(SystemUser.Anonymous.getName(), userDup.getName()); // duplicate on different branch @@ -230,7 +229,7 @@ public class OrcsTransactionTest { transaction2.commit(); userDup = query.fromBranch(topLevelBranch).andId(duplicate).getResults().getExactlyOne(); - assertNotSame(SystemUser.Anonymous.getGuid(), userDup.getGuid()); + assertTrue(SystemUser.Anonymous.notEqual(userDup)); assertEquals(SystemUser.Anonymous.getName(), userDup.getName()); } |