idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
158,300 | 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 . | 168 | 8 |
158,301 | 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 . | 46 | 18 |
158,302 | 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 . | 79 | 10 |
158,303 | 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 . | 81 | 18 |
158,304 | 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 . | 50 | 13 |
158,305 | 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 . | 118 | 9 |
158,306 | 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 . | 117 | 10 |
158,307 | 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 . | 78 | 14 |
158,308 | public Pager < User > getUsers ( int itemsPerPage ) throws GitLabApiException { return ( new Pager < User > ( this , User . class , itemsPerPage , createGitLabApiForm ( ) . asMap ( ) , "users" ) ) ; } | Get a Pager of users . | 62 | 7 |
158,309 | 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 . | 84 | 8 |
158,310 | 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 . | 109 | 10 |
158,311 | 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 . | 127 | 15 |
158,312 | 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 . | 91 | 5 |
158,313 | 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 . | 64 | 9 |
158,314 | 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 . | 115 | 13 |
158,315 | 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 . | 62 | 12 |
158,316 | public List < User > findUsers ( String emailOrUsername ) throws GitLabApiException { return ( findUsers ( emailOrUsername , getDefaultPerPage ( ) ) . all ( ) ) ; } | Search users by Email or username | 45 | 6 |
158,317 | 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 | 94 | 11 |
158,318 | public Stream < User > findUsersStream ( String emailOrUsername ) throws GitLabApiException { return ( findUsers ( emailOrUsername , getDefaultPerPage ( ) ) . stream ( ) ) ; } | Search users by Email or username . | 46 | 7 |
158,319 | @ Deprecated 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 ( respons... | Modifies an existing user . Only administrators can change attributes of a user . | 90 | 15 |
158,320 | 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 . | 122 | 10 |
158,321 | public User getCurrentUser ( ) throws GitLabApiException { Response response = get ( Response . Status . OK , null , "user" ) ; return ( response . readEntity ( User . class ) ) ; } | Get currently authenticated user . | 46 | 5 |
158,322 | 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 . | 74 | 11 |
158,323 | 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 . | 139 | 17 |
158,324 | 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 . | 61 | 6 |
158,325 | 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 . | 70 | 10 |
158,326 | 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 . | 99 | 12 |
158,327 | 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 | 14 |
158,328 | 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 . | 155 | 18 |
158,329 | 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 . | 114 | 15 |
158,330 | 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 . | 86 | 19 |
158,331 | 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 . | 204 | 12 |
158,332 | 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 . | 125 | 13 |
158,333 | 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 . | 516 | 12 |
158,334 | 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 | 201 | 8 |
158,335 | public CustomAttribute changeCustomAttribute ( final Object userIdOrUsername , final CustomAttribute customAttribute ) throws GitLabApiException { if ( Objects . isNull ( customAttribute ) ) { throw new IllegalArgumentException ( "CustomAttributes can't be null" ) ; } //changing & creating custom attributes is the same... | Change custom attribute for the given user | 128 | 7 |
158,336 | 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 | 47 | 7 |
158,337 | 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 . | 62 | 25 |
158,338 | 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 . | 79 | 13 |
158,339 | 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 | 95 | 9 |
158,340 | 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 | 134 | 11 |
158,341 | 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 . | 69 | 10 |
158,342 | 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 | 95 | 10 |
158,343 | 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 | 78 | 9 |
158,344 | 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 | 166 | 13 |
158,345 | 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 . | 45 | 49 |
158,346 | 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 | 64 | 8 |
158,347 | 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 | 93 | 7 |
158,348 | 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 | 86 | 10 |
158,349 | public List < Change > getChanges ( Predicate < Change > predicate ) { return Lists . positiveFilter ( changes , predicate ) ; } | Changes that satisfies given filter | 28 | 5 |
158,350 | 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 | 62 | 8 |
158,351 | 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 : snap... | 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 . | 176 | 33 |
158,352 | 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 . | 85 | 16 |
158,353 | List < JaversProperty > getManagedProperties ( Predicate < JaversProperty > query ) { return Lists . positiveFilter ( managedProperties , query ) ; } | returns managed properties subset | 36 | 5 |
158,354 | public MapContentType getMapContentType ( ContainerType containerType ) { JaversType keyType = getJaversType ( Integer . class ) ; JaversType valueType = getJaversType ( containerType . getItemType ( ) ) ; return new MapContentType ( keyType , valueType ) ; } | only for change appenders | 66 | 5 |
158,355 | 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 | 64 | 10 |
158,356 | 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 . | 70 | 20 |
158,357 | 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 | 126 | 16 |
158,358 | @ Bean ( name = "JaversFromStarter" ) @ ConditionalOnMissingBean public Javers javers ( ) { logger . info ( "Starting javers-spring-boot-starter-mongo ..." ) ; MongoDatabase mongoDatabase = mongoClient . getDatabase ( mongoProperties . getMongoClientDatabase ( ) ) ; logger . info ( "connecting to database: {}" , mongoP... | from spring - boot - starter - data - mongodb | 186 | 13 |
158,359 | private Diff createAndAppendChanges ( GraphPair graphPair , Optional < CommitMetadata > commitMetadata ) { DiffBuilder diff = new DiffBuilder ( javersCoreConfiguration . getPrettyValuePrinter ( ) ) ; //calculate node scope diff for ( NodeChangeAppender appender : nodeChangeAppenders ) { diff . addChanges ( appender . g... | Graph scope appender | 218 | 4 |
158,360 | 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 | 114 | 11 |
158,361 | 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 | 410 | 11 |
158,362 | 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 | 177 | 18 |
158,363 | @ Override public Object map ( Object sourceEnumerable , Function mapFunction , boolean filterNulls ) { Validate . argumentIsNotNull ( mapFunction ) ; Multimap sourceMultimap = toNotNullMultimap ( sourceEnumerable ) ; Multimap targetMultimap = ArrayListMultimap . create ( ) ; MapType . mapEntrySet ( sourceMultimap . en... | Nulls keys are filtered | 121 | 5 |
158,364 | 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 | 231 | 14 |
158,365 | 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 | 68 | 14 |
158,366 | private static Bson prefixQuery ( String fieldName , String prefix ) { return Filters . regex ( fieldName , "^" + RegexEscape . escape ( prefix ) + ".*" ) ; } | enables index range scan | 44 | 5 |
158,367 | 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 | 60 | 13 |
158,368 | 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 | 69 | 15 |
158,369 | public QueryBuilder withChangedProperty ( String propertyName ) { Validate . argumentIsNotNull ( propertyName ) ; queryParamsBuilder . changedProperty ( propertyName ) ; return this ; } | Only snapshots which changed a given property . | 40 | 8 |
158,370 | public QueryBuilder withCommitId ( CommitId commitId ) { Validate . argumentIsNotNull ( commitId ) ; queryParamsBuilder . commitId ( commitId ) ; return this ; } | Only snapshots created in a given commit . | 42 | 8 |
158,371 | 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 . | 75 | 7 |
158,372 | public QueryBuilder toCommitId ( CommitId commitId ) { Validate . argumentIsNotNull ( commitId ) ; queryParamsBuilder . toCommitId ( commitId ) ; return this ; } | Only snapshots created before this commit or exactly in this commit . | 44 | 12 |
158,373 | public QueryBuilder byAuthor ( String author ) { Validate . argumentIsNotNull ( author ) ; queryParamsBuilder . author ( author ) ; return this ; } | Only snapshots committed by a given author . | 35 | 8 |
158,374 | 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 | 61 | 9 |
158,375 | 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 | 267 | 18 |
158,376 | 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 | 95 | 6 |
158,377 | 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 . | 78 | 29 |
158,378 | @ Override public void handleRequest ( HttpServerExchange exchange ) throws Exception { Account account = exchange . getSecurityContext ( ) . getAuthenticatedAccount ( ) ; if ( account != null && account . getPrincipal ( ) instanceof JsonWebToken ) { JsonWebToken token = ( JsonWebToken ) account . getPrincipal ( ) ; Pr... | If there is a JWTAccount installed in the exchange security context create | 125 | 16 |
158,379 | 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 | 60 | 4 |
158,380 | public < T > void put ( Option < T > key , T value ) { this . values . put ( key , value ) ; } | Put a value under a given key . | 29 | 8 |
158,381 | @ 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 . | 73 | 9 |
158,382 | 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 . | 173 | 7 |
158,383 | 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 . | 132 | 6 |
158,384 | 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 . | 172 | 13 |
158,385 | public static CommandLine parse ( Options options , String ... args ) throws Exception { return CommandLineParser . parse ( options , args ) ; } | Parse an array of arguments using specific options . | 29 | 10 |
158,386 | public static ResourceLoader getModuleResourceLoader ( final String rootPath , final String loaderPath , final String loaderName ) { if ( Holder . JAR_FILE != null ) { return new JarFileResourceLoader ( loaderName , Holder . JAR_FILE , Holder . FILE_SYSTEM . getPath ( rootPath , loaderPath ) . toString ( ) ) ; } return... | Creates a new resource loader for the environment . | 100 | 10 |
158,387 | @ Override public AuthenticationMechanismOutcome authenticate ( HttpServerExchange exchange , SecurityContext securityContext ) { List < String > authHeaders = exchange . getRequestHeaders ( ) . get ( AUTHORIZATION ) ; if ( authHeaders != null ) { String bearerToken = null ; for ( String current : authHeaders ) { if ( ... | Extract the Authorization header and validate the bearer token if it exists . If it does and is validated this builds the org . jboss . security . SecurityContext authenticated Subject that drives the container APIs as well as the authorization layers . | 657 | 46 |
158,388 | protected RoleGroup extract ( Subject subject ) { Optional < Principal > match = subject . getPrincipals ( ) . stream ( ) . filter ( g -> g . getName ( ) . equals ( SecurityConstants . ROLES_IDENTIFIER ) ) . findFirst ( ) ; Group rolesGroup = ( Group ) match . get ( ) ; RoleGroup roles = new SimpleRoleGroup ( rolesGrou... | Extract the Roles group and return it as a RoleGroup | 90 | 13 |
158,389 | public ConfigViewImpl withProperties ( Properties properties ) { if ( properties != null ) { this . properties = properties ; this . strategy . withProperties ( properties ) ; } return this ; } | Supply explicit properties object for introspection and outrespection . | 41 | 13 |
158,390 | private Set < String > getPackagesForScanning ( WARArchive deployment ) { final Set < String > packages = new TreeSet <> ( ) ; if ( indexView != null ) { DotName dotName = DotName . createSimple ( Api . class . getName ( ) ) ; Collection < AnnotationInstance > instances = indexView . getAnnotations ( dotName ) ; instan... | Get the packages that should be scanned by Swagger . This method attempts to determine the root packages by leveraging the IndexView of the deployment . If the IndexView is unavailable then this method will fallback to the scanning the classes manually . | 648 | 47 |
158,391 | public void stop ( ) throws Exception { final CountDownLatch latch = new CountDownLatch ( 1 ) ; this . serviceContainer . addTerminateListener ( info -> latch . countDown ( ) ) ; this . serviceContainer . shutdown ( ) ; latch . await ( ) ; executor . submit ( new Runnable ( ) { @ Override public void run ( ) { TempFile... | Stops the service container and cleans up all file system resources . | 105 | 13 |
158,392 | public void beforeShutdown ( @ Observes final BeforeShutdown bs ) { monitor . unregisterHealthReporter ( ) ; monitor . unregisterContextClassLoader ( ) ; reporter = null ; reporterInstance . preDestroy ( ) . dispose ( ) ; reporterInstance = null ; } | Called when the deployment is undeployed . | 59 | 10 |
158,393 | void setup ( final Map < String , Object > properties ) { final List < SetupAction > successfulActions = new ArrayList < SetupAction > ( ) ; for ( final SetupAction action : setupActions ) { try { action . setup ( properties ) ; successfulActions . add ( action ) ; } catch ( final Throwable e ) { for ( SetupAction s : ... | Sets up the contexts . If any of the setup actions fail then any setup contexts are torn down and then the exception is wrapped and thrown | 132 | 28 |
158,394 | private void resolveDependenciesInParallel ( List < DependencyNode > nodes ) { List < ArtifactRequest > artifactRequests = nodes . stream ( ) . map ( node -> new ArtifactRequest ( node . getArtifact ( ) , this . remoteRepositories , null ) ) . collect ( Collectors . toList ( ) ) ; try { this . resolver . resolveArtifac... | This is needed to speed up things . | 117 | 8 |
158,395 | public Swarm outboundSocketBinding ( String socketBindingGroup , OutboundSocketBinding binding ) { this . outboundSocketBindings . add ( new OutboundSocketBindingRequest ( socketBindingGroup , binding ) ) ; return this ; } | Add an outbound socket - binding to the container . | 53 | 11 |
158,396 | public Swarm socketBinding ( String socketBindingGroup , SocketBinding binding ) { this . socketBindings . add ( new SocketBindingRequest ( socketBindingGroup , binding ) ) ; return this ; } | Add an inbound socket - binding to the container . | 45 | 11 |
158,397 | public Swarm start ( ) throws Exception { INSTANCE = this ; try ( AutoCloseable handle = Performance . time ( "Thorntail.start()" ) ) { Module module = Module . getBootModuleLoader ( ) . loadModule ( CONTAINER_MODULE_NAME ) ; Class < ? > bootstrapClass = module . getClassLoader ( ) . loadClass ( "org.wildfly.swarm.cont... | Start the container . | 245 | 4 |
158,398 | public Swarm stop ( ) throws Exception { if ( this . server == null ) { throw SwarmMessages . MESSAGES . containerNotStarted ( "stop()" ) ; } this . server . stop ( ) ; this . server = null ; Module module = Module . getBootModuleLoader ( ) . loadModule ( CONTAINER_MODULE_NAME ) ; Class < ? > shutdownClass = module . g... | Stop the container first undeploying all deployments . | 145 | 10 |
158,399 | public Swarm deploy ( ) throws IllegalStateException , DeploymentException { if ( this . server == null ) { throw SwarmMessages . MESSAGES . containerNotStarted ( "deploy()" ) ; } if ( ApplicationEnvironment . get ( ) . isHollow ( ) ) { this . server . deployer ( ) . deploy ( getCommandLine ( ) . extraArguments ( ) . s... | Perform a default deployment . | 135 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.