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 ( ) ) . withPa...
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" , jir...
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 , f...
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 ( ! isVali...
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" ) ; } G...
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 ( projectIdO...
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...
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 ...
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 . readEnt...
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" , getProjectIdOr...
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 ) ...
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 ( pr...
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" ) ; } Res...
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 ...
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 ( proj...
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...
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 (...
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 <...
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 . readEntit...
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...
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 (...
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 ....
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 ( Re...
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...
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 ) , "i...
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 ( ) ...
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_CONT...
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 se...
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 ) || ...
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 , c...
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 ) ; } retu...
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...
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 ) . t...
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 ( ) ) ...
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 : sna...
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_MAPPIN...
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 . getMongoClientD...
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 ) , ...
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_...
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...
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 " + getSnapsho...
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 ( ) ,...
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 ( reposit...
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