diff options
author | donald.g.dunne | 2017-08-16 17:14:30 +0000 |
---|---|---|
committer | donald.g.dunne | 2017-08-24 18:00:54 +0000 |
commit | 3e88707316b848d449325d18f8e1bb3818427579 (patch) | |
tree | 441f641de976489089d683b8871c269a28e48f40 /plugins | |
parent | 7b881d9d05198b7f6014fee80e382b158ac7437f (diff) | |
download | org.eclipse.osee-3e88707316b848d449325d18f8e1bb3818427579.tar.gz org.eclipse.osee-3e88707316b848d449325d18f8e1bb3818427579.tar.xz org.eclipse.osee-3e88707316b848d449325d18f8e1bb3818427579.zip |
feature[ats_TW1669]: Improve ExportChangeReport for OSEE Web
Change-Id: I071a82ea4bc4f8bc8f236004899fa4cbfd3ece9b
Diffstat (limited to 'plugins')
23 files changed, 206 insertions, 24 deletions
diff --git a/plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF index 3bef2855baa..868b347b2d3 100644 --- a/plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF @@ -46,6 +46,7 @@ Import-Package: com.google.common.base, org.eclipse.osee.framework.core.enums, org.eclipse.osee.framework.core.event, org.eclipse.osee.framework.core.model, + org.eclipse.osee.framework.core.model.change, org.eclipse.osee.framework.core.util, org.eclipse.osee.framework.jdk.core.type, org.eclipse.osee.framework.jdk.core.util, diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/IAtsServices.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/IAtsServices.java index 9f071a93e45..afc3566d4e4 100644 --- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/IAtsServices.java +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/IAtsServices.java @@ -187,5 +187,5 @@ public interface IAtsServices extends IAtsEarnedValueServiceProvider, IAtsConfig IAgileService getAgileService(); - ArtifactId getArtifactByAtsId(String id); + ArtifactToken getArtifactByAtsId(String id); } diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/query/IAtsQueryService.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/query/IAtsQueryService.java index 2238aaf141d..875be36f016 100644 --- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/query/IAtsQueryService.java +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/query/IAtsQueryService.java @@ -17,7 +17,7 @@ import org.eclipse.jdt.annotation.NonNull; import org.eclipse.osee.ats.api.IAtsWorkItem; import org.eclipse.osee.ats.api.user.IAtsUser; import org.eclipse.osee.ats.api.workflow.WorkItemType; -import org.eclipse.osee.framework.core.data.ArtifactId; +import org.eclipse.osee.framework.core.data.ArtifactToken; import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.data.IArtifactType; @@ -50,12 +50,12 @@ public interface IAtsQueryService { @NonNull IAtsConfigQuery createQuery(IArtifactType... artifactType); - Collection<ArtifactId> getArtifacts(List<Integer> ids, BranchId branch); + Collection<ArtifactToken> getArtifacts(List<Integer> ids, BranchId branch); void runUpdate(String query, Object... data); IAtsOrcsScriptQuery createOrcsScriptQuery(String query, Object... data); - Collection<ArtifactId> getArtifactsFromQuery(String query, Object... data); + Collection<ArtifactToken> getArtifactsFromQuery(String query, Object... data); } diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsStoreService.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsStoreService.java index 9e2867a18a0..6d2dc9873fa 100644 --- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsStoreService.java +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsStoreService.java @@ -69,4 +69,6 @@ public interface IAtsStoreService { boolean isOfType(IAtsObject atsObject, IArtifactType artifactType); + boolean isArtifactTypeInheritsFrom(IArtifactType artifactType, IArtifactType baseArtifactType); + } diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/AtsTeamWfEndpointApi.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/AtsTeamWfEndpointApi.java new file mode 100644 index 00000000000..774ba9d4e0d --- /dev/null +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/AtsTeamWfEndpointApi.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2017 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.workflow; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import org.eclipse.osee.framework.core.model.change.CompareResults; + +/** + * @author Donald G. Dunne + */ +@Path("teamwf") +public interface AtsTeamWfEndpointApi { + + @GET + @Path("{id}/changedata") + @Produces({MediaType.APPLICATION_JSON}) + public CompareResults getChangeData(@PathParam("id") String id); + +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsBranchService.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsBranchService.java index 8d6305c9ce8..2790e5f778e 100644 --- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsBranchService.java +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsBranchService.java @@ -22,6 +22,7 @@ import org.eclipse.osee.framework.core.enums.BranchArchivedState; import org.eclipse.osee.framework.core.enums.BranchState; import org.eclipse.osee.framework.core.enums.BranchType; import org.eclipse.osee.framework.core.model.TransactionRecord; +import org.eclipse.osee.framework.core.model.change.CompareResults; import org.eclipse.osee.framework.core.util.Result; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; @@ -138,4 +139,9 @@ public interface IAtsBranchService { Collection<BranchId> getBranches(BranchArchivedState unarchived, BranchType working); ArtifactId getAssociatedArtifactId(BranchId branch); + + CompareResults getChangeData(BranchId branch); + + CompareResults getChangeData(TransactionToken transaction); + } diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsWorkItemService.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsWorkItemService.java index 0ad29d92744..fd4ba0f7660 100644 --- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsWorkItemService.java +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsWorkItemService.java @@ -57,4 +57,7 @@ public interface IAtsWorkItemService { IAtsWorkItemNotes getNotes(IAtsWorkItem workItem); ITeamWorkflowProvidersLazy getTeamWorkflowProviders(); + + IAtsWorkItem getWorkItemByAnyId(String actionId); + } diff --git a/plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF index bf896be65c9..be0f899988e 100644 --- a/plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF @@ -45,6 +45,7 @@ Import-Package: com.google.common.base, org.eclipse.osee.framework.core.exception, org.eclipse.osee.framework.core.model, org.eclipse.osee.framework.core.model.cache, + org.eclipse.osee.framework.core.model.change, org.eclipse.osee.framework.core.model.event, org.eclipse.osee.framework.core.model.type, org.eclipse.osee.framework.core.operation, diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/branch/internal/AtsBranchServiceImpl.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/branch/internal/AtsBranchServiceImpl.java index a537d0c7b40..72c5523a0a9 100644 --- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/branch/internal/AtsBranchServiceImpl.java +++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/branch/internal/AtsBranchServiceImpl.java @@ -26,6 +26,7 @@ import org.eclipse.osee.framework.core.enums.BranchState; import org.eclipse.osee.framework.core.enums.BranchType; import org.eclipse.osee.framework.core.model.TransactionRecord; import org.eclipse.osee.framework.core.model.cache.BranchFilter; +import org.eclipse.osee.framework.core.model.change.CompareResults; import org.eclipse.osee.framework.core.util.Result; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Collections; @@ -167,4 +168,15 @@ public class AtsBranchServiceImpl extends AbstractAtsBranchService { public ArtifactId getAssociatedArtifactId(BranchId branch) { return BranchManager.getAssociatedArtifactId(branch); } + + @Override + public CompareResults getChangeData(BranchId branch) { + throw new UnsupportedOperationException("Not supported on client"); + } + + @Override + public CompareResults getChangeData(TransactionToken transaction) { + throw new UnsupportedOperationException("Not supported on client"); + } + }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsStoreService.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsStoreService.java index 4b7ec5e5284..3eec45f438b 100644 --- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsStoreService.java +++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsStoreService.java @@ -190,4 +190,9 @@ public class AtsStoreService implements IAtsStoreService { return isOfType(AtsClientService.get().getArtifact(atsObject), artifactType); } + @Override + public boolean isArtifactTypeInheritsFrom(IArtifactType artifactType, IArtifactType baseArtifactType) { + return ArtifactTypeManager.inheritsFrom(artifactType, baseArtifactType); + } + }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/query/AtsQueryServiceImpl.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/query/AtsQueryServiceImpl.java index b947c8afbfb..36f336925a6 100644 --- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/query/AtsQueryServiceImpl.java +++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/query/AtsQueryServiceImpl.java @@ -34,6 +34,7 @@ import org.eclipse.osee.ats.core.query.AbstractAtsQueryService; import org.eclipse.osee.ats.core.query.AtsWorkItemFilter; import org.eclipse.osee.ats.core.util.AtsJsonFactory; import org.eclipse.osee.framework.core.data.ArtifactId; +import org.eclipse.osee.framework.core.data.ArtifactToken; import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; @@ -229,7 +230,7 @@ public class AtsQueryServiceImpl extends AbstractAtsQueryService { } @Override - public Collection<ArtifactId> getArtifacts(List<Integer> ids, BranchId branch) { + public Collection<ArtifactToken> getArtifacts(List<Integer> ids, BranchId branch) { return Collections.castAll(ArtifactQuery.getArtifactListFromIds(ids, branch)); } diff --git a/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF index 96be82cd039..824890e3334 100644 --- a/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF @@ -17,6 +17,7 @@ Import-Package: com.google.common.base, org.eclipse.osee.framework.core.enums, org.eclipse.osee.framework.core.exception, org.eclipse.osee.framework.core.model, + org.eclipse.osee.framework.core.model.change, org.eclipse.osee.framework.core.util, org.eclipse.osee.framework.jdk.core.type, org.eclipse.osee.framework.jdk.core.util, 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 bb6f3a40190..1c83280d850 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 @@ -18,6 +18,7 @@ import org.eclipse.osee.ats.api.IAtsWorkItem; import org.eclipse.osee.ats.api.data.AtsArtifactTypes; import org.eclipse.osee.ats.api.query.IAtsQueryService; import org.eclipse.osee.framework.core.data.ArtifactId; +import org.eclipse.osee.framework.core.data.ArtifactToken; import org.eclipse.osee.jdbc.JdbcService; import org.eclipse.osee.jdbc.JdbcStatement; @@ -49,7 +50,7 @@ public abstract class AbstractAtsQueryService implements IAtsQueryService { } @Override - public Collection<ArtifactId> getArtifactsFromQuery(String query, Object... data) { + public Collection<ArtifactToken> getArtifactsFromQuery(String query, Object... data) { JdbcStatement chStmt = jdbcService.getClient().getStatement(); List<Integer> ids = new LinkedList<Integer>(); try { diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsCoreServiceImpl.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsCoreServiceImpl.java index 782ce4bb4f3..f1453adbfcd 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsCoreServiceImpl.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AtsCoreServiceImpl.java @@ -547,10 +547,10 @@ public abstract class AtsCoreServiceImpl implements IAtsServices { + "attr.ATTR_TYPE_ID = 1152921504606847877 and attr.VALUE = ?"; @Override - public ArtifactId getArtifactByAtsId(String id) { - ArtifactId artifact = null; + public ArtifactToken getArtifactByAtsId(String id) { + ArtifactToken artifact = null; try { - Collection<ArtifactId> workItems = + Collection<ArtifactToken> workItems = getQueryService().getArtifactsFromQuery(ATS_ID_QUERY, getAtsBranch().getId(), id); if (!workItems.isEmpty()) { artifact = workItems.iterator().next(); 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 3d70b66d492..8bfb2a9a661 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 @@ -37,10 +37,12 @@ import org.eclipse.osee.ats.core.validator.AtsXWidgetValidateManager; import org.eclipse.osee.ats.core.workflow.note.ArtifactNote; import org.eclipse.osee.ats.core.workflow.note.AtsWorkItemNotes; import org.eclipse.osee.framework.core.data.ArtifactId; +import org.eclipse.osee.framework.core.data.ArtifactToken; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.OseeStateException; import org.eclipse.osee.framework.jdk.core.util.Collections; import org.eclipse.osee.framework.jdk.core.util.Conditions; +import org.eclipse.osee.framework.jdk.core.util.GUID; import org.eclipse.osee.framework.jdk.core.util.Strings; /** @@ -184,4 +186,21 @@ public class AtsWorkItemServiceImpl implements IAtsWorkItemService { return teamWorkflowProvidersLazy; } + @Override + public IAtsWorkItem getWorkItemByAnyId(String actionId) { + IAtsWorkItem workItem = null; + ArtifactToken artifact = null; + if (GUID.isValid(actionId)) { + artifact = services.getArtifactByGuid(actionId); + } else if (Strings.isNumeric(actionId)) { + artifact = services.getArtifact(Long.valueOf(actionId)); + } else { + artifact = services.getArtifactByAtsId(actionId); + } + if (artifact != null) { + workItem = services.getWorkItemFactory().getWorkItem(artifact); + } + return workItem; + } + } diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsApplication.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsApplication.java index c2f5aa77c6b..4ce0aa7e42c 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsApplication.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsApplication.java @@ -39,6 +39,7 @@ import org.eclipse.osee.ats.rest.internal.workitem.ActionUiResource; import org.eclipse.osee.ats.rest.internal.workitem.AtsActionEndpointImpl; import org.eclipse.osee.ats.rest.internal.workitem.AtsRuleEndpointImpl; import org.eclipse.osee.ats.rest.internal.workitem.AtsTaskEndpointImpl; +import org.eclipse.osee.ats.rest.internal.workitem.AtsTeamWfEndpointImpl; import org.eclipse.osee.ats.rest.internal.workitem.AtsWorkPackageEndpointImpl; import org.eclipse.osee.ats.rest.internal.workitem.StateResource; import org.eclipse.osee.ats.rest.internal.world.WorldResource; @@ -119,6 +120,7 @@ public class AtsApplication extends Application { singletons.add(new AtsTaskEndpointImpl(atsServer)); singletons.add(new AtsNotifyEndpointImpl(atsServer)); singletons.add(new AtsWorkPackageEndpointImpl(atsServer, logger)); + singletons.add(new AtsTeamWfEndpointImpl(atsServer)); // UIs singletons.add(new ActionUiResource(atsServer, logger)); diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/query/AtsQueryServiceImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/query/AtsQueryServiceImpl.java index 8ab6fbc5979..f992258a9bc 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/query/AtsQueryServiceImpl.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/query/AtsQueryServiceImpl.java @@ -25,7 +25,7 @@ import org.eclipse.osee.ats.api.workflow.WorkItemType; import org.eclipse.osee.ats.core.query.AbstractAtsQueryService; import org.eclipse.osee.ats.core.query.AtsWorkItemFilter; import org.eclipse.osee.ats.rest.IAtsServer; -import org.eclipse.osee.framework.core.data.ArtifactId; +import org.eclipse.osee.framework.core.data.ArtifactToken; import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.jdk.core.util.Collections; @@ -96,7 +96,7 @@ public class AtsQueryServiceImpl extends AbstractAtsQueryService { } @Override - public Collection<ArtifactId> getArtifacts(List<Integer> ids, BranchId branch) { + public Collection<ArtifactToken> getArtifacts(List<Integer> ids, BranchId branch) { List<Long> uuids = new LinkedList<>(); for (Integer id : ids) { uuids.add(Long.valueOf(id)); diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsBranchServiceImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsBranchServiceImpl.java index e2ae2fa7a52..76594e7354a 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsBranchServiceImpl.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsBranchServiceImpl.java @@ -29,11 +29,13 @@ import org.eclipse.osee.framework.core.enums.BranchState; import org.eclipse.osee.framework.core.enums.BranchType; import org.eclipse.osee.framework.core.enums.TransactionDetailsType; import org.eclipse.osee.framework.core.model.TransactionRecord; +import org.eclipse.osee.framework.core.model.change.CompareResults; import org.eclipse.osee.framework.core.util.Result; import org.eclipse.osee.framework.jdk.core.type.HashCollection; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.orcs.OrcsApi; import org.eclipse.osee.orcs.data.BranchReadable; +import org.eclipse.osee.orcs.data.TransactionReadable; import org.eclipse.osee.orcs.search.BranchQuery; import org.eclipse.osee.orcs.search.TransactionQuery; @@ -180,4 +182,23 @@ public class AtsBranchServiceImpl extends AbstractAtsBranchService { throw new UnsupportedOperationException("Not yet supported on server"); } + @Override + public CompareResults getChangeData(TransactionToken transaction) { + TransactionQuery transQuery = orcsApi.getQueryFactory().transactionQuery(); + TransactionReadable startTx = transQuery.andIsPriorTx(transaction).getResults().getAtMostOneOrNull(); + CompareResults results = orcsApi.getTransactionFactory().compareTxs(startTx, transaction); + return results; + } + + @Override + public CompareResults getChangeData(BranchId branch) { + TransactionQuery transactionQuery2 = orcsApi.getQueryFactory().transactionQuery(); + TransactionQuery transactionQuery3 = orcsApi.getQueryFactory().transactionQuery(); + BranchId parentBranch = services.getBranchService().getParentBranch(branch); + TransactionReadable startTx = transactionQuery2.andIsHead(branch).getResults().getExactlyOne(); + TransactionReadable endTx = transactionQuery3.andIsHead(parentBranch).getResults().getExactlyOne(); + CompareResults results = orcsApi.getTransactionFactory().compareTxs(startTx, endTx); + return results; + } + } diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsStoreServiceImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsStoreServiceImpl.java index aacf2e3ca19..dba4c286e12 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsStoreServiceImpl.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsStoreServiceImpl.java @@ -182,4 +182,9 @@ public class AtsStoreServiceImpl implements IAtsStoreService { return isOfType(atsObject.getStoreObject(), artifactType); } + @Override + public boolean isArtifactTypeInheritsFrom(IArtifactType artifactType, IArtifactType baseArtifactType) { + return atsServer.getOrcsApi().getOrcsTypes().getArtifactTypes().inheritsFrom(artifactType, baseArtifactType); + } + } diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/AtsTeamWfEndpointImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/AtsTeamWfEndpointImpl.java new file mode 100644 index 00000000000..c55800de230 --- /dev/null +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/AtsTeamWfEndpointImpl.java @@ -0,0 +1,49 @@ +package org.eclipse.osee.ats.rest.internal.workitem; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import org.eclipse.osee.ats.api.IAtsServices; +import org.eclipse.osee.ats.api.IAtsWorkItem; +import org.eclipse.osee.ats.api.workflow.AtsTeamWfEndpointApi; +import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow; +import org.eclipse.osee.framework.core.data.BranchId; +import org.eclipse.osee.framework.core.data.TransactionToken; +import org.eclipse.osee.framework.core.model.change.CompareResults; + +/** + * Donald G. Dunne + */ +@Path("teamwf") +public class AtsTeamWfEndpointImpl implements AtsTeamWfEndpointApi { + + private final IAtsServices services; + + public AtsTeamWfEndpointImpl(IAtsServices services) { + this.services = services; + } + + @Override + @GET + @Path("{id}/changedata") + @Produces({MediaType.APPLICATION_JSON}) + public CompareResults getChangeData(@PathParam("id") String id) { + IAtsWorkItem workItem = services.getWorkItemService().getWorkItemByAnyId(id); + if (!workItem.isTeamWorkflow()) { + throw new UnsupportedOperationException(); + } + IAtsTeamWorkflow teamWf = workItem.getParentTeamWorkflow(); + TransactionToken trans = services.getBranchService().getEarliestTransactionId(teamWf); + if (trans.isValid()) { + return services.getBranchService().getChangeData(trans); + } + BranchId branch = services.getBranchService().getWorkingBranch(teamWf); + if (branch.isValid()) { + return services.getBranchService().getChangeData(branch); + } + return new CompareResults(); + } + +} diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ExportChangeReportOperation.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ExportChangeReportOperation.java index e7c4aed0331..2e542bd5b17 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ExportChangeReportOperation.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ExportChangeReportOperation.java @@ -38,6 +38,7 @@ import org.eclipse.osee.framework.core.model.type.ArtifactType; import org.eclipse.osee.framework.core.operation.AbstractOperation; import org.eclipse.osee.framework.core.operation.IOperation; import org.eclipse.osee.framework.core.operation.OperationLogger; +import org.eclipse.osee.framework.core.util.XResultData; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.OseeStateException; import org.eclipse.osee.framework.jdk.core.util.Lib; @@ -65,16 +66,17 @@ public final class ExportChangeReportOperation extends AbstractOperation { CoreArtifactTypes.AbstractSoftwareRequirement, CoreArtifactTypes.InterfaceRequirement, CoreArtifactTypes.HeadingMSWord}; - private final IArtifactType[] DISALLOW_TYPES = {CoreArtifactTypes.ImplementationDetails}; private final String overrideDataRightsClassification; + private final XResultData results; - public ExportChangeReportOperation(List<TeamWorkFlowArtifact> workflows, boolean reverse, boolean writeChangeReports, String overrideDataRightsClassification, Appendable resultFolder, OperationLogger logger) { + public ExportChangeReportOperation(List<TeamWorkFlowArtifact> workflows, boolean reverse, boolean writeChangeReports, String overrideDataRightsClassification, Appendable resultFolder, OperationLogger logger, XResultData results) { super("Exporting Change Report(s)", Activator.PLUGIN_ID, logger); this.workflows = workflows; this.reverse = reverse; this.writeChangeReports = writeChangeReports; this.overrideDataRightsClassification = overrideDataRightsClassification; this.resultFolder = resultFolder; + this.results = results; } @Override @@ -104,7 +106,11 @@ public final class ExportChangeReportOperation extends AbstractOperation { Set<ArtifactId> artIds = new HashSet<>(); Collection<Change> changes = computeChanges(workflow, monitor, artIds); if (!changes.isEmpty() && changes.size() < 4000) { - logf("Exporting: %s -- %s", workflow.toString(), workflow.getAtsId()); + String log = String.format("Exporting: %s -- %s\n", workflow.toString(), workflow.getAtsId()); + logf(log); + if (results != null) { + results.log(log); + } String id = workflow.getSoleAttributeValueAsString(AtsAttributeTypes.LegacyPcrId, workflow.getAtsId()); String prefix = "/" + id; if (writeChangeReports) { @@ -117,7 +123,7 @@ public final class ExportChangeReportOperation extends AbstractOperation { ArtifactDelta next = it.next(); Artifact endArtifact = next.getEndArtifact(); ArtifactType artifactType = endArtifact.getArtifactType(); - if (artifactType.inheritsFrom(DISALLOW_TYPES) || !artifactType.inheritsFrom(ALLOW_TYPES)) { + if (!artifactType.inheritsFrom(ALLOW_TYPES)) { it.remove(); artIds.remove(endArtifact.getArtId()); logf("skipping: [" + endArtifact.getName().replaceAll("%", @@ -127,6 +133,9 @@ public final class ExportChangeReportOperation extends AbstractOperation { } if (artifactDeltas.isEmpty()) { logf("Nothing exported for RPCR[%s]", id); + if (results != null) { + results.errorf("Nothing exported for RPCR[%s]", id); + } continue; } @@ -142,6 +151,10 @@ public final class ExportChangeReportOperation extends AbstractOperation { } Lib.writeStringToFile(artIdsAsString, new File(resultFolder + prefix + "_ids.txt")); } catch (IOException ex) { + if (results != null) { + results.errorf("Exception writing _ids.txt file for %s; exception %s", workflow.toStringWithId(), + Lib.exceptionToString(ex)); + } OseeCoreException.wrapAndThrow(ex); } } @@ -180,7 +193,8 @@ public final class ExportChangeReportOperation extends AbstractOperation { operation = ChangeManager.comparedToPreviousTx(pickTransaction(workflow), changes); } else { BranchId workingBranch = AtsClientService.get().getBranchService().getWorkingBranch(teamArt); - if (workingBranch != null && !BranchManager.getType(workingBranch).isBaselineBranch()) { + if (workingBranch != null && workingBranch.isValid() && !BranchManager.getType( + workingBranch).isBaselineBranch()) { operation = ChangeManager.comparedToParent(workingBranch, changes); } } diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/AbstractOperation.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/AbstractOperation.java index 507d584c419..c32ac11bf94 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/AbstractOperation.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/AbstractOperation.java @@ -21,7 +21,7 @@ import org.eclipse.osee.framework.jdk.core.util.Strings; /** * This class is the basic unit of work for OSEE. All operations should be designed such that they can be chained and/or * composed into composite operations. - * + * * @author Roberto E. Escobar * @author Ryan D. Brooks */ @@ -89,7 +89,7 @@ public abstract class AbstractOperation implements IOperation { /** * All the operations work should be executed directly or indirectly by this method. The operation runs until its * doWork() method terminates normally or by throwing an exception (including OperationCanceledException) - * + * * @param monitor the progress monitor to use for reporting progress to the user. It is the caller's responsibility * to call done() on the given monitor. Accepts null, indicating that no progress should be reported and that the * operation cannot be cancelled. @@ -125,7 +125,7 @@ public abstract class AbstractOperation implements IOperation { * returns */ public static final void checkForCancelledStatus(IProgressMonitor monitor) throws OperationCanceledException { - if (monitor.isCanceled()) { + if (monitor != null && monitor.isCanceled()) { throw new OperationCanceledException(); } } @@ -143,19 +143,27 @@ public abstract class AbstractOperation implements IOperation { } protected final void log(String... row) { - logger.log(row); + if (logger != null) { + logger.log(row); + } } protected final void log(Throwable th) { - logger.log(th); + if (logger != null) { + logger.log(th); + } } protected final void log(IStatus status) { - logger.log(status); + if (logger != null) { + logger.log(status); + } } protected final void logf(String format, Object... args) { - logger.logf(format, args); + if (logger != null) { + logger.logf(format, args); + } } @Override diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/ops/RenameFilesOperation.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/ops/RenameFilesOperation.java index d251eed8af3..fa3a057ef8f 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/ops/RenameFilesOperation.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/ops/RenameFilesOperation.java @@ -68,7 +68,7 @@ public class RenameFilesOperation extends AbstractOperation { int renamedFileCount = 0; for (int i = 0; i < size; i++) { - if (monitor.isCanceled()) { + if (monitor != null && monitor.isCanceled()) { return; } File file = files.get(i); |