Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2016-10-24 16:30:43 -0400
committerRyan D. Brooks2017-07-26 14:36:26 -0400
commit00467ef9da2e86d4e0cdeb422b2bd7c916183c18 (patch)
tree6c4e8fdb2c089a8b11eab1f43c16d5871ce9aec3
parent793150c50dc6bcf06549842cd08dc2eb4f047e1f (diff)
downloadorg.eclipse.osee-00467ef9da2e86d4e0cdeb422b2bd7c916183c18.tar.gz
org.eclipse.osee-00467ef9da2e86d4e0cdeb422b2bd7c916183c18.tar.xz
org.eclipse.osee-00467ef9da2e86d4e0cdeb422b2bd7c916183c18.zip
refactor: Use ArtifactId in ArtifactQuery.getArtifactFromId
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/search/AtsArtifactQuery.java3
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/CommonArtifactReferenceAttributeAdapter.java13
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java3
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactId.java4
4 files changed, 13 insertions, 10 deletions
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/search/AtsArtifactQuery.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/search/AtsArtifactQuery.java
index 3b241a2693..94ae223360 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/search/AtsArtifactQuery.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/search/AtsArtifactQuery.java
@@ -16,6 +16,7 @@ import java.util.LinkedList;
import java.util.List;
import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
import org.eclipse.osee.ats.core.client.internal.AtsClientService;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
import org.eclipse.osee.framework.core.exception.MultipleArtifactsExist;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -74,7 +75,7 @@ public class AtsArtifactQuery {
}
public static Artifact getArtifactFromId(long uuid) {
- return ArtifactQuery.getArtifactFromId((int) uuid, AtsClientService.get().getAtsBranch());
+ return ArtifactQuery.getArtifactFromId(ArtifactId.valueOf(uuid), AtsClientService.get().getAtsBranch());
}
public static List<Artifact> getArtifactListFromIds(List<Long> uuids) {
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/CommonArtifactReferenceAttributeAdapter.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/CommonArtifactReferenceAttributeAdapter.java
index d323d8d58d..e1b4b14cdf 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/CommonArtifactReferenceAttributeAdapter.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/CommonArtifactReferenceAttributeAdapter.java
@@ -15,6 +15,7 @@ import java.util.Collection;
import java.util.List;
import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
import org.eclipse.osee.ats.internal.AtsClientService;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.jdk.core.type.Id;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -37,14 +38,10 @@ public class CommonArtifactReferenceAttributeAdapter implements AttributeAdapter
}
@Override
- public Artifact adapt(Attribute<?> attribute, Id identity) throws OseeCoreException {
- Artifact resultArtifact = AtsClientService.get().getArtifact(identity.getId());
- if (resultArtifact == null) {
- if (identity.isValid()) {
- resultArtifact = ArtifactQuery.getArtifactFromId(identity.getId(), AtsClientService.get().getAtsBranch());
- }
+ public Artifact adapt(Attribute<?> attribute, Id id) throws OseeCoreException {
+ if (id.isValid()) {
+ return ArtifactQuery.getArtifactFromId(ArtifactId.valueOf(id), AtsClientService.get().getAtsBranch());
}
- return resultArtifact;
+ return null;
}
-
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java
index 223c839b42..b30fdb7d9b 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java
@@ -25,6 +25,7 @@ import org.eclipse.osee.client.test.framework.OseeLogMonitorRule;
import org.eclipse.osee.client.test.framework.TestInfo;
import org.eclipse.osee.framework.access.AccessControlManager;
import org.eclipse.osee.framework.core.data.ArtifactId;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.TransactionToken;
import org.eclipse.osee.framework.core.enums.BranchType;
@@ -104,7 +105,7 @@ public class ArtifactQueryTest {
}
// Should still exist with allowDeleted
- searchedArtifact = ArtifactQuery.getArtifactFromId(newArtifact.getGuid(), COMMON, DeletionFlag.INCLUDE_DELETED);
+ searchedArtifact = ArtifactQuery.getArtifactFromId(newArtifact, COMMON, DeletionFlag.INCLUDE_DELETED);
Assert.assertNotNull(searchedArtifact);
}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactId.java
index 131d232413..acc646f0aa 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactId.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactId.java
@@ -32,6 +32,10 @@ public interface ArtifactId extends Identity<String>, Id {
return valueOf(Long.valueOf(id));
}
+ public static ArtifactId valueOf(Id id) {
+ return valueOf(id.getId());
+ }
+
public static ArtifactId valueOf(long id) {
final class ArtifactIdImpl extends BaseId implements ArtifactId, Comparable<ArtifactId> {
public ArtifactIdImpl(Long artId) {

Back to the top