Last active
November 25, 2022 21:38
-
-
Save lonniev/26e3cbfb85189ef4604d591b6059e6bc to your computer and use it in GitHub Desktop.
Perform a Gremlin Query that looks up who changed a particular thread and when
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
userName = { u,t -> userGet = new URL( "http://syndeia.company.com:9000/users/${u}" ).openConnection(); userGet.setRequestProperty( "Accept", "application/json" ); userGet.setRequestProperty( "X-Auth-Token", t ); userGet.getResponseCode(); j = new groovy.json.JsonSlurper().parseText( userGet.getInputStream().getText() ); j.resources.name } | |
signInToken = { -> signInPost = new URL( "http://syndeia.company.com:9000/signIn" ).openConnection(); message = '{ "username": "[email protected]", "password": "pass-phrase", "rememberMe": false }'; signInPost.setDoOutput( true ); signInPost.setRequestProperty( "Content-Type", "application/json" ); signInPost.getOutputStream().write( message.getBytes( "UTF-8" ) ); signInPost.getResponseCode(); j = new groovy.json.JsonSlurper().parseText( signInPost.getInputStream().getText() ); j.resources.token } | |
g.E().has( 'Relation', 'container', 'DZSB19' ) | |
.group() | |
.by( values( 'modifiedDate' ) | |
.map{ ( LocalDateTime.parse( it.get(), java.time.format.DateTimeFormatter.ISO_LOCAL_DATE_TIME ) ) | |
.format( java.time.format.DateTimeFormatter.ofPattern( "YYYY MM/dd EEEE" ) ) } ) | |
.by( groupCount().by( values( 'modifiedBy' ) ) ) | |
.unfold() | |
.order().by( keys ) | |
.project( 'When', 'Who' ) | |
.by( select( keys ) ) | |
.by( select( values ).unfold() | |
.map{ it -> "${userName( it.get().getKey(), signInToken() )} (${it.get().getValue()} times)" }.fold() ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.