Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2015-12-11 16:47:10 -0500
committerRyan D. Brooks2015-12-11 16:47:10 -0500
commiteb0d6078b81d5da64b4ce5e27f34a5b3e77ce65c (patch)
tree297cfc49a45047d76a034562999da7abdd8a976f
parentf69b41f693def40b45c7cfb7d783cc5d72579a0d (diff)
downloadorg.eclipse.osee-eb0d6078b81d5da64b4ce5e27f34a5b3e77ce65c.tar.gz
org.eclipse.osee-eb0d6078b81d5da64b4ce5e27f34a5b3e77ce65c.tar.xz
org.eclipse.osee-eb0d6078b81d5da64b4ce5e27f34a5b3e77ce65c.zip
feature[ats_ATS262469]: Convert readiness reviews to artifact stored xml
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/task/JaxAtsTask.java2
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/task/JaxRelation.java4
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/task/NewTaskData.java3
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/AtsTaskService.java4
-rw-r--r--plugins/org.eclipse.osee.ats.impl/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsChangeSet.java2
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/workitem/CreateTasksOperation.java54
7 files changed, 66 insertions, 4 deletions
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/task/JaxAtsTask.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/task/JaxAtsTask.java
index 9ebb41fe44..89bd72e7ef 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/task/JaxAtsTask.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/task/JaxAtsTask.java
@@ -115,7 +115,7 @@ public class JaxAtsTask extends JaxAtsObject {
for (long relationUuid : relatedUuid) {
relation.getRelatedUuids().add(relationUuid);
}
- relations.add(relation);
+ getRelations().add(relation);
}
public List<JaxRelation> getRelations() {
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/task/JaxRelation.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/task/JaxRelation.java
index 3292bf0697..16c19d79e9 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/task/JaxRelation.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/task/JaxRelation.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.ats.api.task;
+import java.util.LinkedList;
import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
@@ -40,6 +41,9 @@ public class JaxRelation {
}
public List<Long> getRelatedUuids() {
+ if (relatedUuids == null) {
+ relatedUuids = new LinkedList<>();
+ }
return relatedUuids;
}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/task/NewTaskData.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/task/NewTaskData.java
index d8b762c569..a29b792ba3 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/task/NewTaskData.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/task/NewTaskData.java
@@ -65,4 +65,7 @@ public class NewTaskData {
return "NewTaskData [teamUuid=" + teamWfUuid + ", tasks=" + newTasks + ", asUserId=" + asUserId + ", commitComment=" + commitComment + "]";
}
+ public boolean isEmpty() {
+ return newTasks == null || newTasks.isEmpty();
+ }
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/AtsTaskService.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/AtsTaskService.java
index 3560658d11..8c169a1c7a 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/AtsTaskService.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/AtsTaskService.java
@@ -31,6 +31,7 @@ import org.eclipse.osee.ats.api.workflow.IAtsTask;
import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
import org.eclipse.osee.ats.core.client.IAtsClient;
import org.eclipse.osee.ats.core.client.internal.AtsClientService;
+import org.eclipse.osee.ats.core.client.util.AtsTaskCache;
import org.eclipse.osee.ats.core.util.AtsUtilCore;
import org.eclipse.osee.framework.core.enums.DeletionFlag;
import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidArtifact;
@@ -78,13 +79,14 @@ public class AtsTaskService extends AbstractAtsTaskService {
}
private void processForEvents(NewTaskData newTaskData, Response response, List<IAtsTask> tasks, ArtifactEvent artifactEvent2) {
- Artifact teamWf = (Artifact) atsClient.getArtifact(newTaskData.getTeamWfUuid());
+ Artifact teamWf = atsClient.getArtifact(newTaskData.getTeamWfUuid());
JaxAtsTasks jaxTasks = response.readEntity(JaxAtsTasks.class);
ArtifactEvent artifactEvent = new ArtifactEvent(AtsUtilCore.getAtsBranch());
List<Long> artUuids = new LinkedList<>();
teamWf.reloadAttributesAndRelations();
+ AtsTaskCache.decache((AbstractTaskableArtifact) teamWf);
for (JaxAtsTask task : jaxTasks.getTasks()) {
String guid = ArtifactQuery.getGuidFromUuid(task.getUuid(), AtsUtilCore.getAtsBranch());
diff --git a/plugins/org.eclipse.osee.ats.impl/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.impl/META-INF/MANIFEST.MF
index 5f3fe595a6..20fe4f3530 100644
--- a/plugins/org.eclipse.osee.ats.impl/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats.impl/META-INF/MANIFEST.MF
@@ -27,6 +27,7 @@ Import-Package: com.google.common.cache;version="15.0.0",
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.exception,
org.eclipse.osee.framework.core.model,
+ org.eclipse.osee.framework.core.model.type,
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.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsChangeSet.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsChangeSet.java
index 0526841192..b5e0d4523c 100644
--- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsChangeSet.java
+++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsChangeSet.java
@@ -286,7 +286,7 @@ public class AtsChangeSet extends AbstractAtsChangeSet {
@Override
public void setValues(IAtsObject atsObject, IAttributeType attrType, List<String> values) {
ArtifactReadable artifact = getArtifact(atsObject);
- getTransaction().setAttributesFromValues(artifact, attrType, values);
+ getTransaction().setAttributesFromStrings(artifact, attrType, values);
add(artifact);
}
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/workitem/CreateTasksOperation.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/workitem/CreateTasksOperation.java
index 7be6ffc36c..e660beb631 100644
--- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/workitem/CreateTasksOperation.java
+++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/workitem/CreateTasksOperation.java
@@ -23,6 +23,7 @@ import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
import org.eclipse.osee.ats.api.data.AtsRelationTypes;
import org.eclipse.osee.ats.api.task.JaxAtsTask;
import org.eclipse.osee.ats.api.task.JaxAttribute;
+import org.eclipse.osee.ats.api.task.JaxRelation;
import org.eclipse.osee.ats.api.task.NewTaskData;
import org.eclipse.osee.ats.api.task.NewTaskDatas;
import org.eclipse.osee.ats.api.user.IAtsUser;
@@ -30,11 +31,16 @@ import org.eclipse.osee.ats.api.util.IAtsChangeSet;
import org.eclipse.osee.ats.api.workdef.IAtsWorkDefinition;
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.users.AtsCoreUsers;
import org.eclipse.osee.ats.core.util.AtsUtilCore;
import org.eclipse.osee.ats.impl.IAtsServer;
import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.data.IRelationType;
+import org.eclipse.osee.framework.core.data.IRelationTypeSide;
+import org.eclipse.osee.framework.core.enums.RelationSide;
+import org.eclipse.osee.framework.core.model.RelationTypeSide;
import org.eclipse.osee.framework.core.util.XResultData;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
@@ -78,6 +84,7 @@ public class CreateTasksOperation {
Long teamWfUuid = newTaskData.getTeamWfUuid();
if (teamWfUuid == null) {
resultData.error("Team Workflow uuid not specified");
+ continue;
}
ArtifactReadable teamWfArt = atsServer.getArtifact(teamWfUuid);
if (teamWfArt == null) {
@@ -102,7 +109,7 @@ public class CreateTasksOperation {
for (JaxAtsTask task : newTaskData.getNewTasks()) {
Long taskUuid = task.getUuid();
- if (teamWfUuid != null && taskUuid > 0L) {
+ if (taskUuid > 0L) {
ArtifactReadable taskArt = atsServer.getArtifact(taskUuid);
if (taskArt != null) {
resultData.errorf("Task with uuid %d already exists for %s", taskUuid, task);
@@ -161,11 +168,40 @@ public class CreateTasksOperation {
attribute.getAttrTypeName(), task);
}
}
+
+ for (JaxRelation relation : task.getRelations()) {
+ IRelationType relationType = getRelationType(atsServer, relation.getRelationTypeName());
+ if (relationType == null) {
+ resultData.errorf("Relation Type [%s] not valid for Task creation in %s",
+ relation.getRelationTypeName(), task);
+ }
+ if (relation.getRelatedUuids().isEmpty()) {
+ resultData.errorf("Relation [%s] Uuids must be suplied Task creation in %s",
+ relation.getRelationTypeName(), task);
+ }
+ Collection<Integer> foundUuids = atsServer.getQueryService().createQuery(WorkItemType.WorkItem).andUuids(
+ relation.getRelatedUuids().toArray(new Long[relation.getRelatedUuids().size()])).getItemIds();
+ List<Long> notFoundUuids = relation.getRelatedUuids();
+ notFoundUuids.removeAll(foundUuids);
+ if (foundUuids.size() != relation.getRelatedUuids().size()) {
+ resultData.errorf("Relation [%s] Uuids [%s] do not match Work Items in task %s",
+ relation.getRelationTypeName(), notFoundUuids, task);
+ }
+ }
}
}
return resultData;
}
+ private IRelationType getRelationType(IAtsServer atsServer, String relationTypeName) {
+ for (IRelationType relation : atsServer.getOrcsApi().getOrcsTypes().getRelationTypes().getAll()) {
+ if (relation.getName().equals(relation.getName())) {
+ return relation;
+ }
+ }
+ return null;
+ }
+
private static IAttributeType getAttributeType(IAtsServer atsServer, String attrTypeName) {
for (IAttributeType attrType : atsServer.getOrcsApi().getOrcsTypes().getArtifactTypes().getAttributeTypes(
AtsArtifactTypes.Task, AtsUtilCore.getAtsBranch())) {
@@ -263,6 +299,22 @@ public class CreateTasksOperation {
changes.setValues(task, attrType, attribute.getValues());
}
+ for (JaxRelation relation : jaxTask.getRelations()) {
+ IRelationType relationType = getRelationType(atsServer, relation.getRelationTypeName());
+ if (relationType == null) {
+ resultData.errorf("Relation Type [%s] not valid for Task creation in %s",
+ relation.getRelationTypeName(), task);
+ }
+ Collection<IAtsWorkItem> items = atsServer.getQueryService().createQuery(WorkItemType.WorkItem).andUuids(
+ relation.getRelatedUuids().toArray(new Long[relation.getRelatedUuids().size()])).getItems();
+ IRelationTypeSide side = null;
+ if (relation.isSideA()) {
+ side = new RelationTypeSide(relationType, RelationSide.SIDE_A);
+ } else {
+ side = new RelationTypeSide(relationType, RelationSide.SIDE_B);
+ }
+ changes.setRelations(task, side, items);
+ }
changes.add(taskArt);
}
}

Back to the top