idx
int64 0
41.2k
| question
stringlengths 83
4.15k
| target
stringlengths 5
715
|
|---|---|---|
34,900
|
public SlackService getSlackService ( Object projectIdOrPath ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "services" , "slack" ) ; return ( response . readEntity ( SlackService . class ) ) ; }
|
Get the Slack notification settings for a project .
|
34,901
|
public SlackService updateSlackService ( Object projectIdOrPath , SlackService slackNotifications ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "webhook" , slackNotifications . getWebhook ( ) , true ) . withParam ( "username" , slackNotifications . getUsername ( ) ) . withParam ( "channel" , slackNotifications . getDefaultChannel ( ) ) . withParam ( "notify_only_broken_pipelines" , slackNotifications . getNotifyOnlyBrokenPipelines ( ) ) . withParam ( "notify_only_default_branch" , slackNotifications . getNotifyOnlyDefaultBranch ( ) ) . withParam ( "push_events" , slackNotifications . getPushEvents ( ) ) . withParam ( "issues_events" , slackNotifications . getIssuesEvents ( ) ) . withParam ( "confidential_issues_events" , slackNotifications . getConfidentialIssuesEvents ( ) ) . withParam ( "merge_requests_events" , slackNotifications . getMergeRequestsEvents ( ) ) . withParam ( "tag_push_events" , slackNotifications . getTagPushEvents ( ) ) . withParam ( "note_events" , slackNotifications . getNoteEvents ( ) ) . withParam ( "confidential_note_events" , slackNotifications . getConfidentialNoteEvents ( ) ) . withParam ( "pipeline_events" , slackNotifications . getPipelineEvents ( ) ) . withParam ( "wiki_page_events" , slackNotifications . getWikiPageEvents ( ) ) . withParam ( "push_channel" , slackNotifications . getPushChannel ( ) ) . withParam ( "issue_channel" , slackNotifications . getIssueChannel ( ) ) . withParam ( "confidential_issue_channel" , slackNotifications . getConfidentialIssueChannel ( ) ) . withParam ( "merge_request_channel" , slackNotifications . getMergeRequestChannel ( ) ) . withParam ( "note_channel" , slackNotifications . getNoteChannel ( ) ) . withParam ( "confidential_note_channel" , slackNotifications . getConfidentialNoteChannel ( ) ) . withParam ( "tag_push_channel" , slackNotifications . getTagPushChannel ( ) ) . withParam ( "pipeline_channel" , slackNotifications . getPipelineChannel ( ) ) . withParam ( "wiki_page_channel" , slackNotifications . getWikiPageChannel ( ) ) ; Response response = put ( Response . Status . OK , formData . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "services" , "slack" ) ; return ( response . readEntity ( SlackService . class ) ) ; }
|
Updates the Slack notification settings for a project .
|
34,902
|
public JiraService updateJiraService ( Object projectIdOrPath , JiraService jira ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "merge_requests_events" , jira . getMergeRequestsEvents ( ) ) . withParam ( "commit_events" , jira . getCommitEvents ( ) ) . withParam ( "url" , jira . getUrl ( ) , true ) . withParam ( "api_url" , jira . getApiUrl ( ) ) . withParam ( "project_key" , jira . getProjectKey ( ) ) . withParam ( "username" , jira . getUsername ( ) , true ) . withParam ( "password" , jira . getPassword ( ) , true ) . withParam ( "jira_issue_transition_id" , jira . getJiraIssueTransitionId ( ) ) ; Response response = put ( Response . Status . OK , formData . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "services" , "jira" ) ; return ( response . readEntity ( JiraService . class ) ) ; }
|
Updates the JIRA service settings for a project .
|
34,903
|
public ExternalWikiService updateExternalWikiService ( Object projectIdOrPath , ExternalWikiService externalWiki ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "external_wiki_url" , externalWiki . getExternalWikiUrl ( ) ) ; Response response = put ( Response . Status . OK , formData . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "services" , "external-wiki" ) ; return ( response . readEntity ( ExternalWikiService . class ) ) ; }
|
Updates the ExternalWikiService service settings for a project .
|
34,904
|
public void handleEvent ( HttpServletRequest request ) throws GitLabApiException { String eventName = request . getHeader ( "X-Gitlab-Event" ) ; if ( eventName == null || eventName . trim ( ) . isEmpty ( ) ) { String message = "X-Gitlab-Event header is missing!" ; LOGGER . warning ( message ) ; return ; } if ( ! isValidSecretToken ( request ) ) { String message = "X-Gitlab-Token mismatch!" ; LOGGER . warning ( message ) ; throw new GitLabApiException ( message ) ; } LOGGER . info ( "handleEvent: X-Gitlab-Event=" + eventName ) ; if ( ! SYSTEM_HOOK_EVENT . equals ( eventName ) ) { String message = "Unsupported X-Gitlab-Event, event Name=" + eventName ; LOGGER . warning ( message ) ; throw new GitLabApiException ( message ) ; } JsonNode tree ; try { if ( LOGGER . isLoggable ( Level . FINE ) ) { LOGGER . fine ( HttpRequestUtils . getShortRequestDump ( "System Hook" , true , request ) ) ; String postData = HttpRequestUtils . getPostDataAsString ( request ) ; LOGGER . fine ( "Raw POST data:\n" + postData ) ; tree = jacksonJson . readTree ( postData ) ; } else { InputStreamReader reader = new InputStreamReader ( request . getInputStream ( ) ) ; tree = jacksonJson . readTree ( reader ) ; } } catch ( Exception e ) { LOGGER . warning ( "Error reading JSON data, exception=" + e . getClass ( ) . getSimpleName ( ) + ", error=" + e . getMessage ( ) ) ; throw new GitLabApiException ( e ) ; } if ( ! tree . has ( "event_name" ) && tree . has ( "object_kind" ) ) { String objectKind = tree . get ( "object_kind" ) . asText ( ) ; if ( MergeRequestSystemHookEvent . MERGE_REQUEST_EVENT . equals ( objectKind ) ) { ObjectNode node = ( ObjectNode ) tree ; node . put ( "event_name" , MergeRequestSystemHookEvent . MERGE_REQUEST_EVENT ) ; } else { String message = "Unsupported object_kind for system hook event, object_kind=" + objectKind ; LOGGER . warning ( message ) ; throw new GitLabApiException ( message ) ; } } try { SystemHookEvent event = jacksonJson . unmarshal ( SystemHookEvent . class , tree ) ; if ( LOGGER . isLoggable ( Level . FINE ) ) { LOGGER . fine ( event . getEventName ( ) + "\n" + jacksonJson . marshal ( event ) + "\n" ) ; } StringBuffer requestUrl = request . getRequestURL ( ) ; event . setRequestUrl ( requestUrl != null ? requestUrl . toString ( ) : null ) ; event . setRequestQueryString ( request . getQueryString ( ) ) ; fireEvent ( event ) ; } catch ( Exception e ) { LOGGER . warning ( "Error processing JSON data, exception=" + e . getClass ( ) . getSimpleName ( ) + ", error=" + e . getMessage ( ) ) ; throw new GitLabApiException ( e ) ; } }
|
Parses and verifies an SystemHookEvent instance from the HTTP request and fires it off to the registered listeners .
|
34,905
|
public Stream < Runner > getRunnersStream ( Runner . RunnerStatus scope ) throws GitLabApiException { return ( getRunners ( scope , getDefaultPerPage ( ) ) . stream ( ) ) ; }
|
Get a Stream of all available runners available to the user with pagination support .
|
34,906
|
public Pager < Runner > getRunners ( Runner . RunnerStatus scope , int itemsPerPage ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "scope" , scope , false ) ; return ( new Pager < > ( this , Runner . class , itemsPerPage , formData . asMap ( ) , "runners" ) ) ; }
|
Get a list of specific runners available to the user .
|
34,907
|
public RunnerDetail getRunnerDetail ( Integer runnerId ) throws GitLabApiException { if ( runnerId == null ) { throw new RuntimeException ( "runnerId cannot be null" ) ; } Response response = get ( Response . Status . OK , null , "runners" , runnerId ) ; return ( response . readEntity ( RunnerDetail . class ) ) ; }
|
Get details of a runner .
|
34,908
|
public RunnerDetail updateRunner ( Integer runnerId , String description , Boolean active , List < String > tagList , Boolean runUntagged , Boolean locked , RunnerDetail . RunnerAccessLevel accessLevel ) throws GitLabApiException { if ( runnerId == null ) { throw new RuntimeException ( "runnerId cannot be null" ) ; } GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "description" , description , false ) . withParam ( "active" , active , false ) . withParam ( "tag_list" , tagList , false ) . withParam ( "run_untagged" , runUntagged , false ) . withParam ( "locked" , locked , false ) . withParam ( "access_level" , accessLevel , false ) ; Response response = put ( Response . Status . OK , formData . asMap ( ) , "runners" , runnerId ) ; return ( response . readEntity ( RunnerDetail . class ) ) ; }
|
Update details of a runner .
|
34,909
|
public void removeRunner ( Integer runnerId ) throws GitLabApiException { if ( runnerId == null ) { throw new RuntimeException ( "runnerId cannot be null" ) ; } delete ( Response . Status . NO_CONTENT , null , "runners" , runnerId ) ; }
|
Remove a runner .
|
34,910
|
public Runner enableRunner ( Object projectIdOrPath , Integer runnerId ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "runner_id" , runnerId , true ) ; Response response = post ( Response . Status . CREATED , formData . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "runners" ) ; return ( response . readEntity ( Runner . class ) ) ; }
|
Enable an available specific runner in the project .
|
34,911
|
public RunnerDetail registerRunner ( String token , String description , Boolean active , List < String > tagList , Boolean runUntagged , Boolean locked , Integer maximumTimeout ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "token" , token , true ) . withParam ( "description" , description , false ) . withParam ( "active" , active , false ) . withParam ( "locked" , locked , false ) . withParam ( "run_untagged" , runUntagged , false ) . withParam ( "tag_list" , tagList , false ) . withParam ( "maximum_timeout" , maximumTimeout , false ) ; Response response = post ( Response . Status . CREATED , formData . asMap ( ) , "runners" ) ; return ( response . readEntity ( RunnerDetail . class ) ) ; }
|
Register a new runner for the gitlab instance .
|
34,912
|
public void deleteRunner ( String token ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "token" , token , true ) ; delete ( Response . Status . NO_CONTENT , formData . asMap ( ) , "runners" ) ; }
|
Deletes a registered Runner .
|
34,913
|
public boolean isValidSecretToken ( String secretToken ) { return ( this . secretToken == null || this . secretToken . equals ( secretToken ) ? true : false ) ; }
|
Validate the provided secret token against the reference secret token . Returns true if the secret token is valid or there is no reference secret token to validate against otherwise returns false .
|
34,914
|
public boolean isValidSecretToken ( HttpServletRequest request ) { if ( this . secretToken != null ) { String secretToken = request . getHeader ( "X-Gitlab-Token" ) ; return ( isValidSecretToken ( secretToken ) ) ; } return ( true ) ; }
|
Validate the provided secret token found in the HTTP header against the reference secret token . Returns true if the secret token is valid or there is no reference secret token to validate against otherwise returns false .
|
34,915
|
public List < Note > getIssueNotes ( Object projectIdOrPath , Integer issueIid , int page , int perPage ) throws GitLabApiException { Response response = get ( Response . Status . OK , getPageQueryParams ( page , perPage ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "issues" , issueIid , "notes" ) ; return ( response . readEntity ( new GenericType < List < Note > > ( ) { } ) ) ; }
|
Get a list of the issue s notes using the specified page and per page settings .
|
34,916
|
public Stream < Note > getIssueNotesStream ( Object projectIdOrPath , Integer issueIid ) throws GitLabApiException { return ( getIssueNotes ( projectIdOrPath , issueIid , getDefaultPerPage ( ) ) . stream ( ) ) ; }
|
Get a Stream of the issues s notes .
|
34,917
|
public Note getIssueNote ( Object projectIdOrPath , Integer issueIid , Integer noteId ) throws GitLabApiException { Response response = get ( Response . Status . OK , getDefaultPerPageParam ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "issues" , issueIid , "notes" , noteId ) ; return ( response . readEntity ( Note . class ) ) ; }
|
Get the specified issues s note .
|
34,918
|
public Note updateIssueNote ( Object projectIdOrPath , Integer issueIid , Integer noteId , String body ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "body" , body , true ) ; Response response = put ( Response . Status . OK , formData . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "issues" , issueIid , "notes" , noteId ) ; return ( response . readEntity ( Note . class ) ) ; }
|
Update the specified issues s note .
|
34,919
|
public List < Note > getMergeRequestNotes ( Object projectIdOrPath , Integer mergeRequestIid ) throws GitLabApiException { return ( getMergeRequestNotes ( projectIdOrPath , mergeRequestIid , null , null , getDefaultPerPage ( ) ) . all ( ) ) ; }
|
Gets a list of all notes for a single merge request
|
34,920
|
public List < Note > getMergeRequestNotes ( Object projectIdOrPath , Integer mergeRequestIid , SortOrder sortOrder , Note . OrderBy orderBy ) throws GitLabApiException { return ( getMergeRequestNotes ( projectIdOrPath , mergeRequestIid , sortOrder , orderBy , getDefaultPerPage ( ) ) . all ( ) ) ; }
|
Gets a list of all notes for a single merge request .
|
34,921
|
public Stream < Note > getMergeRequestNotesStream ( Object projectIdOrPath , Integer mergeRequestIid ) throws GitLabApiException { return ( getMergeRequestNotes ( projectIdOrPath , mergeRequestIid , null , null , getDefaultPerPage ( ) ) . stream ( ) ) ; }
|
Gets a Stream of all notes for a single merge request
|
34,922
|
public Stream < Note > getMergeRequestNotesStream ( Object projectIdOrPath , Integer mergeRequestIid , SortOrder sortOrder , Note . OrderBy orderBy ) throws GitLabApiException { return ( getMergeRequestNotes ( projectIdOrPath , mergeRequestIid , sortOrder , orderBy , getDefaultPerPage ( ) ) . stream ( ) ) ; }
|
Gets a Stream of all notes for a single merge request .
|
34,923
|
public Note getMergeRequestNote ( Object projectIdOrPath , Integer mergeRequestIid , Integer noteId ) throws GitLabApiException { Response response = get ( Response . Status . OK , getDefaultPerPageParam ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "merge_requests" , mergeRequestIid , "notes" , noteId ) ; return ( response . readEntity ( Note . class ) ) ; }
|
Get the specified merge request s note .
|
34,924
|
public Note createMergeRequestNote ( Object projectIdOrPath , Integer mergeRequestIid , String body ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "body" , body , true ) ; Response response = post ( Response . Status . CREATED , formData , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "merge_requests" , mergeRequestIid , "notes" ) ; return ( response . readEntity ( Note . class ) ) ; }
|
Create a merge request s note .
|
34,925
|
public void deleteMergeRequestNote ( Object projectIdOrPath , Integer mergeRequestIid , Integer noteId ) throws GitLabApiException { if ( mergeRequestIid == null ) { throw new RuntimeException ( "mergeRequestIid cannot be null" ) ; } if ( noteId == null ) { throw new RuntimeException ( "noteId cannot be null" ) ; } Response . Status expectedStatus = ( isApiVersion ( GitLabApi . ApiVersion . V3 ) ? Response . Status . OK : Response . Status . NO_CONTENT ) ; delete ( expectedStatus , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "merge_requests" , mergeRequestIid , "notes" , noteId ) ; }
|
Delete the specified merge request s note .
|
34,926
|
public Stream < Tag > getTagsStream ( Object projectIdOrPath ) throws GitLabApiException { return ( getTags ( projectIdOrPath , getDefaultPerPage ( ) ) . stream ( ) ) ; }
|
Get a Stream of repository tags from a project sorted by name in reverse alphabetical order .
|
34,927
|
public Tag getTag ( Object projectIdOrPath , String tagName ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "repository" , "tags" , tagName ) ; return ( response . readEntity ( Tag . class ) ) ; }
|
Get a specific repository tag determined by its name .
|
34,928
|
public Optional < Tag > getOptionalTag ( Object projectIdOrPath , String tagName ) throws GitLabApiException { try { return ( Optional . ofNullable ( getTag ( projectIdOrPath , tagName ) ) ) ; } catch ( GitLabApiException glae ) { return ( GitLabApi . createOptionalFromException ( glae ) ) ; } }
|
Get an Optional instance holding a Tag instance of a specific repository tag determined by its name .
|
34,929
|
public Tag createTag ( Object projectIdOrPath , String tagName , String ref ) throws GitLabApiException { return ( createTag ( projectIdOrPath , tagName , ref , null , ( String ) null ) ) ; }
|
Creates a tag on a particular ref of the given project .
|
34,930
|
public Release createRelease ( Object projectIdOrPath , String tagName , String releaseNotes ) throws GitLabApiException { Form formData = new GitLabApiForm ( ) . withParam ( "description" , releaseNotes ) ; Response response = post ( Response . Status . CREATED , formData . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "repository" , "tags" , tagName , "release" ) ; return ( response . readEntity ( Release . class ) ) ; }
|
Add release notes to the existing git tag .
|
34,931
|
public Release updateRelease ( Object projectIdOrPath , String tagName , String releaseNotes ) throws GitLabApiException { Form formData = new GitLabApiForm ( ) . withParam ( "description" , releaseNotes ) ; Response response = put ( Response . Status . OK , formData . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "repository" , "tags" , tagName , "release" ) ; return ( response . readEntity ( Release . class ) ) ; }
|
Updates the release notes of a given release .
|
34,932
|
public List < User > getUsers ( int page , int perPage ) throws GitLabApiException { Response response = get ( Response . Status . OK , getPageQueryParams ( page , perPage , customAttributesEnabled ) , "users" ) ; return ( response . readEntity ( new GenericType < List < User > > ( ) { } ) ) ; }
|
Get a list of users using the specified page and per page settings .
|
34,933
|
public Pager < User > getUsers ( int itemsPerPage ) throws GitLabApiException { return ( new Pager < User > ( this , User . class , itemsPerPage , createGitLabApiForm ( ) . asMap ( ) , "users" ) ) ; }
|
Get a Pager of users .
|
34,934
|
public Pager < User > getActiveUsers ( int itemsPerPage ) throws GitLabApiException { GitLabApiForm formData = createGitLabApiForm ( ) . withParam ( "active" , true ) ; return ( new Pager < User > ( this , User . class , itemsPerPage , formData . asMap ( ) , "users" ) ) ; }
|
Get a Pager of active users .
|
34,935
|
public void blockUser ( Integer userId ) throws GitLabApiException { if ( userId == null ) { throw new RuntimeException ( "userId cannot be null" ) ; } if ( isApiVersion ( ApiVersion . V3 ) ) { put ( Response . Status . CREATED , null , "users" , userId , "block" ) ; } else { post ( Response . Status . CREATED , ( Form ) null , "users" , userId , "block" ) ; } }
|
Blocks the specified user . Available only for admin .
|
34,936
|
public List < User > getblockedUsers ( int page , int perPage ) throws GitLabApiException { GitLabApiForm formData = createGitLabApiForm ( ) . withParam ( "blocked" , true ) . withParam ( PAGE_PARAM , page ) . withParam ( PER_PAGE_PARAM , perPage ) ; Response response = get ( Response . Status . OK , formData . asMap ( ) , "users" ) ; return ( response . readEntity ( new GenericType < List < User > > ( ) { } ) ) ; }
|
Get a list of blocked users using the specified page and per page settings .
|
34,937
|
public User getUser ( int userId ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "with_custom_attributes" , customAttributesEnabled ) ; Response response = get ( Response . Status . OK , formData . asMap ( ) , "users" , userId ) ; return ( response . readEntity ( User . class ) ) ; }
|
Get a single user .
|
34,938
|
public Optional < User > getOptionalUser ( int userId ) { try { return ( Optional . ofNullable ( getUser ( userId ) ) ) ; } catch ( GitLabApiException glae ) { return ( GitLabApi . createOptionalFromException ( glae ) ) ; } }
|
Get a single user as an Optional instance .
|
34,939
|
public User getUser ( String username ) throws GitLabApiException { GitLabApiForm formData = createGitLabApiForm ( ) . withParam ( "username" , username , true ) ; Response response = get ( Response . Status . OK , formData . asMap ( ) , "users" ) ; List < User > users = response . readEntity ( new GenericType < List < User > > ( ) { } ) ; return ( users . isEmpty ( ) ? null : users . get ( 0 ) ) ; }
|
Lookup a user by username . Returns null if not found .
|
34,940
|
public Optional < User > getOptionalUser ( String username ) { try { return ( Optional . ofNullable ( getUser ( username ) ) ) ; } catch ( GitLabApiException glae ) { return ( GitLabApi . createOptionalFromException ( glae ) ) ; } }
|
Lookup a user by username and return an Optional instance .
|
34,941
|
public List < User > findUsers ( String emailOrUsername ) throws GitLabApiException { return ( findUsers ( emailOrUsername , getDefaultPerPage ( ) ) . all ( ) ) ; }
|
Search users by Email or username
|
34,942
|
public Pager < User > findUsers ( String emailOrUsername , int itemsPerPage ) throws GitLabApiException { GitLabApiForm formData = createGitLabApiForm ( ) . withParam ( "search" , emailOrUsername , true ) ; return ( new Pager < User > ( this , User . class , itemsPerPage , formData . asMap ( ) , "users" ) ) ; }
|
Search users by Email or username and return a Pager
|
34,943
|
public Stream < User > findUsersStream ( String emailOrUsername ) throws GitLabApiException { return ( findUsers ( emailOrUsername , getDefaultPerPage ( ) ) . stream ( ) ) ; }
|
Search users by Email or username .
|
34,944
|
public User modifyUser ( User user , CharSequence password , Integer projectsLimit ) throws GitLabApiException { Form form = userToForm ( user , projectsLimit , password , false , false ) ; Response response = put ( Response . Status . OK , form . asMap ( ) , "users" , user . getId ( ) ) ; return ( response . readEntity ( User . class ) ) ; }
|
Modifies an existing user . Only administrators can change attributes of a user .
|
34,945
|
public void deleteUser ( Object userIdOrUsername , Boolean hardDelete ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "hard_delete " , hardDelete ) ; Response . Status expectedStatus = ( isApiVersion ( ApiVersion . V3 ) ? Response . Status . OK : Response . Status . NO_CONTENT ) ; delete ( expectedStatus , formData . asMap ( ) , "users" , getUserIdOrUsername ( userIdOrUsername ) ) ; }
|
Deletes a user . Available only for administrators .
|
34,946
|
public User getCurrentUser ( ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "user" ) ; return ( response . readEntity ( User . class ) ) ; }
|
Get currently authenticated user .
|
34,947
|
public List < SshKey > getSshKeys ( ) throws GitLabApiException { Response response = get ( Response . Status . OK , getDefaultPerPageParam ( ) , "user" , "keys" ) ; return ( response . readEntity ( new GenericType < List < SshKey > > ( ) { } ) ) ; }
|
Get a list of currently authenticated user s SSH keys .
|
34,948
|
public List < SshKey > getSshKeys ( Integer userId ) throws GitLabApiException { if ( userId == null ) { throw new RuntimeException ( "userId cannot be null" ) ; } Response response = get ( Response . Status . OK , getDefaultPerPageParam ( ) , "users" , userId , "keys" ) ; List < SshKey > keys = response . readEntity ( new GenericType < List < SshKey > > ( ) { } ) ; if ( keys != null ) { keys . forEach ( key -> key . setUserId ( userId ) ) ; } return ( keys ) ; }
|
Get a list of a specified user s SSH keys . Available only for admin users .
|
34,949
|
public SshKey getSshKey ( Integer keyId ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "user" , "keys" , keyId ) ; return ( response . readEntity ( SshKey . class ) ) ; }
|
Get a single SSH Key .
|
34,950
|
public Optional < SshKey > getOptionalSshKey ( Integer keyId ) { try { return ( Optional . ofNullable ( getSshKey ( keyId ) ) ) ; } catch ( GitLabApiException glae ) { return ( GitLabApi . createOptionalFromException ( glae ) ) ; } }
|
Get a single SSH Key as an Optional instance .
|
34,951
|
public SshKey addSshKey ( String title , String key ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "title" , title ) . withParam ( "key" , key ) ; Response response = post ( Response . Status . CREATED , formData , "user" , "keys" ) ; return ( response . readEntity ( SshKey . class ) ) ; }
|
Creates a new key owned by the currently authenticated user .
|
34,952
|
public SshKey addSshKey ( Integer userId , String title , String key ) throws GitLabApiException { if ( userId == null ) { throw new RuntimeException ( "userId cannot be null" ) ; } GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "title" , title ) . withParam ( "key" , key ) ; Response response = post ( Response . Status . CREATED , formData , "users" , userId , "keys" ) ; SshKey sshKey = response . readEntity ( SshKey . class ) ; if ( sshKey != null ) { sshKey . setUserId ( userId ) ; } return ( sshKey ) ; }
|
Create new key owned by specified user . Available only for admin users .
|
34,953
|
public List < ImpersonationToken > getImpersonationTokens ( Object userIdOrUsername , ImpersonationState state ) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "state" , state ) . withParam ( PER_PAGE_PARAM , getDefaultPerPage ( ) ) ; Response response = get ( Response . Status . OK , formData . asMap ( ) , "users" , getUserIdOrUsername ( userIdOrUsername ) , "impersonation_tokens" ) ; return ( response . readEntity ( new GenericType < List < ImpersonationToken > > ( ) { } ) ) ; }
|
Get a list of a specified user s impersonation tokens . Available only for admin users .
|
34,954
|
public ImpersonationToken getImpersonationToken ( Object userIdOrUsername , Integer tokenId ) throws GitLabApiException { if ( tokenId == null ) { throw new RuntimeException ( "tokenId cannot be null" ) ; } Response response = get ( Response . Status . OK , null , "users" , getUserIdOrUsername ( userIdOrUsername ) , "impersonation_tokens" , tokenId ) ; return ( response . readEntity ( ImpersonationToken . class ) ) ; }
|
Get an impersonation token of a user . Available only for admin users .
|
34,955
|
public Optional < ImpersonationToken > getOptionalImpersonationToken ( Object userIdOrUsername , Integer tokenId ) { try { return ( Optional . ofNullable ( getImpersonationToken ( userIdOrUsername , tokenId ) ) ) ; } catch ( GitLabApiException glae ) { return ( GitLabApi . createOptionalFromException ( glae ) ) ; } }
|
Get an impersonation token of a user as an Optional instance . Available only for admin users .
|
34,956
|
public ImpersonationToken createImpersonationToken ( Object userIdOrUsername , String name , Date expiresAt , Scope [ ] scopes ) throws GitLabApiException { if ( scopes == null || scopes . length == 0 ) { throw new RuntimeException ( "scopes cannot be null or empty" ) ; } GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "name" , name , true ) . withParam ( "expires_at" , expiresAt ) ; for ( Scope scope : scopes ) { formData . withParam ( "scopes[]" , scope . toString ( ) ) ; } Response response = post ( Response . Status . CREATED , formData , "users" , getUserIdOrUsername ( userIdOrUsername ) , "impersonation_tokens" ) ; return ( response . readEntity ( ImpersonationToken . class ) ) ; }
|
Create an impersonation token . Available only for admin users .
|
34,957
|
public void revokeImpersonationToken ( Object userIdOrUsername , Integer tokenId ) throws GitLabApiException { if ( tokenId == null ) { throw new RuntimeException ( "tokenId cannot be null" ) ; } Response . Status expectedStatus = ( isApiVersion ( ApiVersion . V3 ) ? Response . Status . OK : Response . Status . NO_CONTENT ) ; delete ( expectedStatus , null , "users" , getUserIdOrUsername ( userIdOrUsername ) , "impersonation_tokens" , tokenId ) ; }
|
Revokes an impersonation token . Available only for admin users .
|
34,958
|
Form userToForm ( User user , Integer projectsLimit , CharSequence password , Boolean resetPassword , boolean create ) { if ( create ) { if ( ( password == null || password . toString ( ) . trim ( ) . isEmpty ( ) ) && ! resetPassword ) { throw new IllegalArgumentException ( "either password or reset_password must be set" ) ; } } projectsLimit = ( projectsLimit == null ) ? user . getProjectsLimit ( ) : projectsLimit ; String skipConfirmationFeildName = create ? "skip_confirmation" : "skip_reconfirmation" ; return ( new GitLabApiForm ( ) . withParam ( "email" , user . getEmail ( ) , create ) . withParam ( "password" , password , false ) . withParam ( "reset_password" , resetPassword , false ) . withParam ( "username" , user . getUsername ( ) , create ) . withParam ( "name" , user . getName ( ) , create ) . withParam ( "skype" , user . getSkype ( ) , false ) . withParam ( "linkedin" , user . getLinkedin ( ) , false ) . withParam ( "twitter" , user . getTwitter ( ) , false ) . withParam ( "website_url" , user . getWebsiteUrl ( ) , false ) . withParam ( "organization" , user . getOrganization ( ) , false ) . withParam ( "projects_limit" , projectsLimit , false ) . withParam ( "extern_uid" , user . getExternUid ( ) , false ) . withParam ( "provider" , user . getProvider ( ) , false ) . withParam ( "bio" , user . getBio ( ) , false ) . withParam ( "location" , user . getLocation ( ) , false ) . withParam ( "admin" , user . getIsAdmin ( ) , false ) . withParam ( "can_create_group" , user . getCanCreateGroup ( ) , false ) . withParam ( skipConfirmationFeildName , user . getSkipConfirmation ( ) , false ) . withParam ( "external" , user . getExternal ( ) , false ) . withParam ( "shared_runners_minutes_limit" , user . getSharedRunnersMinutesLimit ( ) , false ) ) ; }
|
Populate the REST form with data from the User instance .
|
34,959
|
public CustomAttribute createCustomAttribute ( final Object userIdOrUsername , final String key , final String value ) throws GitLabApiException { if ( Objects . isNull ( key ) || key . trim ( ) . isEmpty ( ) ) { throw new IllegalArgumentException ( "Key can't be null or empty" ) ; } if ( Objects . isNull ( value ) || value . trim ( ) . isEmpty ( ) ) { throw new IllegalArgumentException ( "Value can't be null or empty" ) ; } GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "value" , value ) ; Response response = put ( Response . Status . OK , formData . asMap ( ) , "users" , getUserIdOrUsername ( userIdOrUsername ) , "custom_attributes" , key ) ; return ( response . readEntity ( CustomAttribute . class ) ) ; }
|
Creates custom attribute for the given user
|
34,960
|
public CustomAttribute changeCustomAttribute ( final Object userIdOrUsername , final CustomAttribute customAttribute ) throws GitLabApiException { if ( Objects . isNull ( customAttribute ) ) { throw new IllegalArgumentException ( "CustomAttributes can't be null" ) ; } return createCustomAttribute ( userIdOrUsername , customAttribute . getKey ( ) , customAttribute . getValue ( ) ) ; }
|
Change custom attribute for the given user
|
34,961
|
public CustomAttribute changeCustomAttribute ( final Object userIdOrUsername , final String key , final String value ) throws GitLabApiException { return createCustomAttribute ( userIdOrUsername , key , value ) ; }
|
Changes custom attribute for the given user
|
34,962
|
private GitLabApiForm createGitLabApiForm ( ) { GitLabApiForm formData = new GitLabApiForm ( ) ; return ( customAttributesEnabled ? formData . withParam ( "with_custom_attributes" , true ) : formData ) ; }
|
Creates a GitLabApiForm instance that will optionally include the with_custom_attributes query param if enabled .
|
34,963
|
public User setUserAvatar ( final Object userIdOrUsername , File avatarFile ) throws GitLabApiException { Response response = putUpload ( Response . Status . OK , "avatar" , avatarFile , "users" , getUserIdOrUsername ( userIdOrUsername ) ) ; return ( response . readEntity ( User . class ) ) ; }
|
Uploads and sets the user s avatar for the specified user .
|
34,964
|
private static Object [ ] convertToObjectArray ( Object obj ) { if ( obj instanceof Object [ ] ) { return ( Object [ ] ) obj ; } int arrayLength = Array . getLength ( obj ) ; Object [ ] retArray = new Object [ arrayLength ] ; for ( int i = 0 ; i < arrayLength ; ++ i ) { retArray [ i ] = Array . get ( obj , i ) ; } return retArray ; }
|
as there seems be no legal way for casting
|
34,965
|
public static void loadProperties ( String classpathName , Properties toProps ) { Validate . argumentIsNotNull ( classpathName ) ; Validate . argumentIsNotNull ( toProps ) ; InputStream inputStream = PropertiesUtil . class . getClassLoader ( ) . getResourceAsStream ( classpathName ) ; if ( inputStream == null ) { throw new JaversException ( CLASSPATH_RESOURCE_NOT_FOUND , classpathName ) ; } try { toProps . load ( inputStream ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } }
|
loads a properties file from classpath using default classloader
|
34,966
|
private static Collection difference ( Collection first , Collection second ) { if ( first == null ) { return EMPTY_LIST ; } if ( second == null ) { return first ; } Collection difference = new ArrayList < > ( first ) ; for ( Object current : second ) { difference . remove ( current ) ; } return difference ; }
|
Difference that handle properly collections with duplicates .
|
34,967
|
public List < CdoSnapshot > getHistoricals ( GlobalId globalId , CommitId timePoint , boolean withChildValueObjects , int limit ) { argumentsAreNotNull ( globalId , timePoint ) ; return delegate . getStateHistory ( globalId , QueryParamsBuilder . withLimit ( limit ) . withChildValueObjects ( withChildValueObjects ) . toCommitId ( timePoint ) . build ( ) ) ; }
|
last snapshot with commitId < = given timePoint
|
34,968
|
public Optional < CdoSnapshot > getHistorical ( GlobalId globalId , LocalDateTime timePoint ) { argumentsAreNotNull ( globalId , timePoint ) ; return delegate . getStateHistory ( globalId , QueryParamsBuilder . withLimit ( 1 ) . to ( timePoint ) . build ( ) ) . stream ( ) . findFirst ( ) ; }
|
last snapshot with commitId < = given date
|
34,969
|
private List < CdoSnapshot > loadMasterEntitySnapshotIfNecessary ( InstanceId instanceId , List < CdoSnapshot > alreadyLoaded ) { if ( alreadyLoaded . isEmpty ( ) ) { return alreadyLoaded ; } if ( alreadyLoaded . stream ( ) . filter ( s -> s . getGlobalId ( ) . equals ( instanceId ) ) . findFirst ( ) . isPresent ( ) ) { return alreadyLoaded ; } return getLatest ( instanceId ) . map ( it -> { List < CdoSnapshot > enhanced = new ArrayList ( alreadyLoaded ) ; enhanced . add ( it ) ; return java . util . Collections . unmodifiableList ( enhanced ) ; } ) . orElse ( alreadyLoaded ) ; }
|
required for the corner case when valueObject snapshots consume all the limit
|
34,970
|
public SqlRepositoryBuilder withSchema ( String schemaName ) { if ( schemaName != null && ! schemaName . isEmpty ( ) ) { this . schemaName = schemaName ; } return this ; }
|
This function sets a schema to be used for creation and updating tables . When passing a schema name make sure that the schema has been created in the database before running JaVers . If schemaName is null or empty the default schema is used instead .
|
34,971
|
public Object getPropertyValue ( Property property ) { Validate . argumentIsNotNull ( property ) ; Object val = properties . get ( property . getName ( ) ) ; if ( val == null ) { return Defaults . defaultValue ( property . getGenericType ( ) ) ; } return val ; }
|
returns default values for null primitives
|
34,972
|
public < C extends Change > List getObjectsByChangeType ( final Class < C > type ) { argumentIsNotNull ( type ) ; return Lists . transform ( getChangesByType ( type ) , input -> input . getAffectedObject ( ) . < JaversException > orElseThrow ( ( ) -> new JaversException ( AFFECTED_CDO_IS_NOT_AVAILABLE ) ) ) ; }
|
Selects new removed or changed objects
|
34,973
|
public List getObjectsWithChangedProperty ( String propertyName ) { argumentIsNotNull ( propertyName ) ; return Lists . transform ( getPropertyChanges ( propertyName ) , input -> input . getAffectedObject ( ) . < JaversException > orElseThrow ( ( ) -> new JaversException ( AFFECTED_CDO_IS_NOT_AVAILABLE ) ) ) ; }
|
Selects objects with changed property for given property name
|
34,974
|
public List < Change > getChanges ( Predicate < Change > predicate ) { return Lists . positiveFilter ( changes , predicate ) ; }
|
Changes that satisfies given filter
|
34,975
|
public List < PropertyChange > getPropertyChanges ( final String propertyName ) { argumentIsNotNull ( propertyName ) ; return ( List ) getChanges ( input -> input instanceof PropertyChange && ( ( PropertyChange ) input ) . getPropertyName ( ) . equals ( propertyName ) ) ; }
|
Selects property changes for given property name
|
34,976
|
public List < Change > calculateDiffs ( List < CdoSnapshot > snapshots , Map < SnapshotIdentifier , CdoSnapshot > previousSnapshots ) { Validate . argumentsAreNotNull ( snapshots ) ; Validate . argumentsAreNotNull ( previousSnapshots ) ; List < Change > changes = new ArrayList < > ( ) ; for ( CdoSnapshot snapshot : snapshots ) { if ( snapshot . isInitial ( ) ) { addInitialChanges ( changes , snapshot ) ; } else if ( snapshot . isTerminal ( ) ) { addTerminalChanges ( changes , snapshot ) ; } else { CdoSnapshot previousSnapshot = previousSnapshots . get ( SnapshotIdentifier . from ( snapshot ) . previous ( ) ) ; addChanges ( changes , previousSnapshot , snapshot ) ; } } return changes ; }
|
Calculates changes introduced by a collection of snapshots . This method expects that the previousSnapshots map contains predecessors of all non - initial and non - terminal snapshots .
|
34,977
|
public < T > List < T > filterToList ( Object source , Class < T > filter ) { Validate . argumentsAreNotNull ( filter ) ; return ( List ) unmodifiableList ( items ( source ) . filter ( item -> item != null && filter . isAssignableFrom ( item . getClass ( ) ) ) . collect ( Collectors . toList ( ) ) ) ; }
|
Returns a new unmodifiable Enumerable with filtered items nulls are omitted .
|
34,978
|
List < JaversProperty > getManagedProperties ( Predicate < JaversProperty > query ) { return Lists . positiveFilter ( managedProperties , query ) ; }
|
returns managed properties subset
|
34,979
|
public MapContentType getMapContentType ( ContainerType containerType ) { JaversType keyType = getJaversType ( Integer . class ) ; JaversType valueType = getJaversType ( containerType . getItemType ( ) ) ; return new MapContentType ( keyType , valueType ) ; }
|
only for change appenders
|
34,980
|
public boolean isContainerOfManagedTypes ( JaversType javersType ) { if ( ! ( javersType instanceof ContainerType ) ) { return false ; } return getJaversType ( ( ( ContainerType ) javersType ) . getItemType ( ) ) instanceof ManagedType ; }
|
is Set List or Array of ManagedClasses
|
34,981
|
public JaversType getJaversType ( Type javaType ) { argumentIsNotNull ( javaType ) ; if ( javaType == Object . class ) { return OBJECT_TYPE ; } return engine . computeIfAbsent ( javaType , j -> typeFactory . infer ( j , findPrototype ( j ) ) ) ; }
|
Returns mapped type spawns a new one from a prototype or infers a new one using default mapping .
|
34,982
|
public < T extends ManagedType > T getJaversManagedType ( Class javaClass , Class < T > expectedType ) { JaversType mType = getJaversType ( javaClass ) ; if ( expectedType . isAssignableFrom ( mType . getClass ( ) ) ) { return ( T ) mType ; } else { throw new JaversException ( JaversExceptionCode . MANAGED_CLASS_MAPPING_ERROR , javaClass , mType . getClass ( ) . getSimpleName ( ) , expectedType . getSimpleName ( ) ) ; } }
|
If given javaClass is mapped to expected ManagedType returns its JaversType
|
34,983
|
@ Bean ( name = "JaversFromStarter" ) public Javers javers ( ) { logger . info ( "Starting javers-spring-boot-starter-mongo ..." ) ; MongoDatabase mongoDatabase = mongoClient . getDatabase ( mongoProperties . getMongoClientDatabase ( ) ) ; logger . info ( "connecting to database: {}" , mongoProperties . getMongoClientDatabase ( ) ) ; MongoRepository javersRepository = createMongoRepository ( javersMongoProperties , mongoDatabase ) ; return JaversBuilder . javers ( ) . registerJaversRepository ( javersRepository ) . withProperties ( javersMongoProperties ) . withObjectAccessHook ( new DBRefUnproxyObjectAccessHook ( ) ) . build ( ) ; }
|
from spring - boot - starter - data - mongodb
|
34,984
|
private Diff createAndAppendChanges ( GraphPair graphPair , Optional < CommitMetadata > commitMetadata ) { DiffBuilder diff = new DiffBuilder ( javersCoreConfiguration . getPrettyValuePrinter ( ) ) ; for ( NodeChangeAppender appender : nodeChangeAppenders ) { diff . addChanges ( appender . getChangeSet ( graphPair ) , commitMetadata ) ; } if ( javersCoreConfiguration . isNewObjectsSnapshot ( ) ) { for ( ObjectNode node : graphPair . getOnlyOnRight ( ) ) { FakeNodePair pair = new FakeNodePair ( node ) ; appendPropertyChanges ( diff , pair , commitMetadata ) ; } } for ( NodePair pair : nodeMatcher . match ( graphPair ) ) { appendPropertyChanges ( diff , pair , commitMetadata ) ; } return diff . build ( ) ; }
|
Graph scope appender
|
34,985
|
private void addCommitDateInstantColumnIfNeeded ( ) { if ( ! columnExists ( getCommitTableNameWithSchema ( ) , COMMIT_COMMIT_DATE_INSTANT ) ) { addStringColumn ( getCommitTableNameWithSchema ( ) , COMMIT_COMMIT_DATE_INSTANT , 30 ) ; } else { extendStringColumnIfNeeded ( getCommitTableNameWithSchema ( ) , COMMIT_COMMIT_DATE_INSTANT , 30 ) ; } }
|
JaVers 5 . 0 to 5 . 1 schema migration
|
34,986
|
private void alterCommitIdColumnIfNeeded ( ) { ColumnType commitIdColType = getTypeOf ( getCommitTableNameWithSchema ( ) , "commit_id" ) ; if ( commitIdColType . precision == 12 ) { logger . info ( "migrating db schema from JaVers 2.5 to 2.6 ..." ) ; if ( dialect instanceof PostgresDialect ) { executeSQL ( "ALTER TABLE " + getCommitTableNameWithSchema ( ) + " ALTER COLUMN commit_id TYPE numeric(22,2)" ) ; } else if ( dialect instanceof H2Dialect ) { executeSQL ( "ALTER TABLE " + getCommitTableNameWithSchema ( ) + " ALTER COLUMN commit_id numeric(22,2)" ) ; } else if ( dialect instanceof MysqlDialect ) { executeSQL ( "ALTER TABLE " + getCommitTableNameWithSchema ( ) + " MODIFY commit_id numeric(22,2)" ) ; } else if ( dialect instanceof OracleDialect ) { executeSQL ( "ALTER TABLE " + getCommitTableNameWithSchema ( ) + " MODIFY commit_id number(22,2)" ) ; } else if ( dialect instanceof MsSqlDialect ) { executeSQL ( "drop index jv_commit_commit_id_idx on " + getCommitTableNameWithSchema ( ) ) ; executeSQL ( "ALTER TABLE " + getCommitTableNameWithSchema ( ) + " ALTER COLUMN commit_id numeric(22,2)" ) ; executeSQL ( "CREATE INDEX jv_commit_commit_id_idx ON " + getCommitTableNameWithSchema ( ) + " (commit_id)" ) ; } else { handleUnsupportedDialect ( ) ; } } }
|
JaVers 2 . 5 to 2 . 6 schema migration
|
34,987
|
private void alterMssqlTextColumns ( ) { ColumnType stateColType = getTypeOf ( getSnapshotTableNameWithSchema ( ) , "state" ) ; ColumnType changedPropertiesColType = getTypeOf ( getSnapshotTableNameWithSchema ( ) , "state" ) ; if ( stateColType . typeName . equals ( "text" ) ) { executeSQL ( "ALTER TABLE " + getSnapshotTableNameWithSchema ( ) + " ALTER COLUMN state VARCHAR(MAX)" ) ; } if ( changedPropertiesColType . typeName . equals ( "text" ) ) { executeSQL ( "ALTER TABLE " + getSnapshotTableNameWithSchema ( ) + " ALTER COLUMN changed_properties VARCHAR(MAX)" ) ; } }
|
JaVers 3 . 3 . 0 to 3 . 3 . 1 MsSql schema migration
|
34,988
|
public Object map ( Object sourceEnumerable , Function mapFunction , boolean filterNulls ) { Validate . argumentIsNotNull ( mapFunction ) ; Multimap sourceMultimap = toNotNullMultimap ( sourceEnumerable ) ; Multimap targetMultimap = ArrayListMultimap . create ( ) ; MapType . mapEntrySet ( sourceMultimap . entries ( ) , mapFunction , ( k , v ) -> targetMultimap . put ( k , v ) , filterNulls ) ; return targetMultimap ; }
|
Nulls keys are filtered
|
34,989
|
private Collection < JaversType > bootJsonConverter ( ) { JsonConverterBuilder jsonConverterBuilder = jsonConverterBuilder ( ) ; addModule ( new ChangeTypeAdaptersModule ( getContainer ( ) ) ) ; addModule ( new CommitTypeAdaptersModule ( getContainer ( ) ) ) ; if ( new RequiredMongoSupportPredicate ( ) . test ( repository ) ) { jsonConverterBuilder . registerNativeGsonDeserializer ( Long . class , new MongoLong64JsonDeserializer ( ) ) ; } jsonConverterBuilder . registerJsonTypeAdapters ( getComponents ( JsonTypeAdapter . class ) ) ; jsonConverterBuilder . registerNativeGsonDeserializer ( Diff . class , new DiffTypeDeserializer ( ) ) ; JsonConverter jsonConverter = jsonConverterBuilder . build ( ) ; addComponent ( jsonConverter ) ; return Lists . transform ( jsonConverterBuilder . getValueTypes ( ) , c -> new ValueType ( c ) ) ; }
|
boots JsonConverter and registers domain aware typeAdapters
|
34,990
|
private Object reverseCdoIdMapKey ( Cdo cdo ) { if ( cdo . getGlobalId ( ) instanceof InstanceId ) { return cdo . getGlobalId ( ) ; } return new SystemIdentityWrapper ( cdo . getWrappedCdo ( ) . get ( ) ) ; }
|
InstanceId for Entities System . identityHashCode for ValueObjects
|
34,991
|
private static Bson prefixQuery ( String fieldName , String prefix ) { return Filters . regex ( fieldName , "^" + RegexEscape . escape ( prefix ) + ".*" ) ; }
|
enables index range scan
|
34,992
|
public static < T > List < T > positiveFilter ( List < T > input , Predicate < T > filter ) { argumentsAreNotNull ( input , filter ) ; return input . stream ( ) . filter ( filter ) . collect ( Collectors . toList ( ) ) ; }
|
returns new list with elements from input that satisfies given filter condition
|
34,993
|
public static < T > List < T > negativeFilter ( List < T > input , final Predicate < T > filter ) { argumentsAreNotNull ( input , filter ) ; return input . stream ( ) . filter ( element -> ! filter . test ( element ) ) . collect ( Collectors . toList ( ) ) ; }
|
returns new list with elements from input that don t satisfies given filter condition
|
34,994
|
public QueryBuilder withChangedProperty ( String propertyName ) { Validate . argumentIsNotNull ( propertyName ) ; queryParamsBuilder . changedProperty ( propertyName ) ; return this ; }
|
Only snapshots which changed a given property .
|
34,995
|
public QueryBuilder withCommitId ( CommitId commitId ) { Validate . argumentIsNotNull ( commitId ) ; queryParamsBuilder . commitId ( commitId ) ; return this ; }
|
Only snapshots created in a given commit .
|
34,996
|
public QueryBuilder withCommitIds ( Collection < BigDecimal > commitIds ) { Validate . argumentIsNotNull ( commitIds ) ; queryParamsBuilder . commitIds ( commitIds . stream ( ) . map ( CommitId :: valueOf ) . collect ( Collectors . toSet ( ) ) ) ; return this ; }
|
Only snapshots created in given commits .
|
34,997
|
public QueryBuilder toCommitId ( CommitId commitId ) { Validate . argumentIsNotNull ( commitId ) ; queryParamsBuilder . toCommitId ( commitId ) ; return this ; }
|
Only snapshots created before this commit or exactly in this commit .
|
34,998
|
public QueryBuilder byAuthor ( String author ) { Validate . argumentIsNotNull ( author ) ; queryParamsBuilder . author ( author ) ; return this ; }
|
Only snapshots committed by a given author .
|
34,999
|
public static Class < ? > classForName ( String className ) { try { return Class . forName ( className , false , Javers . class . getClassLoader ( ) ) ; } catch ( ClassNotFoundException ex ) { throw new JaversException ( ex ) ; } }
|
throws RuntimeException if class is not found
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.