From 9670909cb814f918c24c53bbe6d7f1b4a09ca573 Mon Sep 17 00:00:00 2001 From: rescobar Date: Fri, 18 Feb 2011 12:29:45 -0700 Subject: refactor: Cleanup token creation and inheritance Create static TokenFactory to handle token creation Create HasArtifactType interface Create HasBranch interface Fix ArtifactToken inheritance Remove token subclasses --- .../osee/ats/config/demo/DemoCISBuilds.java | 14 +- .../osee/ats/config/demo/PopulateDemoActions.java | 4 +- .../test/config/AtsBranchConfigurationTest.java | 76 +++++---- .../osee/ats/access/AtsAccessContextIdFactory.java | 16 +- .../ats/artifact/AbstractWorkflowArtifact.java | 11 +- .../osee/ats/artifact/ActionableItemArtifact.java | 2 +- .../osee/ats/artifact/AtsArtifactToken.java | 78 ++++----- .../osee/ats/artifact/AtsAttributeTypes.java | 164 ++++++++++--------- .../osee/ats/artifact/TeamDefinitionArtifact.java | 4 +- .../eclipse/osee/ats/config/AtsConfigManager.java | 4 +- .../eclipse/osee/ats/config/AtsDatabaseConfig.java | 30 ++-- .../config/AtsLoadConfigArtifactsOperation.java | 3 +- .../ats/editor/SMARelationsHyperlinkComposite.java | 8 +- .../eclipse/osee/ats/util/AtsArtifactTypes.java | 34 ++-- .../eclipse/osee/ats/util/AtsRelationTypes.java | 138 ++++++++-------- .../src/org/eclipse/osee/ats/util/AtsUtil.java | 11 ++ .../src/org/eclipse/osee/ats/util/Overview.java | 4 +- .../osee/ats/util/validate/RelationSetRule.java | 8 +- .../workdef/AtsWorkDefinitionSheetProviders.java | 2 +- .../osee/ats/workflow/item/AtsWorkDefinitions.java | 8 +- .../osee/ats/world/WorldContentProvider.java | 4 +- .../osee/coverage/store/CoverageArtifactTypes.java | 14 +- .../coverage/store/CoverageAttributeTypes.java | 29 ++-- .../osee/coverage/store/CoverageRelationTypes.java | 40 ++--- .../define/jobs/ImportTraceUnitsOperationTest.java | 4 +- .../define/traceability/blam/TraceReportBlam.java | 14 +- .../define/traceability/blam/UiToTestBlam.java | 6 +- .../operations/TraceUnitToArtifactProcessor.java | 6 +- .../report/AbstractArtifactRelationReport.java | 12 +- .../report/ArtifactToRelatedArtifact.java | 10 +- .../traceability/report/ArtifactTraceCount.java | 8 +- .../report/ArtifactsWithoutRelations.java | 6 +- .../integration/test/OseeDslAccessModelTest.java | 4 +- .../internal/AccessModelInterpreterImplTest.java | 11 +- .../test/mocks/MockAccessContextId.java | 23 --- .../core/dsl/integration/util/OseeUtil.java | 26 +-- .../osee/framework/core/message/SearchRequest.java | 4 +- .../translation/SearchRequestTranslator.java | 12 +- .../core/model/test/mocks/MockDataFactory.java | 10 +- .../framework/core/model/DefaultBasicArtifact.java | 3 +- .../osee/framework/core/model/IBasicArtifact.java | 8 +- .../framework/core/model/RelationTypeSide.java | 4 +- .../osee/framework/core/data/ArtifactToken.java | 29 ---- .../osee/framework/core/data/HasArtifactType.java | 19 +++ .../osee/framework/core/data/HasBranch.java | 19 +++ .../osee/framework/core/data/IArtifactToken.java | 7 +- .../framework/core/data/IRelationTypeSide.java | 17 ++ .../osee/framework/core/data/OseeBranch.java | 20 --- .../osee/framework/core/data/TokenFactory.java | 114 ++++++++++++++ .../framework/core/enums/CoreArtifactTypes.java | 116 +++++++------- .../framework/core/enums/CoreAttributeTypes.java | 174 ++++++++++----------- .../osee/framework/core/enums/CoreBranches.java | 14 +- .../framework/core/enums/CoreRelationTypes.java | 123 +++++++-------- .../framework/core/enums/IRelationEnumeration.java | 17 -- .../core/test/event/ArtifactEventFiltersTest.java | 27 ++-- .../skynet/core/test/event/BranchEventTest.java | 8 +- .../order/RelationOrderMergeUtilityTest.java | 3 +- .../framework/skynet/core/OseeSystemArtifacts.java | 6 +- .../framework/skynet/core/artifact/Artifact.java | 58 +++---- .../skynet/core/artifact/ArtifactTypeManager.java | 6 +- .../skynet/core/artifact/BranchManager.java | 4 +- .../skynet/core/artifact/search/ArtifactQuery.java | 4 +- .../core/artifact/search/InRelationSearch.java | 8 +- .../core/artifact/search/RelationCriteria.java | 4 +- .../osee/framework/skynet/core/change/Change.java | 4 +- .../skynet/core/event/OseeEventManager.java | 6 +- .../skynet/core/relation/RelationManager.java | 18 +-- .../core/relation/crossbranch/CrossBranchLink.java | 14 +- .../crossbranch/CrossBranchLinkManager.java | 12 +- .../relation/crossbranch/LoadedRelationTypes.java | 35 ----- .../relation/order/RelationOrderMergeUtility.java | 8 +- .../framework/ui/skynet/RelationsComposite.java | 4 +- .../ui/skynet/artifact/ArtifactPasteOperation.java | 4 +- .../render/word/template/ArtifactProcessing.java | 5 +- .../osee/ote/define/AUTOGEN/OteAttributeTypes.java | 64 ++++---- .../osee/ote/define/AUTOGEN/OteRelationTypes.java | 23 ++- .../osee/support/test/util/DemoArtifactTypes.java | 14 +- .../osee/support/test/util/DemoSawBuilds.java | 15 +- 78 files changed, 949 insertions(+), 951 deletions(-) delete mode 100644 plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/test/mocks/MockAccessContextId.java delete mode 100644 plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactToken.java create mode 100644 plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/HasArtifactType.java create mode 100644 plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/HasBranch.java create mode 100644 plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IRelationTypeSide.java delete mode 100644 plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeBranch.java create mode 100644 plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TokenFactory.java delete mode 100644 plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/IRelationEnumeration.java delete mode 100644 plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/crossbranch/LoadedRelationTypes.java diff --git a/plugins/org.eclipse.osee.ats.config.demo/src/org/eclipse/osee/ats/config/demo/DemoCISBuilds.java b/plugins/org.eclipse.osee.ats.config.demo/src/org/eclipse/osee/ats/config/demo/DemoCISBuilds.java index 7615f718c99..9998b1ef259 100644 --- a/plugins/org.eclipse.osee.ats.config.demo/src/org/eclipse/osee/ats/config/demo/DemoCISBuilds.java +++ b/plugins/org.eclipse.osee.ats.config.demo/src/org/eclipse/osee/ats/config/demo/DemoCISBuilds.java @@ -11,17 +11,17 @@ package org.eclipse.osee.ats.config.demo; import org.eclipse.osee.framework.core.data.IOseeBranch; -import org.eclipse.osee.framework.core.data.NamedIdentity; +import org.eclipse.osee.framework.core.data.TokenFactory; /** * @author Donald G. Dunne */ -public class DemoCISBuilds extends NamedIdentity implements IOseeBranch { - public static final DemoCISBuilds CIS_Bld_1 = new DemoCISBuilds("AyH_f2sSKy3l07fIvDDD", "CIS_Bld_1"); - public static final DemoCISBuilds CIS_Bld_2 = new DemoCISBuilds("AyH_f2sSKy3l07fIvEEE", "CIS_Bld_2"); - public static final DemoCISBuilds CIS_Bld_3 = new DemoCISBuilds("AyH_f2sSKy3l07fIvFFF", "CIS_Bld_3"); +public final class DemoCISBuilds { + public static final IOseeBranch CIS_Bld_1 = TokenFactory.createBranch("AyH_f2sSKy3l07fIvDDD", "CIS_Bld_1"); + public static final IOseeBranch CIS_Bld_2 = TokenFactory.createBranch("AyH_f2sSKy3l07fIvEEE", "CIS_Bld_2"); + public static final IOseeBranch CIS_Bld_3 = TokenFactory.createBranch("AyH_f2sSKy3l07fIvFFF", "CIS_Bld_3"); - private DemoCISBuilds(String guid, String name) { - super(guid, name); + private DemoCISBuilds() { + // Constants } } \ No newline at end of file diff --git a/plugins/org.eclipse.osee.ats.config.demo/src/org/eclipse/osee/ats/config/demo/PopulateDemoActions.java b/plugins/org.eclipse.osee.ats.config.demo/src/org/eclipse/osee/ats/config/demo/PopulateDemoActions.java index 92077c4eeb9..06f711f7092 100644 --- a/plugins/org.eclipse.osee.ats.config.demo/src/org/eclipse/osee/ats/config/demo/PopulateDemoActions.java +++ b/plugins/org.eclipse.osee.ats.config.demo/src/org/eclipse/osee/ats/config/demo/PopulateDemoActions.java @@ -42,12 +42,12 @@ import org.eclipse.osee.ats.util.SubscribeManager; import org.eclipse.osee.ats.util.TeamState; import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.data.IOseeBranch; +import org.eclipse.osee.framework.core.data.IRelationTypeSide; import org.eclipse.osee.framework.core.data.SystemUser; import org.eclipse.osee.framework.core.enums.BranchType; import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; import org.eclipse.osee.framework.core.enums.CoreRelationTypes; -import org.eclipse.osee.framework.core.enums.IRelationEnumeration; import org.eclipse.osee.framework.core.exception.OseeArgumentException; import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.model.Branch; @@ -494,7 +494,7 @@ public class PopulateDemoActions extends XNavigateItemAction { } } - private void relate(IRelationEnumeration relationSide, Artifact artifact, Collection artifacts) throws OseeCoreException { + private void relate(IRelationTypeSide relationSide, Artifact artifact, Collection artifacts) throws OseeCoreException { for (Artifact otherArtifact : artifacts) { artifact.addRelation(relationSide, otherArtifact); } diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/config/AtsBranchConfigurationTest.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/config/AtsBranchConfigurationTest.java index 845608b36bd..68b4bc381ac 100644 --- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/config/AtsBranchConfigurationTest.java +++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/config/AtsBranchConfigurationTest.java @@ -34,7 +34,7 @@ import org.eclipse.osee.ats.util.AtsRelationTypes; import org.eclipse.osee.ats.util.AtsUtil; import org.eclipse.osee.ats.util.TeamState; import org.eclipse.osee.framework.core.data.IOseeBranch; -import org.eclipse.osee.framework.core.data.NamedIdentity; +import org.eclipse.osee.framework.core.data.TokenFactory; import org.eclipse.osee.framework.core.enums.BranchArchivedState; import org.eclipse.osee.framework.core.enums.BranchType; import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; @@ -70,27 +70,21 @@ import org.junit.Before; */ public class AtsBranchConfigurationTest { - public static class AtsTestBranches extends NamedIdentity implements IOseeBranch { - public static final AtsTestBranches BranchViaTeamDef = new AtsTestBranches("AyH_e6damwQgvDhKfAAA", - "BranchViaTeamDef"); - public static final AtsTestBranches BranchViaVersions = new AtsTestBranches("AyH_e6damwQgvDhKfBBB", - "BranchViaVersions"); + public static final IOseeBranch BRANCH_VIA_TEAM_DEFINITION = TokenFactory.createBranch("AyH_e6damwQgvDhKfAAA", + "BranchViaTeamDef"); + public static final IOseeBranch BRANCH_VIA_VERSIONS = TokenFactory.createBranch("AyH_e6damwQgvDhKfBBB", + "BranchViaVersions"); - private AtsTestBranches(String guid, String name) { - super(guid, name); - } - - public String getNamespace() { - return String.format("org.branchTest.%s", this.getName().toLowerCase()); + private static Collection appendToName(IOseeBranch branch, String... postFixes) { + Collection data = new ArrayList(); + for (String postFix : postFixes) { + data.add(String.format("%s - %s", branch.getName(), postFix)); } + return data; + } - public Collection appendToName(String... postFixes) { - Collection data = new ArrayList(); - for (String postFix : postFixes) { - data.add(String.format("%s - %s", this.getName(), postFix)); - } - return data; - } + private static String asNamespace(IOseeBranch branch) { + return String.format("org.branchTest.%s", branch.getName().toLowerCase()); } @Before @@ -106,21 +100,21 @@ public class AtsBranchConfigurationTest { OseeLog.log(AtsPlugin.class, Level.INFO, "Running testBranchViaVersions..."); // Cleanup from previous run - cleanupBranchTest(AtsTestBranches.BranchViaVersions); + cleanupBranchTest(BRANCH_VIA_VERSIONS); OseeLog.log(AtsPlugin.class, Level.INFO, "Configuring ATS for team org.branchTest.viaTeamDefs"); // create team definition and actionable item - String name = AtsTestBranches.BranchViaVersions.getName(); - String namespace = AtsTestBranches.BranchViaVersions.getNamespace(); - Collection versions = AtsTestBranches.BranchViaVersions.appendToName("Ver1", "Ver2"); - Collection actionableItems = AtsTestBranches.BranchViaVersions.appendToName("A1", "A2"); + String name = BRANCH_VIA_VERSIONS.getName(); + String namespace = asNamespace(BRANCH_VIA_VERSIONS); + Collection versions = appendToName(BRANCH_VIA_VERSIONS, "Ver1", "Ver2"); + Collection actionableItems = appendToName(BRANCH_VIA_VERSIONS, "A1", "A2"); configureAts(namespace, name, versions, actionableItems, namespace); // create main branch OseeLog.log(AtsPlugin.class, Level.INFO, "Creating root branch"); // Create SAW_Bld_2 branch off SAW_Bld_1 - Branch viaTeamDefBranch = BranchManager.createTopLevelBranch(AtsTestBranches.BranchViaVersions); + Branch viaTeamDefBranch = BranchManager.createTopLevelBranch(BRANCH_VIA_VERSIONS); TestUtil.sleep(2000); @@ -128,7 +122,7 @@ public class AtsBranchConfigurationTest { OseeLog.log(AtsPlugin.class, Level.INFO, "Configuring version to use branch and allow create/commit"); TeamDefinitionArtifact teamDef = (TeamDefinitionArtifact) ArtifactQuery.getArtifactFromTypeAndName(AtsArtifactTypes.TeamDefinition, - AtsTestBranches.BranchViaVersions.getName(), AtsUtil.getAtsBranch()); + BRANCH_VIA_VERSIONS.getName(), AtsUtil.getAtsBranch()); VersionArtifact verArtToTarget = null; for (VersionArtifact vArt : teamDef.getVersionsArtifacts()) { if (vArt.getName().contains("Ver1")) { @@ -150,12 +144,12 @@ public class AtsBranchConfigurationTest { OseeLog.log(AtsPlugin.class, Level.INFO, "Create new Action and target for version " + verArtToTarget); Collection selectedActionableItems = - ActionableItemArtifact.getActionableItems(AtsTestBranches.BranchViaVersions.appendToName("A1")); + ActionableItemArtifact.getActionableItems(appendToName(BRANCH_VIA_VERSIONS, "A1")); Assert.assertFalse(selectedActionableItems.isEmpty()); SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Branch Configuration Test"); ActionArtifact actionArt = - ActionManager.createAction(null, AtsTestBranches.BranchViaVersions.getName() + " Req Changes", "description", + ActionManager.createAction(null, BRANCH_VIA_VERSIONS.getName() + " Req Changes", "description", ChangeType.Problem, "1", false, null, selectedActionableItems, new Date(), UserManager.getUser(), transaction); actionArt.getTeamWorkFlowArtifacts().iterator().next().addRelation( @@ -184,7 +178,7 @@ public class AtsBranchConfigurationTest { Artifact rootArtifact = OseeSystemArtifacts.getDefaultHierarchyRootArtifact(teamWf.getWorkingBranch()); Artifact blk3MainArt = ArtifactTypeManager.addArtifact(CoreArtifactTypes.SoftwareRequirement, teamWf.getWorkingBranch(), - AtsTestBranches.BranchViaVersions.getName() + " Requirement"); + BRANCH_VIA_VERSIONS.getName() + " Requirement"); rootArtifact.addChild(blk3MainArt); blk3MainArt.persist(); @@ -209,21 +203,21 @@ public class AtsBranchConfigurationTest { OseeLog.log(AtsPlugin.class, Level.INFO, "Running testBranchViaTeamDefinition..."); // Cleanup from previous run - cleanupBranchTest(AtsTestBranches.BranchViaTeamDef); + cleanupBranchTest(BRANCH_VIA_TEAM_DEFINITION); OseeLog.log(AtsPlugin.class, Level.INFO, "Configuring ATS for team org.branchTest.viaTeamDefs"); // create team definition and actionable item - String name = AtsTestBranches.BranchViaTeamDef.getName(); - String namespace = AtsTestBranches.BranchViaTeamDef.getNamespace(); + String name = BRANCH_VIA_TEAM_DEFINITION.getName(); + String namespace = asNamespace(BRANCH_VIA_TEAM_DEFINITION); Collection versions = null; - Collection actionableItems = AtsTestBranches.BranchViaTeamDef.appendToName("A1", "A2"); + Collection actionableItems = appendToName(BRANCH_VIA_TEAM_DEFINITION, "A1", "A2"); configureAts(namespace, name, versions, actionableItems, namespace); // create main branch OseeLog.log(AtsPlugin.class, Level.INFO, "Creating root branch"); // Create SAW_Bld_2 branch off SAW_Bld_1 - Branch viaTeamDefBranch = BranchManager.createTopLevelBranch(AtsTestBranches.BranchViaTeamDef); + Branch viaTeamDefBranch = BranchManager.createTopLevelBranch(BRANCH_VIA_TEAM_DEFINITION); TestUtil.sleep(2000); @@ -231,7 +225,7 @@ public class AtsBranchConfigurationTest { OseeLog.log(AtsPlugin.class, Level.INFO, "Configuring team def to use branch and allow create/commit"); TeamDefinitionArtifact teamDef = (TeamDefinitionArtifact) ArtifactQuery.getArtifactFromTypeAndName(AtsArtifactTypes.TeamDefinition, - AtsTestBranches.BranchViaTeamDef.getName(), AtsUtil.getAtsBranch()); + BRANCH_VIA_TEAM_DEFINITION.getName(), AtsUtil.getAtsBranch()); teamDef.setSoleAttributeFromString(AtsAttributeTypes.BaselineBranchGuid, viaTeamDefBranch.getGuid()); // setup team def to allow create/commit of branch teamDef.setSoleAttributeValue(AtsAttributeTypes.AllowCommitBranch, true); @@ -247,12 +241,12 @@ public class AtsBranchConfigurationTest { // create action, OseeLog.log(AtsPlugin.class, Level.INFO, "Create new Action"); Collection selectedActionableItems = - ActionableItemArtifact.getActionableItems(AtsTestBranches.BranchViaTeamDef.appendToName("A1")); + ActionableItemArtifact.getActionableItems(appendToName(BRANCH_VIA_TEAM_DEFINITION, "A1")); Assert.assertFalse(selectedActionableItems.isEmpty()); SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Test branch via team definition: create action"); - String actionTitle = AtsTestBranches.BranchViaTeamDef.getName() + " Req Changes"; + String actionTitle = BRANCH_VIA_TEAM_DEFINITION.getName() + " Req Changes"; ActionArtifact actionArt = ActionManager.createAction(null, actionTitle, "description", ChangeType.Problem, "1", false, null, selectedActionableItems, new Date(), UserManager.getUser(), transaction); @@ -277,7 +271,7 @@ public class AtsBranchConfigurationTest { Artifact rootArtifact = OseeSystemArtifacts.getDefaultHierarchyRootArtifact(teamWf.getWorkingBranch()); Artifact blk3MainArt = ArtifactTypeManager.addArtifact(CoreArtifactTypes.SoftwareRequirement, teamWf.getWorkingBranch(), - AtsTestBranches.BranchViaTeamDef.getName() + " Requirement"); + BRANCH_VIA_TEAM_DEFINITION.getName() + " Requirement"); rootArtifact.addChild(blk3MainArt); blk3MainArt.persist(); @@ -293,7 +287,7 @@ public class AtsBranchConfigurationTest { Assert.assertTrue("Should be 1 new artifact in change report, found " + newArts.size(), newArts.size() == 1); } - public static void cleanupBranchTest(AtsTestBranches testType) throws Exception { + public static void cleanupBranchTest(IOseeBranch testType) throws Exception { String namespace = "org.branchTest." + testType.getName().toLowerCase(); OseeLog.log(AtsPlugin.class, Level.INFO, "Cleanup from previous run of ATS for team " + namespace); ActionArtifact aArt = @@ -424,8 +418,8 @@ public class AtsBranchConfigurationTest { @After public void tearDown() throws Exception { - cleanupBranchTest(AtsTestBranches.BranchViaVersions); - cleanupBranchTest(AtsTestBranches.BranchViaTeamDef); + cleanupBranchTest(BRANCH_VIA_VERSIONS); + cleanupBranchTest(BRANCH_VIA_TEAM_DEFINITION); } public static void configureAts(String namespace, String teamDefName, Collection versionNames, Collection actionableItems, String workflowId) throws Exception { diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/access/AtsAccessContextIdFactory.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/access/AtsAccessContextIdFactory.java index 33d25d9c522..326ed63fdaf 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/access/AtsAccessContextIdFactory.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/access/AtsAccessContextIdFactory.java @@ -15,7 +15,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.eclipse.osee.ats.internal.AtsPlugin; import org.eclipse.osee.framework.core.data.AccessContextId; -import org.eclipse.osee.framework.core.data.NamedIdentity; +import org.eclipse.osee.framework.core.data.TokenFactory; import org.eclipse.osee.framework.logging.OseeLog; /** @@ -32,7 +32,7 @@ public final class AtsAccessContextIdFactory { public static AccessContextId createContextId(final String guid, final String name) { AccessContextId context = guidToIds.get(guid); if (context == null) { - context = new AtsAccessContextId(guid, name); + context = TokenFactory.createAccessContextId(guid, name); guidToIds.put(guid, context); } else { OseeLog.log( @@ -51,16 +51,4 @@ public final class AtsAccessContextIdFactory { } return context; } - - private final static class AtsAccessContextId extends NamedIdentity implements AccessContextId { - - protected AtsAccessContextId(final String guid, final String name) { - super(guid, name); - } - - @Override - public String toString() { - return String.format("%s - %s", getName(), getGuid()); - } - } } diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/AbstractWorkflowArtifact.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/AbstractWorkflowArtifact.java index 887b461617a..b14ce0e9573 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/AbstractWorkflowArtifact.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/AbstractWorkflowArtifact.java @@ -32,7 +32,6 @@ import org.eclipse.osee.ats.help.ui.AtsHelpContext; import org.eclipse.osee.ats.internal.AtsPlugin; import org.eclipse.osee.ats.notify.AtsNotification; import org.eclipse.osee.ats.util.AtsArtifactTypes; -import org.eclipse.osee.ats.util.AtsRelationTypes; import org.eclipse.osee.ats.util.AtsUtil; import org.eclipse.osee.ats.util.SimpleTeamState; import org.eclipse.osee.ats.util.StateManager; @@ -49,8 +48,8 @@ import org.eclipse.osee.ats.workflow.TransitionManager; import org.eclipse.osee.ats.world.IWorldViewArtifact; import org.eclipse.osee.framework.access.AccessControlManager; import org.eclipse.osee.framework.core.data.IArtifactType; +import org.eclipse.osee.framework.core.data.IRelationTypeSide; import org.eclipse.osee.framework.core.data.SystemUser; -import org.eclipse.osee.framework.core.enums.IRelationEnumeration; import org.eclipse.osee.framework.core.enums.PermissionEnum; import org.eclipse.osee.framework.core.exception.OseeArgumentException; import org.eclipse.osee.framework.core.exception.OseeCoreException; @@ -86,7 +85,7 @@ import org.osgi.framework.ServiceReference; */ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact implements HasCmAccessControl, IGroupExplorerProvider, IWorldViewArtifact { - private final Set atsWorldRelations = new HashSet(); + private final Set atsWorldRelations = new HashSet(); private Collection transitionAssignees; protected AbstractWorkflowArtifact parentSma; protected TeamWorkFlowArtifact parentTeamArt; @@ -220,8 +219,8 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple /** * Registers relation as part of the parent/child hierarchy in ATS World */ - public void registerAtsWorldRelation(AtsRelationTypes side) { - atsWorldRelations.add(side); + public void registerAtsWorldRelation(IRelationTypeSide typeSideToken) { + atsWorldRelations.add(typeSideToken); } @Override @@ -707,7 +706,7 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple return getPercentCompleteSMATotal(); } - public Set getAtsWorldRelations() { + public Set getAtsWorldRelations() { return atsWorldRelations; } diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/ActionableItemArtifact.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/ActionableItemArtifact.java index 1bcab6346e8..c3fc7bd285b 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/ActionableItemArtifact.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/ActionableItemArtifact.java @@ -62,7 +62,7 @@ public class ActionableItemArtifact extends Artifact { } public static ActionableItemArtifact getTopActionableItem() throws OseeCoreException { - return (ActionableItemArtifact) AtsArtifactToken.get(AtsArtifactToken.TopActionableItem); + return (ActionableItemArtifact) AtsUtil.getFromToken(AtsArtifactToken.TopActionableItem); } public static List getActionableItems() throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/AtsArtifactToken.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/AtsArtifactToken.java index 69980f56ec1..2e96c6ffe4a 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/AtsArtifactToken.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/AtsArtifactToken.java @@ -1,56 +1,42 @@ -/* - * Created on Feb 8, 2011 +/******************************************************************************* + * 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 * - * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE - */ + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ package org.eclipse.osee.ats.artifact; import org.eclipse.osee.ats.util.AtsArtifactTypes; -import org.eclipse.osee.ats.util.AtsUtil; -import org.eclipse.osee.framework.core.data.ArtifactToken; -import org.eclipse.osee.framework.core.data.IArtifactType; -import org.eclipse.osee.framework.core.data.IOseeBranch; +import org.eclipse.osee.framework.core.data.IArtifactToken; +import org.eclipse.osee.framework.core.data.TokenFactory; import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; -import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist; -import org.eclipse.osee.framework.core.exception.OseeCoreException; -import org.eclipse.osee.framework.skynet.core.artifact.Artifact; -import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; -public class AtsArtifactToken extends ArtifactToken { +public final class AtsArtifactToken { - public static AtsArtifactToken HeadingFolder = new AtsArtifactToken("Action Tracking System", - CoreArtifactTypes.Folder, "AAABER+3yR4A8O7WYQ+Xbw"); - public static AtsArtifactToken TopTeamDefinition = new AtsArtifactToken("Teams", AtsArtifactTypes.TeamDefinition, - "AAABER+35b4A8O7WHrXTiA"); - public static AtsArtifactToken TopActionableItem = new AtsArtifactToken("Actionable Items", - AtsArtifactTypes.ActionableItem, "AAABER+37QEA8O7WSQaqJQ"); - public static AtsArtifactToken ConfigFolder = new AtsArtifactToken("Config", CoreArtifactTypes.Folder, - "AAABF4n18eYAc1ruQSSWdg"); - public static AtsArtifactToken WorkDefinitionsFolder = new AtsArtifactToken("Work Definitions", - CoreArtifactTypes.Folder, "ADTfjCLEj2DH2WYyeOgA"); - public static AtsArtifactToken WorkPagesFolder = new AtsArtifactToken("Work Pages", CoreArtifactTypes.Folder, - "AAABGnncY_gAAo+3N69ASA"); - public static AtsArtifactToken WorkRulesFolder = new AtsArtifactToken("Work Rules", CoreArtifactTypes.Folder, - "AAABGnmhCyYAoJoIciyaag"); - public static AtsArtifactToken WorkWidgetsFolder = new AtsArtifactToken("Work Widgets", CoreArtifactTypes.Folder, - "AAABGnmjk4IAoJoIa945Kg"); - public static AtsArtifactToken WorkFlowsFolder = new AtsArtifactToken("Work Flows", CoreArtifactTypes.Folder, - "AAABGnncZ_4AAo+3D0sGfw"); + public static IArtifactToken HeadingFolder = TokenFactory.createArtifactToken("AAABER+3yR4A8O7WYQ+Xbw", + "Action Tracking System", CoreArtifactTypes.Folder); + public static IArtifactToken TopTeamDefinition = TokenFactory.createArtifactToken("AAABER+35b4A8O7WHrXTiA", "Teams", + AtsArtifactTypes.TeamDefinition); + public static IArtifactToken TopActionableItem = TokenFactory.createArtifactToken("AAABER+37QEA8O7WSQaqJQ", + "Actionable Items", AtsArtifactTypes.ActionableItem); + public static IArtifactToken ConfigFolder = TokenFactory.createArtifactToken("AAABF4n18eYAc1ruQSSWdg", "Config", + CoreArtifactTypes.Folder); + public static IArtifactToken WorkDefinitionsFolder = TokenFactory.createArtifactToken("ADTfjCLEj2DH2WYyeOgA", + "Work Definitions", CoreArtifactTypes.Folder); + public static IArtifactToken WorkPagesFolder = TokenFactory.createArtifactToken("AAABGnncY_gAAo+3N69ASA", + "Work Pages", CoreArtifactTypes.Folder); + public static IArtifactToken WorkRulesFolder = TokenFactory.createArtifactToken("AAABGnmhCyYAoJoIciyaag", + "Work Rules", CoreArtifactTypes.Folder); + public static IArtifactToken WorkWidgetsFolder = TokenFactory.createArtifactToken("AAABGnmjk4IAoJoIa945Kg", + "Work Widgets", CoreArtifactTypes.Folder); + public static IArtifactToken WorkFlowsFolder = TokenFactory.createArtifactToken("AAABGnncZ_4AAo+3D0sGfw", + "Work Flows", CoreArtifactTypes.Folder); - public AtsArtifactToken(String name, IArtifactType artifactType, String guid) { - this(name, artifactType, guid, AtsUtil.getAtsBranchToken()); - } - - public AtsArtifactToken(String name, IArtifactType artifactType, String guid, IOseeBranch oseeBranch) { - super(guid, name, artifactType, oseeBranch); - } - - public static Artifact get(AtsArtifactToken atsArtifactToken) throws OseeCoreException { - try { - return ArtifactQuery.getArtifactFromToken(atsArtifactToken); - } catch (ArtifactDoesNotExist ex) { - // do nothing - } - return null; + private AtsArtifactToken() { + // Constants } } diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/AtsAttributeTypes.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/AtsAttributeTypes.java index cb06402a55e..a758ef55ae9 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/AtsAttributeTypes.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/AtsAttributeTypes.java @@ -11,109 +11,107 @@ package org.eclipse.osee.ats.artifact; import org.eclipse.osee.framework.core.data.IAttributeType; -import org.eclipse.osee.framework.core.data.NamedIdentity; +import org.eclipse.osee.framework.core.data.TokenFactory; import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; /** * @author Ryan D. Brooks * @author Donald G. Dunne */ -public class AtsAttributeTypes extends NamedIdentity implements IAttributeType { +public final class AtsAttributeTypes { // @formatter:off - public static final IAttributeType Actionable = new AtsAttributeTypes("AAMFEcvDtBiaJ3TMatAA", "Actionable", "True if item can have Action written against or assigned to."); - public static final IAttributeType ActionableItem = new AtsAttributeTypes("AAMFEdbcR2zpGzFOLOQA", "Actionable Item", "Actionable Items that are impacted by this change."); - public static final IAttributeType ActionDetailsFormat = new AtsAttributeTypes("Aij_PfM7wCsEA2Z720wA", "Action Details Format", "Format of string when push Action Details Copy button on SMA Workflow Editor."); - public static final IAttributeType Active = new AtsAttributeTypes("AAMFEclQOVmzkIvzyWwA", "Active", "Active ATS configuration object."); - public static final IAttributeType AllowCommitBranch = new AtsAttributeTypes("AAMFEbCZCkwgj73BsQgA", "Allow Commit Branch"); - public static final IAttributeType AllowCreateBranch = new AtsAttributeTypes("AAMFEbARuQEvi6rtY5gA", "Allow Create Branch"); - public static final IAttributeType BaselineBranchGuid = new AtsAttributeTypes("AAMFEdIjJ2za2fblEVgA", "Baseline Branch Guid", "Basline branch associated with ATS object."); - public static final IAttributeType BlockingReview = new AtsAttributeTypes("AAMFEctKkjMRrIy1C7gA", "Blocking Review"); + public static final IAttributeType Actionable = createType("AAMFEcvDtBiaJ3TMatAA", "Actionable", "True if item can have Action written against or assigned to."); + public static final IAttributeType ActionableItem = createType("AAMFEdbcR2zpGzFOLOQA", "Actionable Item", "Actionable Items that are impacted by this change."); + public static final IAttributeType ActionDetailsFormat = createType("Aij_PfM7wCsEA2Z720wA", "Action Details Format", "Format of string when push Action Details Copy button on SMA Workflow Editor."); + public static final IAttributeType Active = createType("AAMFEclQOVmzkIvzyWwA", "Active", "Active ATS configuration object."); + public static final IAttributeType AllowCommitBranch = createType("AAMFEbCZCkwgj73BsQgA", "Allow Commit Branch"); + public static final IAttributeType AllowCreateBranch = createType("AAMFEbARuQEvi6rtY5gA", "Allow Create Branch"); + public static final IAttributeType BaselineBranchGuid = createType("AAMFEdIjJ2za2fblEVgA", "Baseline Branch Guid", "Basline branch associated with ATS object."); + public static final IAttributeType BlockingReview = createType("AAMFEctKkjMRrIy1C7gA", "Blocking Review"); - public static final IAttributeType Category1 = new AtsAttributeTypes("AAMFEdrYniOQYrYUKKQA", "Category", "Open field for user to be able to enter text to use for categorizing/sorting."); - public static final IAttributeType Category2 = new AtsAttributeTypes("AAMFEdthBkolbJKLXuAA", "Category2", Category1.getDescription()); - public static final IAttributeType Category3 = new AtsAttributeTypes("AAMFEd06oxr8LMzZxdgA", "Category3", Category1.getDescription()); + public static final IAttributeType Category1 = createType("AAMFEdrYniOQYrYUKKQA", "Category", "Open field for user to be able to enter text to use for categorizing/sorting."); + public static final IAttributeType Category2 = createType("AAMFEdthBkolbJKLXuAA", "Category2", Category1.getDescription()); + public static final IAttributeType Category3 = createType("AAMFEd06oxr8LMzZxdgA", "Category3", Category1.getDescription()); - public static final IAttributeType ChangeType = new AtsAttributeTypes("AAMFEc+MwGHnPCv7HlgA", "Change Type", "Type of change."); + public static final IAttributeType ChangeType = createType("AAMFEc+MwGHnPCv7HlgA", "Change Type", "Type of change."); - public static final IAttributeType CancelledDate = new AtsAttributeTypes("AXnyKG1waCcPPHHGEFQA", "Cancelled Date", "Date the workflow was cancelled."); - public static final IAttributeType CancelledBy = new AtsAttributeTypes("AXpNsieBHnqaJJfduGgA", "Cancelled By", "UserId of the user who cancelled workflow."); - public static final IAttributeType CancelledReason = new AtsAttributeTypes("AXqJE0SmwRQzvzlqC9gA", "Cancelled Reason", "Explanation of why worklfow was cancelled."); - public static final IAttributeType CancelledFromState = new AtsAttributeTypes("AXrxlXOwGiAnlaUNX6AA", "Cancelled From State", "State workflow was in when cancelled."); + public static final IAttributeType CancelledDate = createType("AXnyKG1waCcPPHHGEFQA", "Cancelled Date", "Date the workflow was cancelled."); + public static final IAttributeType CancelledBy = createType("AXpNsieBHnqaJJfduGgA", "Cancelled By", "UserId of the user who cancelled workflow."); + public static final IAttributeType CancelledReason = createType("AXqJE0SmwRQzvzlqC9gA", "Cancelled Reason", "Explanation of why worklfow was cancelled."); + public static final IAttributeType CancelledFromState = createType("AXrxlXOwGiAnlaUNX6AA", "Cancelled From State", "State workflow was in when cancelled."); - public static final IAttributeType CreatedDate = new AtsAttributeTypes("AXny90bBpmfNkLpNhqwA", "Created Date", "Date the workflow was created."); - public static final IAttributeType CreatedBy = new AtsAttributeTypes("AXpTVIExV1p0kp9IKKQA", "Created By", "UserId of the user who created the workflow."); + public static final IAttributeType CreatedDate = createType("AXny90bBpmfNkLpNhqwA", "Created Date", "Date the workflow was created."); + public static final IAttributeType CreatedBy = createType("AXpTVIExV1p0kp9IKKQA", "Created By", "UserId of the user who created the workflow."); - public static final IAttributeType CompletedDate = new AtsAttributeTypes("AXnxSfRg6UhirNzaZnQA", "Completed Date", "Date the workflow was completed."); - public static final IAttributeType CompletedBy = new AtsAttributeTypes("AXo6tqxrOStgd9P16XQA", "Completed By", "UserId of the user who completed workflow."); - public static final IAttributeType CompletedFromState = new AtsAttributeTypes("AXr9OO909xRiI3MFNOwA", "Completed From State", "State workflow was in when completed."); + public static final IAttributeType CompletedDate = createType("AXnxSfRg6UhirNzaZnQA", "Completed Date", "Date the workflow was completed."); + public static final IAttributeType CompletedBy = createType("AXo6tqxrOStgd9P16XQA", "Completed By", "UserId of the user who completed workflow."); + public static final IAttributeType CompletedFromState = createType("AXr9OO909xRiI3MFNOwA", "Completed From State", "State workflow was in when completed."); - public static final IAttributeType CurrentState = new AtsAttributeTypes("AAMFEdOWL3u6hmX2VbwA", "Current State", "Current state of workflow state machine."); - public static final IAttributeType CurrentStateType = new AtsAttributeTypes("ATOWheEyGUJmPmPuqyAA", "Current State Type", "Type of Current State: InWork, Completed or Cancelled."); - public static final IAttributeType Decision = new AtsAttributeTypes("AAMFEd7uDXcmqq_FrCQA", "Decision", "Option selected during decision review."); + public static final IAttributeType CurrentState = createType("AAMFEdOWL3u6hmX2VbwA", "Current State", "Current state of workflow state machine."); + public static final IAttributeType CurrentStateType = createType("ATOWheEyGUJmPmPuqyAA", "Current State Type", "Type of Current State: InWork, Completed or Cancelled."); + public static final IAttributeType Decision = createType("AAMFEd7uDXcmqq_FrCQA", "Decision", "Option selected during decision review."); - public static final IAttributeType DecisionReviewOptions = new AtsAttributeTypes("AAMFEd5hRy1+SRJRqfwA", "Decision Review Options", "Options available for selection in review. Each line is a separate option. Format: