Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2018-08-17 12:31:07 -0400
committerDonald Dunne2018-08-17 15:24:55 -0400
commit107d15147715d05e5bb43c05694f04651d126e99 (patch)
treea399dd27c4f87b3ada2bc9217f00c62c1665f9fc
parentb2cc2e959c6bcb27acc9d17c9fdf931c9b934fcd (diff)
downloadorg.eclipse.osee-107d15147715d05e5bb43c05694f04651d126e99.tar.gz
org.eclipse.osee-107d15147715d05e5bb43c05694f04651d126e99.tar.xz
org.eclipse.osee-107d15147715d05e5bb43c05694f04651d126e99.zip
refactor: Use IArtifactType in artifact creation
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/ArtifactDataFactory.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactory.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManager.java6
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImpl.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/ArtifactObjectFactory.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsObjectFactoryImpl.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactEndpointImpl.java5
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionBuilder.java8
9 files changed, 31 insertions, 28 deletions
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/ArtifactDataFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/ArtifactDataFactory.java
index 8471147a65..87bf39ad92 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/ArtifactDataFactory.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/ArtifactDataFactory.java
@@ -10,19 +10,19 @@
*******************************************************************************/
package org.eclipse.osee.orcs.core.ds;
-import org.eclipse.osee.framework.core.data.ArtifactTypeId;
import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.IArtifactType;
/**
* @author Roberto E. Escobar
*/
public interface ArtifactDataFactory {
- ArtifactData create(BranchId branch, ArtifactTypeId artifactType, String guid);
+ ArtifactData create(BranchId branch, IArtifactType artifactType, String guid);
- ArtifactData create(BranchId branch, ArtifactTypeId artifactType, String guid, long artifactId);
+ ArtifactData create(BranchId branch, IArtifactType artifactType, String guid, long artifactId);
- ArtifactData create(BranchId branch, ArtifactTypeId artifactType, Long artifactId);
+ ArtifactData create(BranchId branch, IArtifactType artifactType, Long artifactId);
ArtifactData copy(BranchId destination, ArtifactData source);
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactory.java
index effd296caf..86af3fd879 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactory.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactory.java
@@ -14,9 +14,9 @@ import static org.eclipse.osee.framework.core.enums.CoreAttributeTypes.RelationO
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
-import org.eclipse.osee.framework.core.data.ArtifactTypeId;
import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.enums.DeletionFlag;
import org.eclipse.osee.framework.core.exception.AttributeDoesNotExist;
import org.eclipse.osee.orcs.OrcsSession;
@@ -47,21 +47,21 @@ public class ArtifactFactory {
return new ArtifactImpl(artifactTypeCache, artifactData, attributeFactory);
}
- public Artifact createArtifact(OrcsSession session, BranchId branch, ArtifactTypeId artifactType, String guid) {
+ public Artifact createArtifact(OrcsSession session, BranchId branch, IArtifactType artifactType, String guid) {
ArtifactData artifactData = factory.create(branch, artifactType, guid);
Artifact artifact = createArtifact(session, artifactData);
artifact.setLoaded(true);
return artifact;
}
- public Artifact createArtifact(OrcsSession session, BranchId branch, ArtifactTypeId artifactType, String guid, long uuid) {
+ public Artifact createArtifact(OrcsSession session, BranchId branch, IArtifactType artifactType, String guid, long uuid) {
ArtifactData artifactData = factory.create(branch, artifactType, guid, uuid);
Artifact artifact = createArtifact(session, artifactData);
artifact.setLoaded(true);
return artifact;
}
- public Artifact createArtifact(OrcsSession session, BranchId branch, ArtifactTypeId artifactType, Long artifactId) {
+ public Artifact createArtifact(OrcsSession session, BranchId branch, IArtifactType artifactType, Long artifactId) {
ArtifactData artifactData = factory.create(branch, artifactType, artifactId);
Artifact artifact = createArtifact(session, artifactData);
artifact.setLoaded(true);
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java
index eec7f1878a..6f6151a41b 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java
@@ -19,11 +19,11 @@ import java.util.Map.Entry;
import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.ArtifactToken;
-import org.eclipse.osee.framework.core.data.ArtifactTypeId;
import org.eclipse.osee.framework.core.data.AttributeId;
import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.GammaId;
+import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.RelationTypeSide;
import org.eclipse.osee.framework.core.data.Tuple2Type;
@@ -104,7 +104,7 @@ public class TransactionBuilderImpl implements TransactionBuilder {
}
@Override
- public ArtifactToken createArtifact(ArtifactId parent, ArtifactTypeId artifactType, String name) {
+ public ArtifactToken createArtifact(ArtifactId parent, IArtifactType artifactType, String name) {
ArtifactToken child = createArtifact(artifactType, name);
if (parent.isValid()) {
addChild(parent, child);
@@ -113,7 +113,7 @@ public class TransactionBuilderImpl implements TransactionBuilder {
}
@Override
- public ArtifactToken createArtifact(ArtifactTypeId artifactType, String name) {
+ public ArtifactToken createArtifact(IArtifactType artifactType, String name) {
return txManager.createArtifact(txData, artifactType, name, (String) null);
}
@@ -123,7 +123,7 @@ public class TransactionBuilderImpl implements TransactionBuilder {
}
@Override
- public ArtifactToken createArtifact(ArtifactTypeId artifactType, String name, Long artifactId) {
+ public ArtifactToken createArtifact(IArtifactType artifactType, String name, Long artifactId) {
return txManager.createArtifact(txData, artifactType, name, artifactId);
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManager.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManager.java
index 1359aef680..f98d80bf2b 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManager.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManager.java
@@ -20,10 +20,10 @@ import java.util.List;
import java.util.Set;
import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.data.ArtifactId;
-import org.eclipse.osee.framework.core.data.ArtifactTypeId;
import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.GammaId;
+import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.RelationTypeSide;
import org.eclipse.osee.framework.core.data.Tuple2Type;
@@ -258,14 +258,14 @@ public class TxDataManager {
return tuple.getVersion().getGammaId();
}
- public ArtifactReadable createArtifact(TxData txData, ArtifactTypeId artifactType, String name, String guid) {
+ public ArtifactReadable createArtifact(TxData txData, IArtifactType artifactType, String name, String guid) {
checkChangesAllowed(txData);
Artifact artifact = artifactFactory.createArtifact(txData.getSession(), txData.getBranch(), artifactType, guid);
artifact.setName(name);
return asExternalArtifact(txData, artifact);
}
- public ArtifactReadable createArtifact(TxData txData, ArtifactTypeId artifactType, String name, long uuid) {
+ public ArtifactReadable createArtifact(TxData txData, IArtifactType artifactType, String name, long uuid) {
checkChangesAllowed(txData);
Artifact artifact = artifactFactory.createArtifact(txData.getSession(), txData.getBranch(), artifactType, uuid);
artifact.setName(name);
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImpl.java
index 4a312f275d..d2dfeb2984 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImpl.java
@@ -12,10 +12,10 @@ package org.eclipse.osee.orcs.db.internal.loader;
import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.data.ArtifactId;
-import org.eclipse.osee.framework.core.data.ArtifactTypeId;
import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.GammaId;
+import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.RelationTypeId;
import org.eclipse.osee.framework.core.data.RelationalConstants;
import org.eclipse.osee.framework.core.data.TransactionId;
@@ -53,17 +53,17 @@ public class DataFactoryImpl implements DataFactory {
}
@Override
- public ArtifactData create(BranchId branch, ArtifactTypeId token, String guid) {
+ public ArtifactData create(BranchId branch, IArtifactType token, String guid) {
return this.create(branch, token, guid, idFactory.getNextArtifactId());
}
@Override
- public ArtifactData create(BranchId branch, ArtifactTypeId token, Long artifactId) {
+ public ArtifactData create(BranchId branch, IArtifactType token, Long artifactId) {
return this.create(branch, token, null, artifactId);
}
@Override
- public ArtifactData create(BranchId branchId, ArtifactTypeId token, String guid, long artifactId) {
+ public ArtifactData create(BranchId branchId, IArtifactType token, String guid, long artifactId) {
Conditions.checkNotNull(branchId, "branch");
Conditions.checkExpressionFailOnTrue(artifactCache.isAbstract(token),
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/ArtifactObjectFactory.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/ArtifactObjectFactory.java
index fb26bf98e1..466c3a12b6 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/ArtifactObjectFactory.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/ArtifactObjectFactory.java
@@ -11,7 +11,7 @@
package org.eclipse.osee.orcs.db.internal.loader.data;
import org.eclipse.osee.framework.core.data.ApplicabilityId;
-import org.eclipse.osee.framework.core.data.ArtifactTypeId;
+import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.orcs.core.ds.ArtifactData;
import org.eclipse.osee.orcs.core.ds.VersionData;
@@ -23,7 +23,7 @@ public interface ArtifactObjectFactory extends VersionObjectFactory {
ArtifactData createArtifactData(VersionData version, Integer id, long typeID, ModificationType modType, String guid, ApplicabilityId applicId);
- ArtifactData createArtifactData(VersionData version, int generateArtId, ArtifactTypeId type, ModificationType modType, String guidToSet, ApplicabilityId applicId);
+ ArtifactData createArtifactData(VersionData version, int generateArtId, IArtifactType type, ModificationType modType, String guidToSet, ApplicabilityId applicId);
ArtifactData createCopy(ArtifactData source);
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsObjectFactoryImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsObjectFactoryImpl.java
index 5c0c79c327..ceb746a79c 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsObjectFactoryImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsObjectFactoryImpl.java
@@ -12,10 +12,10 @@ package org.eclipse.osee.orcs.db.internal.loader.data;
import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.data.ArtifactId;
-import org.eclipse.osee.framework.core.data.ArtifactTypeId;
import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.GammaId;
+import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.RelationTypeId;
import org.eclipse.osee.framework.core.data.RelationalConstants;
import org.eclipse.osee.framework.core.data.TransactionId;
@@ -92,7 +92,7 @@ public class OrcsObjectFactoryImpl implements OrcsObjectFactory {
}
@Override
- public ArtifactData createArtifactData(VersionData version, int id, ArtifactTypeId type, ModificationType modType, String guid, ApplicabilityId applicId) {
+ public ArtifactData createArtifactData(VersionData version, int id, IArtifactType type, ModificationType modType, String guid, ApplicabilityId applicId) {
return createArtifactFromRow(version, id, type.getId(), modType, type.getId(), modType, guid, applicId);
}
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactEndpointImpl.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactEndpointImpl.java
index 18bd88b616..4a89426abb 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactEndpointImpl.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactEndpointImpl.java
@@ -20,6 +20,7 @@ import org.eclipse.osee.framework.core.data.ArtifactToken;
import org.eclipse.osee.framework.core.data.ArtifactTypeId;
import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.data.UserId;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
@@ -195,8 +196,10 @@ public class ArtifactEndpointImpl implements ArtifactEndpoint {
List<ArtifactToken> tokens = new ArrayList<>(names.size());
TransactionBuilder tx =
orcsApi.getTransactionFactory().createTransaction(branch, account, "rest - create artifacts");
+
+ IArtifactType artifactTypeToken = orcsApi.getOrcsTypes().getArtifactTypes().get(artifactType);
for (String name : names) {
- tokens.add(tx.createArtifact(parent, artifactType, name));
+ tokens.add(tx.createArtifact(parent, artifactTypeToken, name));
}
tx.commit();
return tokens;
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionBuilder.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionBuilder.java
index 6f59651bc9..dd73c22ede 100644
--- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionBuilder.java
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionBuilder.java
@@ -17,11 +17,11 @@ import java.util.List;
import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.ArtifactToken;
-import org.eclipse.osee.framework.core.data.ArtifactTypeId;
import org.eclipse.osee.framework.core.data.AttributeId;
import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.GammaId;
+import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.RelationTypeSide;
import org.eclipse.osee.framework.core.data.Tuple2Type;
@@ -54,11 +54,11 @@ public interface TransactionBuilder {
/**
* If parent is invalid, the artifact will be created with no parent
*/
- ArtifactToken createArtifact(ArtifactId parent, ArtifactTypeId artifactType, String name);
+ ArtifactToken createArtifact(ArtifactId parent, IArtifactType artifactType, String name);
- ArtifactToken createArtifact(ArtifactTypeId artifactType, String name);
+ ArtifactToken createArtifact(IArtifactType artifactType, String name);
- ArtifactToken createArtifact(ArtifactTypeId artifactType, String name, Long artifactId);
+ ArtifactToken createArtifact(IArtifactType artifactType, String name, Long artifactId);
ArtifactToken createArtifact(ArtifactToken configsFolder);

Back to the top