File tree Expand file tree Collapse file tree
elide-core/src/main/java/com/yahoo/elide/core
src/main/java/com/yahoo/elide/graphql Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ;
Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff 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 ))
Original file line number Diff line number Diff line change 77
88import com .yahoo .elide .graphql .Environment ;
99
10+ import java .util .List ;
1011import java .util .Map ;
1112
1213public 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}
Original file line number Diff line number Diff 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 ());
You can’t perform that action at this time.
0 commit comments