Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2019-05-25 03:50:05 +0000
committerRyan D. Brooks2020-12-15 21:44:50 +0000
commite1f27a60f594f2de7d354edf24374d6692727ccb (patch)
tree5cb5359beb82b8b7615aede56a963b6daf0db771
parent0469f27d143e3474cc5d1d0b3ccb9181c463762c (diff)
downloadorg.eclipse.osee-e1f27a60f594f2de7d354edf24374d6692727ccb.tar.gz
org.eclipse.osee-e1f27a60f594f2de7d354edf24374d6692727ccb.tar.xz
org.eclipse.osee-e1f27a60f594f2de7d354edf24374d6692727ccb.zip
feature: Selective Loading
-rw-r--r--plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/GitOperationsImpl.java10
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/QueryData.java18
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/ArtifactQuerySelection.java58
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/QueryBuilder.java8
4 files changed, 94 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/GitOperationsImpl.java b/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/GitOperationsImpl.java
index 0abed8f5d17..0e90708a439 100644
--- a/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/GitOperationsImpl.java
+++ b/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/GitOperationsImpl.java
@@ -110,8 +110,18 @@ public final class GitOperationsImpl implements GitOperations {
this.systemPrefs = systemPrefs;
}
+ private void s(Date authorDate) {
+
+ }
+
@Override
public ArtifactToken getCommitArtifactId(BranchId branch, String changeId) {
+
+ queryFactory.fromBranch(branch).and(GitChangeId, changeId).selectInto(this).selectAtt(GitCommitAuthorDate,
+ GitOperationsImpl::s);
+
+ queryFactory.fromBranch(branch).and(GitChangeId, changeId).selectAtt(GitCommitAuthorDate, this::s);
+
List<ArtifactReadable> commits =
queryFactory.fromBranch(branch).andAttributeIs(GitChangeId, changeId).andTypeEquals(
GitCommit).getResults().getList();
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/QueryData.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/QueryData.java
index 37637954668..ddc35d233cc 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/QueryData.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/QueryData.java
@@ -26,6 +26,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
+import java.util.function.Consumer;
import java.util.stream.Collectors;
import org.eclipse.osee.framework.core.OrcsTokenService;
import org.eclipse.osee.framework.core.data.ArtifactId;
@@ -67,6 +68,7 @@ import org.eclipse.osee.orcs.core.ds.criteria.CriteriaRelationTypeSideNotExists;
import org.eclipse.osee.orcs.core.internal.search.CallableQueryFactory;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.data.AttributeReadable;
+import org.eclipse.osee.orcs.search.ArtifactQuerySelection;
import org.eclipse.osee.orcs.search.Match;
import org.eclipse.osee.orcs.search.QueryBuilder;
import org.eclipse.osee.orcs.search.QueryFactory;
@@ -91,6 +93,7 @@ public final class QueryData implements QueryBuilder, HasOptions, HasBranch {
private final HashMap<SqlTable, String> mainAliases = new HashMap<>(4);
private QueryType queryType;
private boolean followCausesChild = true;
+ private Supplier<?> selectInto;
public QueryData(QueryData parentQueryData, QueryFactory queryFactory, QueryEngine queryEngine, CallableQueryFactory artQueryFactory, OrcsTokenService tokenService, BranchId branch, ArtifactId view) {
this.parentQueryData = parentQueryData;
@@ -141,6 +144,21 @@ public final class QueryData implements QueryBuilder, HasOptions, HasBranch {
return options;
}
+ @Override
+ public <R> ArtifactQuerySelection<R> selectInto(Supplier<R> receiver) {
+ return new ArtifactQuerySelection<>(receiver);
+ }
+
+ @Override
+ public <R> ArtifactQuerySelection<R> selectInto(R receiver) {
+ return new ArtifactQuerySelection<>(receiver);
+ }
+
+ @Override
+ public <T> void selectAtt(AttributeTypeToken<T> attributeType, Consumer<T> consumer) {
+
+ }
+
public boolean isSelectQueryType() {
return queryType == QueryType.SELECT;
}
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/ArtifactQuerySelection.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/ArtifactQuerySelection.java
new file mode 100644
index 00000000000..b65bcc4bf3c
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/ArtifactQuerySelection.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2019 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.orcs.search;
+
+import java.util.HashMap;
+import java.util.function.BiConsumer;
+import java.util.function.Supplier;
+import org.eclipse.osee.framework.core.data.ArtifactId;
+import org.eclipse.osee.framework.core.data.ArtifactTypeToken;
+import org.eclipse.osee.framework.core.data.AttributeTypeToken;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class ArtifactQuerySelection<R> {
+ private final R receiver;
+ private final Supplier<R> receiverSupplier;
+ private final HashMap<AttributeTypeToken<?>, BiConsumer<R, ?>> atts = new HashMap<>();
+
+ public ArtifactQuerySelection(Supplier<R> receiverSupplier) {
+ this.receiverSupplier = receiverSupplier;
+ this.receiver = null;
+ }
+
+ public ArtifactQuerySelection(R receiver) {
+ this.receiverSupplier = null;
+ this.receiver = receiver;
+ }
+
+ public <T> void selectAtt(AttributeTypeToken<T> attributeType, BiConsumer<R, T> consumer) {
+ atts.put(attributeType, consumer);
+ }
+
+ public <T> void accept(AttributeTypeToken<T> attributeType, T value) {
+ BiConsumer<R, T> consumer = (BiConsumer<R, T>) atts.get(attributeType);
+ consumer.accept(getReceiver(), value);
+ }
+
+ private R getReceiver() {
+ return receiver == null ? receiverSupplier.get() : receiver;
+ }
+
+ public <T> void selectArtifactId(BiConsumer<R, ArtifactId> consumer) {
+
+ }
+
+ public <T> void selectArtifactType(BiConsumer<R, ArtifactTypeToken> consumer) {
+
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/QueryBuilder.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/QueryBuilder.java
index ec5bed21995..e67a3b10bf6 100644
--- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/QueryBuilder.java
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/QueryBuilder.java
@@ -16,6 +16,8 @@ package org.eclipse.osee.orcs.search;
import java.util.Collection;
import java.util.List;
import java.util.Map;
+import java.util.function.Consumer;
+import java.util.function.Supplier;
import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.ArtifactToken;
import org.eclipse.osee.framework.core.data.ArtifactTypeToken;
@@ -91,6 +93,12 @@ public interface QueryBuilder extends Query {
*/
ArtifactToken getArtifactOrSentinal();
+
+ <R> ArtifactQuerySelection<R> selectInto(Supplier<R> receiver);
+
+ <R> ArtifactQuerySelection<R> selectInto(R receiver);
+
+ public <T> void selectAtt(AttributeTypeToken<T> attributeType, Consumer<T> consumer);
public static AttributeTypeToken ANY_ATTRIBUTE_TYPE =
AttributeTypeToken.valueOf(Long.MIN_VALUE, "Any Attribute Type");

Back to the top