Skip to content

Commit c7f0126

Browse files
author
Dennis J. McWherter, Jr
committed
Minor code tweaks.
1 parent f8a1fd4 commit c7f0126

5 files changed

Lines changed: 17 additions & 4 deletions

File tree

‎elide-core/src/main/java/com/yahoo/elide/core/RequestScope.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ public class RequestScope implements com.yahoo.elide.security.RequestScope {
7575
@Getter private final boolean useFilterExpressions;
7676
@Getter private final int updateStatusCode;
7777
@Getter private final boolean mutatingMultipleEntities;
78-
@Getter @Setter private String historicalVersion = null;
79-
@Getter @Setter private String historicalDate = null;
78+
@Getter @Setter private Long historicalRevision = null;
79+
@Getter @Setter private Long historicalDatestamp = null;
8080

8181
@Getter private final MultipleFilterDialect filterDialect;
8282
private final Map<String, FilterExpression> expressionsByType;

‎elide-graphql/pom.xml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@
4242
</scm>
4343

4444
<dependencies>
45+
<!-- TODO: Refactor to remove this dep from graphql -->
46+
<dependency>
47+
<groupId>org.hibernate</groupId>
48+
<artifactId>hibernate-envers</artifactId>
49+
<version>5.0.2.Final</version>
50+
</dependency>
4551
<dependency>
4652
<groupId>com.yahoo.elide</groupId>
4753
<artifactId>elide-core</artifactId>

‎elide-graphql/src/main/java/com/yahoo/elide/graphql/ModelBuilder.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ public GraphQLSchema build() {
201201

202202
root.field(newFieldDefinition()
203203
.name("__history")
204+
.dataFetcher(dataFetcher)
204205
.argument(newArgument()
205206
.name("revision")
206207
.type(new GraphQLList(Scalars.GraphQLLong))

‎elide-graphql/src/main/java/com/yahoo/elide/graphql/containers/HistoryContainer.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import com.yahoo.elide.graphql.Environment;
99

10+
import java.util.List;
1011
import java.util.Map;
1112

1213
public class HistoryContainer extends RootContainer {
@@ -22,8 +23,8 @@ public class HistoryContainer extends RootContainer {
2223
HistoryContainer(Environment context) {
2324
Map<String, Object> args = context.arguments;
2425
if (args != null) {
25-
context.requestScope.setHistoricalDate((String) args.get(DATE_KEY));
26-
context.requestScope.setHistoricalVersion((String) args.get(REVISION_KEY));
26+
context.requestScope.setHistoricalDatestamp((Long) ((List) args.get(DATE_KEY)).get(0));
27+
context.requestScope.setHistoricalRevision((Long) ((List) args.get(REVISION_KEY)).get(0));
2728
}
2829
}
2930
}

‎elide-graphql/src/main/java/com/yahoo/elide/graphql/containers/RootContainer.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ public class RootContainer implements GraphQLContainer {
2121
public Object processFetch(Environment context, PersistentResourceFetcher fetcher) {
2222
if (isHistorySelection(context.field)) {
2323
return new HistoryContainer(context);
24+
} else {
25+
// Not a revision request
26+
// TODO: Clean this up.
27+
context.requestScope.setHistoricalRevision(null);
28+
context.requestScope.setHistoricalDatestamp(null);
2429
}
2530
EntityDictionary dictionary = context.requestScope.getDictionary();
2631
Class<?> entityClass = dictionary.getEntityClass(context.field.getName());

0 commit comments

Comments
 (0)