idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
158,600 | 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 . |
158,601 | 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 . |
158,602 | 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 . |
158,603 | 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 . |
158,604 | 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 . |
158,605 | 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 . |
158,606 | public Stream < Note > getIssueNotesStream ( Object projectIdOrPath , Integer issueIid ) throws GitLabApiException { return ( getIssueNotes ( projectIdOrPath , issueIid , getDefaultPerPage ( ) ) . stream ( ) ) ; } | Get a Stream of the issues s notes . |
158,607 | 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 . |
158,608 | 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 . |
158,609 | 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 |
158,610 | 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 . |
158,611 | 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 |
158,612 | 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 . |
158,613 | 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 . |
158,614 | 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 . |
158,615 | 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 . |
158,616 | 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 . |
158,617 | 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 . |
158,618 | 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 . |
158,619 | 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 . |
158,620 | 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 . |
158,621 | 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 . |
158,622 | 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 . |
158,623 | public Pager < User > getUsers ( int itemsPerPage ) throws GitLabApiException { return ( new Pager < User > ( this , User . class , itemsPerPage , createGitLabApiForm ( ) . asMap ( ) , "users" ) ) ; } | Get a Pager of users . |
158,624 | 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 . |
158,625 | 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 . |
158,626 | 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 . |
158,627 | 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 . |
158,628 | 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 . |
158,629 | 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 . |
158,630 | 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 . |
158,631 | public List < User > findUsers ( String emailOrUsername ) throws GitLabApiException { return ( findUsers ( emailOrUsername , getDefaultPerPage ( ) ) . all ( ) ) ; } | Search users by Email or username |
158,632 | 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 |
158,633 | public Stream < User > findUsersStream ( String emailOrUsername ) throws GitLabApiException { return ( findUsers ( emailOrUsername , getDefaultPerPage ( ) ) . stream ( ) ) ; } | Search users by Email or username . |
158,634 | 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 . |
158,635 | 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 . |
158,636 | public User getCurrentUser ( ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "user" ) ; return ( response . readEntity ( User . class ) ) ; } | Get currently authenticated user . |
158,637 | 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 . |
158,638 | 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 . |
158,639 | 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 . |
158,640 | 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 . |
158,641 | 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 . |
158,642 | 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 . |
158,643 | 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 . |
158,644 | 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 . |
158,645 | 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 . |
158,646 | 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 . |
158,647 | 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 . |
158,648 | 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 . |
158,649 | 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 |
158,650 | 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 |
158,651 | 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 |
158,652 | 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 . |
158,653 | 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 . |
158,654 | 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 |
158,655 | 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 |
158,656 | 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 . |
158,657 | 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 |
158,658 | 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 |
158,659 | 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 |
158,660 | 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 . |
158,661 | 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 |
158,662 | 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 |
158,663 | 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 |
158,664 | public List < Change > getChanges ( Predicate < Change > predicate ) { return Lists . positiveFilter ( changes , predicate ) ; } | Changes that satisfies given filter |
158,665 | 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 |
158,666 | 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 . |
158,667 | 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 . |
158,668 | List < JaversProperty > getManagedProperties ( Predicate < JaversProperty > query ) { return Lists . positiveFilter ( managedProperties , query ) ; } | returns managed properties subset |
158,669 | public MapContentType getMapContentType ( ContainerType containerType ) { JaversType keyType = getJaversType ( Integer . class ) ; JaversType valueType = getJaversType ( containerType . getItemType ( ) ) ; return new MapContentType ( keyType , valueType ) ; } | only for change appenders |
158,670 | 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 |
158,671 | 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 . |
158,672 | 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 |
158,673 | @ 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 |
158,674 | 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 |
158,675 | 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 |
158,676 | 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 |
158,677 | 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 |
158,678 | 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 |
158,679 | 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 |
158,680 | 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 |
158,681 | private static Bson prefixQuery ( String fieldName , String prefix ) { return Filters . regex ( fieldName , "^" + RegexEscape . escape ( prefix ) + ".*" ) ; } | enables index range scan |
158,682 | 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 |
158,683 | 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 |
158,684 | public QueryBuilder withChangedProperty ( String propertyName ) { Validate . argumentIsNotNull ( propertyName ) ; queryParamsBuilder . changedProperty ( propertyName ) ; return this ; } | Only snapshots which changed a given property . |
158,685 | public QueryBuilder withCommitId ( CommitId commitId ) { Validate . argumentIsNotNull ( commitId ) ; queryParamsBuilder . commitId ( commitId ) ; return this ; } | Only snapshots created in a given commit . |
158,686 | 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 . |
158,687 | public QueryBuilder toCommitId ( CommitId commitId ) { Validate . argumentIsNotNull ( commitId ) ; queryParamsBuilder . toCommitId ( commitId ) ; return this ; } | Only snapshots created before this commit or exactly in this commit . |
158,688 | public QueryBuilder byAuthor ( String author ) { Validate . argumentIsNotNull ( author ) ; queryParamsBuilder . author ( author ) ; return this ; } | Only snapshots committed by a given author . |
158,689 | 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 |
158,690 | public static Object newInstance ( Class clazz , ArgumentResolver resolver ) { Validate . argumentIsNotNull ( clazz ) ; for ( Constructor constructor : clazz . getDeclaredConstructors ( ) ) { if ( isPrivate ( constructor ) || isProtected ( constructor ) ) { continue ; } Class [ ] types = constructor . getParameterTypes... | Creates new instance of public or package - private class . Calls first not - private constructor |
158,691 | JaversType spawn ( Type baseJavaType ) { try { Constructor c = this . getClass ( ) . getConstructor ( Type . class ) ; return ( JaversType ) c . newInstance ( new Object [ ] { baseJavaType } ) ; } catch ( ReflectiveOperationException exception ) { throw new RuntimeException ( "error calling Constructor for " + this . g... | Factory method delegates to self constructor |
158,692 | private String formatMaybeIpv6 ( String address ) { String openBracket = "[" ; String closeBracket = "]" ; if ( address . contains ( ":" ) && ! address . startsWith ( openBracket ) && ! address . endsWith ( closeBracket ) ) { return openBracket + address + closeBracket ; } return address ; } | This isn t very precise ; org . jboss . as . network . NetworkUtils has better implementation but that s in a private module . |
158,693 | public void handleRequest ( HttpServerExchange exchange ) throws Exception { Account account = exchange . getSecurityContext ( ) . getAuthenticatedAccount ( ) ; if ( account != null && account . getPrincipal ( ) instanceof JsonWebToken ) { JsonWebToken token = ( JsonWebToken ) account . getPrincipal ( ) ; PrincipalProd... | If there is a JWTAccount installed in the exchange security context create |
158,694 | public static Options defaultOptions ( ) { return new Options ( HELP , CONFIG_HELP , YAML_HELP , VERSION , PROPERTY , PROPERTIES_URL , SERVER_CONFIG , CONFIG , PROFILES , BIND ) ; } | Default set of options |
158,695 | public < T > void put ( Option < T > key , T value ) { this . values . put ( key , value ) ; } | Put a value under a given key . |
158,696 | @ SuppressWarnings ( "unchecked" ) public < T > T get ( Option < T > key ) { T v = ( T ) this . values . get ( key ) ; if ( v == null ) { v = key . defaultValue ( ) ; this . values . put ( key , v ) ; } return v ; } | Retrieve a value under a given key . |
158,697 | public void applyProperties ( Swarm swarm ) throws IOException { URL propsUrl = get ( PROPERTIES_URL ) ; if ( propsUrl != null ) { Properties urlProps = new Properties ( ) ; urlProps . load ( propsUrl . openStream ( ) ) ; for ( String name : urlProps . stringPropertyNames ( ) ) { swarm . withProperty ( name , urlProps ... | Apply properties to the system properties . |
158,698 | public void applyConfigurations ( Swarm swarm ) throws IOException { if ( get ( SERVER_CONFIG ) != null ) { swarm . withXmlConfig ( get ( SERVER_CONFIG ) ) ; } if ( get ( CONFIG ) != null ) { List < URL > configs = get ( CONFIG ) ; for ( URL config : configs ) { swarm . withConfig ( config ) ; } } if ( get ( PROFILES )... | Apply configuration to the container . |
158,699 | public void apply ( Swarm swarm ) throws IOException , ModuleLoadException { applyProperties ( swarm ) ; applyConfigurations ( swarm ) ; if ( get ( HELP ) ) { displayVersion ( System . err ) ; System . err . println ( ) ; displayHelp ( System . err ) ; System . exit ( 0 ) ; } if ( get ( CONFIG_HELP ) != null ) { displa... | Apply properties and configuration from the parsed commandline to a container . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.