Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2017-08-02 15:14:00 -0400
committerRyan D. Brooks2017-08-15 14:59:09 -0400
commit234e996d89312e5794e04992590b07cee8a4a522 (patch)
treeb67047d18e24a0737bce3eb116823e2f04971b12
parentddcb2a395ec5bdfaeb6497d43364d7131eba006a (diff)
downloadorg.eclipse.osee-234e996d89312e5794e04992590b07cee8a4a522.tar.gz
org.eclipse.osee-234e996d89312e5794e04992590b07cee8a4a522.tar.xz
org.eclipse.osee-234e996d89312e5794e04992590b07cee8a4a522.zip
refactor: Use tuple type primatives with tuple API
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Tuple2Type.java10
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/TupleData.java5
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/TupleDataFactory.java11
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryBuilderImpl.java1
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java115
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManager.java22
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImpl.java15
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsObjectFactoryImpl.java19
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/TupleDataImpl.java7
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/TupleObjectFactory.java11
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/TupleEndpoint.java12
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchesResource.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TupleEndpointImpl.java109
-rw-r--r--plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTupleTest.java30
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionBuilder.java11
15 files changed, 131 insertions, 251 deletions
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Tuple2Type.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Tuple2Type.java
index 017a3a8539..ff2beff02d 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Tuple2Type.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Tuple2Type.java
@@ -11,7 +11,6 @@
package org.eclipse.osee.framework.core.data;
import static org.eclipse.osee.framework.core.enums.CoreTupleFamilyTypes.DefaultFamily;
-import org.codehaus.jackson.annotate.JsonCreator;
/**
* @author Ryan D. Brooks
@@ -36,8 +35,11 @@ public interface Tuple2Type<E1, E2> extends TupleTypeId {
return new Tuple2TypeImpl(family, tupleTypeId);
}
- @JsonCreator
- public static <E1, E2> Tuple2Type<E1, E2> valueOf(long tupleTypeId) {
- return valueOf(DefaultFamily, tupleTypeId);
+ public static <E1, E2> Tuple2Type<E1, E2> valueOf(long tupleType) {
+ return valueOf(DefaultFamily, tupleType);
+ }
+
+ public static <E1, E2> Tuple2Type<E1, E2> valueOf(String tupleType) {
+ return valueOf(DefaultFamily, Long.parseLong(tupleType));
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/TupleData.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/TupleData.java
index f50a2ce584..57c9361bad 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/TupleData.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/TupleData.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.orcs.core.ds;
+import org.eclipse.osee.framework.core.data.TupleTypeId;
/**
* @author Angel Avila
*/
@@ -17,7 +18,7 @@ import org.eclipse.osee.orcs.core.internal.tuple.TupleVisitor;
public interface TupleData extends OrcsData {
- Long getTupleType();
+ TupleTypeId getTupleType();
Long getElement1();
@@ -35,7 +36,7 @@ public interface TupleData extends OrcsData {
void setElement4(Long e4);
- void setTupleType(Long tupleType);
+ void setTupleType(TupleTypeId tupleType);
void setRationale(String rationale);
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/TupleDataFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/TupleDataFactory.java
index fe5d2c342e..4d450fb953 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/TupleDataFactory.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/TupleDataFactory.java
@@ -11,16 +11,19 @@
package org.eclipse.osee.orcs.core.ds;
import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.Tuple2Type;
+import org.eclipse.osee.framework.core.data.Tuple3Type;
+import org.eclipse.osee.framework.core.data.Tuple4Type;
/**
* @author Angel Avila
*/
public interface TupleDataFactory {
- TupleData createTuple2Data(Long tupleTypeId, BranchId branch, Long e1, Long e2);
+ TupleData createTuple2Data(Tuple2Type<?, ?> tupleType, BranchId branch, Long e1, Long e2);
- TupleData createTuple3Data(Long tupleTypeId, BranchId branch, Long e1, Long e2, Long e3);
+ TupleData createTuple3Data(Tuple3Type<?, ?, ?> tupleType, BranchId branch, Long e1, Long e2, Long e3);
- TupleData createTuple4Data(Long tupleTypeId, BranchId branch, Long e1, Long e2, Long e3, Long e4);
+ TupleData createTuple4Data(Tuple4Type<?, ?, ?, ?> tupleType, BranchId branch, Long e1, Long e2, Long e3, Long e4);
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryBuilderImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryBuilderImpl.java
index 6bf25a3235..4d510e99b2 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryBuilderImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryBuilderImpl.java
@@ -62,6 +62,7 @@ public class QueryBuilderImpl extends ArtifactQueryBuilderImpl<QueryBuilder> imp
}
}
+ @Override
public boolean exists() {
return getCount() > 0;
}
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 5818a1e73d..2f9cbfad0d 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
@@ -20,14 +20,13 @@ import org.eclipse.osee.framework.core.data.ArtifactToken;
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.AttributeTypeId;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.RelationTypeSide;
import org.eclipse.osee.framework.core.data.Tuple2Type;
import org.eclipse.osee.framework.core.data.Tuple3Type;
import org.eclipse.osee.framework.core.data.Tuple4Type;
-import org.eclipse.osee.framework.core.data.TupleTypeId;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.RelationSorter;
import org.eclipse.osee.framework.jdk.core.type.Id;
@@ -359,112 +358,27 @@ public class TransactionBuilderImpl implements TransactionBuilder {
}
@Override
- public <E1, E2> Long addTuple2(Tuple2Type<E1, E2> tupleType, E1 element1, E2 element2) {
- return addTuple(tupleType, element1, element2);
- }
-
- @Override
- public <E1, E2, E3> Long addTuple3(Tuple3Type<E1, E2, E3> tupleType, E1 element1, E2 element2, E3 element3) {
- return addTuple(tupleType, element1, element2, element3);
+ public <E1, E2> GammaId addTuple2(Tuple2Type<E1, E2> tupleType, E1 e1, E2 e2) {
+ return txManager.createTuple2(txData, tupleType, toLong(e1), toLong(e2));
}
@Override
- public <E1, E2, E3, E4> Long addTuple4(Tuple4Type<E1, E2, E3, E4> tupleType, E1 element1, E2 element2, E3 element3, E4 element4) {
- return addTuple(tupleType, element1, element2, element3, element4);
+ public <E1, E2, E3> GammaId addTuple3(Tuple3Type<E1, E2, E3> tupleType, E1 e1, E2 e2, E3 e3) {
+ return txManager.createTuple3(txData, tupleType, toLong(e1), toLong(e2), toLong(e3));
}
@Override
- public Long addTuple(TupleTypeId tupleType, Object... elements) {
- int length = elements.length;
-
- if (length == 2) {
- return addTuple2(tupleType, txData.getBranch(), elements[0], elements[1]);
- } else if (length == 3) {
- return addTuple3(tupleType, txData.getBranch(), elements[0], elements[1], elements[2]);
- } else {
- return addTuple4(tupleType, txData.getBranch(), elements[0], elements[1], elements[2], elements[3]);
- }
- }
-
- private Long addTuple2(TupleTypeId tupleTypeId, BranchId branch, Object element1, Object element2) {
- Long e1;
- Long e2;
- if (element1 instanceof String) {
- e1 = insertValue((String) element1);
- } else {
- if (element1 instanceof Id) {
- e1 = ((Id) element1).getId();
- } else if (element1 instanceof AttributeId) {
- e1 = Long.valueOf(((AttributeId) element1).getLocalId());
- } else {
- e1 = (Long) element1;
- }
- }
- if (element2 instanceof String) {
- e2 = insertValue((String) element2);
- } else {
- if (element1 instanceof ArtifactId) {
- e2 = ((Id) element2).getId();
- } else if (element2 instanceof AttributeId) {
- e2 = Long.valueOf(((AttributeId) element2).getLocalId());
- } else {
- e2 = (Long) element2;
- }
- }
-
- return txManager.createTuple2(txData, branch, tupleTypeId.getId(), e1, e2);
+ public <E1, E2, E3, E4> GammaId addTuple4(Tuple4Type<E1, E2, E3, E4> tupleType, E1 e1, E2 e2, E3 e3, E4 e4) {
+ return txManager.createTuple4(txData, tupleType, toLong(e1), toLong(e2), toLong(e3), toLong(e4));
}
- private Long addTuple3(TupleTypeId tupleTypeId, BranchId branch, Object element1, Object element2, Object element3) {
- Long e1;
- Long e2;
- Long e3;
- if (element1 instanceof String) {
- e1 = insertValue((String) element1);
- } else {
- e1 = (Long) element1;
+ private Long toLong(Object element) {
+ if (element instanceof String) {
+ return insertValue((String) element);
+ } else if (element instanceof Id) {
+ return ((Id) element).getId();
}
- if (element2 instanceof String) {
- e2 = insertValue((String) element2);
- } else {
- e2 = (Long) element2;
- }
- if (element3 instanceof String) {
- e3 = insertValue((String) element3);
- } else {
- e3 = (Long) element3;
- }
-
- return txManager.createTuple3(txData, branch, tupleTypeId.getId(), e1, e2, e3);
- }
-
- private Long addTuple4(TupleTypeId tupleTypeId, BranchId branch, Object element1, Object element2, Object element3, Object element4) {
- Long e1;
- Long e2;
- Long e3;
- Long e4;
- if (element1 instanceof String) {
- e1 = insertValue((String) element1);
- } else {
- e1 = (Long) element1;
- }
- if (element2 instanceof String) {
- e2 = insertValue((String) element2);
- } else {
- e2 = (Long) element2;
- }
- if (element3 instanceof String) {
- e3 = insertValue((String) element3);
- } else {
- e3 = (Long) element3;
- }
- if (element4 instanceof String) {
- e4 = insertValue((String) element4);
- } else {
- e4 = (Long) element4;
- }
-
- return txManager.createTuple4(txData, branch, tupleTypeId.getId(), e1, e2, e3, e4);
+ return (Long) element;
}
@Override
@@ -486,5 +400,4 @@ public class TransactionBuilderImpl implements TransactionBuilder {
public <E1, E2, E3, E4> boolean deleteTupple4(Tuple4Type<E1, E2, E3, E4> tupleType, E1 element1, E2 element2, E3 element3, E4 element4) {
return false;
}
-
-}
+} \ No newline at end of file
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 bb52740202..cf7bb1e9aa 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
@@ -22,8 +22,12 @@ import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.data.ArtifactId;
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.Tuple2Type;
+import org.eclipse.osee.framework.core.data.Tuple3Type;
+import org.eclipse.osee.framework.core.data.Tuple4Type;
import org.eclipse.osee.framework.core.enums.RelationSide;
import org.eclipse.osee.framework.core.enums.RelationSorter;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -236,22 +240,22 @@ public class TxDataManager {
txData.setAuthor(author);
}
- public Long createTuple2(TxData txData, BranchId branch, Long tupleTypeId, Long e1, Long e2) {
- TupleData tuple = tupleFactory.createTuple2Data(tupleTypeId, branch, e1, e2);
+ public GammaId createTuple2(TxData txData, Tuple2Type<?, ?> tupleType, Long e1, Long e2) {
+ TupleData tuple = tupleFactory.createTuple2Data(tupleType, txData.getBranch(), e1, e2);
txData.add(tuple);
- return tuple.getVersion().getGammaId().getId();
+ return tuple.getVersion().getGammaId();
}
- public Long createTuple3(TxData txData, BranchId branch, Long tupleTypeId, Long e1, Long e2, Long e3) {
- TupleData tuple = tupleFactory.createTuple3Data(tupleTypeId, branch, e1, e2, e3);
+ public GammaId createTuple3(TxData txData, Tuple3Type<?, ?, ?> tupleType, Long e1, Long e2, Long e3) {
+ TupleData tuple = tupleFactory.createTuple3Data(tupleType, txData.getBranch(), e1, e2, e3);
txData.add(tuple);
- return tuple.getVersion().getGammaId().getId();
+ return tuple.getVersion().getGammaId();
}
- public Long createTuple4(TxData txData, BranchId branch, Long tupleTypeId, Long e1, Long e2, Long e3, Long e4) {
- TupleData tuple = tupleFactory.createTuple4Data(tupleTypeId, branch, e1, e2, e3, e4);
+ public GammaId createTuple4(TxData txData, Tuple4Type<?, ?, ?, ?> tupleType, Long e1, Long e2, Long e3, Long e4) {
+ TupleData tuple = tupleFactory.createTuple4Data(tupleType, txData.getBranch(), e1, e2, e3, e4);
txData.add(tuple);
- return tuple.getVersion().getGammaId().getId();
+ return tuple.getVersion().getGammaId();
}
public ArtifactReadable createArtifact(TxData txData, IArtifactType artifactType, String name, String guid) throws OseeCoreException {
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 048eb5e36c..e62d016c53 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
@@ -19,6 +19,9 @@ 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;
+import org.eclipse.osee.framework.core.data.Tuple2Type;
+import org.eclipse.osee.framework.core.data.Tuple3Type;
+import org.eclipse.osee.framework.core.data.Tuple4Type;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
@@ -128,23 +131,23 @@ public class DataFactoryImpl implements DataFactory {
}
@Override
- public TupleData createTuple2Data(Long tupleTypeId, BranchId branch, Long e1, Long e2) {
+ public TupleData createTuple2Data(Tuple2Type<?, ?> tupleType, BranchId branch, Long e1, Long e2) {
VersionData version = objectFactory.createDefaultVersionData();
- TupleData tupleData = objectFactory.createTuple2Data(version, branch, tupleTypeId, e1, e2);
+ TupleData tupleData = objectFactory.createTuple2Data(version, branch, tupleType, e1, e2);
return tupleData;
}
@Override
- public TupleData createTuple3Data(Long tupleTypeId, BranchId branch, Long e1, Long e2, Long e3) {
+ public TupleData createTuple3Data(Tuple3Type<?, ?, ?> tupleType, BranchId branch, Long e1, Long e2, Long e3) {
VersionData version = objectFactory.createDefaultVersionData();
- TupleData tupleData = objectFactory.createTuple3Data(version, branch, tupleTypeId, e1, e2, e3);
+ TupleData tupleData = objectFactory.createTuple3Data(version, branch, tupleType, e1, e2, e3);
return tupleData;
}
@Override
- public TupleData createTuple4Data(Long tupleTypeId, BranchId branch, Long e1, Long e2, Long e3, Long e4) {
+ public TupleData createTuple4Data(Tuple4Type<?, ?, ?, ?> tupleType, BranchId branch, Long e1, Long e2, Long e3, Long e4) {
VersionData version = objectFactory.createDefaultVersionData();
- TupleData tupleData = objectFactory.createTuple4Data(version, branch, tupleTypeId, e1, e2, e3, e4);
+ TupleData tupleData = objectFactory.createTuple4Data(version, branch, tupleType, e1, e2, e3, e4);
return tupleData;
}
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 d4a2f24bd4..73d04ebc48 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
@@ -20,6 +20,10 @@ 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;
+import org.eclipse.osee.framework.core.data.Tuple2Type;
+import org.eclipse.osee.framework.core.data.Tuple3Type;
+import org.eclipse.osee.framework.core.data.Tuple4Type;
+import org.eclipse.osee.framework.core.data.TupleTypeId;
import org.eclipse.osee.framework.core.enums.BranchArchivedState;
import org.eclipse.osee.framework.core.enums.BranchState;
import org.eclipse.osee.framework.core.enums.BranchType;
@@ -230,8 +234,7 @@ public class OrcsObjectFactoryImpl implements OrcsObjectFactory {
source.getAuthor(), source.getCommitArt());
}
- @Override
- public TupleData createTuple2Data(VersionData version, BranchId branch, Long tupleType, Long e1, Long e2) {
+ private TupleData createTuple2Data(VersionData version, BranchId branch, TupleTypeId tupleType, Long e1, Long e2) {
TupleData data = new TupleDataImpl(version);
data.setBaseModType(ModificationType.NEW);
data.setModType(ModificationType.NEW);
@@ -245,15 +248,21 @@ public class OrcsObjectFactoryImpl implements OrcsObjectFactory {
}
@Override
- public TupleData createTuple3Data(VersionData version, BranchId branch, Long tupleType, Long e1, Long e2, Long e3) {
+ public TupleData createTuple2Data(VersionData version, BranchId branch, Tuple2Type<?, ?> tupleType, Long e1, Long e2) {
+ return createTuple2Data(version, branch, (TupleTypeId) tupleType, e1, e2);
+ }
+
+ @Override
+ public TupleData createTuple3Data(VersionData version, BranchId branch, Tuple3Type<?, ?, ?> tupleType, Long e1, Long e2, Long e3) {
TupleData data = createTuple2Data(version, branch, tupleType, e1, e2);
data.setElement3(e3);
return data;
}
@Override
- public TupleData createTuple4Data(VersionData version, BranchId branch, Long tupleType, Long e1, Long e2, Long e3, Long e4) {
- TupleData data = createTuple3Data(version, branch, tupleType, e1, e2, e3);
+ public TupleData createTuple4Data(VersionData version, BranchId branch, Tuple4Type<?, ?, ?, ?> tupleType, Long e1, Long e2, Long e3, Long e4) {
+ TupleData data = createTuple2Data(version, branch, tupleType, e1, e2);
+ data.setElement3(e3);
data.setElement4(e4);
return data;
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/TupleDataImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/TupleDataImpl.java
index d91cbe9dff..db4d4d68e7 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/TupleDataImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/TupleDataImpl.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.orcs.db.internal.loader.data;
+import org.eclipse.osee.framework.core.data.TupleTypeId;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.core.ds.TupleData;
import org.eclipse.osee.orcs.core.ds.VersionData;
@@ -20,7 +21,7 @@ import org.eclipse.osee.orcs.core.internal.tuple.TupleVisitor;
*/
public class TupleDataImpl extends OrcsVersionedObjectImpl implements TupleData {
- private Long tupleType;
+ private TupleTypeId tupleType;
private Long element1;
private Long element2;
private Long element3;
@@ -36,7 +37,7 @@ public class TupleDataImpl extends OrcsVersionedObjectImpl implements TupleData
}
@Override
- public Long getTupleType() {
+ public TupleTypeId getTupleType() {
return tupleType;
}
@@ -81,7 +82,7 @@ public class TupleDataImpl extends OrcsVersionedObjectImpl implements TupleData
}
@Override
- public void setTupleType(Long tupleType) {
+ public void setTupleType(TupleTypeId tupleType) {
this.tupleType = tupleType;
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/TupleObjectFactory.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/TupleObjectFactory.java
index 4c011c2bed..1c251796a1 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/TupleObjectFactory.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/TupleObjectFactory.java
@@ -11,6 +11,9 @@
package org.eclipse.osee.orcs.db.internal.loader.data;
import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.Tuple2Type;
+import org.eclipse.osee.framework.core.data.Tuple3Type;
+import org.eclipse.osee.framework.core.data.Tuple4Type;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.core.ds.TupleData;
import org.eclipse.osee.orcs.core.ds.VersionData;
@@ -20,10 +23,10 @@ import org.eclipse.osee.orcs.core.ds.VersionData;
*/
public interface TupleObjectFactory extends VersionObjectFactory {
- TupleData createTuple2Data(VersionData version, BranchId branch, Long tupleType, Long e1, Long e2) throws OseeCoreException;
+ TupleData createTuple2Data(VersionData version, BranchId branch, Tuple2Type<?, ?> tupleType, Long e1, Long e2) throws OseeCoreException;
- TupleData createTuple3Data(VersionData version, BranchId branch, Long tupleType, Long e1, Long e2, Long e3) throws OseeCoreException;
+ TupleData createTuple3Data(VersionData version, BranchId branch, Tuple3Type<?, ?, ?> tupleType, Long e1, Long e2, Long e3) throws OseeCoreException;
- TupleData createTuple4Data(VersionData version, BranchId branch, Long tupleType, Long e1, Long e2, Long e3, Long e4) throws OseeCoreException;
+ TupleData createTuple4Data(VersionData version, BranchId branch, Tuple4Type<?, ?, ?, ?> tupleType, Long e1, Long e2, Long e3, Long e4) throws OseeCoreException;
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/TupleEndpoint.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/TupleEndpoint.java
index 95416fdc71..df24afb121 100644
--- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/TupleEndpoint.java
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/TupleEndpoint.java
@@ -14,6 +14,10 @@ import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
+import org.eclipse.osee.framework.core.data.GammaId;
+import org.eclipse.osee.framework.core.data.Tuple2Type;
+import org.eclipse.osee.framework.core.data.Tuple3Type;
+import org.eclipse.osee.framework.core.data.Tuple4Type;
public interface TupleEndpoint {
@@ -23,18 +27,18 @@ public interface TupleEndpoint {
@Path("/tuple2")
@GET
- <E1, E2> Long getTuple2(@QueryParam("tupleType") Long tupleType, @QueryParam("e1") String e1);
+ <E1, E2> Long getTuple2(@QueryParam("tupleType") Tuple2Type<E1, E2> tupleType, @QueryParam("e1") E1 e1);
@Path("/tuple2")
@POST
- <E1, E2> Long addTuple2(@QueryParam("tupleType") Long tupleType, @QueryParam("e1") String e1, @QueryParam("e2") String e2);
+ <E1, E2> GammaId addTuple2(@QueryParam("tupleType") Tuple2Type<E1, E2> tupleType, @QueryParam("e1") E1 e1, @QueryParam("e2") E2 e2);
@Path("/tuple3")
@POST
- <E1, E2> Long addTuple3(@QueryParam("tupleType") Long tupleType, @QueryParam("e1") String e1, @QueryParam("e2") String e2, @QueryParam("e3") String e3);
+ <E1, E2, E3> GammaId addTuple3(@QueryParam("tupleType") Tuple3Type<E1, E2, E3> tupleType, @QueryParam("e1") E1 e1, @QueryParam("e2") E2 e2, @QueryParam("e3") E3 e3);
@Path("/tuple4")
@POST
- <E1, E2> Long addTuple4(@QueryParam("tupleType") Long tupleType, @QueryParam("e1") String e1, @QueryParam("e2") String e2, @QueryParam("e3") String e3, @QueryParam("e4") String e4);
+ <E1, E2, E3, E4> GammaId addTuple4(@QueryParam("tupleType") Tuple4Type<E1, E2, E3, E4> tupleType, @QueryParam("e1") E1 e1, @QueryParam("e2") E2 e2, @QueryParam("e3") E3 e3, @QueryParam("e4") E4 e4);
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchesResource.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchesResource.java
index d43667dbf3..5d5a0efa30 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchesResource.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchesResource.java
@@ -58,8 +58,8 @@ public class BranchesResource {
}
@Path("{branch}/tuples")
- public TupleEndpoint getTuples(@PathParam("branch") BranchId branch) {
- return new TupleEndpointImpl(OrcsApplication.getOrcsApi(), branch);
+ public TupleEndpoint getTuples(@PathParam("branch") BranchId branch, @HeaderParam("osee.account.id") UserId accountId) {
+ return new TupleEndpointImpl(OrcsApplication.getOrcsApi(), branch, accountId);
}
@Path("{branch}/applic")
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TupleEndpointImpl.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TupleEndpointImpl.java
index 9ac10a55e0..b430d6f3d4 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TupleEndpointImpl.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TupleEndpointImpl.java
@@ -19,17 +19,13 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.GammaId;
import org.eclipse.osee.framework.core.data.Tuple2Type;
import org.eclipse.osee.framework.core.data.Tuple3Type;
import org.eclipse.osee.framework.core.data.Tuple4Type;
-import org.eclipse.osee.framework.core.data.TupleTypeId;
-import org.eclipse.osee.framework.core.enums.CoreBranches;
-import org.eclipse.osee.framework.core.enums.SystemUser;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.core.data.UserId;
import org.eclipse.osee.orcs.OrcsApi;
-import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.rest.model.TupleEndpoint;
-import org.eclipse.osee.orcs.search.QueryFactory;
import org.eclipse.osee.orcs.transaction.TransactionBuilder;
/**
@@ -42,17 +38,19 @@ public class TupleEndpointImpl implements TupleEndpoint {
@Context
private UriInfo uriInfo;
private final BranchId branch;
+ private final UserId account;
- public TupleEndpointImpl(OrcsApi orcsApi, BranchId branch) {
+ public TupleEndpointImpl(OrcsApi orcsApi, BranchId branch, UserId account) {
this.orcsApi = orcsApi;
this.branch = branch;
+ this.account = account;
}
@Override
@Path("init")
@POST
public void addTuples() {
- TransactionBuilder tx = orcsApi.getTransactionFactory().createTransaction(branch, getUser(), "Init Tuples");
+ TransactionBuilder tx = orcsApi.getTransactionFactory().createTransaction(branch, account, "Init Tuples");
Tuple3Type<Long, Long, Long> ViewApplicability22 = Tuple3Type.valueOf(ProductLineFamily, 20L);
Tuple4Type<Long, Long, Long, Long> OseeTypeDef22 = Tuple4Type.valueOf(DefaultFamily, 40L);
@@ -66,9 +64,8 @@ public class TupleEndpointImpl implements TupleEndpoint {
@Override
@Path("/tuple2")
@GET
- public <E1, E2> Long getTuple2(@QueryParam("tupleType") Long tupleType, @QueryParam("e1") String e1) {
- Iterable<Object> iterable =
- orcsApi.getQueryFactory().tupleQuery().getTuple2(Tuple2Type.valueOf(tupleType), branch, e1);
+ public <E1, E2> Long getTuple2(@QueryParam("tupleType") Tuple2Type<E1, E2> tupleType, @QueryParam("e1") E1 e1) {
+ Iterable<E2> iterable = orcsApi.getQueryFactory().tupleQuery().getTuple2(tupleType, branch, e1);
if (iterable.iterator().hasNext()) {
return (Long) iterable.iterator().next();
}
@@ -76,90 +73,30 @@ public class TupleEndpointImpl implements TupleEndpoint {
}
@Override
- @Path("/tuple2")
- @POST
- public <E1, E2> Long addTuple2(@QueryParam("tupleType") Long tupleType, @QueryParam("e1") String e1, @QueryParam("e2") String e2) {
- Long toReturn;
- Object element1 = e1;
- Object element2 = e2;
- if (Strings.isNumeric(e1)) {
- element1 = Long.parseLong(e1);
- }
- if (Strings.isNumeric(e2)) {
- element2 = Long.parseLong(e2);
- }
-
- TupleTypeId typleTypeId = TupleTypeId.valueOf(tupleType);
-
- TransactionBuilder tx = orcsApi.getTransactionFactory().createTransaction(branch, getUser(), "Add Tuple 2");
- toReturn = tx.addTuple(typleTypeId, element1, element2);
+ public <E1, E2> GammaId addTuple2(Tuple2Type<E1, E2> tupleType, E1 e1, E2 e2) {
+ TransactionBuilder tx = orcsApi.getTransactionFactory().createTransaction(branch, account, "Add Tuple 2");
+ GammaId gammaId = tx.addTuple2(tupleType, e1, e2);
tx.commit();
- return toReturn;
+ return gammaId;
}
- @Override
@Path("/tuple3")
@POST
- public <E1, E2> Long addTuple3(@QueryParam("tupleType") Long tupleType, @QueryParam("e1") String e1, @QueryParam("e2") String e2, @QueryParam("e3") String e3) {
- Long toReturn;
- Object element1 = e1;
- Object element2 = e2;
- Object element3 = e3;
- if (Strings.isNumeric(e1)) {
- element1 = Long.parseLong(e1);
- }
- if (Strings.isNumeric(e2)) {
- element2 = Long.parseLong(e2);
- }
- if (Strings.isNumeric(e3)) {
- element3 = Long.parseLong(e3);
- }
- TupleTypeId typleTypeId = TupleTypeId.valueOf(tupleType);
-
- TransactionBuilder tx = orcsApi.getTransactionFactory().createTransaction(branch, getUser(), "Add Tuple 3");
- toReturn = tx.addTuple(typleTypeId, element1, element2, element3);
+ @Override
+ public <E1, E2, E3> GammaId addTuple3(Tuple3Type<E1, E2, E3> tupleType, E1 e1, E2 e2, E3 e3) {
+ TransactionBuilder tx = orcsApi.getTransactionFactory().createTransaction(branch, account, "Add Tuple 3");
+ GammaId gammaId = tx.addTuple3(tupleType, e1, e2, e3);
tx.commit();
- return toReturn;
+ return gammaId;
}
- @Override
@Path("/tuple4")
@POST
- public <E1, E2> Long addTuple4(@QueryParam("tupleType") Long tupleType, @QueryParam("e1") String e1, @QueryParam("e2") String e2, @QueryParam("e3") String e3, @QueryParam("e4") String e4) {
- Long toReturn;
- Object element1 = e1;
- Object element2 = e2;
- Object element3 = e3;
- Object element4 = e4;
- if (Strings.isNumeric(e1)) {
- element1 = Long.parseLong(e1);
- }
- if (Strings.isNumeric(e2)) {
- element2 = Long.parseLong(e2);
- }
- if (Strings.isNumeric(e3)) {
- element3 = Long.parseLong(e3);
- }
- if (Strings.isNumeric(e4)) {
- element4 = Long.parseLong(e4);
- }
- TupleTypeId typleTypeId = TupleTypeId.valueOf(tupleType);
-
- TransactionBuilder tx = orcsApi.getTransactionFactory().createTransaction(branch, getUser(), "Add Tuple 4");
- toReturn = tx.addTuple(typleTypeId, element1, element2, element3, element4);
+ @Override
+ public <E1, E2, E3, E4> GammaId addTuple4(Tuple4Type<E1, E2, E3, E4> tupleType, E1 e1, E2 e2, E3 e3, E4 e4) {
+ TransactionBuilder tx = orcsApi.getTransactionFactory().createTransaction(branch, account, "Add Tuple 4");
+ GammaId gammaId = tx.addTuple4(tupleType, e1, e2, e3, e4);
tx.commit();
- return toReturn;
- }
-
- private BranchId getAdminBranch() {
- return CoreBranches.COMMON;
- }
-
- private ArtifactReadable getUser() {
- return getQuery().fromBranch(getAdminBranch()).andId(SystemUser.OseeSystem).getResults().getExactlyOne();
- }
-
- private QueryFactory getQuery() {
- return orcsApi.getQueryFactory();
+ return gammaId;
}
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTupleTest.java b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTupleTest.java
index 3b1da0ce3d..2f5b3bffba 100644
--- a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTupleTest.java
+++ b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTupleTest.java
@@ -10,14 +10,18 @@
*******************************************************************************/
package org.eclipse.osee.orcs.api;
+import static org.eclipse.osee.framework.core.enums.CoreArtifactTokens.Everyone;
import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON;
+import static org.eclipse.osee.framework.core.enums.CoreTupleFamilyTypes.DefaultFamily;
+import static org.eclipse.osee.framework.core.enums.CoreTupleTypes.LruDataTypes;
+import static org.eclipse.osee.framework.core.enums.CoreTupleTypes.ViewApplicability;
import static org.eclipse.osee.framework.core.enums.SystemUser.OseeSystem;
import java.util.ArrayList;
import java.util.List;
import java.util.function.BiConsumer;
import org.eclipse.osee.framework.core.data.ApplicabilityToken;
-import org.eclipse.osee.framework.core.data.ArtifactId;
-import org.eclipse.osee.framework.core.data.TupleTypeId;
+import org.eclipse.osee.framework.core.data.GammaId;
+import org.eclipse.osee.framework.core.data.Tuple4Type;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreTupleTypes;
import org.eclipse.osee.framework.core.enums.DemoBranches;
@@ -78,43 +82,41 @@ public class OrcsTupleTest {
@Test(expected = JdbcException.class)
public void testAddTuple2() throws OseeCoreException {
- TupleTypeId createTuple2Type = TupleTypeId.valueOf(24L);
TransactionBuilder transaction =
orcsApi.getTransactionFactory().createTransaction(COMMON, OseeSystem, "Add Tuple2 Test");
- Long gamma_id = transaction.addTuple(createTuple2Type, 234L, "t");
+ GammaId gamma_id = transaction.addTuple2(ViewApplicability, Everyone, "t");
transaction.commit();
- Assert.assertTrue(gamma_id > 0L);
+ Assert.assertTrue(gamma_id.isValid());
- gamma_id = transaction.addTuple(createTuple2Type, 234L, "t");
+ transaction.addTuple2(ViewApplicability, Everyone, "t");
transaction.commit();
}
@Test(expected = JdbcException.class)
public void testAddTuple3() throws OseeCoreException {
- TupleTypeId createTuple3Type = TupleTypeId.valueOf(44L);
TransactionBuilder transaction =
orcsApi.getTransactionFactory().createTransaction(COMMON, OseeSystem, "Add Tuple3 Test");
- Long gamma_id = transaction.addTuple(createTuple3Type, 244L, 12L, "three");
+ GammaId gamma_id = transaction.addTuple3(LruDataTypes, "three", 244L, 12L);
transaction.commit();
- Assert.assertTrue(gamma_id > 0L);
+ Assert.assertTrue(gamma_id.isValid());
- gamma_id = transaction.addTuple(createTuple3Type, 244L, 12L, "three");
+ transaction.addTuple3(LruDataTypes, "three", 244L, 12L);
transaction.commit();
}
@Test(expected = JdbcException.class)
public void testAddTuple4() throws OseeCoreException {
- TupleTypeId createTuple4Type = TupleTypeId.valueOf(44L);
+ Tuple4Type<Long, Long, String, String> createTuple4Type = Tuple4Type.valueOf(DefaultFamily, 40L);
TransactionBuilder transaction =
orcsApi.getTransactionFactory().createTransaction(COMMON, OseeSystem, "Add Tuple4 Test");
- Long gamma_id = transaction.addTuple(createTuple4Type, 244L, 12L, "four", "four2");
+ GammaId gamma_id = transaction.addTuple4(createTuple4Type, 244L, 12L, "four", "four2");
transaction.commit();
- Assert.assertTrue(gamma_id > 0L);
+ Assert.assertTrue(gamma_id.isValid());
- gamma_id = transaction.addTuple(createTuple4Type, 244L, 12L, "four", "four2");
+ transaction.addTuple4(createTuple4Type, 244L, 12L, "four", "four2");
transaction.commit();
}
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 e4ccf38a90..84c0b00302 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
@@ -18,14 +18,13 @@ import org.eclipse.osee.framework.core.data.ArtifactToken;
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.AttributeTypeId;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.RelationTypeSide;
import org.eclipse.osee.framework.core.data.Tuple2Type;
import org.eclipse.osee.framework.core.data.Tuple3Type;
import org.eclipse.osee.framework.core.data.Tuple4Type;
-import org.eclipse.osee.framework.core.data.TupleTypeId;
import org.eclipse.osee.framework.core.enums.RelationSorter;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.data.ArtifactReadable;
@@ -143,13 +142,11 @@ public interface TransactionBuilder {
void setApplicability(ArtifactId art, ApplicabilityId applicId);
// Tuples
- <E1, E2> Long addTuple2(Tuple2Type<E1, E2> tupleType, E1 e1, E2 e2);
-
- <E1, E2, E3> Long addTuple3(Tuple3Type<E1, E2, E3> tupleType, E1 e1, E2 e2, E3 e3);
+ <E1, E2> GammaId addTuple2(Tuple2Type<E1, E2> tupleType, E1 e1, E2 e2);
- <E1, E2, E3, E4> Long addTuple4(Tuple4Type<E1, E2, E3, E4> tupleType, E1 e1, E2 e2, E3 e3, E4 e4);
+ <E1, E2, E3> GammaId addTuple3(Tuple3Type<E1, E2, E3> tupleType, E1 e1, E2 e2, E3 e3);
- Long addTuple(TupleTypeId tupleTypeId, Object... elements);
+ <E1, E2, E3, E4> GammaId addTuple4(Tuple4Type<E1, E2, E3, E4> tupleType, E1 e1, E2 e2, E3 e3, E4 e4);
boolean deleteTuple(Long gammaId);

Back to the top