diff options
author | donald.g.dunne | 2018-04-24 20:23:51 +0000 |
---|---|---|
committer | Ryan T. Baldwin | 2018-04-24 20:23:51 +0000 |
commit | b0a75a78e6e7a104bffbd452101b332c132aefbf (patch) | |
tree | 79cd59795e8f9f91b87d9f77de9ba5218f9a9e17 | |
parent | a66dad06e356df1946702dc99c4437ba78a439e6 (diff) | |
download | org.eclipse.osee-b0a75a78e6e7a104bffbd452101b332c132aefbf.tar.gz org.eclipse.osee-b0a75a78e6e7a104bffbd452101b332c132aefbf.tar.xz org.eclipse.osee-b0a75a78e6e7a104bffbd452101b332c132aefbf.zip |
feature[ats_TW8369]: Remove ATS ConfigItemFactory
Change-Id: I9a679f716c9982f4208e70d3288bd885d12a1b27
82 files changed, 520 insertions, 958 deletions
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/AtsApi.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/AtsApi.java index fdc4a3c14c4..2ab85f305ba 100644 --- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/AtsApi.java +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/AtsApi.java @@ -28,7 +28,6 @@ import org.eclipse.osee.ats.api.query.IAtsSearchDataProvider; import org.eclipse.osee.ats.api.review.IAtsReviewService; import org.eclipse.osee.ats.api.task.IAtsTaskService; import org.eclipse.osee.ats.api.team.ChangeType; -import org.eclipse.osee.ats.api.team.IAtsConfigItemFactory; import org.eclipse.osee.ats.api.team.IAtsTeamDefinitionService; import org.eclipse.osee.ats.api.user.IAtsUser; import org.eclipse.osee.ats.api.user.IAtsUserService; @@ -90,8 +89,6 @@ public interface AtsApi extends IAtsEarnedValueServiceProvider, IAtsWorkDefiniti Collection<IArtifactType> getArtifactTypes(); - IAtsConfigItemFactory getConfigItemFactory(); - IAtsStoreService getStoreService(); Collection<ITransitionListener> getTransitionListeners(); diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/agile/IAgileService.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/agile/IAgileService.java index 32d6cef2c0e..e4ae2ce879d 100644 --- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/agile/IAgileService.java +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/agile/IAgileService.java @@ -160,4 +160,8 @@ public interface IAgileService { ArtifactToken getAgileProgramBacklogArt(IAgileProgram program); + IAgileTeam getAgileTeamById(ArtifactId agileTeamId); + + IAgileFeatureGroup getAgileFeatureGroupById(ArtifactId agileFeatureGroupId); + } diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/ai/IAtsActionableItemService.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/ai/IAtsActionableItemService.java index bfa80600977..734c6d5ebc5 100644 --- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/ai/IAtsActionableItemService.java +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/ai/IAtsActionableItemService.java @@ -42,4 +42,9 @@ public interface IAtsActionableItemService { List<IAtsActionableItem> getActiveActionableItemsAndChildren(IAtsTeamDefinition teamDef); + /** + * @return this object casted, else if hard artifact constructed, else load and construct + */ + IAtsActionableItem getActionableItemById(ArtifactId aiId); + }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/ev/IAtsEarnedValueService.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/ev/IAtsEarnedValueService.java index 6d3298b677d..847bb667609 100644 --- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/ev/IAtsEarnedValueService.java +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/ev/IAtsEarnedValueService.java @@ -55,4 +55,9 @@ public interface IAtsEarnedValueService { void setWorkPackage(IAtsWorkPackage workPackage, IAtsWorkItem workItem, IAtsChangeSet changes); + /** + * @return this object casted, else if hard artifact constructed, else load and construct + */ + IAtsWorkPackage getWorkPackageById(ArtifactId workPackageId); + } diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/program/IAtsProgramService.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/program/IAtsProgramService.java index 1486b96ad96..11a6c101b56 100644 --- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/program/IAtsProgramService.java +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/program/IAtsProgramService.java @@ -116,4 +116,19 @@ public interface IAtsProgramService { List<ProgramVersions> getProgramVersions(IArtifactType artType, boolean activeOnly); + /** + * @return this object casted, else if hard artifact constructed, else load and construct + */ + IAtsInsertion getInsertionById(ArtifactId insertionId); + + /** + * @return this object casted, else if hard artifact constructed, else load and construct + */ + IAtsInsertionActivity getInsertionActivityById(ArtifactId insertionActivityId); + + /** + * @return this object casted, else if hard artifact constructed, else load and construct + */ + IAtsCountry getCountryById(ArtifactId countryId); + } diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/team/IAtsConfigItemFactory.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/team/IAtsConfigItemFactory.java deleted file mode 100644 index 2eaea7cf6e7..00000000000 --- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/team/IAtsConfigItemFactory.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ats.api.team; - -import java.util.List; -import org.eclipse.osee.ats.api.IAtsConfigObject; -import org.eclipse.osee.ats.api.agile.IAgileFeatureGroup; -import org.eclipse.osee.ats.api.agile.IAgileTeam; -import org.eclipse.osee.ats.api.ai.IAtsActionableItem; -import org.eclipse.osee.ats.api.country.IAtsCountry; -import org.eclipse.osee.ats.api.ev.IAtsWorkPackage; -import org.eclipse.osee.ats.api.insertion.IAtsInsertion; -import org.eclipse.osee.ats.api.insertion.IAtsInsertionActivity; -import org.eclipse.osee.ats.api.insertion.JaxInsertion; -import org.eclipse.osee.ats.api.insertion.JaxInsertionActivity; -import org.eclipse.osee.ats.api.program.IAtsProgram; -import org.eclipse.osee.ats.api.version.IAtsVersion; -import org.eclipse.osee.framework.core.data.ArtifactId; -import org.eclipse.osee.framework.core.data.IArtifactType; - -/** - * @author Donald G. Dunne - */ -public interface IAtsConfigItemFactory { - - IAtsTeamDefinition getTeamDef(ArtifactId artifact); - - IAtsActionableItem getActionableItem(ArtifactId artifact); - - IAtsConfigObject getConfigObject(ArtifactId artifact); - - IAtsVersion getVersion(ArtifactId artifact); - - IAtsProgram getProgram(ArtifactId artifact); - - IAgileTeam getAgileTeam(ArtifactId artifact); - - IAgileFeatureGroup getAgileFeatureGroup(ArtifactId artifact); - - IAtsInsertion getInsertion(ArtifactId artifact); - - IAtsInsertion createInsertion(ArtifactId programArtifact, JaxInsertion newInsertion); - - IAtsInsertion updateInsertion(JaxInsertion newInsertion); - - void deleteInsertion(ArtifactId artifact); - - IAtsInsertionActivity getInsertionActivity(ArtifactId artifact); - - IAtsInsertionActivity createInsertionActivity(ArtifactId insertion, JaxInsertionActivity newActivity); - - IAtsInsertionActivity updateInsertionActivity(JaxInsertionActivity newFeature); - - void deleteInsertionActivity(ArtifactId artifact); - - boolean isAtsConfigArtifact(ArtifactId artifact); - - List<IArtifactType> getAtsConfigArtifactTypes(); - - IAtsCountry getCountry(ArtifactId artifact); - - IAtsWorkPackage getWorkPackage(ArtifactId artifact); -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/team/IAtsConfigItemFactoryProvider.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/team/IAtsConfigItemFactoryProvider.java deleted file mode 100644 index 23712c6b5c2..00000000000 --- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/team/IAtsConfigItemFactoryProvider.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ats.api.team; - -/** - * @author Donald G Dunne - */ -public interface IAtsConfigItemFactoryProvider { - - IAtsConfigItemFactory getConfigItemFactory(); -} diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/team/IAtsTeamDefinitionService.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/team/IAtsTeamDefinitionService.java index b60526ea0b3..46637cf48df 100644 --- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/team/IAtsTeamDefinitionService.java +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/team/IAtsTeamDefinitionService.java @@ -15,6 +15,7 @@ import org.eclipse.osee.ats.api.IAtsWorkItem; import org.eclipse.osee.ats.api.agile.IAgileTeam; import org.eclipse.osee.ats.api.program.IAtsProgram; import org.eclipse.osee.ats.api.version.IAtsVersion; +import org.eclipse.osee.framework.core.data.ArtifactId; public interface IAtsTeamDefinitionService { @@ -30,4 +31,9 @@ public interface IAtsTeamDefinitionService { Collection<IAtsTeamDefinition> getTeamDefinitions(IAgileTeam agileTeam); + /** + * @return this object casted, else if hard artifact constructed, else load and construct + */ + IAtsTeamDefinition getTeamDefinitionById(ArtifactId teamDefId); + } diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/version/IAtsVersionService.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/version/IAtsVersionService.java index d04faded62f..4c3c961a4d5 100644 --- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/version/IAtsVersionService.java +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/version/IAtsVersionService.java @@ -58,4 +58,6 @@ public interface IAtsVersionService { Collection<IAtsVersion> getVersions(IAtsTeamDefinition teamDef); + IAtsVersion getVersion(ArtifactId versionId); + } diff --git a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/config/DemoDbUtil.java b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/config/DemoDbUtil.java index 5ad14981311..dd0bf1105c8 100644 --- a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/config/DemoDbUtil.java +++ b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/config/DemoDbUtil.java @@ -14,6 +14,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.Set; import java.util.logging.Level; +import org.eclipse.osee.ats.api.ai.IAtsActionableItem; import org.eclipse.osee.ats.client.demo.internal.Activator; import org.eclipse.osee.ats.client.demo.internal.AtsClientService; import org.eclipse.osee.framework.core.data.ArtifactToken; @@ -67,10 +68,10 @@ public class DemoDbUtil { branch); } - public static <T> Collection<T> getConfigObjects(ArtifactToken... configTokens) { - Set<T> aias = new HashSet<>(); - for (ArtifactToken configObj : configTokens) { - aias.add(AtsClientService.get().getConfigItem(configObj)); + public static Collection<IAtsActionableItem> getActionableItems(ArtifactToken... aiTokens) { + Set<IAtsActionableItem> aias = new HashSet<>(); + for (ArtifactToken aiToken : aiTokens) { + aias.add(AtsClientService.get().getActionableItemService().getActionableItemById(aiToken)); } return aias; } diff --git a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd20CreateCommittedAction.java b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd20CreateCommittedAction.java index 52fd3ab74a7..d993051c144 100644 --- a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd20CreateCommittedAction.java +++ b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd20CreateCommittedAction.java @@ -55,7 +55,7 @@ public class Pdd20CreateCommittedAction implements IPopulateDemoDatabase { public void run() { IAtsChangeSet changes = AtsClientService.get().createChangeSet(getClass().getSimpleName()); - Collection<IAtsActionableItem> aias = DemoDbUtil.getConfigObjects(DemoArtifactToken.SAW_Requirements_AI, + Collection<IAtsActionableItem> aias = DemoDbUtil.getActionableItems(DemoArtifactToken.SAW_Requirements_AI, DemoArtifactToken.SAW_Code_AI, DemoArtifactToken.SAW_Test_AI); Date createdDate = new Date(); IAtsUser createdBy = AtsClientService.get().getUserService().getCurrentUser(); diff --git a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd21CreateUnCommittedAction.java b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd21CreateUnCommittedAction.java index 321c7fa0305..ca7140e4c85 100644 --- a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd21CreateUnCommittedAction.java +++ b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd21CreateUnCommittedAction.java @@ -57,7 +57,7 @@ public class Pdd21CreateUnCommittedAction implements IPopulateDemoDatabase { public void run() { IAtsChangeSet changes = AtsClientService.get().createChangeSet(getClass().getSimpleName()); String title = DemoWorkflowTitles.SAW_UNCOMMITTED_REQT_CHANGES_FOR_DIAGRAM_VIEW; - Collection<IAtsActionableItem> aias = DemoDbUtil.getConfigObjects(DemoArtifactToken.SAW_Code_AI, + Collection<IAtsActionableItem> aias = DemoDbUtil.getActionableItems(DemoArtifactToken.SAW_Code_AI, DemoArtifactToken.SAW_SW_Design_AI, DemoArtifactToken.SAW_Requirements_AI, DemoArtifactToken.SAW_Test_AI); Date createdDate = new Date(); IAtsUser createdBy = AtsClientService.get().getUserService().getCurrentUser(); diff --git a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd22CreateUnCommittedConflictedAction.java b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd22CreateUnCommittedConflictedAction.java index 3848edc3653..cd4a687b632 100644 --- a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd22CreateUnCommittedConflictedAction.java +++ b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd22CreateUnCommittedConflictedAction.java @@ -50,7 +50,7 @@ public class Pdd22CreateUnCommittedConflictedAction implements IPopulateDemoData public void run() { IAtsChangeSet changes = AtsClientService.get().createChangeSet(getClass().getName()); - Collection<IAtsActionableItem> aias = DemoDbUtil.getConfigObjects(DemoArtifactToken.SAW_Requirements_AI); + Collection<IAtsActionableItem> aias = DemoDbUtil.getActionableItems(DemoArtifactToken.SAW_Requirements_AI); Date createdDate = new Date(); IAtsUser createdBy = AtsClientService.get().getUserService().getCurrentUser(); String priority = "3"; diff --git a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd23CreateNoBranchAction.java b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd23CreateNoBranchAction.java index bfbfa1ccbaf..700b02a04c7 100644 --- a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd23CreateNoBranchAction.java +++ b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd23CreateNoBranchAction.java @@ -24,6 +24,7 @@ import org.eclipse.osee.ats.api.workflow.ActionResult; import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow; import org.eclipse.osee.ats.api.workflow.INewActionListener; import org.eclipse.osee.ats.api.workflow.transition.TransitionOption; +import org.eclipse.osee.ats.client.demo.config.DemoDbUtil; import org.eclipse.osee.ats.client.demo.internal.AtsClientService; import org.eclipse.osee.ats.core.workflow.state.TeamState; import org.eclipse.osee.ats.core.workflow.transition.TeamWorkFlowManager; @@ -42,7 +43,7 @@ public class Pdd23CreateNoBranchAction implements IPopulateDemoDatabase { public void run() { IAtsChangeSet changes = AtsClientService.get().createChangeSet(getClass().getSimpleName()); String title = DemoWorkflowTitles.SAW_NO_BRANCH_REQT_CHANGES_FOR_DIAGRAM_VIEW; - Collection<IAtsActionableItem> aias = AtsClientService.get().getConfigItems(DemoArtifactToken.SAW_Code_AI, + Collection<IAtsActionableItem> aias = DemoDbUtil.getActionableItems(DemoArtifactToken.SAW_Code_AI, DemoArtifactToken.SAW_SW_Design_AI, DemoArtifactToken.SAW_Requirements_AI, DemoArtifactToken.SAW_Test_AI); Date createdDate = new Date(); IAtsUser createdBy = AtsClientService.get().getUserService().getCurrentUser(); diff --git a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd51CreateWorkaroundForGraphViewActions.java b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd51CreateWorkaroundForGraphViewActions.java index c6dc255a640..7488d4c4566 100644 --- a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd51CreateWorkaroundForGraphViewActions.java +++ b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd51CreateWorkaroundForGraphViewActions.java @@ -51,7 +51,7 @@ public class Pdd51CreateWorkaroundForGraphViewActions implements IPopulateDemoDa public void run() { IAtsChangeSet changes = AtsClientService.get().createChangeSet(getClass().getName()); - Collection<IAtsActionableItem> aias = DemoDbUtil.getConfigObjects(DemoArtifactToken.Adapter_AI); + Collection<IAtsActionableItem> aias = DemoDbUtil.getActionableItems(DemoArtifactToken.Adapter_AI); Date createdDate = new Date(); for (ArtifactToken version : getVersionToWorkflowToken().keySet()) { diff --git a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd52CreateWorkingWithDiagramTreeActions.java b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd52CreateWorkingWithDiagramTreeActions.java index 8f414cf389c..d5e07a5c319 100644 --- a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd52CreateWorkingWithDiagramTreeActions.java +++ b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd52CreateWorkingWithDiagramTreeActions.java @@ -51,7 +51,7 @@ public class Pdd52CreateWorkingWithDiagramTreeActions implements IPopulateDemoDa public void run() { IAtsChangeSet changes = AtsClientService.get().createChangeSet(getClass().getName()); - Collection<IAtsActionableItem> aias = DemoDbUtil.getConfigObjects(DemoArtifactToken.SAW_SW_Design_AI); + Collection<IAtsActionableItem> aias = DemoDbUtil.getActionableItems(DemoArtifactToken.SAW_SW_Design_AI); Date createdDate = new Date(); for (ArtifactToken version : getVersionToWorkflowToken().keySet()) { diff --git a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd80CreateButtonSDoesntWorkAction.java b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd80CreateButtonSDoesntWorkAction.java index 902b536f7f6..6662fbe4f5c 100644 --- a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd80CreateButtonSDoesntWorkAction.java +++ b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd80CreateButtonSDoesntWorkAction.java @@ -33,7 +33,7 @@ public class Pdd80CreateButtonSDoesntWorkAction implements IPopulateDemoDatabase public void run() { IAtsChangeSet changes = AtsClientService.get().createChangeSet(getClass().getSimpleName()); - Collection<IAtsActionableItem> aias = DemoDbUtil.getConfigObjects(DemoArtifactToken.Reader_AI); + Collection<IAtsActionableItem> aias = DemoDbUtil.getActionableItems(DemoArtifactToken.Reader_AI); ActionResult actionResult = AtsClientService.get().getActionFactory().createAction(null, DemoArtifactToken.ButtonSDoesntWorkOnHelp_TeamWf.getName(), "Problem with the help", ChangeType.Problem, "3", diff --git a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd81CreateButtonWDoesntWorkAction.java b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd81CreateButtonWDoesntWorkAction.java index cab07423228..cb3ae87d442 100644 --- a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd81CreateButtonWDoesntWorkAction.java +++ b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd81CreateButtonWDoesntWorkAction.java @@ -33,7 +33,7 @@ public class Pdd81CreateButtonWDoesntWorkAction implements IPopulateDemoDatabase public void run() { IAtsChangeSet changes = AtsClientService.get().createChangeSet(getClass().getSimpleName()); - Collection<IAtsActionableItem> aias = DemoDbUtil.getConfigObjects(DemoArtifactToken.CIS_Test_AI); + Collection<IAtsActionableItem> aias = DemoDbUtil.getActionableItems(DemoArtifactToken.CIS_Test_AI); ActionResult actionResult = AtsClientService.get().getActionFactory().createAction(null, DemoArtifactToken.ButtonWDoesntWorkOnSituationPage_TeamWf.getName(), "Problem with the Situation Page", diff --git a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd82CreateCantLoadDiagramTreeAction.java b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd82CreateCantLoadDiagramTreeAction.java index 2a304901df4..f900e6022e0 100644 --- a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd82CreateCantLoadDiagramTreeAction.java +++ b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd82CreateCantLoadDiagramTreeAction.java @@ -31,7 +31,7 @@ public class Pdd82CreateCantLoadDiagramTreeAction implements IPopulateDemoDataba public void run() { IAtsChangeSet changes = AtsClientService.get().createChangeSet(getClass().getSimpleName()); - Collection<IAtsActionableItem> aias = DemoDbUtil.getConfigObjects(DemoArtifactToken.CIS_Test_AI); + Collection<IAtsActionableItem> aias = DemoDbUtil.getActionableItems(DemoArtifactToken.CIS_Test_AI); AtsClientService.get().getActionFactory().createAction(null, DemoArtifactToken.CantLoadDiagramTree_TeamWf.getName(), "Problem with the Diagram Tree", ChangeType.Problem, diff --git a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd83CreateCantSeeTheGraphViewAction.java b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd83CreateCantSeeTheGraphViewAction.java index 1493f0d9577..4ddbf613bd4 100644 --- a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd83CreateCantSeeTheGraphViewAction.java +++ b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd83CreateCantSeeTheGraphViewAction.java @@ -33,7 +33,7 @@ public class Pdd83CreateCantSeeTheGraphViewAction implements IPopulateDemoDataba public void run() { IAtsChangeSet changes = AtsClientService.get().createChangeSet(getClass().getSimpleName()); - Collection<IAtsActionableItem> aias = DemoDbUtil.getConfigObjects(DemoArtifactToken.Adapter_AI); + Collection<IAtsActionableItem> aias = DemoDbUtil.getActionableItems(DemoArtifactToken.Adapter_AI); ActionResult actionResult = AtsClientService.get().getActionFactory().createAction(null, DemoArtifactToken.CantSeeTheGraphView_TeamWf.getName(), "Problem with the Graph View", ChangeType.Problem, "1", diff --git a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd84CreateProblemInDiagramTreeAction.java b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd84CreateProblemInDiagramTreeAction.java index b5778056d50..e6c7b5919fc 100644 --- a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd84CreateProblemInDiagramTreeAction.java +++ b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd84CreateProblemInDiagramTreeAction.java @@ -31,7 +31,7 @@ public class Pdd84CreateProblemInDiagramTreeAction implements IPopulateDemoDatab public void run() { IAtsChangeSet changes = AtsClientService.get().createChangeSet(getClass().getSimpleName()); - Collection<IAtsActionableItem> aias = DemoDbUtil.getConfigObjects(DemoArtifactToken.CIS_Test_AI); + Collection<IAtsActionableItem> aias = DemoDbUtil.getActionableItems(DemoArtifactToken.CIS_Test_AI); AtsClientService.get().getActionFactory().createAction(null, DemoArtifactToken.ProblemInDiagramTree_TeamWf.getName(), "Problem with the Diagram Tree", ChangeType.Problem, diff --git a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd85CreateProblemWithTheGraphViewAction.java b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd85CreateProblemWithTheGraphViewAction.java index c2077010894..d4f6b5affd7 100644 --- a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd85CreateProblemWithTheGraphViewAction.java +++ b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd85CreateProblemWithTheGraphViewAction.java @@ -33,7 +33,7 @@ public class Pdd85CreateProblemWithTheGraphViewAction implements IPopulateDemoDa public void run() { IAtsChangeSet changes = AtsClientService.get().createChangeSet(getClass().getSimpleName()); - Collection<IAtsActionableItem> aias = DemoDbUtil.getConfigObjects(DemoArtifactToken.Adapter_AI); + Collection<IAtsActionableItem> aias = DemoDbUtil.getActionableItems(DemoArtifactToken.Adapter_AI); ActionResult actionResult = AtsClientService.get().getActionFactory().createAction(null, DemoArtifactToken.ProblemWithTheGraphView_TeamWf.getName(), "Problem with the Graph View", ChangeType.Problem, diff --git a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd86CreateProblemWithTheUserWindowAction.java b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd86CreateProblemWithTheUserWindowAction.java index bc1223d402b..365658f0f89 100644 --- a/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd86CreateProblemWithTheUserWindowAction.java +++ b/plugins/org.eclipse.osee.ats.client.demo/src/org/eclipse/osee/ats/client/demo/populate/Pdd86CreateProblemWithTheUserWindowAction.java @@ -33,7 +33,7 @@ public class Pdd86CreateProblemWithTheUserWindowAction implements IPopulateDemoD public void run() { IAtsChangeSet changes = AtsClientService.get().createChangeSet(getClass().getSimpleName()); - Collection<IAtsActionableItem> aias = DemoDbUtil.getConfigObjects(DemoArtifactToken.Timesheet_AI); + Collection<IAtsActionableItem> aias = DemoDbUtil.getActionableItems(DemoArtifactToken.Timesheet_AI); ActionResult actionResult = AtsClientService.get().getActionFactory().createAction(null, DemoArtifactToken.ProblemWithTheUserWindow_TeamWf.getName(), "Problem with the user window", diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/resource/AtsActionEndpointImplTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/resource/AtsActionEndpointImplTest.java index dca30bc4360..6468e680754 100644 --- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/resource/AtsActionEndpointImplTest.java +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/resource/AtsActionEndpointImplTest.java @@ -448,7 +448,7 @@ public class AtsActionEndpointImplTest extends AbstractRestTest { AtsActionEndpointApi actionEp = AtsClientService.getActionEndpoint(); // Set to Build 1 by id - IAtsVersion sawBld1Ver = AtsClientService.get().getConfigItem(DemoArtifactToken.SAW_Bld_1); + IAtsVersion sawBld1Ver = AtsClientService.get().getVersionService().getVersion(DemoArtifactToken.SAW_Bld_1); actionEp.setActionAttributeByType(teamWf.getIdString(), AttributeKey.Version.name(), Collections.singletonList(sawBld1Ver.getIdString())); @@ -513,7 +513,8 @@ public class AtsActionEndpointImplTest extends AbstractRestTest { Date needBy = new Date(); data.setNeedByDateLong(String.valueOf(needBy.getTime())); data.setPriority("3"); - IAtsActionableItem ai = AtsClientService.get().getConfigItem(DemoArtifactToken.SAW_Code_AI); + IAtsActionableItem ai = + AtsClientService.get().getActionableItemService().getActionableItemById(DemoArtifactToken.SAW_Code_AI); data.setAiIds(Arrays.asList(ai.getIdString())); data.addAttrValue(AtsAttributeTypes.ColorTeam, "Blue Team"); data.addAttrValue(AtsAttributeTypes.IPT, "My IPT"); @@ -604,7 +605,8 @@ public class AtsActionEndpointImplTest extends AbstractRestTest { @Test public void testCreateEmptyAction() throws Exception { - IAtsActionableItem ai = AtsClientService.get().getConfigItem(DemoArtifactToken.SAW_Code_AI); + IAtsActionableItem ai = + AtsClientService.get().getActionableItemService().getActionableItemById(DemoArtifactToken.SAW_Code_AI); String aiStr = ai.getIdString(); String newAction = AtsClientService.getActionEndpoint().createEmptyAction( diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/workflow/AtsTestUtil.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/workflow/AtsTestUtil.java index 77aafc19496..1c360ba05da 100644 --- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/workflow/AtsTestUtil.java +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/workflow/AtsTestUtil.java @@ -277,7 +277,8 @@ public class AtsTestUtil { IAtsChangeSet changes = AtsClientService.get().createChangeSet(AtsTestUtil.class.getSimpleName()); - IAtsActionableItem topAi = AtsClientService.get().getConfigItem(AtsArtifactToken.TopActionableItem); + IAtsActionableItem topAi = + AtsClientService.get().getActionableItemService().getActionableItemById(AtsArtifactToken.TopActionableItem); testAi = AtsClientService.get().createActionableItem(getTitle("AI", postFixName), AtsUtilClient.createConfigObjectId(), changes, AtsClientService.get()); @@ -316,7 +317,8 @@ public class AtsTestUtil { changes.relate(teamDef, AtsRelationTypes.TeamActionableItem_ActionableItem, testAi2); changes.relate(teamDef, AtsRelationTypes.TeamActionableItem_ActionableItem, testAi3); changes.relate(teamDef, AtsRelationTypes.TeamActionableItem_ActionableItem, testAi4); - IAtsTeamDefinition topTeamDef = AtsClientService.get().getConfigItem(AtsArtifactToken.TopTeamDefinition); + IAtsTeamDefinition topTeamDef = + AtsClientService.get().getTeamDefinitionService().getTeamDefinitionById(AtsArtifactToken.TopTeamDefinition); changes.addChild(topTeamDef, teamDef); verArt1 = AtsClientService.get().getVersionService().createVersion(getTitle("ver 1.0", postFixName), diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/config/WorkPackageUtilityTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/config/WorkPackageUtilityTest.java index ee3f185287c..ac702fb8a3b 100644 --- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/config/WorkPackageUtilityTest.java +++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/config/WorkPackageUtilityTest.java @@ -18,11 +18,12 @@ import org.eclipse.osee.ats.api.AtsApi; import org.eclipse.osee.ats.api.country.IAtsCountry; import org.eclipse.osee.ats.api.data.AtsAttributeTypes; import org.eclipse.osee.ats.api.data.AtsRelationTypes; +import org.eclipse.osee.ats.api.ev.IAtsEarnedValueService; import org.eclipse.osee.ats.api.insertion.IAtsInsertion; import org.eclipse.osee.ats.api.insertion.IAtsInsertionActivity; import org.eclipse.osee.ats.api.program.IAtsProgram; +import org.eclipse.osee.ats.api.program.IAtsProgramService; import org.eclipse.osee.ats.api.query.IAtsQueryService; -import org.eclipse.osee.ats.api.team.IAtsConfigItemFactory; import org.eclipse.osee.ats.api.workdef.IAttributeResolver; import org.eclipse.osee.ats.api.workdef.IRelationResolver; import org.eclipse.osee.ats.api.workflow.IAtsGoal; @@ -59,7 +60,8 @@ public class WorkPackageUtilityTest { @Mock private IAtsProgram program; @Mock private IAtsCountry country; - @Mock private IAtsConfigItemFactory factory; + @Mock private IAtsEarnedValueService evService; + @Mock private IAtsProgramService programService; @Mock private IAtsQueryService queryService; // @formatter:on @@ -76,8 +78,9 @@ public class WorkPackageUtilityTest { when(atsApi.getAttributeResolver()).thenReturn(attributeResolver); when(atsApi.getRelationResolver()).thenReturn(relationResolver); - when(atsApi.getConfigItemFactory()).thenReturn(factory); + when(atsApi.getEarnedValueService()).thenReturn(evService); when(atsApi.getQueryService()).thenReturn(queryService); + when(atsApi.getProgramService()).thenReturn(programService); util = new WorkPackageUtility(); } @@ -120,7 +123,7 @@ public class WorkPackageUtilityTest { when(relationResolver.getRelatedOrNull(workPackageArt, AtsRelationTypes.InsertionActivityToWorkPackage_InsertionActivity)).thenReturn(activityArt); - when(factory.getInsertionActivity(activityArt)).thenReturn(activity); + when(programService.getInsertionActivityById(activityArt)).thenReturn(activity); result = util.getInsertionActivity(atsApi, teamWf); assertResult(result, activity, false); @@ -136,12 +139,12 @@ public class WorkPackageUtilityTest { ArtifactId.SENTINEL)).thenReturn(workPackageArt); when(relationResolver.getRelatedOrNull(workPackageArt, AtsRelationTypes.InsertionActivityToWorkPackage_InsertionActivity)).thenReturn(activityArt); - when(factory.getInsertionActivity(activityArt)).thenReturn(null); + when(programService.getInsertionActivityById(activityArt)).thenReturn(null); Pair<IAtsInsertion, Boolean> result = util.getInsertion(atsApi, teamWf); assertResult(result, null, false); - when(factory.getInsertionActivity(activityArt)).thenReturn(activity); + when(programService.getInsertionActivityById(activityArt)).thenReturn(activity); when(relationResolver.getRelatedOrNull(activity, AtsRelationTypes.InsertionToInsertionActivity_Insertion, IAtsInsertion.class)).thenReturn(insertion); result = util.getInsertion(atsApi, teamWf); @@ -159,7 +162,7 @@ public class WorkPackageUtilityTest { ArtifactId.SENTINEL)).thenReturn(workPackageArt); when(relationResolver.getRelatedOrNull(workPackageArt, AtsRelationTypes.InsertionActivityToWorkPackage_InsertionActivity)).thenReturn(activityArt); - when(factory.getInsertionActivity(activityArt)).thenReturn(activity); + when(programService.getInsertionActivityById(activityArt)).thenReturn(activity); when(relationResolver.getRelatedOrNull(activity, AtsRelationTypes.InsertionToInsertionActivity_Insertion, IAtsInsertion.class)).thenReturn(insertion); @@ -184,8 +187,8 @@ public class WorkPackageUtilityTest { when(relationResolver.getRelatedOrNull(workPackageArt, AtsRelationTypes.InsertionActivityToWorkPackage_InsertionActivity)).thenReturn(activityArt); when(atsApi.getQueryService().getArtifact(37L)).thenReturn(workPackageArt); - when(factory.getInsertionActivity(activityArt)).thenReturn(null); - when(factory.getInsertionActivity(activityArt)).thenReturn(activity); + when(programService.getInsertionActivityById(activityArt)).thenReturn(null); + when(programService.getInsertionActivityById(activityArt)).thenReturn(activity); when(relationResolver.getRelatedOrNull(activity, AtsRelationTypes.InsertionToInsertionActivity_Insertion, IAtsInsertion.class)).thenReturn(insertion); when(relationResolver.getRelatedOrNull(insertion, AtsRelationTypes.ProgramToInsertion_Program, diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/agile/AgileService.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/agile/AgileService.java index 0e962754076..7e8e2341fae 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/agile/AgileService.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/agile/AgileService.java @@ -82,6 +82,34 @@ public class AgileService implements IAgileService { this.atsApi = atsApi; } + @Override + public IAgileTeam getAgileTeamById(ArtifactId agileTeamId) { + AgileTeam program = null; + if (agileTeamId instanceof AgileTeam) { + program = (AgileTeam) agileTeamId; + } else { + ArtifactToken art = atsApi.getQueryService().getArtifact(agileTeamId); + if (atsApi.getStoreService().isOfType(art, AtsArtifactTypes.AgileTeam)) { + program = new AgileTeam(atsApi.getLogger(), atsApi, art); + } + } + return program; + } + + @Override + public IAgileFeatureGroup getAgileFeatureGroupById(ArtifactId agileFeatureGroupId) { + AgileFeatureGroup agileFeatureGroup = null; + if (agileFeatureGroupId instanceof AgileFeatureGroup) { + agileFeatureGroup = (AgileFeatureGroup) agileFeatureGroupId; + } else { + ArtifactToken art = atsApi.getQueryService().getArtifact(agileFeatureGroupId); + if (atsApi.getStoreService().isOfType(art, AtsArtifactTypes.AgileFeatureGroup)) { + agileFeatureGroup = new AgileFeatureGroup(atsApi.getLogger(), atsApi, art); + } + } + return agileFeatureGroup; + } + /******************************** ** Agile Program ***********************************/ @@ -275,7 +303,7 @@ public class AgileService implements IAgileService { IAgileTeam aTeam = null; ArtifactId aTeamArt = atsApi.getQueryService().getArtifactByName(AtsArtifactTypes.AgileTeam, agileTeamName); if (aTeamArt != null) { - aTeam = atsApi.getConfigItemFactory().getAgileTeam(aTeamArt); + aTeam = atsApi.getAgileService().getAgileTeam(aTeamArt); } return aTeam; } @@ -342,7 +370,7 @@ public class AgileService implements IAgileService { ArtifactId artifact = team.getStoreObject(); for (ArtifactId groupArt : atsApi.getRelationResolver().getRelated(artifact, AtsRelationTypes.AgileTeamToFeatureGroup_FeatureGroup)) { - groups.add(atsApi.getConfigItemFactory().getAgileFeatureGroup(groupArt)); + groups.add(atsApi.getAgileService().getAgileFeatureGroup(groupArt)); } return groups; } @@ -452,7 +480,7 @@ public class AgileService implements IAgileService { public Collection<IAgileFeatureGroup> getAgileFeatureGroups(List<Long> ids) { List<IAgileFeatureGroup> features = new LinkedList<>(); for (ArtifactId featureArt : atsApi.getQueryService().getArtifacts(ids)) { - features.add(atsApi.getConfigItemFactory().getAgileFeatureGroup(featureArt)); + features.add(atsApi.getAgileService().getAgileFeatureGroup(featureArt)); } return features; } @@ -522,7 +550,7 @@ public class AgileService implements IAgileService { ArtifactId teamArt = atsApi.getRelationResolver().getRelatedOrNull(backlogArt, AtsRelationTypes.AgileTeamToBacklog_AgileTeam); if (teamArt != null) { - return atsApi.getConfigItemFactory().getAgileTeam(teamArt); + return atsApi.getAgileService().getAgileTeam(teamArt); } } ArtifactId sprintArt = @@ -531,7 +559,7 @@ public class AgileService implements IAgileService { ArtifactId teamArt = atsApi.getRelationResolver().getRelatedOrNull(sprintArt, AtsRelationTypes.AgileTeamToSprint_AgileTeam); if (teamArt != null) { - return atsApi.getConfigItemFactory().getAgileTeam(teamArt); + return atsApi.getAgileService().getAgileTeam(teamArt); } } return null; diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/ai/ActionableItemService.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/ai/ActionableItemServiceImpl.java index da644eb35dd..9a4964de32a 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/ai/ActionableItemService.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/ai/ActionableItemServiceImpl.java @@ -20,34 +20,51 @@ import org.eclipse.osee.ats.api.AtsApi; import org.eclipse.osee.ats.api.IAtsObject; import org.eclipse.osee.ats.api.ai.IAtsActionableItem; import org.eclipse.osee.ats.api.ai.IAtsActionableItemService; +import org.eclipse.osee.ats.api.data.AtsArtifactTypes; import org.eclipse.osee.ats.api.data.AtsAttributeTypes; import org.eclipse.osee.ats.api.data.AtsRelationTypes; import org.eclipse.osee.ats.api.team.IAtsTeamDefinition; import org.eclipse.osee.ats.api.util.IAtsChangeSet; import org.eclipse.osee.ats.api.util.IAtsStoreService; import org.eclipse.osee.ats.api.workdef.IAttributeResolver; +import org.eclipse.osee.ats.core.config.ActionableItem; import org.eclipse.osee.ats.core.config.ActionableItems; import org.eclipse.osee.ats.core.util.AtsObjects; import org.eclipse.osee.framework.core.data.ArtifactId; +import org.eclipse.osee.framework.core.data.ArtifactToken; import org.eclipse.osee.framework.core.util.Result; import org.eclipse.osee.framework.logging.OseeLog; /** * @author Donald G. Dunne */ -public class ActionableItemService implements IAtsActionableItemService { +public class ActionableItemServiceImpl implements IAtsActionableItemService { private final IAttributeResolver attrResolver; private final IAtsStoreService atsStoreService; private final AtsApi atsApi; - public ActionableItemService(IAttributeResolver attrResolver, IAtsStoreService atsStoreService, AtsApi atsApi) { + public ActionableItemServiceImpl(IAttributeResolver attrResolver, IAtsStoreService atsStoreService, AtsApi atsApi) { this.attrResolver = attrResolver; this.atsStoreService = atsStoreService; this.atsApi = atsApi; } @Override + public IAtsActionableItem getActionableItemById(ArtifactId aiId) { + IAtsActionableItem ai = null; + if (aiId instanceof IAtsActionableItem) { + ai = (IAtsActionableItem) aiId; + } else { + ArtifactToken art = atsApi.getQueryService().getArtifact(aiId); + if (atsApi.getStoreService().isOfType(art, AtsArtifactTypes.ActionableItem)) { + ai = new ActionableItem(atsApi.getLogger(), atsApi, art); + } + } + return ai; + } + + @Override public List<IAtsActionableItem> getActiveActionableItemsAndChildren(IAtsTeamDefinition teamDef) { List<IAtsActionableItem> ais = new LinkedList<>(); getActiveActionableItemsAndChildrenRecurse(teamDef, ais); @@ -74,7 +91,7 @@ public class ActionableItemService implements IAtsActionableItemService { for (ArtifactId id : getActionableItemIds(atsObject)) { IAtsActionableItem aia = atsApi.getQueryService().getConfigItem(id); if (aia == null) { - OseeLog.logf(ActionableItemService.class, Level.SEVERE, + OseeLog.logf(ActionableItemServiceImpl.class, Level.SEVERE, "Actionable Item id [%s] from [%s] doesn't match item in AtsConfigCache", id, atsObject.toStringWithId()); } else { diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/AbstractConfigItemFactory.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/AbstractConfigItemFactory.java deleted file mode 100644 index c89603d6927..00000000000 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/AbstractConfigItemFactory.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ats.core.config; - -import java.util.Arrays; -import java.util.List; -import org.eclipse.osee.ats.api.data.AtsArtifactTypes; -import org.eclipse.osee.ats.api.team.IAtsConfigItemFactory; -import org.eclipse.osee.framework.core.data.ArtifactId; -import org.eclipse.osee.framework.core.data.IArtifactType; - -/** - * @author Donald G. Dunne - */ -public abstract class AbstractConfigItemFactory implements IAtsConfigItemFactory { - - public final List<IArtifactType> atsConfigArtifactTypes; - - public AbstractConfigItemFactory() { - atsConfigArtifactTypes = Arrays.asList(AtsArtifactTypes.Version, AtsArtifactTypes.TeamDefinition, - AtsArtifactTypes.ActionableItem, AtsArtifactTypes.Country, AtsArtifactTypes.Program, - AtsArtifactTypes.Insertion, AtsArtifactTypes.InsertionActivity, AtsArtifactTypes.AgileTeam, - AtsArtifactTypes.AgileFeatureGroup, AtsArtifactTypes.WorkPackage); - } - - @Override - public List<IArtifactType> getAtsConfigArtifactTypes() { - return atsConfigArtifactTypes; - } - - @Override - public abstract boolean isAtsConfigArtifact(ArtifactId artifact); - -} diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/ActionableItem.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/ActionableItem.java index c87e65428a5..8487bcee285 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/ActionableItem.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/ActionableItem.java @@ -85,12 +85,13 @@ public class ActionableItem extends AtsConfigObject implements IAtsActionableIte IAtsActionableItem parent = null; try { if (jaxAI != null && jaxAI.getParentId() != null) { - parent = atsApi.getConfigItemFactory().getActionableItem(atsApi.getQueryService().getArtifact(jaxAI.getParentId())); + parent = atsApi.getActionableItemService().getActionableItemById( + atsApi.getQueryService().getArtifact(jaxAI.getParentId())); } else { ArtifactToken art = atsApi.getRelationResolver().getRelatedOrNull(artifact, CoreRelationTypes.Default_Hierarchical__Parent); if (art != null) { - parent = atsApi.getConfigItemFactory().getActionableItem(art); + parent = atsApi.getActionableItemService().getActionableItemById(art); } } } catch (OseeCoreException ex) { @@ -104,12 +105,13 @@ public class ActionableItem extends AtsConfigObject implements IAtsActionableIte IAtsTeamDefinition teamDef = null; try { if (jaxAI != null && jaxAI.getTeamDefId() != null) { - teamDef = atsApi.getConfigItemFactory().getTeamDef(atsApi.getQueryService().getArtifact(jaxAI.getTeamDefId())); + teamDef = atsApi.getTeamDefinitionService().getTeamDefinitionById( + atsApi.getQueryService().getArtifact(jaxAI.getTeamDefId())); } else { ArtifactToken art = atsApi.getRelationResolver().getRelatedOrNull(artifact, AtsRelationTypes.TeamActionableItem_Team); if (art != null) { - teamDef = atsApi.getConfigItemFactory().getTeamDef(art); + teamDef = atsApi.getTeamDefinitionService().getTeamDefinitionById(art); } } } catch (OseeCoreException ex) { diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/AtsCache.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/AtsCache.java index b4acebf80cb..a5a0da28b5a 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/AtsCache.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/AtsCache.java @@ -17,7 +17,9 @@ import java.util.concurrent.TimeUnit; import org.eclipse.osee.ats.api.AtsApi; import org.eclipse.osee.ats.api.IAtsObject; import org.eclipse.osee.ats.api.config.IAtsCache; +import org.eclipse.osee.ats.core.util.AtsObjects; import org.eclipse.osee.framework.core.data.ArtifactId; +import org.eclipse.osee.framework.core.data.ArtifactToken; import org.eclipse.osee.framework.jdk.core.util.Conditions; /** @@ -63,7 +65,8 @@ public class AtsCache implements IAtsCache { private final CacheLoader<Long, IAtsObject> idToAtsObjectCacheLoader = new CacheLoader<Long, IAtsObject>() { @Override public IAtsObject load(Long id) { - return atsApi.getConfigItemFactory().getConfigObject(atsApi.getQueryService().getArtifact(id)); + ArtifactToken artifact = atsApi.getQueryService().getArtifact(id); + return AtsObjects.getConfigObject(artifact, atsApi); } }; diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/TeamDefinition.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/TeamDefinition.java index 24990c7f5a7..bc764b3ce39 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/TeamDefinition.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/TeamDefinition.java @@ -82,7 +82,7 @@ public class TeamDefinition extends AtsConfigObject implements IAtsTeamDefinitio if (parentArt != null && !parentArt.equals(AtsArtifactToken.HeadingFolder)) { parent = atsApi.getCache().getAtsObject(parentArt.getId()); if (parent == null) { - parent = atsApi.getConfigItemFactory().getTeamDef(parentArt); + parent = atsApi.getTeamDefinitionService().getTeamDefinitionById(parentArt); } } } catch (OseeCoreException ex) { @@ -97,7 +97,7 @@ public class TeamDefinition extends AtsConfigObject implements IAtsTeamDefinitio try { for (ArtifactId childArt : atsApi.getRelationResolver().getRelated(artifact, CoreRelationTypes.Default_Hierarchical__Child)) { - IAtsTeamDefinition childTeamDef = atsApi.getConfigItemFactory().getTeamDef(childArt); + IAtsTeamDefinition childTeamDef = atsApi.getTeamDefinitionService().getTeamDefinitionById(childArt); if (childTeamDef != null) { children.add(childTeamDef); } @@ -269,7 +269,7 @@ public class TeamDefinition extends AtsConfigObject implements IAtsTeamDefinitio try { for (ArtifactId verArt : atsApi.getRelationResolver().getRelated(artifact, AtsRelationTypes.TeamDefinitionToVersion_Version)) { - IAtsVersion version = atsApi.getConfigItemFactory().getVersion(verArt); + IAtsVersion version = atsApi.getVersionService().getVersion(verArt); results.add(version); } } catch (OseeCoreException ex) { diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/TeamDefinitionService.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/TeamDefinitionServiceImpl.java index ce168b7e2b8..46927f29c19 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/TeamDefinitionService.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/TeamDefinitionServiceImpl.java @@ -25,19 +25,34 @@ import org.eclipse.osee.ats.api.team.IAtsTeamDefinition; import org.eclipse.osee.ats.api.team.IAtsTeamDefinitionService; import org.eclipse.osee.ats.api.version.IAtsVersion; import org.eclipse.osee.framework.core.data.ArtifactId; +import org.eclipse.osee.framework.core.data.ArtifactToken; /** * @author Donald G. Dunne */ -public class TeamDefinitionService implements IAtsTeamDefinitionService { +public class TeamDefinitionServiceImpl implements IAtsTeamDefinitionService { private final AtsApi atsApi; - public TeamDefinitionService(AtsApi atsApi) { + public TeamDefinitionServiceImpl(AtsApi atsApi) { this.atsApi = atsApi; } @Override + public IAtsTeamDefinition getTeamDefinitionById(ArtifactId teamDefId) { + IAtsTeamDefinition teamDef = null; + if (teamDefId instanceof IAtsTeamDefinition) { + teamDef = (IAtsTeamDefinition) teamDefId; + } else { + ArtifactToken art = atsApi.getQueryService().getArtifact(teamDefId); + if (atsApi.getStoreService().isOfType(art, AtsArtifactTypes.TeamDefinition)) { + teamDef = new TeamDefinition(atsApi.getLogger(), atsApi, art); + } + } + return teamDef; + } + + @Override public IAtsTeamDefinition getTeamDefinition(IAtsWorkItem workItem) { IAtsTeamDefinition teamDef = null; ArtifactId teamDefId = atsApi.getAttributeResolver().getSoleArtifactIdReference(workItem, @@ -53,7 +68,7 @@ public class TeamDefinitionService implements IAtsTeamDefinitionService { List<IAtsVersion> versions = new ArrayList<>(); for (ArtifactId verArt : atsApi.getRelationResolver().getRelated(teamDef, AtsRelationTypes.TeamDefinitionToVersion_Version)) { - versions.add(atsApi.getConfigItemFactory().getVersion(verArt)); + versions.add(atsApi.getVersionService().getVersion(verArt)); } return versions; } @@ -73,7 +88,7 @@ public class TeamDefinitionService implements IAtsTeamDefinitionService { IAtsTeamDefinition teamDef = null; ArtifactId teamDefArt = atsApi.getQueryService().getArtifactByName(AtsArtifactTypes.TeamDefinition, name); if (teamDefArt != null) { - teamDef = atsApi.getConfigItemFactory().getTeamDef(teamDefArt); + teamDef = atsApi.getTeamDefinitionService().getTeamDefinitionById(teamDefArt); } return teamDef; } @@ -83,7 +98,7 @@ public class TeamDefinitionService implements IAtsTeamDefinitionService { List<IAtsTeamDefinition> teamDefs = new LinkedList<>(); for (ArtifactId atsTeamArt : atsApi.getRelationResolver().getRelated(agileTeam, AtsRelationTypes.AgileTeamToAtsTeam_AtsTeam)) { - teamDefs.add(atsApi.getConfigItemFactory().getTeamDef(atsTeamArt)); + teamDefs.add(atsApi.getTeamDefinitionService().getTeamDefinitionById(atsTeamArt)); } return teamDefs; } diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/Versions.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/Versions.java index a5ef275c294..7988c7daf4d 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/Versions.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/Versions.java @@ -56,7 +56,7 @@ public class Versions { List<IAtsVersion> parallelVersions = new ArrayList<>(); for (ArtifactId parallelVersion : atsApi.getRelationResolver().getRelated(atsApi.getQueryService().getArtifact(version), AtsRelationTypes.ParallelVersion_Child)) { - IAtsVersion parallelVer = atsApi.getConfigItemFactory().getVersion(parallelVersion); + IAtsVersion parallelVer = atsApi.getVersionService().getVersion(parallelVersion); parallelVersions.add(parallelVer); } return parallelVersions; diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/WorkPackageUtility.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/WorkPackageUtility.java index 113692841e3..0b008768098 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/WorkPackageUtility.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/WorkPackageUtility.java @@ -82,7 +82,7 @@ public class WorkPackageUtility { ArtifactId activityArt = atsApi.getRelationResolver().getRelatedOrNull(workPackageResult.getFirst(), AtsRelationTypes.InsertionActivityToWorkPackage_InsertionActivity); if (activityArt != null) { - IAtsInsertionActivity activity = atsApi.getConfigItemFactory().getInsertionActivity(activityArt); + IAtsInsertionActivity activity = atsApi.getProgramService().getInsertionActivityById(activityArt); result.setFirst(activity); result.setSecond(workPackageResult.getSecond()); } diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/model/WorkPackage.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/model/WorkPackage.java index bc5ebaac2b0..d4255239c13 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/model/WorkPackage.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/model/WorkPackage.java @@ -35,7 +35,7 @@ public class WorkPackage extends AtsConfigObject implements IAtsWorkPackage { private ArtifactToken artifact; private final AtsApi atsApi; - public WorkPackage(Log logger, ArtifactToken artifact, AtsApi atsApi) { + public WorkPackage(Log logger, AtsApi atsApi, ArtifactToken artifact) { super(logger, atsApi, artifact, AtsArtifactTypes.WorkPackage); this.artifact = artifact; this.atsApi = atsApi; diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/program/AtsProgramService.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/program/AtsProgramService.java index 48c5393a3e5..7715e609fd1 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/program/AtsProgramService.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/program/AtsProgramService.java @@ -45,6 +45,10 @@ import org.eclipse.osee.ats.api.workflow.IAtsAction; import org.eclipse.osee.ats.api.workflow.IAtsTask; import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow; import org.eclipse.osee.ats.api.workflow.WorkItemType; +import org.eclipse.osee.ats.core.config.Country; +import org.eclipse.osee.ats.core.config.Program; +import org.eclipse.osee.ats.core.insertion.Insertion; +import org.eclipse.osee.ats.core.insertion.InsertionActivity; import org.eclipse.osee.ats.core.program.operations.AtsProgramOperations; import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.ArtifactToken; @@ -77,25 +81,67 @@ public class AtsProgramService implements IAtsProgramService { } @Override + public IAtsCountry getCountryById(ArtifactId countryId) { + IAtsCountry country = null; + if (countryId instanceof IAtsCountry) { + country = (IAtsCountry) countryId; + } else { + ArtifactToken art = atsApi.getQueryService().getArtifact(countryId); + if (atsApi.getStoreService().isOfType(art, AtsArtifactTypes.Country)) { + country = new Country(atsApi.getLogger(), atsApi, art); + } + } + return country; + } + + @Override + public IAtsInsertion getInsertionById(ArtifactId insertionId) { + IAtsInsertion insertion = null; + if (insertionId instanceof IAtsInsertion) { + insertion = (IAtsInsertion) insertionId; + } else { + ArtifactToken art = atsApi.getQueryService().getArtifact(insertionId); + if (atsApi.getStoreService().isOfType(art, AtsArtifactTypes.Insertion)) { + insertion = new Insertion(atsApi.getLogger(), atsApi, art); + } + } + return insertion; + } + + @Override + public IAtsInsertionActivity getInsertionActivityById(ArtifactId insertionActivityId) { + IAtsInsertionActivity insertionActivity = null; + if (insertionActivityId instanceof IAtsInsertionActivity) { + insertionActivity = (IAtsInsertionActivity) insertionActivityId; + } else { + ArtifactToken art = atsApi.getQueryService().getArtifact(insertionActivityId); + if (atsApi.getStoreService().isOfType(art, AtsArtifactTypes.InsertionActivity)) { + insertionActivity = new InsertionActivity(atsApi.getLogger(), atsApi, art); + } + } + return insertionActivity; + } + + @Override public Collection<IAtsInsertionActivity> getInsertionActivities(IAtsInsertion insertion) { List<IAtsInsertionActivity> insertionActivitys = new ArrayList<>(); for (ArtifactId artifact : atsApi.getRelationResolver().getRelated( atsApi.getQueryService().getArtifact(insertion.getId()), AtsRelationTypes.InsertionToInsertionActivity_InsertionActivity)) { - insertionActivitys.add(atsApi.getConfigItemFactory().getInsertionActivity(artifact)); + insertionActivitys.add(atsApi.getProgramService().getInsertionActivityById(artifact)); } return insertionActivitys; } @Override public IAtsInsertionActivity getInsertionActivity(Long insertionActivityId) { - return atsApi.getConfigItemFactory().getInsertionActivity( + return atsApi.getProgramService().getInsertionActivityById( atsApi.getQueryService().getArtifact(insertionActivityId)); } @Override public IAtsWorkPackage getWorkPackage(Long workPackageId) { - return atsApi.getConfigItemFactory().getWorkPackage(atsApi.getQueryService().getArtifact(workPackageId)); + return atsApi.getEarnedValueService().getWorkPackage(atsApi.getQueryService().getArtifact(workPackageId)); } @Override @@ -104,7 +150,7 @@ public class AtsProgramService implements IAtsProgramService { Collection<ArtifactToken> related = atsApi.getRelationResolver().getRelated(wpArt, AtsRelationTypes.InsertionActivityToWorkPackage_InsertionActivity); if (related.size() > 0) { - return atsApi.getConfigItemFactory().getInsertionActivity(related.iterator().next()); + return atsApi.getProgramService().getInsertionActivityById(related.iterator().next()); } return null; } @@ -114,7 +160,7 @@ public class AtsProgramService implements IAtsProgramService { Collection<ArtifactToken> related = atsApi.getRelationResolver().getRelated(activity.getStoreObject(), AtsRelationTypes.InsertionToInsertionActivity_Insertion); if (related.size() > 0) { - return atsApi.getConfigItemFactory().getInsertion(related.iterator().next()); + return atsApi.getProgramService().getInsertionById(related.iterator().next()); } return null; } @@ -124,7 +170,7 @@ public class AtsProgramService implements IAtsProgramService { Collection<ArtifactToken> related = atsApi.getRelationResolver().getRelated(insertion.getStoreObject(), AtsRelationTypes.ProgramToInsertion_Program); if (related.size() > 0) { - return atsApi.getConfigItemFactory().getProgram(related.iterator().next()); + return atsApi.getProgramService().getProgramById(related.iterator().next()); } return null; } @@ -147,7 +193,7 @@ public class AtsProgramService implements IAtsProgramService { @Override public IAtsInsertion getInsertion(Long insertionId) { - return atsApi.getConfigItemFactory().getInsertion(atsApi.getQueryService().getArtifact(insertionId)); + return atsApi.getProgramService().getInsertionById(atsApi.getQueryService().getArtifact(insertionId)); } @Override @@ -155,7 +201,7 @@ public class AtsProgramService implements IAtsProgramService { List<IAtsInsertion> insertions = new ArrayList<>(); for (ArtifactId artifact : atsApi.getRelationResolver().getRelated( atsApi.getQueryService().getArtifact(program.getId()), AtsRelationTypes.ProgramToInsertion_Insertion)) { - insertions.add(atsApi.getConfigItemFactory().getInsertion(artifact)); + insertions.add(atsApi.getProgramService().getInsertionById(artifact)); } return insertions; } @@ -164,14 +210,23 @@ public class AtsProgramService implements IAtsProgramService { public Collection<IAtsProgram> getPrograms() { List<IAtsProgram> programs = new ArrayList<>(); for (ArtifactId artifact : atsApi.getQueryService().createQuery(AtsArtifactTypes.Program).getArtifacts()) { - programs.add(atsApi.getConfigItemFactory().getProgram(artifact)); + programs.add(atsApi.getProgramService().getProgramById(artifact)); } return programs; } @Override public IAtsProgram getProgramById(ArtifactId programId) { - return atsApi.getConfigItemFactory().getProgram(atsApi.getQueryService().getArtifact(programId)); + IAtsProgram program = null; + if (programId instanceof IAtsProgram) { + program = (IAtsProgram) programId; + } else { + ArtifactToken art = atsApi.getQueryService().getArtifact(programId); + if (atsApi.getStoreService().isOfType(art, AtsArtifactTypes.Program)) { + program = new Program(atsApi.getLogger(), atsApi, art); + } + } + return program; } @Override @@ -181,7 +236,7 @@ public class AtsProgramService implements IAtsProgramService { if (artifact != null) { for (ArtifactId related : atsApi.getRelationResolver().getRelated(artifact, AtsRelationTypes.CountryToProgram_Program)) { - programs.add(atsApi.getConfigItemFactory().getProgram(related)); + programs.add(atsApi.getProgramService().getProgramById(related)); } } return programs; @@ -195,7 +250,7 @@ public class AtsProgramService implements IAtsProgramService { ArtifactId countryArt = atsApi.getRelationResolver().getRelatedOrNull(artifact, AtsRelationTypes.CountryToProgram_Country); if (countryArt != null) { - country = atsApi.getConfigItemFactory().getCountry(countryArt); + country = atsApi.getProgramService().getCountryById(countryArt); } } return country; @@ -221,7 +276,7 @@ public class AtsProgramService implements IAtsProgramService { IAtsProgram program = null; Object object = atsApi.getAttributeResolver().getSoleAttributeValue(teamDef, AtsAttributeTypes.ProgramId, null); if (object instanceof ArtifactId) { - program = atsApi.getConfigItemFactory().getProgram((ArtifactId) object); + program = atsApi.getProgramService().getProgramById((ArtifactId) object); } else if (object instanceof String && Strings.isNumeric((String) object)) { program = atsApi.getProgramService().getProgramById(ArtifactId.valueOf((String) object)); } diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsConfigQueryImpl.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsConfigQueryImpl.java index 965d0e74fd6..616d061101e 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsConfigQueryImpl.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsConfigQueryImpl.java @@ -25,6 +25,7 @@ import org.eclipse.osee.ats.api.data.AtsAttributeTypes; import org.eclipse.osee.ats.api.program.IAtsProgram; import org.eclipse.osee.ats.api.query.IAtsConfigQuery; import org.eclipse.osee.ats.api.query.IAtsQueryFilter; +import org.eclipse.osee.ats.core.util.AtsObjects; import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.ArtifactToken; import org.eclipse.osee.framework.core.data.AttributeTypeId; @@ -70,7 +71,7 @@ public abstract class AbstractAtsConfigQueryImpl implements IAtsConfigQuery { public <T extends IAtsConfigObject> Collection<T> getConfigObjects() { Set<T> allResults = new HashSet<>(); for (ArtifactToken artifact : getArtifacts()) { - IAtsConfigObject configObj = atsApi.getConfigItemFactory().getConfigObject(artifact); + IAtsConfigObject configObj = AtsObjects.getConfigObject(artifact, atsApi); if (configObj == null) { throw new OseeArgumentException("Non-AtsConfigObject Artifact Returned %s", artifact.toStringWithId()); } diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsQueryService.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsQueryService.java index f8c1254347a..c6a05ef6fca 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsQueryService.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsQueryService.java @@ -22,6 +22,7 @@ import org.eclipse.osee.ats.api.data.AtsArtifactTypes; import org.eclipse.osee.ats.api.data.AtsAttributeTypes; import org.eclipse.osee.ats.api.query.IAtsQueryService; import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow; +import org.eclipse.osee.ats.core.util.AtsObjects; import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.ArtifactToken; import org.eclipse.osee.framework.core.data.BranchId; @@ -223,9 +224,9 @@ public abstract class AbstractAtsQueryService implements IAtsQueryService { if (Strings.isNumeric(id)) { atsObject = getCache().getAtsObject(Long.valueOf(id)); if (atsObject == null) { - ArtifactId artifact = getArtifact(Long.valueOf(id)); + ArtifactToken artifact = getArtifact(Long.valueOf(id)); if (artifact != null && artifact instanceof IAtsConfigObject) { - atsObject = (T) atsApi.getConfigItemFactory().getConfigObject(artifact); + atsObject = (T) AtsObjects.getConfigObject(artifact, atsApi); } } } @@ -237,9 +238,9 @@ public abstract class AbstractAtsQueryService implements IAtsQueryService { public <T> T getConfigItem(Long id) { T atsObject = getCache().getAtsObject(id); if (atsObject == null) { - ArtifactId artifact = getArtifact(id); + ArtifactToken artifact = getArtifact(id); if (artifact != null && artifact instanceof IAtsConfigObject) { - atsObject = (T) atsApi.getConfigItemFactory().getConfigObject(artifact); + atsObject = (T) AtsObjects.getConfigObject(artifact, atsApi); } } return atsObject; diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/review/AbstractReview.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/review/AbstractReview.java index 3da97290a68..ca41f743780 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/review/AbstractReview.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/review/AbstractReview.java @@ -39,7 +39,7 @@ public abstract class AbstractReview extends WorkItem implements IAtsAbstractRev atsApi.getAttributeResolver().getAttributeValues(artifact, AtsAttributeTypes.ActionableItemReference); for (ArtifactId aiId : artifactIds) { ArtifactId aiArt = atsApi.getQueryService().getConfigItem(aiId); - IAtsActionableItem ai = atsApi.getConfigItemFactory().getActionableItem(aiArt); + IAtsActionableItem ai = atsApi.getActionableItemService().getActionableItemById(aiArt); ais.add(ai); } return ais; diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsAbstractEarnedValueImpl.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsAbstractEarnedValueImpl.java index 84713de6827..b3e7b5714a3 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsAbstractEarnedValueImpl.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsAbstractEarnedValueImpl.java @@ -18,6 +18,7 @@ import org.eclipse.osee.ats.api.IAtsConfigObject; import org.eclipse.osee.ats.api.IAtsObject; import org.eclipse.osee.ats.api.IAtsWorkItem; import org.eclipse.osee.ats.api.ai.IAtsActionableItem; +import org.eclipse.osee.ats.api.data.AtsArtifactTypes; import org.eclipse.osee.ats.api.data.AtsAttributeTypes; import org.eclipse.osee.ats.api.data.AtsRelationTypes; import org.eclipse.osee.ats.api.ev.IAtsEarnedValueService; @@ -48,6 +49,20 @@ public abstract class AtsAbstractEarnedValueImpl implements IAtsEarnedValueServi } @Override + public IAtsWorkPackage getWorkPackageById(ArtifactId workPackageId) { + IAtsWorkPackage workPackage = null; + if (workPackageId instanceof IAtsWorkPackage) { + workPackage = (IAtsWorkPackage) workPackageId; + } else { + ArtifactToken art = atsApi.getQueryService().getArtifact(workPackageId); + if (atsApi.getStoreService().isOfType(art, AtsArtifactTypes.WorkPackage)) { + workPackage = new WorkPackage(atsApi.getLogger(), atsApi, art); + } + } + return workPackage; + } + + @Override public ArtifactId getWorkPackageId(IAtsWorkItem workItem) { ArtifactId artifact = atsApi.getQueryService().getArtifact(workItem); Conditions.checkNotNull(artifact, "workItem", "Can't Find Work Package matching %s", workItem.toStringWithId()); @@ -60,7 +75,7 @@ public abstract class AtsAbstractEarnedValueImpl implements IAtsEarnedValueServi ArtifactId workPackageId = getWorkPackageId(workItem); if (workPackageId.isValid()) { ArtifactToken workPkgArt = atsApi.getQueryService().getArtifact(workPackageId); - return new WorkPackage(logger, workPkgArt, atsApi); + return new WorkPackage(logger, atsApi, workPkgArt); } return null; } @@ -80,7 +95,7 @@ public abstract class AtsAbstractEarnedValueImpl implements IAtsEarnedValueServi if (artifact != null) { for (ArtifactToken workPackageArt : atsApi.getRelationResolver().getRelated(artifact, AtsRelationTypes.WorkPackage_WorkPackage)) { - workPackageOptions.add(new WorkPackage(logger, workPackageArt, atsApi)); + workPackageOptions.add(new WorkPackage(logger, atsApi, workPackageArt)); } } } @@ -117,15 +132,16 @@ public abstract class AtsAbstractEarnedValueImpl implements IAtsEarnedValueServi @Override public IAtsWorkPackage getWorkPackage(ArtifactId artifact) { ArtifactToken realArt = atsApi.getQueryService().getArtifact(artifact); - return new WorkPackage(logger, realArt, atsApi); + return new WorkPackage(logger, atsApi, realArt); } @Override public Collection<IAtsWorkPackage> getWorkPackages(IAtsInsertionActivity insertionActivity) { List<IAtsWorkPackage> workPackages = new ArrayList<>(); for (ArtifactToken artifact : atsApi.getRelationResolver().getRelated( - atsApi.getQueryService().getArtifact(insertionActivity.getId()), AtsRelationTypes.InsertionActivityToWorkPackage_WorkPackage)) { - workPackages.add(new WorkPackage(logger, artifact, atsApi)); + atsApi.getQueryService().getArtifact(insertionActivity.getId()), + AtsRelationTypes.InsertionActivityToWorkPackage_WorkPackage)) { + workPackages.add(new WorkPackage(logger, atsApi, artifact)); } return workPackages; } diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsApiImpl.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsApiImpl.java index 0d5b2636551..512e9c0dfb7 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsApiImpl.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsApiImpl.java @@ -31,7 +31,6 @@ import org.eclipse.osee.ats.api.query.IAtsQueryService; import org.eclipse.osee.ats.api.query.IAtsSearchDataProvider; import org.eclipse.osee.ats.api.review.IAtsReviewService; import org.eclipse.osee.ats.api.task.IAtsTaskService; -import org.eclipse.osee.ats.api.team.IAtsConfigItemFactory; import org.eclipse.osee.ats.api.team.IAtsTeamDefinitionService; import org.eclipse.osee.ats.api.user.IAtsUser; import org.eclipse.osee.ats.api.user.IAtsUserService; @@ -54,7 +53,7 @@ import org.eclipse.osee.ats.api.workflow.log.IAtsLogFactory; import org.eclipse.osee.ats.api.workflow.state.IAtsStateFactory; import org.eclipse.osee.ats.api.workflow.state.IAtsWorkStateFactory; import org.eclipse.osee.ats.core.config.AtsCache; -import org.eclipse.osee.ats.core.config.TeamDefinitionService; +import org.eclipse.osee.ats.core.config.TeamDefinitionServiceImpl; import org.eclipse.osee.ats.core.program.AtsProgramService; import org.eclipse.osee.ats.core.review.AtsReviewServiceImpl; import org.eclipse.osee.ats.core.version.AtsVersionServiceImpl; @@ -110,7 +109,6 @@ public abstract class AtsApiImpl implements AtsApi { protected IAtsWorkStateFactory workStateFactory; protected IAtsLogFactory logFactory; protected IAtsColumnService columnServices; - protected IAtsConfigItemFactory configItemFactory; protected IAtsActionableItemService actionableItemManager; protected IRelationResolver relationResolver; protected IAtsVersionService versionService; @@ -163,7 +161,7 @@ public abstract class AtsApiImpl implements AtsApi { workDefinitionStore = new AtsWorkDefinitionStoreService(this); programService = new AtsProgramService(this); - teamDefinitionService = new TeamDefinitionService(this); + teamDefinitionService = new TeamDefinitionServiceImpl(this); versionService = new AtsVersionServiceImpl(this, eventAdmin); reviewService = new AtsReviewServiceImpl(this); } @@ -413,11 +411,6 @@ public abstract class AtsApiImpl implements AtsApi { } @Override - public IAtsConfigItemFactory getConfigItemFactory() { - return configItemFactory; - } - - @Override public IRelationResolver getRelationResolver() { return relationResolver; } diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsObjects.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsObjects.java index 328a38dffa1..e243f92f2a0 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsObjects.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsObjects.java @@ -23,6 +23,7 @@ import org.eclipse.osee.ats.api.workflow.IAtsAction; import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow; import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.ArtifactToken; +import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException; import org.eclipse.osee.framework.jdk.core.util.Collections; /** @@ -156,4 +157,48 @@ public class AtsObjects { return element instanceof IAtsAction || element instanceof IAtsWorkItem; } + public static IAtsConfigObject getConfigObject(ArtifactToken artifact, AtsApi atsApi) { + IAtsConfigObject configObject; + if (atsApi.getStoreService().isOfType(artifact, AtsArtifactTypes.Version)) { + configObject = atsApi.getVersionService().getVersion(artifact); + } else if (atsApi.getStoreService().isOfType(artifact, AtsArtifactTypes.TeamDefinition)) { + configObject = atsApi.getTeamDefinitionService().getTeamDefinitionById(artifact); + } else if (atsApi.getStoreService().isOfType(artifact, AtsArtifactTypes.ActionableItem)) { + configObject = atsApi.getActionableItemService().getActionableItemById(artifact); + } else if (atsApi.getStoreService().isOfType(artifact, AtsArtifactTypes.Program)) { + configObject = atsApi.getProgramService().getProgramById(artifact); + } else if (atsApi.getStoreService().isOfType(artifact, AtsArtifactTypes.AgileTeam)) { + configObject = atsApi.getAgileService().getAgileTeam(artifact); + } else if (atsApi.getStoreService().isOfType(artifact, AtsArtifactTypes.AgileFeatureGroup)) { + configObject = atsApi.getAgileService().getAgileFeatureGroup(artifact); + } else if (atsApi.getStoreService().isOfType(artifact, AtsArtifactTypes.Insertion)) { + configObject = atsApi.getProgramService().getInsertionById(artifact); + } else if (atsApi.getStoreService().isOfType(artifact, AtsArtifactTypes.InsertionActivity)) { + configObject = atsApi.getProgramService().getInsertionActivityById(artifact); + } else if (atsApi.getStoreService().isOfType(artifact, AtsArtifactTypes.Country)) { + configObject = atsApi.getProgramService().getCountryById(artifact); + } else if (atsApi.getStoreService().isOfType(artifact, AtsArtifactTypes.WorkPackage)) { + configObject = atsApi.getEarnedValueService().getWorkPackage(artifact); + } else { + throw new OseeArgumentException("Unexpected artifact type [%s]", artifact.getArtifactTypeId()); + } + return configObject; + } + + public static boolean isAtsConfigArtifact(ArtifactToken artifact, AtsApi atsApi) { + return atsApi.getStoreService().isOfType(artifact, AtsArtifactTypes.AtsConfigObject); + } + + public static IAtsObject getAtsObject(ArtifactToken artifact, AtsApi atsApi) { + IAtsObject result = null; + if (atsApi.getStoreService().isOfType(artifact, AtsArtifactTypes.AbstractWorkflowArtifact)) { + result = atsApi.getWorkItemService().getWorkItem(artifact); + } else if (AtsObjects.isAtsConfigArtifact(artifact, atsApi)) { + result = AtsObjects.getConfigObject(artifact, atsApi); + } else if (atsApi.getStoreService().isOfType(artifact, AtsArtifactTypes.Action)) { + result = atsApi.getWorkItemService().getAction(artifact); + } + return result; + } + } diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/ConvertAtsConfigGuidAttributesOperations.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/ConvertAtsConfigGuidAttributesOperations.java index fedb9ee8794..b2fe1c94992 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/ConvertAtsConfigGuidAttributesOperations.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/ConvertAtsConfigGuidAttributesOperations.java @@ -95,7 +95,7 @@ public class ConvertAtsConfigGuidAttributesOperations { String teamDefGuid = atsApi.getAttributeResolver().getSoleAttributeValue(art, TeamDefinition, ""); if (Strings.isValid(teamDefGuid)) { ArtifactToken artifact = atsApi.getQueryService().getArtifactByGuid(teamDefGuid); - IAtsTeamDefinition teamDef = atsApi.getConfigItemFactory().getTeamDef(artifact); + IAtsTeamDefinition teamDef = atsApi.getTeamDefinitionService().getTeamDefinitionById(artifact); changes.setSoleAttributeValue(art, AtsAttributeTypes.TeamDefinitionReference, teamDef.getStoreObject()); } } diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/version/AtsVersionServiceImpl.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/version/AtsVersionServiceImpl.java index f0ee9e7551b..e1fcccb3daa 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/version/AtsVersionServiceImpl.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/version/AtsVersionServiceImpl.java @@ -29,6 +29,7 @@ import org.eclipse.osee.ats.api.util.IExecuteListener; import org.eclipse.osee.ats.api.version.IAtsVersion; import org.eclipse.osee.ats.api.version.IAtsVersionService; import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow; +import org.eclipse.osee.ats.core.config.Version; import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.ArtifactToken; import org.eclipse.osee.framework.core.data.BranchId; @@ -54,6 +55,20 @@ public class AtsVersionServiceImpl implements IAtsVersionService { } @Override + public IAtsVersion getVersion(ArtifactId versionId) { + IAtsVersion version = null; + if (versionId instanceof IAtsVersion) { + version = (IAtsVersion) versionId; + } else { + ArtifactToken art = atsApi.getQueryService().getArtifact(versionId); + if (atsApi.getStoreService().isOfType(art, AtsArtifactTypes.Version)) { + version = new Version(atsApi.getLogger(), atsApi, art); + } + } + return version; + } + + @Override public IAtsVersion getTargetedVersion(IAtsWorkItem workItem) { IAtsVersion version = null; IAtsTeamWorkflow team = workItem.getParentTeamWorkflow(); @@ -76,7 +91,7 @@ public class AtsVersionServiceImpl implements IAtsVersionService { OseeLog.log(Activator.class, Level.SEVERE, "Multiple targeted versions for artifact " + team.toStringWithId()); } else { - version = atsApi.getConfigItemFactory().getVersion(versions.iterator().next()); + version = atsApi.getVersionService().getVersion(versions.iterator().next()); } } return version; @@ -178,7 +193,7 @@ public class AtsVersionServiceImpl implements IAtsVersionService { IAtsVersion version = null; ArtifactToken verArt = atsApi.getQueryService().getArtifact(id.getId()); if (verArt != null) { - version = atsApi.getConfigItemFactory().getVersion(verArt); + version = atsApi.getVersionService().getVersion(verArt); } return version; } @@ -208,8 +223,7 @@ public class AtsVersionServiceImpl implements IAtsVersionService { IAtsVersion version = null; version = atsApi.getProgramService().getVersion(program, versionName); if (version == null) { - version = - atsApi.getConfigItemFactory().getVersion(changes.createArtifact(AtsArtifactTypes.Version, versionName)); + version = atsApi.getVersionService().getVersion(changes.createArtifact(AtsArtifactTypes.Version, versionName)); } return version; } diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/AtsWorkItemServiceImpl.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/AtsWorkItemServiceImpl.java index 23805be10dc..f6a53e56126 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/AtsWorkItemServiceImpl.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workflow/AtsWorkItemServiceImpl.java @@ -46,7 +46,7 @@ import org.eclipse.osee.ats.api.workflow.note.IAtsWorkItemNotes; import org.eclipse.osee.ats.api.workflow.transition.ITransitionListener; import org.eclipse.osee.ats.core.agile.AgileBacklog; import org.eclipse.osee.ats.core.agile.AgileSprint; -import org.eclipse.osee.ats.core.ai.ActionableItemService; +import org.eclipse.osee.ats.core.ai.ActionableItemServiceImpl; import org.eclipse.osee.ats.core.review.DecisionReview; import org.eclipse.osee.ats.core.review.PeerToPeerReview; import org.eclipse.osee.ats.core.util.AtsObjects; @@ -168,7 +168,7 @@ public class AtsWorkItemServiceImpl implements IAtsWorkItemService { public IAtsActionableItemService getActionableItemService() { if (actionableItemService == null) { actionableItemService = - new ActionableItemService(atsApi.getAttributeResolver(), atsApi.getStoreService(), atsApi); + new ActionableItemServiceImpl(atsApi.getAttributeResolver(), atsApi.getStoreService(), atsApi); } return actionableItemService; } diff --git a/plugins/org.eclipse.osee.ats.rest.test/src/org/eclipse/osee/ats/rest/internal/util/AtsChangeSetTest.java b/plugins/org.eclipse.osee.ats.rest.test/src/org/eclipse/osee/ats/rest/internal/util/AtsChangeSetTest.java index 1a193bf3e4b..c87fc19a797 100644 --- a/plugins/org.eclipse.osee.ats.rest.test/src/org/eclipse/osee/ats/rest/internal/util/AtsChangeSetTest.java +++ b/plugins/org.eclipse.osee.ats.rest.test/src/org/eclipse/osee/ats/rest/internal/util/AtsChangeSetTest.java @@ -79,7 +79,7 @@ public class AtsChangeSetTest { ArtifactReadable folder = (ArtifactReadable) atsServer.getQueryService().getArtifact(folderArt.getId()); assertNotNull(folder); IAtsVersion version = - atsServer.getConfigItemFactory().getVersion(atsServer.getQueryService().getArtifact(verArt.getId())); + atsServer.getVersionService().getVersion(atsServer.getQueryService().getArtifact(verArt.getId())); assertNotNull(version); // add relation from folder to version @@ -111,7 +111,7 @@ public class AtsChangeSetTest { // relate version to folder with same relation, but opposite order folder = (ArtifactReadable) atsServer.getQueryService().getArtifact(folderArt.getId()); assertNotNull(folder); - version = atsServer.getConfigItemFactory().getVersion(atsServer.getQueryService().getArtifact(verArt.getId())); + version = atsServer.getVersionService().getVersion(atsServer.getQueryService().getArtifact(verArt.getId())); assertNotNull(version); changes = createAtsChangeSet(); changes.relate(version, CoreRelationTypes.SupportingInfo_SupportedBy, folder); diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/IAtsServer.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/IAtsServer.java index 7036f2d09bd..6adb63c4433 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/IAtsServer.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/IAtsServer.java @@ -16,7 +16,6 @@ import org.eclipse.osee.ats.api.AtsApi; import org.eclipse.osee.ats.api.ai.IAtsActionableItemService; import org.eclipse.osee.ats.api.notify.IAtsNotifier; import org.eclipse.osee.ats.api.review.IAtsReviewServiceProvider; -import org.eclipse.osee.ats.api.team.IAtsConfigItemFactoryProvider; import org.eclipse.osee.ats.api.user.IAtsUser; import org.eclipse.osee.ats.api.util.IAtsChangeSet; import org.eclipse.osee.ats.api.util.IAtsDatabaseConversion; @@ -28,7 +27,7 @@ import org.eclipse.osee.orcs.OrcsApi; /** * @author Donald G Dunne */ -public interface IAtsServer extends AtsApi, IAtsNotifier, IAtsConfigItemFactoryProvider, IAtsCacheProvider, IAtsReviewServiceProvider, IAtsBranchServiceProvider { +public interface IAtsServer extends AtsApi, IAtsNotifier, IAtsCacheProvider, IAtsReviewServiceProvider, IAtsBranchServiceProvider { OrcsApi getOrcsApi(); diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsServerImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsServerImpl.java index ce34a79499b..0d1e3f2833f 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsServerImpl.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsServerImpl.java @@ -32,7 +32,7 @@ import org.eclipse.osee.ats.api.workflow.AtsActionEndpointApi; import org.eclipse.osee.ats.api.workflow.IAtsAction; import org.eclipse.osee.ats.api.workflow.transition.ITransitionListener; import org.eclipse.osee.ats.core.agile.AgileService; -import org.eclipse.osee.ats.core.ai.ActionableItemService; +import org.eclipse.osee.ats.core.ai.ActionableItemServiceImpl; import org.eclipse.osee.ats.core.util.ActionFactory; import org.eclipse.osee.ats.core.util.AtsApiImpl; import org.eclipse.osee.ats.core.util.AtsCoreFactory; @@ -54,7 +54,6 @@ import org.eclipse.osee.ats.rest.internal.util.AtsRelationResolverServiceImpl; import org.eclipse.osee.ats.rest.internal.util.AtsStoreServiceImpl; import org.eclipse.osee.ats.rest.internal.workitem.AtsActionEndpointImpl; import org.eclipse.osee.ats.rest.internal.workitem.AtsTaskService; -import org.eclipse.osee.ats.rest.internal.workitem.ConfigItemFactory; import org.eclipse.osee.ats.rest.util.ChangeTypeUtil; import org.eclipse.osee.ats.rest.util.IAtsNotifierServer; import org.eclipse.osee.executor.admin.ExecutorAdmin; @@ -124,7 +123,6 @@ public class AtsServerImpl extends AtsApiImpl implements IAtsServer { workDefinitionDslService, teamWorkflowProvidersLazy); notifyService = new AtsNotifierServiceImpl(); - configItemFactory = new ConfigItemFactory(logger, this, orcsApi); artifactResolver = new ArtifactResolverImpl(this, orcsApi); branchService = new AtsBranchServiceImpl(this, orcsApi, teamWorkflowProvidersLazy); @@ -139,7 +137,7 @@ public class AtsServerImpl extends AtsApiImpl implements IAtsServer { new AtsStoreServiceImpl(attributeResolverService, this, orcsApi, stateFactory, logFactory, this, jdbcService); queryService = new AtsQueryServiceImpl(this, jdbcService, orcsApi); - actionableItemManager = new ActionableItemService(attributeResolverService, storeService, this); + actionableItemManager = new ActionableItemServiceImpl(attributeResolverService, storeService, this); actionFactory = new ActionFactory(sequenceProvider, actionableItemManager, attributeResolverService, stateFactory, this); diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/agile/AgileEndpointImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/agile/AgileEndpointImpl.java index e9dd5b53893..f531b2ecfe4 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/agile/AgileEndpointImpl.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/agile/AgileEndpointImpl.java @@ -491,7 +491,7 @@ public class AgileEndpointImpl implements AgileEndpointApi { // Add any AgileTeam to AI relations for (ArtifactId aiArt : atsApi.getRelationResolver().getRelated(aTeam, AtsRelationTypes.AgileTeamToAtsAtsAis_AtsAis)) { - ais.add(atsApi.getConfigItemFactory().getActionableItem(aiArt)); + ais.add(atsApi.getActionableItemService().getActionableItemById(aiArt)); } Collections.sort(ais, new NamedComparator(SortOrder.ASCENDING)); return ais; @@ -559,7 +559,7 @@ public class AgileEndpointImpl implements AgileEndpointApi { if (child.getName().equals(IAgileService.FEATURE_GROUP_FOLDER_NAME)) { for (ArtifactToken subChild : atsApi.getRelationResolver().getChildren(child)) { if (atsApi.getStoreService().isOfType(subChild, AtsArtifactTypes.AgileFeatureGroup)) { - IAgileFeatureGroup group = atsApi.getConfigItemFactory().getAgileFeatureGroup(subChild); + IAgileFeatureGroup group = atsApi.getAgileService().getAgileFeatureGroup(subChild); JaxAgileFeatureGroup newGroup = new JaxAgileFeatureGroup(); newGroup.setName(group.getName()); newGroup.setId(group.getId()); diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/agile/operations/ProgramOperations.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/agile/operations/ProgramOperations.java index 3c03f6d1dfd..5601290cbe1 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/agile/operations/ProgramOperations.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/agile/operations/ProgramOperations.java @@ -18,8 +18,20 @@ import org.eclipse.osee.ats.api.agile.atw.AtwNode; import org.eclipse.osee.ats.api.agile.program.UiGridProgItem; import org.eclipse.osee.ats.api.agile.program.UiGridProgram; import org.eclipse.osee.ats.api.data.AtsArtifactTypes; +import org.eclipse.osee.ats.api.data.AtsRelationTypes; +import org.eclipse.osee.ats.api.insertion.IAtsInsertion; +import org.eclipse.osee.ats.api.insertion.IAtsInsertionActivity; +import org.eclipse.osee.ats.api.insertion.JaxInsertion; +import org.eclipse.osee.ats.api.insertion.JaxInsertionActivity; +import org.eclipse.osee.ats.api.util.IAtsChangeSet; +import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.ArtifactToken; +import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; +import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; +import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; +import org.eclipse.osee.framework.jdk.core.util.Lib; +import org.eclipse.osee.orcs.data.ArtifactReadable; /** * @author Donald G. Dunne @@ -118,4 +130,81 @@ public class ProgramOperations { return null; } + public IAtsInsertion createInsertion(ArtifactId programArtifact, JaxInsertion newInsertion) { + + long id = newInsertion.getId(); + if (id <= 0) { + id = Lib.generateArtifactIdAsInt(); + } + IAtsChangeSet changes = + atsApi.getStoreService().createAtsChangeSet("Create new Insertion", atsApi.getUserService().getCurrentUser()); + ArtifactReadable insertionArt = + (ArtifactReadable) changes.createArtifact(AtsArtifactTypes.Insertion, newInsertion.getName(), id); + + changes.relate(programArtifact, AtsRelationTypes.ProgramToInsertion_Insertion, insertionArt); + changes.execute(); + return atsApi.getProgramService().getInsertionById(insertionArt); + } + + public IAtsInsertion updateInsertion(JaxInsertion updatedInsertion) { + IAtsChangeSet changes = + atsApi.getStoreService().createAtsChangeSet("Update Insertion", atsApi.getUserService().getCurrentUser()); + changes.setSoleAttributeValue(ArtifactId.valueOf(updatedInsertion.getId()), CoreAttributeTypes.Name, + updatedInsertion.getName()); + changes.execute(); + return atsApi.getProgramService().getInsertionById( + atsApi.getQueryService().getArtifact(updatedInsertion.getId())); + } + + public void deleteInsertion(ArtifactId artifact) { + deleteConfigObject(artifact, "Delete Insertion", AtsArtifactTypes.Insertion); + } + + public IAtsInsertionActivity createInsertionActivity(ArtifactId insertion, JaxInsertionActivity newActivity) { + long id = newActivity.getId(); + if (id <= 0) { + id = Lib.generateArtifactIdAsInt(); + } + IAtsChangeSet changes = atsApi.getStoreService().createAtsChangeSet("Create new Insertion Activity", + atsApi.getUserService().getCurrentUser()); + ArtifactReadable insertionActivityArt = + (ArtifactReadable) changes.createArtifact(AtsArtifactTypes.InsertionActivity, newActivity.getName(), id); + + changes.relate(insertion, AtsRelationTypes.InsertionToInsertionActivity_InsertionActivity, insertionActivityArt); + changes.execute(); + return atsApi.getProgramService().getInsertionActivityById(insertionActivityArt); + } + + public IAtsInsertionActivity updateInsertionActivity(JaxInsertionActivity updatedActivity) { + IAtsChangeSet changes = + atsApi.getStoreService().createAtsChangeSet("Update Insertion", atsApi.getUserService().getCurrentUser()); + ArtifactReadable insertionActivityArt = + (ArtifactReadable) atsApi.getQueryService().getArtifact(updatedActivity.getId()); + + changes.setSoleAttributeValue(insertionActivityArt, CoreAttributeTypes.Name, updatedActivity.getName()); + changes.setSoleAttributeValue(ArtifactId.valueOf(updatedActivity.getId()), CoreAttributeTypes.Name, + updatedActivity.getName()); + changes.execute(); + return atsApi.getProgramService().getInsertionActivityById( + atsApi.getQueryService().getArtifact(updatedActivity.getId())); + } + + public void deleteInsertionActivity(ArtifactId artifact) { + deleteConfigObject(artifact, "Delete Insertion Activity", AtsArtifactTypes.InsertionActivity); + } + + private void deleteConfigObject(ArtifactId id, String comment, IArtifactType type) { + ArtifactReadable toDelete = (ArtifactReadable) atsApi.getQueryService().getArtifact(id); + if (toDelete == null) { + throw new OseeCoreException("No object found for id %s", id); + } + + if (!toDelete.isTypeEqual(type)) { + throw new OseeCoreException("Artifact type does not match for %s", comment); + } + IAtsChangeSet changes = atsApi.createChangeSet(String.format("Delete config object %s-%s", id, type)); + changes.deleteArtifact(toDelete); + changes.execute(); + } + } diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigurationsService.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigurationsService.java index 5ed2246acd1..3b2bad461ea 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigurationsService.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/AtsConfigurationsService.java @@ -56,9 +56,9 @@ import org.eclipse.osee.orcs.search.QueryBuilder; * @author Donald G Dunne */ public class AtsConfigurationsService implements IAtsConfigurationsService { + private AtsConfigurations atsConfigurations; private final OrcsApi orcsApi; private final AtsApi atsApi; - private AtsConfigurations atsConfigurations; public AtsConfigurationsService(AtsApi atsApi, OrcsApi orcsApi) { this.atsApi = atsApi; @@ -259,4 +259,5 @@ public class AtsConfigurationsService implements IAtsConfigurationsService { } return null; } + }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/BaseConfigEndpointImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/BaseConfigEndpointImpl.java index 9f455e863d5..c18b88a29c5 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/BaseConfigEndpointImpl.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/BaseConfigEndpointImpl.java @@ -19,7 +19,6 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.Response; import org.eclipse.osee.ats.api.AtsApi; -import org.eclipse.osee.ats.api.IAtsObject; import org.eclipse.osee.ats.api.config.BaseConfigEndpointApi; import org.eclipse.osee.ats.api.config.JaxAtsObject; import org.eclipse.osee.ats.api.data.AtsArtifactToken; @@ -77,7 +76,6 @@ public abstract class BaseConfigEndpointImpl<T extends JaxAtsObject> implements IAtsChangeSet changes = atsApi.getStoreService().createAtsChangeSet("Create " + artifactType.getName(), AtsCoreUsers.SYSTEM_USER); ArtifactId newArtifact = changes.createArtifact(artifactType, jaxAtsObject.getName(), jaxAtsObject.getId()); - IAtsObject newAtsObject = atsApi.getConfigItemFactory().getConfigObject(newArtifact); if (typeFolder != null) { ArtifactReadable typeFolderArtifact = (ArtifactReadable) atsApi.getQueryService().getArtifact(typeFolder); if (typeFolderArtifact == null) { @@ -91,11 +89,11 @@ public abstract class BaseConfigEndpointImpl<T extends JaxAtsObject> implements changes.relate(typeFolderArtifact, CoreRelationTypes.Default_Hierarchical__Child, newArtifact); } if (Strings.isValid(jaxAtsObject.getDescription())) { - changes.setSoleAttributeValue(newAtsObject, AtsAttributeTypes.Description, jaxAtsObject.getDescription()); + changes.setSoleAttributeValue(newArtifact, AtsAttributeTypes.Description, jaxAtsObject.getDescription()); } else { - changes.deleteAttributes(newAtsObject, AtsAttributeTypes.Description); + changes.deleteAttributes(newArtifact, AtsAttributeTypes.Description); } - changes.setSoleAttributeValue(newAtsObject, AtsAttributeTypes.Active, jaxAtsObject.isActive()); + changes.setSoleAttributeValue(newArtifact, AtsAttributeTypes.Active, jaxAtsObject.isActive()); create(jaxAtsObject, newArtifact, changes); changes.execute(); return Response.created(new URI("/" + jaxAtsObject.getId())).build(); diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/ConfigJsonWriter.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/ConfigJsonWriter.java index f103097b5c5..51702cdf308 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/ConfigJsonWriter.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/ConfigJsonWriter.java @@ -120,7 +120,7 @@ public class ConfigJsonWriter implements MessageBodyWriter<IAtsConfigObject> { if (!identityView) { writer.writeArrayFieldStart("version"); for (ArtifactReadable verArt : artifact.getRelated(AtsRelationTypes.TeamDefinitionToVersion_Version)) { - IAtsVersion version = atsApi.getConfigItemFactory().getVersion(verArt); + IAtsVersion version = atsApi.getVersionService().getVersion(verArt); addProgramObject(atsApi, orcsApi, version, annotations, writer, true, attributeTypes); } writer.writeEndArray(); diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/CountryEndpointImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/CountryEndpointImpl.java index 56c5a94306f..d43abc8aae5 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/CountryEndpointImpl.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/CountryEndpointImpl.java @@ -15,7 +15,6 @@ import java.util.ArrayList; import java.util.List; import javax.ws.rs.core.Response; import org.eclipse.osee.ats.api.AtsApi; -import org.eclipse.osee.ats.api.IAtsConfigObject; import org.eclipse.osee.ats.api.country.CountryEndpointApi; import org.eclipse.osee.ats.api.country.IAtsCountry; import org.eclipse.osee.ats.api.country.JaxCountry; @@ -48,9 +47,8 @@ public class CountryEndpointImpl extends BaseConfigEndpointImpl<JaxCountry> impl IAtsChangeSet changes = atsApi.getStoreService().createAtsChangeSet("Create " + artifactType.getName(), AtsCoreUsers.SYSTEM_USER); ArtifactToken configArtifact = changes.createArtifact(artifactType, country.getName(), country.getId()); - IAtsConfigObject configObject = atsApi.getConfigItemFactory().getConfigObject(configArtifact); if (!configArtifact.getName().equals(country.getName())) { - changes.setSoleAttributeValue(configObject, CoreAttributeTypes.Name, country.getName()); + changes.setSoleAttributeValue(configArtifact, CoreAttributeTypes.Name, country.getName()); } changes.execute(); return Response.created(new URI("/" + country.getId())).build(); @@ -59,7 +57,7 @@ public class CountryEndpointImpl extends BaseConfigEndpointImpl<JaxCountry> impl @Override public JaxCountry getConfigObject(ArtifactId artifact) { JaxCountry jaxCountry = new JaxCountry(); - IAtsCountry country = atsApi.getConfigItemFactory().getCountry(artifact); + IAtsCountry country = atsApi.getProgramService().getCountryById(artifact); jaxCountry.setName(country.getName()); jaxCountry.setId(country.getId()); jaxCountry.setActive(country.isActive()); diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/InsertionActivityEndpointImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/InsertionActivityEndpointImpl.java index f04b8a44827..ac42a2f344a 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/InsertionActivityEndpointImpl.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/InsertionActivityEndpointImpl.java @@ -16,7 +16,6 @@ import java.util.List; import javax.ws.rs.PUT; import javax.ws.rs.core.Response; import org.eclipse.osee.ats.api.AtsApi; -import org.eclipse.osee.ats.api.IAtsConfigObject; import org.eclipse.osee.ats.api.data.AtsArtifactTypes; import org.eclipse.osee.ats.api.data.AtsRelationTypes; import org.eclipse.osee.ats.api.insertion.IAtsInsertionActivity; @@ -56,9 +55,9 @@ public class InsertionActivityEndpointImpl extends BaseConfigEndpointImpl<JaxIns IAtsChangeSet changes = atsApi.getStoreService().createAtsChangeSet("Create " + artifactType.getName(), AtsCoreUsers.SYSTEM_USER); ArtifactToken configArtifact = changes.createArtifact(artifactType, activity.getName(), activity.getId()); - IAtsConfigObject configObject = atsApi.getConfigItemFactory().getConfigObject(configArtifact); + IAtsInsertionActivity insertionActivity = atsApi.getProgramService().getInsertionActivityById(configArtifact); if (!configArtifact.getName().equals(activity.getName())) { - changes.setSoleAttributeValue(configObject, CoreAttributeTypes.Name, activity.getName()); + changes.setSoleAttributeValue(insertionActivity, CoreAttributeTypes.Name, activity.getName()); } changes.execute(); return Response.created(new URI("/" + activity.getId())).build(); @@ -67,7 +66,7 @@ public class InsertionActivityEndpointImpl extends BaseConfigEndpointImpl<JaxIns @Override public JaxInsertionActivity getConfigObject(ArtifactId artifact) { JaxInsertionActivity jaxInsertion = new JaxInsertionActivity(); - IAtsInsertionActivity insertion = atsApi.getConfigItemFactory().getInsertionActivity(artifact); + IAtsInsertionActivity insertion = atsApi.getProgramService().getInsertionActivityById(artifact); jaxInsertion.setName(insertion.getName()); jaxInsertion.setId(insertion.getId()); jaxInsertion.setActive(insertion.isActive()); diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/InsertionEndpointImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/InsertionEndpointImpl.java index b6ee0e4f3de..15e825077f9 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/InsertionEndpointImpl.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/InsertionEndpointImpl.java @@ -16,7 +16,6 @@ import java.util.List; import javax.ws.rs.PUT; import javax.ws.rs.core.Response; import org.eclipse.osee.ats.api.AtsApi; -import org.eclipse.osee.ats.api.IAtsConfigObject; import org.eclipse.osee.ats.api.data.AtsArtifactTypes; import org.eclipse.osee.ats.api.data.AtsRelationTypes; import org.eclipse.osee.ats.api.insertion.IAtsInsertion; @@ -49,26 +48,26 @@ public class InsertionEndpointImpl extends BaseConfigEndpointImpl<JaxInsertion> @PUT @Override - public Response update(JaxInsertion insertion) throws Exception { - ArtifactReadable artifact = (ArtifactReadable) atsApi.getQueryService().getArtifact(insertion.getId()); + public Response update(JaxInsertion jaxInsertion) throws Exception { + ArtifactReadable artifact = (ArtifactReadable) atsApi.getQueryService().getArtifact(jaxInsertion.getId()); if (artifact == null) { - throw new OseeStateException("Artifact with id %d not found", insertion.getId()); + throw new OseeStateException("Artifact with id %d not found", jaxInsertion.getId()); } IAtsChangeSet changes = atsApi.getStoreService().createAtsChangeSet("Create " + artifactType.getName(), AtsCoreUsers.SYSTEM_USER); - ArtifactToken configArtifact = changes.createArtifact(artifactType, insertion.getName(), insertion.getId()); - IAtsConfigObject configObject = atsApi.getConfigItemFactory().getConfigObject(configArtifact); - if (!configArtifact.getName().equals(insertion.getName())) { - changes.setSoleAttributeValue(configObject, CoreAttributeTypes.Name, insertion.getName()); + ArtifactToken insertionArt = changes.createArtifact(artifactType, jaxInsertion.getName(), jaxInsertion.getId()); + IAtsInsertion insertion = atsApi.getProgramService().getInsertionById(insertionArt); + if (!insertionArt.getName().equals(jaxInsertion.getName())) { + changes.setSoleAttributeValue(insertion, CoreAttributeTypes.Name, jaxInsertion.getName()); } changes.execute(); - return Response.created(new URI("/" + insertion.getId())).build(); + return Response.created(new URI("/" + jaxInsertion.getId())).build(); } @Override public JaxInsertion getConfigObject(ArtifactId artifact) { JaxInsertion jaxInsertion = new JaxInsertion(); - IAtsInsertion insertion = atsApi.getConfigItemFactory().getInsertion(artifact); + IAtsInsertion insertion = atsApi.getProgramService().getInsertionById(artifact); jaxInsertion.setName(insertion.getName()); jaxInsertion.setId(insertion.getId()); jaxInsertion.setActive(insertion.isActive()); diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/ProgramEndpointImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/ProgramEndpointImpl.java index 7ff5f2712f2..ff5a757bf6f 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/ProgramEndpointImpl.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/ProgramEndpointImpl.java @@ -23,7 +23,6 @@ import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import org.eclipse.osee.ats.api.AtsApi; -import org.eclipse.osee.ats.api.IAtsConfigObject; import org.eclipse.osee.ats.api.data.AtsArtifactTypes; import org.eclipse.osee.ats.api.data.AtsRelationTypes; import org.eclipse.osee.ats.api.insertion.InsertionEndpointApi; @@ -59,26 +58,26 @@ public class ProgramEndpointImpl extends BaseConfigEndpointImpl<JaxProgram> impl @PUT @Override - public Response update(JaxProgram program) throws Exception { - ArtifactReadable artifact = (ArtifactReadable) atsApi.getQueryService().getArtifact(program.getId()); + public Response update(JaxProgram jaxProgram) throws Exception { + ArtifactReadable artifact = (ArtifactReadable) atsApi.getQueryService().getArtifact(jaxProgram.getId()); if (artifact == null) { - throw new OseeStateException("Artifact with id %d not found", program.getId()); + throw new OseeStateException("Artifact with id %d not found", jaxProgram.getId()); } IAtsChangeSet changes = atsApi.getStoreService().createAtsChangeSet("Create " + artifactType.getName(), AtsCoreUsers.SYSTEM_USER); - ArtifactToken configArtifact = changes.createArtifact(artifactType, program.getName(), program.getId()); - IAtsConfigObject configObject = atsApi.getConfigItemFactory().getConfigObject(configArtifact); - if (!configArtifact.getName().equals(program.getName())) { - changes.setSoleAttributeValue(configObject, CoreAttributeTypes.Name, program.getName()); + ArtifactToken programArt = changes.createArtifact(artifactType, jaxProgram.getName(), jaxProgram.getId()); + IAtsProgram program = atsApi.getProgramService().getProgramById(programArt); + if (!programArt.getName().equals(jaxProgram.getName())) { + changes.setSoleAttributeValue(program, CoreAttributeTypes.Name, jaxProgram.getName()); } changes.execute(); - return Response.created(new URI("/" + program.getId())).build(); + return Response.created(new URI("/" + jaxProgram.getId())).build(); } @Override public JaxProgram getConfigObject(ArtifactId artifact) { JaxProgram jaxProgram = new JaxProgram(); - IAtsProgram program = atsApi.getConfigItemFactory().getProgram(artifact); + IAtsProgram program = atsApi.getProgramService().getProgramById(artifact); jaxProgram.setName(program.getName()); jaxProgram.setId(program.getId()); jaxProgram.setActive(program.isActive()); diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/ProgramResource.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/ProgramResource.java index 0e1c4fbacd3..72480b0ecbe 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/ProgramResource.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/ProgramResource.java @@ -39,6 +39,7 @@ import org.eclipse.osee.ats.api.insertion.JaxInsertion; import org.eclipse.osee.ats.api.insertion.JaxInsertionActivity; import org.eclipse.osee.ats.api.program.IAtsProgram; import org.eclipse.osee.ats.api.version.IAtsVersion; +import org.eclipse.osee.ats.rest.internal.agile.operations.ProgramOperations; import org.eclipse.osee.ats.rest.util.AbstractConfigResource; import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.ArtifactToken; @@ -54,6 +55,7 @@ public class ProgramResource extends AbstractConfigResource { @Context private UriInfo uriInfo; + private ProgramOperations programOperations; public void setUriInfo(UriInfo uriInfo) { this.uriInfo = uriInfo; @@ -93,7 +95,8 @@ public class ProgramResource extends AbstractConfigResource { atsApi.getRelationResolver().getRelated(programArt, AtsRelationTypes.ProgramToInsertion_Insertion); List<IAtsConfigObject> insertions = new LinkedList<>(); for (ArtifactToken insertion : results) { - insertions.add(atsApi.getConfigItemFactory().getInsertion(insertion)); + // want to make sure to reload, so use the id + insertions.add(atsApi.getProgramService().getInsertion(insertion.getId())); } // http://aruld.info/handling-generified-collections-in-jersey-jax-rs/ GenericEntity<List<IAtsConfigObject>> entity = new GenericEntity<List<IAtsConfigObject>>(insertions) { // @@ -117,10 +120,17 @@ public class ProgramResource extends AbstractConfigResource { if (artifact != null) { throw new OseeStateException("Insertion with id %d already exists", newInsertion.getId()); } - IAtsInsertion created = atsApi.getConfigItemFactory().createInsertion(programArt, newInsertion); + IAtsInsertion created = getProgramOperations().createInsertion(programArt, newInsertion); return getResponse(created); } + ProgramOperations getProgramOperations() { + if (programOperations == null) { + programOperations = new ProgramOperations(atsApi); + } + return programOperations; + } + @PUT @Path("{programId}/insertion") @Consumes(MediaType.APPLICATION_JSON) @@ -135,7 +145,7 @@ public class ProgramResource extends AbstractConfigResource { } Response response = null; if (!insertionArt.getName().equals(insertion.getName())) { - IAtsConfigObject updated = atsApi.getConfigItemFactory().updateInsertion(insertion); + IAtsConfigObject updated = getProgramOperations().updateInsertion(insertion); response = Response.ok().entity(updated).build(); } else { response = Response.notModified().build(); @@ -151,13 +161,14 @@ public class ProgramResource extends AbstractConfigResource { if (configArt == null) { throw new OseeCoreException("Given id not found"); } - return Response.ok().entity(atsApi.getConfigItemFactory().getInsertion(configArt)).build(); + // want to make sure to reload, so use the id + return Response.ok().entity(atsApi.getProgramService().getInsertion(configArt.getId())).build(); } @DELETE @Path("{programId}/insertion/{insertionId}") public Response deleteInsertion(@PathParam("insertionId") ArtifactId insertionId) { - atsApi.getConfigItemFactory().deleteInsertion(insertionId); + getProgramOperations().deleteInsertion(insertionId); return Response.ok().build(); } @@ -177,7 +188,7 @@ public class ProgramResource extends AbstractConfigResource { AtsRelationTypes.InsertionToInsertionActivity_InsertionActivity); List<IAtsConfigObject> insertionActivitys = new LinkedList<>(); for (ArtifactToken insertionActivity : results) { - insertionActivitys.add(atsApi.getConfigItemFactory().getInsertionActivity(insertionActivity)); + insertionActivitys.add(atsApi.getProgramService().getInsertionActivityById(insertionActivity)); } // http://aruld.info/handling-generified-collections-in-jersey-jax-rs/ GenericEntity<List<IAtsConfigObject>> entity = new GenericEntity<List<IAtsConfigObject>>(insertionActivitys) { // @@ -201,7 +212,7 @@ public class ProgramResource extends AbstractConfigResource { if (artifact != null) { throw new OseeStateException("Insertion Activity with id %d already exists", newActivity.getId()); } - IAtsInsertionActivity created = atsApi.getConfigItemFactory().createInsertionActivity(insertion, newActivity); + IAtsInsertionActivity created = getProgramOperations().createInsertionActivity(insertion, newActivity); return getResponse(created); } @@ -219,7 +230,7 @@ public class ProgramResource extends AbstractConfigResource { } Response response = null; if (!insertionActivityArt.getName().equals(newActivity.getName())) { - IAtsConfigObject updated = atsApi.getConfigItemFactory().updateInsertionActivity(newActivity); + IAtsConfigObject updated = getProgramOperations().updateInsertionActivity(newActivity); response = Response.ok().entity(updated).build(); } else { response = Response.notModified().build(); @@ -231,13 +242,13 @@ public class ProgramResource extends AbstractConfigResource { @Path("{programId}/insertion/{insertionId}/activity/{iaId}") @Produces(MediaType.APPLICATION_JSON) public Response getInsertionActivityDetails(@PathParam("programId") long programId, @PathParam("insertionId") long insertionId, @PathParam("iaId") ArtifactId iaId) { - return Response.ok().entity(atsApi.getConfigItemFactory().getInsertionActivity(iaId)).build(); + return Response.ok().entity(atsApi.getProgramService().getInsertionActivityById(iaId)).build(); } @DELETE @Path("{programId}/insertion/{insertionId}/activity/{iaId}") public Response deleteInsertionActivity(@PathParam("iaId") ArtifactId iaId) { - atsApi.getConfigItemFactory().deleteInsertionActivity(iaId); + getProgramOperations().deleteInsertionActivity(iaId); return Response.ok().build(); } diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsRelationResolverServiceImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsRelationResolverServiceImpl.java index f6be503fd5c..523287356dd 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsRelationResolverServiceImpl.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsRelationResolverServiceImpl.java @@ -17,8 +17,8 @@ import java.util.List; import org.eclipse.osee.ats.api.AtsApi; import org.eclipse.osee.ats.api.IAtsObject; import org.eclipse.osee.ats.api.IAtsWorkItem; -import org.eclipse.osee.ats.api.data.AtsArtifactTypes; import org.eclipse.osee.ats.core.util.AbstractRelationResolverServiceImpl; +import org.eclipse.osee.ats.core.util.AtsObjects; import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.ArtifactToken; import org.eclipse.osee.framework.core.data.IArtifactType; @@ -60,7 +60,7 @@ public class AtsRelationResolverServiceImpl extends AbstractRelationResolverServ ArtifactReadable useArt = getArtifact(atsObject); if (useArt != null) { for (ArtifactReadable art : useArt.getRelated(relationType, flag)) { - IAtsObject object = getAtsObject(art); + IAtsObject object = AtsObjects.getAtsObject(art, atsApi); if (object != null) { results.add((T) object); } @@ -109,7 +109,7 @@ public class AtsRelationResolverServiceImpl extends AbstractRelationResolverServ try { ArtifactReadable artifact = art.getRelated(relationType).getOneOrNull(); if (artifact != null) { - IAtsObject object = getAtsObject(artifact); + IAtsObject object = AtsObjects.getAtsObject(artifact, atsApi); if (object != null) { related = (T) object; } @@ -121,18 +121,6 @@ public class AtsRelationResolverServiceImpl extends AbstractRelationResolverServ return related; } - private IAtsObject getAtsObject(ArtifactReadable artifact) { - IAtsObject result = null; - if (artifact.isOfType(AtsArtifactTypes.AbstractWorkflowArtifact)) { - result = atsApi.getWorkItemService().getWorkItem(artifact); - } else if (atsApi.getConfigItemFactory().isAtsConfigArtifact(artifact)) { - result = atsApi.getConfigItemFactory().getConfigObject(artifact); - } else if (artifact.isOfType(AtsArtifactTypes.Action)) { - result = atsApi.getWorkItemService().getAction(artifact); - } - return result; - } - @Override public ArtifactReadable getArtifact(Object object) { ArtifactReadable useArt = null; diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/AtsRuleEndpointImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/AtsRuleEndpointImpl.java index d0195836bb4..40fe3c10f39 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/AtsRuleEndpointImpl.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/AtsRuleEndpointImpl.java @@ -92,8 +92,7 @@ public class AtsRuleEndpointImpl implements AtsRuleEndpointApi { if (!ruleList.contains(setRuleData.getRuleName())) { IAtsChangeSet changes = atsApi.getStoreService().createAtsChangeSet("Update artifact with Rule", AtsCoreUsers.SYSTEM_USER); - changes.addAttribute(atsApi.getConfigItemFactory().getConfigObject(artifact), AtsAttributeTypes.RuleDefinition, - setRuleData.getRuleName()); + changes.addAttribute(artifact, AtsAttributeTypes.RuleDefinition, setRuleData.getRuleName()); changes.execute(); IAtsConfigObject atsObject = atsApi.getCache().getAtsObject(setRuleData.getConfigItemId()); atsApi.getCache().deCacheAtsObject(atsObject); diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/ConfigItemFactory.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/ConfigItemFactory.java deleted file mode 100644 index 8f6d92c3648..00000000000 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/ConfigItemFactory.java +++ /dev/null @@ -1,328 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ats.rest.internal.workitem; - -import org.eclipse.osee.ats.api.AtsApi; -import org.eclipse.osee.ats.api.IAtsConfigObject; -import org.eclipse.osee.ats.api.agile.IAgileFeatureGroup; -import org.eclipse.osee.ats.api.agile.IAgileTeam; -import org.eclipse.osee.ats.api.ai.IAtsActionableItem; -import org.eclipse.osee.ats.api.country.IAtsCountry; -import org.eclipse.osee.ats.api.data.AtsArtifactTypes; -import org.eclipse.osee.ats.api.data.AtsRelationTypes; -import org.eclipse.osee.ats.api.ev.IAtsWorkPackage; -import org.eclipse.osee.ats.api.insertion.IAtsInsertion; -import org.eclipse.osee.ats.api.insertion.IAtsInsertionActivity; -import org.eclipse.osee.ats.api.insertion.JaxInsertion; -import org.eclipse.osee.ats.api.insertion.JaxInsertionActivity; -import org.eclipse.osee.ats.api.program.IAtsProgram; -import org.eclipse.osee.ats.api.team.IAtsTeamDefinition; -import org.eclipse.osee.ats.api.util.IAtsChangeSet; -import org.eclipse.osee.ats.api.version.IAtsVersion; -import org.eclipse.osee.ats.core.config.AbstractConfigItemFactory; -import org.eclipse.osee.ats.core.config.ActionableItem; -import org.eclipse.osee.ats.core.config.Country; -import org.eclipse.osee.ats.core.config.Program; -import org.eclipse.osee.ats.core.config.TeamDefinition; -import org.eclipse.osee.ats.core.config.Version; -import org.eclipse.osee.ats.core.insertion.Insertion; -import org.eclipse.osee.ats.core.insertion.InsertionActivity; -import org.eclipse.osee.ats.core.model.WorkPackage; -import org.eclipse.osee.framework.core.data.ArtifactId; -import org.eclipse.osee.framework.core.data.IArtifactType; -import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; -import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.framework.jdk.core.util.Lib; -import org.eclipse.osee.logger.Log; -import org.eclipse.osee.orcs.OrcsApi; -import org.eclipse.osee.orcs.data.ArtifactReadable; -import org.eclipse.osee.orcs.search.QueryBuilder; -import org.eclipse.osee.orcs.transaction.TransactionBuilder; - -/** - * @author Donald G. Dunne - * @author David W. Miller - */ -public class ConfigItemFactory extends AbstractConfigItemFactory { - - private final Log logger; - private final AtsApi atsApi; - private final OrcsApi orcsApi; - - public ConfigItemFactory(Log logger, AtsApi atsApi, OrcsApi orcsApi) { - this.logger = logger; - this.atsApi = atsApi; - this.orcsApi = orcsApi; - } - - @Override - public IAtsConfigObject getConfigObject(ArtifactId artifact) { - if (artifact instanceof IAtsConfigObject) { - return (IAtsConfigObject) artifact; - } else if (artifact instanceof ArtifactReadable) { - return getConfigObject((ArtifactReadable) artifact); - } - QueryBuilder query = orcsApi.getQueryFactory().fromBranch(atsApi.getAtsBranch()); - return getConfigObject(query.andId(artifact).getResults().getExactlyOne()); - } - - private IAtsConfigObject getConfigObject(ArtifactReadable artifact) { - IAtsConfigObject configObject; - if (artifact.isOfType(AtsArtifactTypes.Version)) { - configObject = getVersion(artifact); - } else if (artifact.isOfType(AtsArtifactTypes.TeamDefinition)) { - configObject = getTeamDef(artifact); - } else if (artifact.isOfType(AtsArtifactTypes.ActionableItem)) { - configObject = getActionableItem(artifact); - } else if (artifact.isOfType(AtsArtifactTypes.Program)) { - configObject = getProgram(artifact); - } else if (artifact.isOfType(AtsArtifactTypes.AgileTeam)) { - configObject = getAgileTeam(artifact); - } else if (artifact.isOfType(AtsArtifactTypes.AgileFeatureGroup)) { - configObject = getAgileFeatureGroup(artifact); - } else if (artifact.isOfType(AtsArtifactTypes.Insertion)) { - configObject = getInsertion(artifact); - } else if (artifact.isOfType(AtsArtifactTypes.InsertionActivity)) { - configObject = getInsertionActivity(artifact); - } else if (artifact.isOfType(AtsArtifactTypes.Country)) { - configObject = getCountry(artifact); - } else if (artifact.isOfType(AtsArtifactTypes.WorkPackage)) { - configObject = getWorkPackage(artifact); - } else { - throw new OseeArgumentException("Unexpected artifact type [%s]", artifact.getArtifactTypeId()); - } - return configObject; - } - - @Override - public IAtsWorkPackage getWorkPackage(ArtifactId artifact) { - IAtsWorkPackage workPackage = null; - if (artifact instanceof ArtifactReadable) { - ArtifactReadable art = (ArtifactReadable) artifact; - if (art.isOfType(AtsArtifactTypes.WorkPackage)) { - workPackage = new WorkPackage(logger, art, atsApi); - } - } - return workPackage; - } - - @Override - public IAtsVersion getVersion(ArtifactId artifact) { - IAtsVersion version = null; - if (artifact instanceof ArtifactReadable) { - ArtifactReadable artRead = (ArtifactReadable) artifact; - if (artRead.isOfType(AtsArtifactTypes.Version)) { - version = new Version(logger, atsApi, artRead); - } - } - return version; - } - - @Override - public IAtsTeamDefinition getTeamDef(ArtifactId artifact) { - IAtsTeamDefinition teamDef = null; - if (artifact instanceof ArtifactReadable) { - ArtifactReadable artRead = (ArtifactReadable) artifact; - if (artRead.isOfType(AtsArtifactTypes.TeamDefinition)) { - teamDef = new TeamDefinition(logger, atsApi, artRead); - } - } - return teamDef; - } - - @Override - public IAtsActionableItem getActionableItem(ArtifactId artifact) { - IAtsActionableItem ai = null; - if (artifact instanceof ArtifactReadable) { - ArtifactReadable artRead = (ArtifactReadable) artifact; - if (artRead.isOfType(AtsArtifactTypes.ActionableItem)) { - ai = new ActionableItem(logger, atsApi, artRead); - } - } - return ai; - } - - @Override - public IAtsProgram getProgram(ArtifactId artifact) { - Program program = null; - if (artifact instanceof ArtifactReadable) { - ArtifactReadable artRead = (ArtifactReadable) artifact; - if (artRead.isOfType(AtsArtifactTypes.Program)) { - program = new Program(logger, atsApi, artRead); - } - } - return program; - } - - @Override - public IAgileTeam getAgileTeam(ArtifactId artifact) { - IAgileTeam agileTeam = null; - if (artifact instanceof ArtifactReadable) { - ArtifactReadable artRead = (ArtifactReadable) artifact; - if (artRead.isOfType(AtsArtifactTypes.AgileTeam)) { - agileTeam = atsApi.getAgileService().getAgileTeam(artRead); - } - } - return agileTeam; - } - - @Override - public IAgileFeatureGroup getAgileFeatureGroup(ArtifactId artifact) { - IAgileFeatureGroup agileTeam = null; - if (artifact instanceof ArtifactReadable) { - ArtifactReadable artRead = (ArtifactReadable) artifact; - if (artRead.isOfType(AtsArtifactTypes.AgileFeatureGroup)) { - agileTeam = atsApi.getAgileService().getAgileFeatureGroup(artRead); - } - } - return agileTeam; - } - - @Override - public IAtsInsertion getInsertion(ArtifactId artifact) { - Insertion insertion = null; - if (artifact instanceof ArtifactReadable) { - ArtifactReadable artRead = (ArtifactReadable) artifact; - if (artRead.isOfType(AtsArtifactTypes.Insertion)) { - insertion = new Insertion(logger, atsApi, artRead); - ArtifactReadable programArt = - ((ArtifactReadable) artifact).getRelated(AtsRelationTypes.ProgramToInsertion_Program).getOneOrNull(); - if (programArt != null) { - insertion.setProgramId(programArt.getId()); - } - } else { - throw new OseeCoreException("Requested id not Insertion"); - } - } - return insertion; - } - - @Override - public IAtsInsertionActivity getInsertionActivity(ArtifactId artifact) { - InsertionActivity insertionActivity = null; - if (artifact instanceof ArtifactReadable) { - ArtifactReadable artRead = (ArtifactReadable) artifact; - if (artRead.isOfType(AtsArtifactTypes.InsertionActivity)) { - insertionActivity = new InsertionActivity(logger, atsApi, artRead); - ArtifactReadable insertionArt = ((ArtifactReadable) artifact).getRelated( - AtsRelationTypes.InsertionToInsertionActivity_Insertion).getOneOrNull(); - if (insertionArt != null) { - insertionActivity.setInsertionId(insertionArt.getId()); - } - } else { - throw new OseeCoreException("Requested id not Insertion Activity"); - } - } - return insertionActivity; - } - - @Override - public IAtsInsertion createInsertion(ArtifactId programArtifact, JaxInsertion newInsertion) { - - long id = newInsertion.getId(); - if (id <= 0) { - id = Lib.generateArtifactIdAsInt(); - } - IAtsChangeSet changes = - atsApi.getStoreService().createAtsChangeSet("Create new Insertion", atsApi.getUserService().getCurrentUser()); - ArtifactReadable insertionArt = - (ArtifactReadable) changes.createArtifact(AtsArtifactTypes.Insertion, newInsertion.getName(), id); - - changes.relate(programArtifact, AtsRelationTypes.ProgramToInsertion_Insertion, insertionArt); - changes.execute(); - return getInsertion(insertionArt); - } - - @Override - public IAtsInsertion updateInsertion(JaxInsertion updatedInsertion) { - IAtsChangeSet changes = - atsApi.getStoreService().createAtsChangeSet("Update Insertion", atsApi.getUserService().getCurrentUser()); - changes.setSoleAttributeValue(ArtifactId.valueOf(updatedInsertion.getId()), CoreAttributeTypes.Name, - updatedInsertion.getName()); - changes.execute(); - return getInsertion(atsApi.getQueryService().getArtifact(updatedInsertion.getId())); - } - - @Override - public void deleteInsertion(ArtifactId artifact) { - deleteConfigObject(artifact, "Delete Insertion", AtsArtifactTypes.Insertion); - } - - @Override - public IAtsInsertionActivity createInsertionActivity(ArtifactId insertion, JaxInsertionActivity newActivity) { - long id = newActivity.getId(); - if (id <= 0) { - id = Lib.generateArtifactIdAsInt(); - } - IAtsChangeSet changes = atsApi.getStoreService().createAtsChangeSet("Create new Insertion Activity", - atsApi.getUserService().getCurrentUser()); - ArtifactReadable insertionActivityArt = - (ArtifactReadable) changes.createArtifact(AtsArtifactTypes.InsertionActivity, newActivity.getName(), id); - - changes.relate(insertion, AtsRelationTypes.InsertionToInsertionActivity_InsertionActivity, insertionActivityArt); - changes.execute(); - return getInsertionActivity(insertionActivityArt); - } - - @Override - public IAtsInsertionActivity updateInsertionActivity(JaxInsertionActivity updatedActivity) { - IAtsChangeSet changes = - atsApi.getStoreService().createAtsChangeSet("Update Insertion", atsApi.getUserService().getCurrentUser()); - ArtifactReadable insertionActivityArt = - (ArtifactReadable) atsApi.getQueryService().getArtifact(updatedActivity.getId()); - - changes.setSoleAttributeValue(insertionActivityArt, CoreAttributeTypes.Name, updatedActivity.getName()); - changes.setSoleAttributeValue(ArtifactId.valueOf(updatedActivity.getId()), CoreAttributeTypes.Name, - updatedActivity.getName()); - changes.execute(); - return getInsertionActivity(atsApi.getQueryService().getArtifact(updatedActivity.getId())); - } - - @Override - public void deleteInsertionActivity(ArtifactId artifact) { - deleteConfigObject(artifact, "Delete Insertion Activity", AtsArtifactTypes.InsertionActivity); - } - - private void deleteConfigObject(ArtifactId id, String comment, IArtifactType type) { - ArtifactReadable toDelete = (ArtifactReadable) atsApi.getQueryService().getArtifact(id); - if (toDelete == null) { - throw new OseeCoreException("No object found for id %s", id); - } - - if (!toDelete.isTypeEqual(type)) { - throw new OseeCoreException("Artifact type does not match for %s", comment); - } - TransactionBuilder transaction = - orcsApi.getTransactionFactory().createTransaction(atsApi.getAtsBranch(), toDelete, comment); - transaction.deleteArtifact(toDelete); - transaction.commit(); - } - - @Override - public boolean isAtsConfigArtifact(ArtifactId artifact) { - return getAtsConfigArtifactTypes().contains(((ArtifactReadable) artifact).getArtifactTypeId()); - } - - @Override - public IAtsCountry getCountry(ArtifactId artifact) { - IAtsCountry country = null; - if (artifact instanceof ArtifactReadable) { - ArtifactReadable artRead = (ArtifactReadable) artifact; - if (artRead.isOfType(AtsArtifactTypes.Country)) { - country = new Country(logger, atsApi, artRead); - } else { - throw new OseeCoreException("Requested id not Country"); - } - } - return country; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/util/AbstractConfigResource.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/util/AbstractConfigResource.java index de1fc8da84b..124aa6a6450 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/util/AbstractConfigResource.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/util/AbstractConfigResource.java @@ -19,6 +19,7 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import org.eclipse.osee.ats.api.AtsApi; import org.eclipse.osee.ats.api.IAtsConfigObject; +import org.eclipse.osee.ats.core.util.AtsObjects; import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.ArtifactToken; import org.eclipse.osee.framework.core.data.ArtifactTypeId; @@ -52,8 +53,8 @@ public abstract class AbstractConfigResource { @Produces(MediaType.APPLICATION_JSON) public List<IAtsConfigObject> getObjectsJson() { List<IAtsConfigObject> configs = new ArrayList<>(); - for (ArtifactId art : query.andTypeEquals(artifactType).getResults()) { - configs.add(atsApi.getConfigItemFactory().getConfigObject(art)); + for (ArtifactToken art : query.andTypeEquals(artifactType).getResults()) { + configs.add(AtsObjects.getConfigObject(art, atsApi)); } return configs; } @@ -69,6 +70,6 @@ public abstract class AbstractConfigResource { @Path("{id}/details") @Produces(MediaType.APPLICATION_JSON) public IAtsConfigObject getObjectDetails(@PathParam("id") ArtifactId artifactId) { - return atsApi.getConfigItemFactory().getConfigObject(artifactId); + return AtsObjects.getConfigObject(atsApi.getQueryService().getArtifact(artifactId), atsApi); } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/wizard/AbstractWizardItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/wizard/AbstractWizardItem.java index 0104921c5ad..36ddbb6138f 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/wizard/AbstractWizardItem.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/wizard/AbstractWizardItem.java @@ -284,7 +284,7 @@ public abstract class AbstractWizardItem implements IAtsWizardItem, IDynamicWidg List<IAgileFeatureGroup> featureGroups = new LinkedList<>(); for (ArtifactToken featureGroupArt : atsApi.getRelationResolver().getRelated(agileTeam, AtsRelationTypes.AgileTeamToFeatureGroup_FeatureGroup)) { - IAgileFeatureGroup featureGroup = atsApi.getConfigItemFactory().getAgileFeatureGroup(featureGroupArt); + IAgileFeatureGroup featureGroup = atsApi.getAgileService().getAgileFeatureGroup(featureGroupArt); featureGroups.add(featureGroup); } if (!featureGroups.isEmpty()) { @@ -394,7 +394,7 @@ public abstract class AbstractWizardItem implements IAtsWizardItem, IDynamicWidg ArtifactToken agileTeamArt = AtsClientService.get().getRelationResolver().getRelatedOrNull(teamDef, AtsRelationTypes.AgileTeamToAtsTeam_AgileTeam); if (agileTeamArt != null) { - IAgileTeam agileTeam = AtsClientService.get().getConfigItemFactory().getAgileTeam(agileTeamArt); + IAgileTeam agileTeam = AtsClientService.get().getAgileService().getAgileTeam(agileTeamArt); AttributeTypeId agileTeamPointsAttributeType = AtsClientService.get().getAgileService().getAgileTeamPointsAttributeType(agileTeam); XWidget widget = (XWidget) teamDefFieldToWidget.get(teamDef, agileTeamPointsAttributeType.equals( diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/wizard/NewActionPage1.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/wizard/NewActionPage1.java index 23d3619534f..103a995aa82 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/wizard/NewActionPage1.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/wizard/NewActionPage1.java @@ -206,7 +206,8 @@ public class NewActionPage1 extends WizardPage { try { ((XText) getXWidget(TITLE)).set("tt"); if (atsAi == null) { - atsAi = AtsClientService.get().getConfigItem(AtsArtifactToken.TopActionableItem); + atsAi = AtsClientService.get().getActionableItemService().getActionableItemById( + AtsArtifactToken.TopActionableItem); if (atsAi != null) { treeViewer.getViewer().setSelection(new StructuredSelection(Arrays.asList(atsAi))); treeViewer.setInitalChecked(Arrays.asList(atsAi)); diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/agile/AgileFeatureGroupColumn.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/agile/AgileFeatureGroupColumn.java index e32a7e02931..2b16faecd77 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/agile/AgileFeatureGroupColumn.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/agile/AgileFeatureGroupColumn.java @@ -176,8 +176,7 @@ public class AgileFeatureGroupColumn extends XViewerAtsColumn implements IAtsXVi if (awas.size() == 1) { for (Artifact featureArt : awas.iterator().next().getRelatedArtifacts( AtsRelationTypes.AgileFeatureToItem_FeatureGroup)) { - IAgileFeatureGroup featureGroup = - AtsClientService.get().getConfigItemFactory().getAgileFeatureGroup(featureArt); + IAgileFeatureGroup featureGroup = AtsClientService.get().getAgileService().getAgileFeatureGroup(featureArt); if (featureGroup.isActive()) { selected.add(createJaxAgileFeatureGroupFromAgileFeatureGroup(featureGroup)); } diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsConfig2DataExample.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsConfig2DataExample.java index df0a86d9e15..f9664896772 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsConfig2DataExample.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsConfig2DataExample.java @@ -47,7 +47,7 @@ public class AtsConfig2DataExample extends AbstractAtsConfig2Data { @Override public void performPostConfig(IAtsChangeSet changes, AbstractAtsConfig2Data data) { Artifact dtsSoftwareArt = ArtifactQuery.getArtifactFromToken(Software_Team); - IAtsTeamDefinition dtsSoftwareTeam = AtsClientService.get().getConfigItemFactory().getTeamDef(dtsSoftwareArt); + IAtsTeamDefinition dtsSoftwareTeam = AtsClientService.get().getTeamDefinitionService().getTeamDefinitionById(dtsSoftwareArt); changes.setSoleAttributeValue(dtsSoftwareTeam, ConvertAtsConfigGuidAttributesOperations.RelatedTaskWorkDefinition, AtsArtifactToken.WorkDef_Task_AtsConfig2Example.getName()); diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsDatabaseConfig.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsDatabaseConfig.java index cebbcae642f..19aa2897cbc 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsDatabaseConfig.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsDatabaseConfig.java @@ -55,7 +55,8 @@ public class AtsDatabaseConfig implements IDbInitializationTask { // load top team into cache Artifact topTeamDefArt = ArtifactQuery.getArtifactFromToken(AtsArtifactToken.TopTeamDefinition); - IAtsTeamDefinition teamDef = AtsClientService.get().getConfigItem(topTeamDefArt); + IAtsTeamDefinition teamDef = + AtsClientService.get().getTeamDefinitionService().getTeamDefinitionById(topTeamDefArt); IAtsChangeSet changes = AtsClientService.get().createChangeSet("Set Top Team Work Definition"); AtsClientService.get().getWorkDefinitionService().setWorkDefinitionAttrs(teamDef, @@ -64,7 +65,7 @@ public class AtsDatabaseConfig implements IDbInitializationTask { // load top ai into cache Artifact topAiArt = ArtifactQuery.getArtifactFromToken(AtsArtifactToken.TopActionableItem); - IAtsActionableItem aia = AtsClientService.get().getConfigItem(topAiArt); + IAtsActionableItem aia = AtsClientService.get().getActionableItemService().getActionableItemById(topAiArt); changes.setSoleAttributeValue(aia, AtsAttributeTypes.Actionable, false); changes.execute(); diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/copy/CopyAtsConfigurationOperation.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/copy/CopyAtsConfigurationOperation.java index 452118d4a1f..166e5a056d8 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/copy/CopyAtsConfigurationOperation.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/copy/CopyAtsConfigurationOperation.java @@ -122,7 +122,7 @@ public class CopyAtsConfigurationOperation extends AbstractOperation { // Get or create new team definition Artifact newAiArt = duplicateTeamDefinitionOrActionableItem(changes, fromAiArt); changes.add(newAiArt); - IAtsActionableItem newAi = AtsClientService.get().getConfigItem(newAiArt); + IAtsActionableItem newAi = AtsClientService.get().getActionableItemService().getActionableItemById(newAiArt); changes.relate(parentAiArt, CoreRelationTypes.Default_Hierarchical__Child, newAi); existingArtifacts.add(parentAiArt); newArtifacts.add(newAiArt); @@ -145,8 +145,10 @@ public class CopyAtsConfigurationOperation extends AbstractOperation { // Handle all children for (Artifact childFromAiArt : fromAiArt.getChildren()) { if (childFromAiArt.isOfType(AtsArtifactTypes.ActionableItem)) { - IAtsActionableItem childAi = AtsClientService.get().getConfigItem(childFromAiArt); - IAtsActionableItem newChildAi = AtsClientService.get().getConfigItem(newAiArt); + IAtsActionableItem childAi = + AtsClientService.get().getActionableItemService().getActionableItemById(childFromAiArt); + IAtsActionableItem newChildAi = + AtsClientService.get().getActionableItemService().getActionableItemById(newAiArt); createActionableItems(changes, childAi, newChildAi); } } @@ -160,7 +162,8 @@ public class CopyAtsConfigurationOperation extends AbstractOperation { Artifact newTeamDefArt = duplicateTeamDefinitionOrActionableItem(changes, fromTeamDefArt); changes.add(newTeamDefArt); - IAtsTeamDefinition newTeamDef = AtsClientService.get().getConfigItem(newTeamDefArt); + IAtsTeamDefinition newTeamDef = + AtsClientService.get().getTeamDefinitionService().getTeamDefinitionById(newTeamDefArt); parentTeamDefArt.addChild(newTeamDefArt); changes.add(parentTeamDefArt); @@ -173,7 +176,8 @@ public class CopyAtsConfigurationOperation extends AbstractOperation { // handle all children for (Artifact childFromTeamDefArt : fromTeamDefArt.getChildren()) { if (childFromTeamDefArt.isOfType(AtsArtifactTypes.TeamDefinition)) { - IAtsTeamDefinition childFromTeamDef = AtsClientService.get().getConfigItem(childFromTeamDefArt); + IAtsTeamDefinition childFromTeamDef = + AtsClientService.get().getTeamDefinitionService().getTeamDefinitionById(childFromTeamDefArt); AtsClientService.get().getCache().getAtsObject(childFromTeamDefArt.getId()); createTeamDefinitions(changes, childFromTeamDef, newTeamDef); } diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/ev/SearchWorkPackageOperation.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/ev/SearchWorkPackageOperation.java index ea69a3fcc46..c8bda474280 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/ev/SearchWorkPackageOperation.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/ev/SearchWorkPackageOperation.java @@ -105,7 +105,7 @@ public class SearchWorkPackageOperation extends AbstractOperation { Set<IAtsWorkPackage> resultWorkPgks = new HashSet<>(); for (Artifact art : results) { resultWorkPgks.add( - new WorkPackage(AtsClientService.get().getLogger(), art, AtsClientService.get().getServices())); + new WorkPackage(AtsClientService.get().getLogger(), AtsClientService.get().getServices(), art)); } return resultWorkPgks; } diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/ev/WorkPackageSearchProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/ev/WorkPackageSearchProvider.java index 6953ec5df30..f8c664c67d2 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/ev/WorkPackageSearchProvider.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/ev/WorkPackageSearchProvider.java @@ -38,7 +38,7 @@ public class WorkPackageSearchProvider implements IWorkPackageProvider { Collection<IAtsWorkPackage> items = new LinkedList<>(); for (Artifact art : ArtifactQuery.getArtifactListFrom(selectableWorkPackageTokens, AtsClientService.get().getAtsBranch())) { - items.add(AtsClientService.get().getConfigItemFactory().getWorkPackage(art)); + items.add(AtsClientService.get().getEarnedValueService().getWorkPackage(art)); } return items; } @@ -50,7 +50,7 @@ public class WorkPackageSearchProvider implements IWorkPackageProvider { Collection<IAtsWorkPackage> items = new LinkedList<>(); for (Artifact art : ArtifactQuery.getArtifactListFrom(selectableWorkPackageTokens, AtsClientService.get().getAtsBranch())) { - items.add(AtsClientService.get().getConfigItemFactory().getWorkPackage(art)); + items.add(AtsClientService.get().getEarnedValueService().getWorkPackage(art)); } return items; } diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/SubscribeByActionableItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/SubscribeByActionableItem.java index bbc1c328dea..bbd9073f5ab 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/SubscribeByActionableItem.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/SubscribeByActionableItem.java @@ -48,7 +48,7 @@ public class SubscribeByActionableItem extends XNavigateItemAction { for (Artifact artifact : AtsClientService.get().getUserServiceClient().getCurrentOseeUser().getRelatedArtifacts( AtsRelationTypes.SubscribedUser_Artifact)) { if (artifact.isOfType(AtsArtifactTypes.ActionableItem)) { - objs.add(AtsClientService.get().getConfigItemFactory().getActionableItem(artifact)); + objs.add(AtsClientService.get().getActionableItemService().getActionableItemById(artifact)); } } diag.setInitialAias(objs); diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/SubscribeByTeamDefinition.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/SubscribeByTeamDefinition.java index e0e45a622d8..8dbd9bf7e26 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/SubscribeByTeamDefinition.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/SubscribeByTeamDefinition.java @@ -49,7 +49,7 @@ public class SubscribeByTeamDefinition extends XNavigateItemAction { for (Artifact art : AtsClientService.get().getUserServiceClient().getCurrentOseeUser().getRelatedArtifacts( AtsRelationTypes.SubscribedUser_Artifact)) { if (art.isOfType(AtsArtifactTypes.TeamDefinition)) { - objs.add((IAtsTeamDefinition) AtsClientService.get().getConfigItem(art)); + objs.add(AtsClientService.get().getTeamDefinitionService().getTeamDefinitionById(art)); } } diag.setInitialTeamDefs(objs); diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/IAtsClient.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/IAtsClient.java index f2a7d52bbee..96171a1236e 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/IAtsClient.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/IAtsClient.java @@ -26,7 +26,6 @@ import org.eclipse.osee.ats.core.config.IAtsCacheProvider; import org.eclipse.osee.ats.core.config.ITeamDefinitionFactory; import org.eclipse.osee.ats.workflow.goal.GoalArtifact; import org.eclipse.osee.ats.workflow.sprint.SprintArtifact; -import org.eclipse.osee.framework.core.data.ArtifactToken; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.orcs.rest.client.OseeClient; @@ -57,10 +56,6 @@ public interface IAtsClient extends AtsApi, IAtsNotifier, IAttributeResolverProv OseeClient getOseeClient(); - <T> T getConfigItem(ArtifactToken configToken); - - <T> Collection<T> getConfigItems(ArtifactToken... configTokens); - void reloadServerAndClientCaches(); IAtsClientUtil getClientUtils(); diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsActionArtifactExtractor.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsActionArtifactExtractor.java index d74c95e0b0e..83a16788672 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsActionArtifactExtractor.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/Import/ExcelAtsActionArtifactExtractor.java @@ -112,7 +112,7 @@ public class ExcelAtsActionArtifactExtractor { Collection<IAtsActionableItem> aias = new ArrayList<>(); for (Artifact aiaArt : ArtifactQuery.getArtifactListFromTypeAndName(AtsArtifactTypes.ActionableItem, actionableItemName, AtsClientService.get().getAtsBranch())) { - IAtsActionableItem ai = AtsClientService.get().getConfigItemFactory().getActionableItem(aiaArt); + IAtsActionableItem ai = AtsClientService.get().getActionableItemService().getActionableItemById(aiaArt); if (ai != null) { aias.add(ai); } @@ -236,7 +236,7 @@ public class ExcelAtsActionArtifactExtractor { for (String actionableItemName : aData.actionableItems) { for (Artifact aiaArt : ArtifactQuery.getArtifactListFromTypeAndName(AtsArtifactTypes.ActionableItem, actionableItemName, AtsClientService.get().getAtsBranch())) { - IAtsActionableItem ai = AtsClientService.get().getConfigItemFactory().getActionableItem(aiaArt); + IAtsActionableItem ai = AtsClientService.get().getActionableItemService().getActionableItemById(aiaArt); if (ai != null) { aias.add(ai); } diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/internal/AtsClientImpl.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/internal/AtsClientImpl.java index 2d925dd17c4..757d123f426 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/internal/AtsClientImpl.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/internal/AtsClientImpl.java @@ -49,7 +49,7 @@ import org.eclipse.osee.ats.api.workflow.transition.ITransitionListener; import org.eclipse.osee.ats.branch.internal.AtsBranchServiceImpl; import org.eclipse.osee.ats.config.IAtsUserServiceClient; import org.eclipse.osee.ats.core.agile.AgileService; -import org.eclipse.osee.ats.core.ai.ActionableItemService; +import org.eclipse.osee.ats.core.ai.ActionableItemServiceImpl; import org.eclipse.osee.ats.core.config.ActionableItem; import org.eclipse.osee.ats.core.config.IActionableItemFactory; import org.eclipse.osee.ats.core.config.ITeamDefinitionFactory; @@ -81,7 +81,6 @@ import org.eclipse.osee.ats.workflow.task.internal.AtsTaskService; import org.eclipse.osee.ats.workflow.transition.TransitionListeners; import org.eclipse.osee.framework.core.client.OseeClientProperties; import org.eclipse.osee.framework.core.data.ArtifactId; -import org.eclipse.osee.framework.core.data.ArtifactToken; import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; import org.eclipse.osee.framework.core.enums.DeletionFlag; @@ -127,8 +126,6 @@ public class AtsClientImpl extends AtsApiImpl implements IAtsClient { workDefinitionDslService, teamWorkflowProvidersLazy); earnedValueService = new AtsEarnedValueImpl(logger, this); - configItemFactory = new ConfigItemFactory(logger, this); - actionableItemFactory = new ActionableItemFactory(); teamDefFactory = new TeamDefinitionFactory(); versionFactory = new VersionFactory(); @@ -143,7 +140,7 @@ public class AtsClientImpl extends AtsApiImpl implements IAtsClient { storeService = new AtsStoreService(this, getUserServiceClient(), jdbcService); queryService = new AtsQueryServiceImpl(this, jdbcService); - actionableItemManager = new ActionableItemService(attributeResolverService, storeService, this); + actionableItemManager = new ActionableItemServiceImpl(attributeResolverService, storeService, this); actionFactory = new ActionFactory(sequenceProvider, actionableItemManager, attributeResolverService, stateFactory, this); @@ -442,24 +439,6 @@ public class AtsClientImpl extends AtsApiImpl implements IAtsClient { return getConfigService().getConfigurations().getWorkDefinitionsData(); } - @SuppressWarnings("unchecked") - @Override - public <T> T getConfigItem(ArtifactToken configToken) { - return (T) getConfigItemFactory().getConfigObject(configToken); - } - - @Override - public <T> Collection<T> getConfigItems(ArtifactToken... configTokens) { - List<T> results = new LinkedList<>(); - for (ArtifactToken art : configTokens) { - T configItem = getConfigItem(art); - if (configItem != null) { - results.add(configItem); - } - } - return results; - } - @Override public String getApplicationServerBase() { return OseeClientProperties.getOseeApplicationServer(); diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/internal/AtsConfigurationsService.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/internal/AtsConfigurationsService.java index 8aed4e17967..40649a2714b 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/internal/AtsConfigurationsService.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/internal/AtsConfigurationsService.java @@ -26,7 +26,7 @@ import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; /** * Provides client configurations through server endpoint - * + * * @author Donald G. Dunne */ public class AtsConfigurationsService implements IAtsConfigurationsService { diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/internal/ConfigItemFactory.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/internal/ConfigItemFactory.java deleted file mode 100644 index 9ad98103a44..00000000000 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/internal/ConfigItemFactory.java +++ /dev/null @@ -1,258 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ats.util.internal; - -import org.eclipse.osee.ats.api.IAtsConfigObject; -import org.eclipse.osee.ats.api.agile.IAgileFeatureGroup; -import org.eclipse.osee.ats.api.agile.IAgileTeam; -import org.eclipse.osee.ats.api.ai.IAtsActionableItem; -import org.eclipse.osee.ats.api.country.IAtsCountry; -import org.eclipse.osee.ats.api.data.AtsArtifactTypes; -import org.eclipse.osee.ats.api.ev.IAtsWorkPackage; -import org.eclipse.osee.ats.api.insertion.IAtsInsertion; -import org.eclipse.osee.ats.api.insertion.IAtsInsertionActivity; -import org.eclipse.osee.ats.api.insertion.JaxInsertion; -import org.eclipse.osee.ats.api.insertion.JaxInsertionActivity; -import org.eclipse.osee.ats.api.program.IAtsProgram; -import org.eclipse.osee.ats.api.team.IAtsTeamDefinition; -import org.eclipse.osee.ats.api.version.IAtsVersion; -import org.eclipse.osee.ats.core.agile.AgileFeatureGroup; -import org.eclipse.osee.ats.core.agile.AgileTeam; -import org.eclipse.osee.ats.core.config.AbstractConfigItemFactory; -import org.eclipse.osee.ats.core.config.ActionableItem; -import org.eclipse.osee.ats.core.config.Country; -import org.eclipse.osee.ats.core.config.Program; -import org.eclipse.osee.ats.core.config.TeamDefinition; -import org.eclipse.osee.ats.core.config.Version; -import org.eclipse.osee.ats.core.insertion.Insertion; -import org.eclipse.osee.ats.core.insertion.InsertionActivity; -import org.eclipse.osee.ats.core.model.WorkPackage; -import org.eclipse.osee.ats.internal.AtsClientService; -import org.eclipse.osee.ats.util.IAtsClient; -import org.eclipse.osee.framework.core.data.ArtifactId; -import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException; -import org.eclipse.osee.framework.skynet.core.artifact.Artifact; -import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; -import org.eclipse.osee.logger.Log; - -/** - * @author Donald G. Dunne - */ -public class ConfigItemFactory extends AbstractConfigItemFactory { - - private final IAtsClient atsClient; - private final Log logger; - - public ConfigItemFactory(Log logger, IAtsClient atsClient) { - this.logger = logger; - this.atsClient = atsClient; - } - - @Override - public IAtsConfigObject getConfigObject(ArtifactId art) { - if (art instanceof IAtsConfigObject) { - return (IAtsConfigObject) art; - } else if (art instanceof Artifact) { - return getConfigObject((Artifact) art); - } - return getConfigObject(ArtifactQuery.getArtifactFromId(art, AtsClientService.get().getAtsBranch())); - } - - private IAtsConfigObject getConfigObject(Artifact artifact) { - IAtsConfigObject configObject; - if (artifact.isOfType(AtsArtifactTypes.Program)) { - configObject = getProgram(artifact); - } else if (artifact.isOfType(AtsArtifactTypes.Version)) { - configObject = getVersion(artifact); - } else if (artifact.isOfType(AtsArtifactTypes.TeamDefinition)) { - configObject = getTeamDef(artifact); - } else if (artifact.isOfType(AtsArtifactTypes.ActionableItem)) { - configObject = getActionableItem(artifact); - } else if (artifact.isOfType(AtsArtifactTypes.AgileTeam)) { - configObject = getAgileTeam(artifact); - } else if (artifact.isOfType(AtsArtifactTypes.AgileFeatureGroup)) { - configObject = getAgileFeatureGroup(artifact); - } else if (artifact.isOfType(AtsArtifactTypes.Insertion)) { - configObject = getInsertion(artifact); - } else if (artifact.isOfType(AtsArtifactTypes.InsertionActivity)) { - configObject = getInsertionActivity(artifact); - } else if (artifact.isOfType(AtsArtifactTypes.Country)) { - configObject = getCountry(artifact); - } else if (artifact.isOfType(AtsArtifactTypes.WorkPackage)) { - configObject = getWorkPackage(artifact); - } else { - throw new OseeArgumentException("Unhandled artifact type %s for %s", artifact.getArtifactTypeName(), - artifact.toStringWithId()); - } - return configObject; - } - - @Override - public IAtsWorkPackage getWorkPackage(ArtifactId artifact) { - IAtsWorkPackage workPackage = null; - if (artifact instanceof Artifact) { - Artifact art = (Artifact) artifact; - if (art.isOfType(AtsArtifactTypes.WorkPackage)) { - workPackage = new WorkPackage(logger, art, atsClient.getServices()); - } - } - return workPackage; - } - - @Override - public IAtsVersion getVersion(ArtifactId artifact) { - IAtsVersion version = null; - if (artifact instanceof Artifact) { - Artifact art = (Artifact) artifact; - if (art.isOfType(AtsArtifactTypes.Version)) { - version = new Version(logger, atsClient, art); - } - } - return version; - } - - @Override - public IAtsTeamDefinition getTeamDef(ArtifactId artifact) { - IAtsTeamDefinition teamDef = null; - if (artifact instanceof Artifact) { - Artifact art = (Artifact) artifact; - if (art.isOfType(AtsArtifactTypes.TeamDefinition)) { - teamDef = new TeamDefinition(logger, atsClient, art); - } - } - return teamDef; - } - - @Override - public IAtsActionableItem getActionableItem(ArtifactId artifact) { - IAtsActionableItem ai = null; - if (artifact instanceof Artifact) { - Artifact art = (Artifact) artifact; - if (art.isOfType(AtsArtifactTypes.ActionableItem)) { - ai = new ActionableItem(logger, atsClient, art); - } - } - return ai; - } - - @Override - public IAtsProgram getProgram(ArtifactId object) { - IAtsProgram program = null; - if (object instanceof IAtsProgram) { - program = (IAtsProgram) object; - } else if (object instanceof Artifact) { - Artifact art = (Artifact) object; - if (art.isOfType(AtsArtifactTypes.Program)) { - program = new Program(logger, atsClient.getServices(), art); - } - } - return program; - } - - @Override - public IAgileTeam getAgileTeam(ArtifactId artifact) { - IAgileTeam agileTeam = null; - if (artifact instanceof IAgileTeam) { - agileTeam = (IAgileTeam) artifact; - } else if (artifact instanceof Artifact && ((Artifact) artifact).isOfType(AtsArtifactTypes.AgileTeam)) { - agileTeam = new AgileTeam(logger, atsClient, (Artifact) artifact); - } - return agileTeam; - } - - @Override - public IAgileFeatureGroup getAgileFeatureGroup(ArtifactId artifact) { - IAgileFeatureGroup group = null; - if (artifact instanceof IAgileFeatureGroup) { - group = (IAgileFeatureGroup) artifact; - } else if (artifact instanceof Artifact && ((Artifact) artifact).isOfType(AtsArtifactTypes.AgileFeatureGroup)) { - group = new AgileFeatureGroup(logger, atsClient, (Artifact) artifact); - } - return group; - } - - @Override - public IAtsInsertion getInsertion(ArtifactId artifact) { - IAtsInsertion result = null; - if (artifact instanceof IAtsInsertion) { - result = (IAtsInsertion) artifact; - } else if (artifact instanceof Artifact) { - Artifact art = ((Artifact) artifact); - if (art.isOfType(AtsArtifactTypes.Insertion)) { - result = new Insertion(logger, atsClient.getServices(), art); - } - } - return result; - } - - @Override - public IAtsInsertionActivity getInsertionActivity(ArtifactId artifact) { - IAtsInsertionActivity result = null; - if (artifact instanceof IAtsInsertionActivity) { - result = (IAtsInsertionActivity) artifact; - } else if (artifact instanceof Artifact) { - Artifact art = ((Artifact) artifact); - if (art.isOfType(AtsArtifactTypes.InsertionActivity)) { - result = new InsertionActivity(logger, atsClient.getServices(), art); - } - } - return result; - } - - @Override - public IAtsInsertion createInsertion(ArtifactId teamArtifact, JaxInsertion newInsertion) { - throw new UnsupportedOperationException("createInsertion not implemented on client"); - } - - @Override - public IAtsInsertion updateInsertion(JaxInsertion newInsertion) { - throw new UnsupportedOperationException("updateInsertion not implemented on client"); - } - - @Override - public void deleteInsertion(ArtifactId artifact) { - throw new UnsupportedOperationException("deleteInsertion not implemented on client"); - } - - @Override - public IAtsInsertionActivity createInsertionActivity(ArtifactId insertion, JaxInsertionActivity newActivity) { - throw new UnsupportedOperationException("createInsertionActivity not implemented on client"); - } - - @Override - public IAtsInsertionActivity updateInsertionActivity(JaxInsertionActivity newActivity) { - throw new UnsupportedOperationException("updateInsertionActivity not implemented on client"); - } - - @Override - public void deleteInsertionActivity(ArtifactId artifact) { - throw new UnsupportedOperationException("deleteInsertionActivity not implemented on client"); - } - - @Override - public boolean isAtsConfigArtifact(ArtifactId artifact) { - return getAtsConfigArtifactTypes().contains(((Artifact) artifact).getArtifactType()); - } - - @Override - public IAtsCountry getCountry(ArtifactId artifact) { - IAtsCountry country = null; - if (artifact instanceof IAtsCountry) { - country = (IAtsCountry) artifact; - } else if (artifact instanceof Artifact) { - Artifact art = ((Artifact) artifact); - if (art.isOfType(AtsArtifactTypes.Country)) { - country = new Country(logger, atsClient.getServices(), art); - } - } - return country; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/config/ImportAIsAndTeamDefinitionsToDb.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/config/ImportAIsAndTeamDefinitionsToDb.java index f9238cfc91c..5e757843a6b 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/config/ImportAIsAndTeamDefinitionsToDb.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/config/ImportAIsAndTeamDefinitionsToDb.java @@ -153,7 +153,7 @@ public class ImportAIsAndTeamDefinitionsToDb { } if (Strings.isValid(dslTeamDef.getWorkDefinition())) { ArtifactToken workDefArt = sheetNameToArtifactIdMap.get(dslTeamDef.getWorkDefinition()); - IAtsTeamDefinition newTeamDef = AtsClientService.get().getConfigItemFactory().getTeamDef(newTeam); + IAtsTeamDefinition newTeamDef = AtsClientService.get().getTeamDefinitionService().getTeamDefinitionById(newTeam); AtsClientService.get().getWorkDefinitionService().setWorkDefinitionAttrs(newTeamDef, workDefArt, changes); } if (Strings.isValid(dslTeamDef.getTeamWorkflowArtifactType())) { diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/goal/NewActionToGoalAction.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/goal/NewActionToGoalAction.java index 3da5440f2e7..7a64433dd31 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/goal/NewActionToGoalAction.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/goal/NewActionToGoalAction.java @@ -79,7 +79,7 @@ public class NewActionToGoalAction extends Action { List<Artifact> atsTeams = agileTeam.getRelatedArtifacts(AtsRelationTypes.AgileTeamToAtsTeam_AtsTeam); for (Artifact atsTeam : atsTeams) { for (Artifact ai : atsTeam.getRelatedArtifacts(AtsRelationTypes.TeamActionableItem_ActionableItem)) { - ais.add(AtsClientService.get().getConfigItemFactory().getActionableItem(ai)); + ais.add(AtsClientService.get().getActionableItemService().getActionableItemById(ai)); } } } diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/internal/AtsRelationResolverServiceImpl.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/internal/AtsRelationResolverServiceImpl.java index b0e96f09ad9..f362f23faf0 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/internal/AtsRelationResolverServiceImpl.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/internal/AtsRelationResolverServiceImpl.java @@ -16,8 +16,8 @@ import java.util.LinkedList; import java.util.List; import org.eclipse.osee.ats.api.IAtsObject; import org.eclipse.osee.ats.api.IAtsWorkItem; -import org.eclipse.osee.ats.api.data.AtsArtifactTypes; import org.eclipse.osee.ats.core.util.AbstractRelationResolverServiceImpl; +import org.eclipse.osee.ats.core.util.AtsObjects; import org.eclipse.osee.ats.util.IAtsClient; import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.ArtifactToken; @@ -63,7 +63,7 @@ public class AtsRelationResolverServiceImpl extends AbstractRelationResolverServ Artifact useArt = getArtifact(atsObject); if (useArt != null) { for (Artifact art : useArt.getRelatedArtifacts(relationType, flag)) { - IAtsObject object = getAtsObject(art); + IAtsObject object = AtsObjects.getAtsObject(art, atsClient); if (object != null) { results.add((T) object); } @@ -72,18 +72,6 @@ public class AtsRelationResolverServiceImpl extends AbstractRelationResolverServ return results; } - private IAtsObject getAtsObject(Artifact artifact) { - IAtsObject result = null; - if (artifact instanceof IAtsWorkItem) { - result = atsClient.getWorkItemService().getWorkItem(artifact); - } else if (atsClient.getConfigItemFactory().isAtsConfigArtifact(artifact)) { - result = atsClient.getConfigItemFactory().getConfigObject(artifact); - } else if (artifact.isOfType(AtsArtifactTypes.Action)) { - result = atsClient.getWorkItemService().getAction(artifact); - } - return result; - } - @Override public Artifact getArtifact(Object object) { Artifact useArt = null; @@ -147,7 +135,7 @@ public class AtsRelationResolverServiceImpl extends AbstractRelationResolverServ try { Artifact artifact = art.getRelatedArtifact(relationType); if (artifact != null) { - IAtsObject object = getAtsObject(artifact); + IAtsObject object = AtsObjects.getAtsObject(artifact, atsClient); if (object != null) { related = (T) object; } diff --git a/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/SafetyWorkflowEventHandler.java b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/SafetyWorkflowEventHandler.java index 631e6947345..2faedff3e9b 100644 --- a/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/SafetyWorkflowEventHandler.java +++ b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/SafetyWorkflowEventHandler.java @@ -111,7 +111,8 @@ public class SafetyWorkflowEventHandler implements EventHandler { ArtifactReadable safetyActionableItemArt = (ArtifactReadable) atsServer.getQueryService().getArtifact(AtsArtifactToken.SafetyActionableItem); IAtsTeamWorkflow teamWf = atsServer.getWorkItemService().getTeamWf(workflowArt); - IAtsActionableItem actionableItem = atsServer.getConfigItemFactory().getActionableItem(safetyActionableItemArt); + IAtsActionableItem actionableItem = + atsServer.getActionableItemService().getActionableItemById(safetyActionableItemArt); for (IAtsTeamWorkflow sibling : atsServer.getActionFactory().getSiblingTeamWorkflows(teamWf)) { if (sibling.getActionableItems().contains(actionableItem)) { safetyWorkflow = sibling; |