idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
13,300
public void billingAccount_voicemail_serviceName_migrateOnNewVersion_POST ( String billingAccount , String serviceName ) throws IOException { String qPath = "/telephony/{billingAccount}/voicemail/{serviceName}/migrateOnNewVersion" ; StringBuilder sb = path ( qPath , billingAccount , serviceName ) ; exec ( qPath , "POST...
Change the voicemail on a new version to manager greetings directories and extra settings .
100
17
13,301
public ArrayList < Long > billingAccount_voicemail_serviceName_directories_GET ( String billingAccount , String serviceName , OvhVoicemailMessageFolderDirectoryEnum dir ) throws IOException { String qPath = "/telephony/{billingAccount}/voicemail/{serviceName}/directories" ; StringBuilder sb = path ( qPath , billingAcco...
Voicemail directory messages
135
5
13,302
public void billingAccount_voicemail_serviceName_directories_id_move_POST ( String billingAccount , String serviceName , Long id , OvhVoicemailMessageFolderDirectoryEnum dir ) throws IOException { String qPath = "/telephony/{billingAccount}/voicemail/{serviceName}/directories/{id}/move" ; StringBuilder sb = path ( qPat...
Move the message to another directory
153
6
13,303
public OvhPcsFile billingAccount_voicemail_serviceName_directories_id_download_GET ( String billingAccount , String serviceName , Long id , OvhServiceVoicemailAudioFormatEnum format ) throws IOException { String qPath = "/telephony/{billingAccount}/voicemail/{serviceName}/directories/{id}/download" ; StringBuilder sb =...
Get a url to download the sound file
155
8
13,304
public void billingAccount_voicemail_serviceName_settings_changePassword_POST ( String billingAccount , String serviceName , String password ) throws IOException { String qPath = "/telephony/{billingAccount}/voicemail/{serviceName}/settings/changePassword" ; StringBuilder sb = path ( qPath , billingAccount , serviceNam...
Change the voicemail password . It must be 4 digit
133
11
13,305
public OvhTrunkExternalDisplayedNumber billingAccount_trunk_serviceName_externalDisplayedNumber_POST ( String billingAccount , String serviceName , Boolean autoValidation , String number ) throws IOException { String qPath = "/telephony/{billingAccount}/trunk/{serviceName}/externalDisplayedNumber" ; StringBuilder sb = ...
External displayed number creation for a given trunk
180
8
13,306
public void billingAccount_trunk_serviceName_externalDisplayedNumber_number_DELETE ( String billingAccount , String serviceName , String number ) throws IOException { String qPath = "/telephony/{billingAccount}/trunk/{serviceName}/externalDisplayedNumber/{number}" ; StringBuilder sb = path ( qPath , billingAccount , se...
Delete an external displayed number for a given trunk
110
9
13,307
public OvhTrunkExternalDisplayedNumberValidation billingAccount_trunk_serviceName_externalDisplayedNumber_number_validate_POST ( String billingAccount , String serviceName , String number ) throws IOException { String qPath = "/telephony/{billingAccount}/trunk/{serviceName}/externalDisplayedNumber/{number}/validate" ; ...
Generate a phone call for validation . Returned validation code should be typed when asked .
145
18
13,308
public void billingAccount_transferSecurityDeposit_POST ( String billingAccount , Long amount , String billingAccountDestination ) throws IOException { String qPath = "/telephony/{billingAccount}/transferSecurityDeposit" ; StringBuilder sb = path ( qPath , billingAccount ) ; HashMap < String , Object > o = new HashMap ...
Transfer security deposit between two billing accounts
135
7
13,309
public ArrayList < Long > billingAccount_offerTask_GET ( String billingAccount , OvhOfferTaskActionEnum action , OvhTaskStatusEnum status , OvhOfferTaskTypeEnum type ) throws IOException { String qPath = "/telephony/{billingAccount}/offerTask" ; StringBuilder sb = path ( qPath , billingAccount ) ; query ( sb , "action"...
Operations on a telephony service s offer
152
9
13,310
public OvhConsumptionThreshold billingAccount_outplanNotification_POST ( String billingAccount , OvhOutplanNotificationBlockEnum block , String notifyEmail , Double percentage ) throws IOException { String qPath = "/telephony/{billingAccount}/outplanNotification" ; StringBuilder sb = path ( qPath , billingAccount ) ; H...
Add an outplan notification on the billing account
177
9
13,311
public OvhHistoryRepaymentConsumption billingAccount_historyRepaymentConsumption_POST ( String billingAccount , String billingNumber ) throws IOException { String qPath = "/telephony/{billingAccount}/historyRepaymentConsumption" ; StringBuilder sb = path ( qPath , billingAccount ) ; HashMap < String , Object > o = new ...
Ask for a new repayment
146
5
13,312
public OvhTask billingAccount_ddi_serviceName_changeDestination_POST ( String billingAccount , String serviceName , String destination ) throws IOException { String qPath = "/telephony/{billingAccount}/ddi/{serviceName}/changeDestination" ; StringBuilder sb = path ( qPath , billingAccount , serviceName ) ; HashMap < St...
Change the destination of the DDI
148
7
13,313
public ArrayList < OvhAccessoryOffer > accessories_GET ( OvhNumberCountryEnum country ) throws IOException { String qPath = "/telephony/accessories" ; StringBuilder sb = path ( qPath ) ; query ( sb , "country" , country ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t19 ...
Get all available accessories
95
4
13,314
public ArrayList < OvhTelephonySearchService > searchServices_GET ( String axiom ) throws IOException { String qPath = "/telephony/searchServices" ; StringBuilder sb = path ( qPath ) ; query ( sb , "axiom" , axiom ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t20 ) ; }
Search a service with its domain to get its billing account and type
95
13
13,315
public ArrayList < OvhNumberDetailedZone > number_detailedZones_GET ( String axiom , OvhNumberCountryEnum country ) throws IOException { String qPath = "/telephony/number/detailedZones" ; StringBuilder sb = path ( qPath ) ; query ( sb , "axiom" , axiom ) ; query ( sb , "country" , country ) ; String resp = execN ( qPat...
Get all available geographic zone with some details from a country
123
11
13,316
public ArrayList < OvhSpecificNumber > number_specificNumbers_GET ( OvhNumberCountryEnum country , String range , OvhNumberTypeEnum type , String zone ) throws IOException { String qPath = "/telephony/number/specificNumbers" ; StringBuilder sb = path ( qPath ) ; query ( sb , "country" , country ) ; query ( sb , "range"...
Get all available specific number from a country
150
8
13,317
public ArrayList < OvhCity > directories_cities_GET ( OvhNumberCountryEnum country , String zipCode ) throws IOException { String qPath = "/telephony/directories/cities" ; StringBuilder sb = path ( qPath ) ; query ( sb , "country" , country ) ; query ( sb , "zipCode" , zipCode ) ; String resp = execN ( qPath , "GET" , ...
Get city informations from a zip code
118
8
13,318
public ArrayList < String > directories_availableZipCodes_GET ( OvhNumberCountryEnum country , String number ) throws IOException { String qPath = "/telephony/directories/availableZipCodes" ; StringBuilder sb = path ( qPath ) ; query ( sb , "country" , country ) ; query ( sb , "number" , number ) ; String resp = execN ...
Get all zip codes compatible for a number
117
8
13,319
public OvhSound sounds_POST ( String description , String filename ) throws IOException { String qPath = "/telephony/sounds" ; StringBuilder sb = path ( qPath ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "description" , description ) ; addBody ( o , "filename" , filename ) ; S...
Create a new sound
122
4
13,320
public ArrayList < OvhLinePhone > line_offer_phones_GET ( OvhNumberCountryEnum country , String offer ) throws IOException { String qPath = "/telephony/line/offer/phones" ; StringBuilder sb = path ( qPath ) ; query ( sb , "country" , country ) ; query ( sb , "offer" , offer ) ; String resp = execN ( qPath , "GET" , sb ...
Get all available phone brands compatible with lines
117
8
13,321
public ArrayList < OvhLineOffer > fax_offers_GET ( OvhNumberCountryEnum country ) throws IOException { String qPath = "/telephony/fax/offers" ; StringBuilder sb = path ( qPath ) ; query ( sb , "country" , country ) ; String resp = execN ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t15 ) ; }
Get all available fax offer compatible
101
6
13,322
public void spare_spare_replace_POST ( String spare , String domain , String ip ) throws IOException { String qPath = "/telephony/spare/{spare}/replace" ; StringBuilder sb = path ( qPath , spare ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "domain" , domain ) ; addBody ( o , "...
Replace the phone by its spare . The broken phone became a spare if it was bought . An RMA is created if the broken phone is under securitydeposit .
121
34
13,323
public ArrayList < String > spare_brands_GET ( ) throws IOException { String qPath = "/telephony/spare/brands" ; StringBuilder sb = path ( qPath ) ; String resp = execN ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t4 ) ; }
Get all available spare brands
79
5
13,324
void removeResourceModels ( final Bundle bundle ) { this . logger . info ( "Removing resource models of bundle " + displayNameOf ( bundle ) + "..." ) ; MatchedBundlesPredicate sourcesWithBundles = new MatchedBundlesPredicate ( bundle ) ; for ( Collection < OsgiModelSource < ? > > values : this . typeNameToModelSourcesM...
Removes all resource models originating from the given bundle from this registry .
157
14
13,325
public synchronized void removeMetadataForModelsIn ( Bundle bundle ) { if ( bundle == null ) { throw new IllegalArgumentException ( "method parameter bundle must not be null" ) ; } Map < Class < ? > , ResourceModelMetadataHolder > newCache = copyCache ( ) ; Iterator < Map . Entry < Class < ? > , ResourceModelMetadataHo...
Removes the metadata of all models contained in the provided bundle from the registrar .
166
17
13,326
private static boolean isPropertyType ( Class < ? > type ) { return type . isPrimitive ( ) || type == String . class || type == Date . class || type == Calendar . class || ClassUtils . wrapperToPrimitive ( type ) != null ; }
Whether a property cannot be represented by a resource but must stem from a value map representing the properties of a resource .
56
23
13,327
public void removeValue ( V value ) { if ( value == null ) { throw new IllegalArgumentException ( "Method argument value must not be null." ) ; } for ( Collection < V > values : values ( ) ) { values . remove ( value ) ; } }
Removes the given value from all collections stored under any key .
57
13
13,328
@ Override @ Async public void onOsgiApplicationEvent ( OsgiBundleApplicationContextEvent event ) { // We need to use the generic OsgiBundleApplicationContextEvent here and test // for instanceof since gemini-blueprint does not correctly determine // the event type we are listening for. if ( event instanceof OsgiBundle...
This method is executed asynchronously since the original extender thread may try to obtain a lock to the OSGi framework s registry state during the stop while holding the event handling lock which may result in a transitive deadlock .
104
46
13,329
void handleStop ( Bundle bundle ) { if ( bundle == null ) { throw new IllegalArgumentException ( "Method argument bundle must not be null." ) ; } this . logger . info ( "Removing infrastructure for bundle: " + bundle + "..." ) ; this . modelRegistrar . unregister ( bundle ) ; this . dispatcherServlet . disableMvc ( bun...
We must guarantee the order in which the event is consumed by the collaborators since subsequent operations may depend on the resulting state .
99
24
13,330
public static < K , T extends Collection < K > > Collection < K > instantiateCollectionType ( Class < T > collectionType ) { return instantiateCollectionType ( collectionType , DEFAULT_COLLECTION_SIZE ) ; }
Creates an instance with a default capacity .
49
9
13,331
public static List < Method > methodsOf ( Class < ? > type ) { if ( type == null ) { throw new IllegalArgumentException ( "Method argument type must not be null" ) ; } List < Method > methods = new LinkedList <> ( ) ; Queue < Class < ? > > classes = new LinkedList <> ( ) ; classes . add ( type ) ; while ( ! classes . i...
All methods of the given type its super types and interfaces starting with the methods of the given type .
171
20
13,332
public ResourceModelStatistics countMappingDuration ( int durationInMs ) { // The right-hand interval boundaries are pre-calculated. We start at the smallest (1) of the // interval [0, 1). Thus, when our value is less than the boundary, we know it is in the current interval (i), // as the right-hand boundary is exclusi...
Adds the mapping with the duration to the statistics .
179
10
13,333
public static String [ ] appendToAll ( String append , String [ ] appendTo ) { if ( append == null ) { throw new IllegalArgumentException ( "Method argument append must not be null." ) ; } if ( appendTo == null ) { throw new IllegalArgumentException ( "Method argument to must not be null." ) ; } String [ ] result = new...
Appends the given String to all elements of the given array .
132
13
13,334
public static ChronoZonedDateTime zonedTime ( final Object target , final ZoneId defaultZoneId ) { Validate . notNull ( target , "Target cannot be null" ) ; Validate . notNull ( defaultZoneId , "ZoneId cannot be null" ) ; if ( target instanceof Instant ) { return ZonedDateTime . ofInstant ( ( Instant ) target , default...
Creates a Temporal object filling the missing fields of the provided time with default values .
449
18
13,335
public boolean export ( Context context , Class < ? > spaceClass , String accessToken ) { successful = false ; final SpaceHelper helper = crateSpaceHelper ( spaceClass ) ; final String outputPath = createOutputPath ( helper ) ; final CountDownLatch countDownLatch = new CountDownLatch ( 1 ) ; final Vault vault = Vault ....
Use this method to export Contentful spaces into sqlite3 databases which can be imported later .
262
19
13,336
public static String generateSetupJavaScript ( List < String > prefixes ) { Map < String , String > webJars = new WebJarAssetLocator ( ) . getWebJars ( ) ; return generateSetupJavaScript ( prefixes , webJars ) ; }
Returns the JavaScript that is used to setup the RequireJS config . This value is not cached .
57
20
13,337
public static Map < String , ObjectNode > generateSetupJson ( List < Map . Entry < String , Boolean > > prefixes ) { Map < String , String > webJars = new WebJarAssetLocator ( ) . getWebJars ( ) ; Map < String , ObjectNode > jsonConfigs = new HashMap <> ( ) ; for ( Map . Entry < String , String > webJar : webJars . ent...
Returns the JSON used to setup the RequireJS config for each WebJar in the CLASSPATH . This value is not cached .
133
28
13,338
private static String requireJsConfigErrorMessage ( Map . Entry < String , String > webJar ) { return "Could not read WebJar RequireJS config for: " + webJar . getKey ( ) + " " + webJar . getValue ( ) + "\n" + "Please file a bug at: http://github.com/webjars/" + webJar . getKey ( ) + "/issues/new" ; }
A generic error message for when the RequireJS config could not be parsed out of the WebJar s pom . xml meta - data .
92
29
13,339
@ Deprecated public static String getWebJarConfig ( Map . Entry < String , String > webJar ) { String webJarConfig = "" ; // read the webJarConfigs String filename = WebJarAssetLocator . WEBJARS_PATH_PREFIX + "/" + webJar . getKey ( ) + "/" + webJar . getValue ( ) + "/" + "webjars-requirejs.js" ; InputStream inputStrea...
The legacy webJars - requirejs . js based RequireJS config for a WebJar .
375
20
13,340
@ SuppressWarnings ( "unchecked" ) public static < E extends Enum < ? extends Style . HasCssName > > E fromStyleName ( final String styleName , final Class < E > enumClass , final E defaultValue ) { if ( styleName == null || enumClass == null ) { return defaultValue ; } for ( final Enum < ? extends Style . HasCssName >...
Returns first enum constant found in at space - separated list of style names .
177
15
13,341
public static SimpleRadioButton wrap ( Element element ) { // Assert that the element is attached. assert Document . get ( ) . getBody ( ) . isOrHasChild ( element ) ; SimpleRadioButton radioButton = new SimpleRadioButton ( InputElement . as ( element ) ) ; // Mark it attached and remember it for cleanup. radioButton ....
Creates a SimpleRadioButton widget that wraps an existing &lt ; input type = radio &gt ; element .
95
23
13,342
public List < EditorError > createErrorList ( Editor < T > editor , T value , String messageKey ) { List < EditorError > result = new ArrayList < EditorError > ( ) ; result . add ( new BasicEditorError ( editor , value , getInvalidMessage ( messageKey ) ) ) ; return result ; }
Creates the error list .
68
6
13,343
private void ensureId ( final Element element ) { final String id = element . getId ( ) ; if ( id == null || id . isEmpty ( ) ) { element . setId ( Document . get ( ) . createUniqueId ( ) ) ; } }
Ensures the given element has a non - empty id .
55
13
13,344
public static void setHiddenOn ( final UIObject uiObject , final DeviceSize deviceSize ) { // Split the enum up by _ to get the different devices // Separates the SM_MD into [SM, MD] so we can add the right styles final String [ ] deviceString = deviceSize . name ( ) . split ( "_" ) ; for ( final String device : device...
Sets the ui object to be hidden on the device size
258
13
13,345
public static void setVisibleOn ( final UIObject uiObject , final DeviceSize deviceSize ) { // Split the enum up by _ to get the different devices // Separates the SM_MD into [SM, MD] so we can add the right styles final String [ ] deviceString = deviceSize . name ( ) . split ( "_" ) ; for ( final String device : devic...
Sets the ui object to be visible on the device size
254
13
13,346
public static ScrollSpy scrollSpy ( final UIObject spyOn , final String selector ) { return new ScrollSpy ( spyOn . getElement ( ) , selector ) ; }
Attaches ScrollSpy to specified object with specified target selector .
38
13
13,347
public static ScrollSpy scrollSpy ( final UIObject spyOn , final HasId target ) { return new ScrollSpy ( spyOn . getElement ( ) , target ) ; }
Attaches ScrollSpy to specified object with specified target element .
39
13
13,348
public void setIconType ( IconType type ) { IconType prevType = iconType ; iconType = type ; if ( iconType != prevType && iconElement != null ) { iconElement . removeFromParent ( ) ; iconElement = null ; DomEvent . fireNativeEvent ( Document . get ( ) . createChangeEvent ( ) , this ) ; } }
Sets the icon type . If the icon type changes programatically then the icon is removed from the dom and recreated .
76
25
13,349
public static SimpleCheckBox wrap ( Element element ) { // Assert that the element is attached. assert Document . get ( ) . getBody ( ) . isOrHasChild ( element ) ; SimpleCheckBox checkBox = new SimpleCheckBox ( InputElement . as ( element ) ) ; // Mark it attached and remember it for cleanup. checkBox . onAttach ( ) ;...
Creates a SimpleCheckBox widget that wraps an existing &lt ; input type = checkbox &gt ; element .
95
24
13,350
private void call ( final Element e , final String arg ) { JQuery . jQuery ( e ) . popover ( arg ) ; }
Call the native popover method with the given argument .
28
11
13,351
private void popover ( Element e , String content ) { e . setAttribute ( "data-content" , content ) ; JQuery . jQuery ( e ) . popover ( ) ; }
Create the popover .
40
5
13,352
public void setAttribute ( final String attributeName , final String attributeValue ) { uiObject . getElement ( ) . setAttribute ( attributeName , attributeValue ) ; }
Sets the attribute on the UiObject
36
9
13,353
private void updatePaginationState ( final SimplePager pager ) { for ( int i = 0 ; i < getWidgetCount ( ) ; i ++ ) { if ( i == 0 ) { //previous button ( ( AnchorListItem ) getWidget ( i ) ) . setEnabled ( pager . hasPreviousPage ( ) ) ; } else if ( i == getWidgetCount ( ) - 1 ) { //next button ( ( AnchorListItem ) getW...
This updates the current active page and the enabled state of the previous and next buttons in the Pagination based on the state of the given SimplePager .
188
31
13,354
public void insert ( final Widget child , final int beforeIndex ) { insert ( child , ( Element ) getElement ( ) , beforeIndex , true ) ; }
Inserts a widget at a specific index
34
8
13,355
public < T extends Widget & HasValidators < ? > > void add ( final T field ) { fields . put ( field , field . validate ( false ) ) ; if ( field . isAttached ( ) ) { updateStateAndNotify ( ) ; } registrations . put ( field , field . addValidationChangedHandler ( new ValidationChangedHandler ( ) { @ Override public void ...
Adds a field to the group .
130
7
13,356
public < T extends Widget & HasValidators < ? > > boolean remove ( final T field ) { fields . remove ( ( HasValidators < ? > ) field ) ; HandlerRegistration reg = registrations . remove ( ( HasValidators < ? > ) field ) ; if ( reg != null ) { reg . removeHandler ( ) ; return true ; } return false ; }
Removes a field from the validation group .
78
9
13,357
public void setSize ( final ColumnSize firstSize , final ColumnSize ... otherSizes ) { addEnumVarargsValues ( new ColumnSize [ ] { firstSize } , ColumnSize . class , true ) ; addEnumVarargsValues ( otherSizes , ColumnSize . class , false ) ; }
Adds one or more additional column sizes .
65
8
13,358
protected Set < Radio > getRadioChildren ( final Widget widget , final Set < Radio > c ) { Set < Radio > children = c ; if ( children == null ) { children = new HashSet < Radio > ( ) ; } if ( widget instanceof Radio ) { children . add ( ( Radio ) widget ) ; } else if ( widget instanceof HasOneWidget ) { children = getR...
Gets the radio children .
169
6
13,359
protected void updateChildren ( ) { for ( Radio child : getRadioChildren ( ) ) { HandlerRegistration reg = valueChangedRegistrations . get ( child ) ; if ( reg == null ) { valueChangedRegistrations . put ( child , child . addValueChangeHandler ( changeHandler ) ) ; } child . setName ( name ) ; } }
Update the radio children names .
74
6
13,360
private void call ( final Element e , final String arg ) { JQuery . jQuery ( e ) . tooltip ( arg ) ; }
Call the native tooltip method with the given argument .
27
10
13,361
@ Override public void setName ( final String name ) { this . name = name ; if ( name == null ) { return ; } for ( final Widget w : getChildren ( ) ) { if ( w instanceof HasName ) { ( ( HasName ) w ) . setName ( name ) ; } } }
Convenience method that will set the name of all child widgets that can have a name
68
18
13,362
private Map getCurrentStep ( Phase phase ) { String target = phase . ordinal ( ) <= Phase . match . ordinal ( ) ? Phase . match . name ( ) : Phase . result . name ( ) ; Map lastWithValue = null ; for ( Map stepOrHook : getSteps ( ) ) { if ( stepOrHook . get ( target ) == null ) { return stepOrHook ; } else { lastWithVa...
In order to handle steps being added all at once this method determines allows methods to opperator correctly if
108
21
13,363
public void syntaxError ( String state , String event , List < String > legalEvents , String uri , Integer line ) { formatter . syntaxError ( state , event , legalEvents , uri , line ) ; }
Not part of the API . Used for testing only .
46
11
13,364
public JCodeModel getCodeModel ( String basePackage , String schemaLocation , Annotator annotator ) { if ( type != null ) { return codeModel ; } else { return SchemaHelper . buildBodyJCodeModel ( schemaLocation , basePackage , name , schema , annotator ) ; } }
Builds a JCodeModel for this body
64
9
13,365
public Set < ApiResourceMetadata > extractControllers ( JCodeModel bodyCodeModel , RamlRoot raml ) { Set < ApiResourceMetadata > controllers = new LinkedHashSet <> ( ) ; if ( raml == null ) { return controllers ; } if ( bodyCodeModel == null ) { bodyCodeModel = new JCodeModel ( ) ; } Set < String > names = new LinkedHa...
This method will extract a set of controllers from the RAML file . These controllers will contain the metadata required by the code generator including name any annotations as well as conatining methods
362
36
13,366
private Set < ApiResourceMetadata > checkResource ( JCodeModel bodyCodeModel , String baseUrl , RamlResource resource , ApiResourceMetadata controller , RamlRoot document ) { Set < ApiResourceMetadata > controllers = new LinkedHashSet <> ( ) ; // append resource URL to url. String url = baseUrl + resource . getRelative...
Recursive method to parse resources in a Raml File . It tries to go as deep as possible before creating the root Resource . Once this is done methods and child resources will be relative to the root resource
460
41
13,367
private Set < String > getAllReferencedTypeNames ( Set < ApiResourceMetadata > controllers ) { // TODO Add nested objects as well. For now only the top level objects // are included Set < String > parametersNames = controllers . stream ( ) . flatMap ( resourceMetadata -> resourceMetadata . getParameters ( ) . stream ( ...
Fetches all referenced type names so as to not generate classes multiple times
183
15
13,368
public static RamlRoot loadRamlFromFile ( String ramlFileUrl ) { try { return createRamlModelFactoryFor ( ramlFileUrl ) . buildRamlRoot ( ramlFileUrl ) ; } catch ( NullPointerException npe ) { logger . error ( "File not found at {}" , ramlFileUrl ) ; return null ; } }
Loads a RAML document from a file . This method will
79
13
13,369
private boolean doesActionTypeSupportRequestBody ( RamlActionType target ) { return target . equals ( RamlActionType . POST ) || target . equals ( RamlActionType . PUT ) || target . equals ( RamlActionType . PATCH ) || target . equals ( RamlActionType . DELETE ) ; }
Method to check if a specific action type supports payloads in the body of the request
70
17
13,370
public static String resolveSchema ( String schema , RamlRoot document ) { if ( document == null || schema == null || schema . indexOf ( "{" ) != - 1 ) { return null ; } if ( document . getSchemas ( ) != null && ! document . getSchemas ( ) . isEmpty ( ) ) { for ( Map < String , String > map : document . getSchemas ( ) ...
Utility method that will return a schema if the identifier is valid and exists in the raml file definition .
115
22
13,371
public static Class < ? > mapSimpleType ( RamlParamType param , String format , String rawType ) { switch ( param ) { case BOOLEAN : return Boolean . class ; case DATE : return mapDateFormat ( rawType ) ; case INTEGER : { Class < ? > fromFormat = mapNumberFromFormat ( format ) ; if ( fromFormat == Double . class ) { th...
Maps simple types supported by RAML into primitives and other simple Java types
190
15
13,372
private static String extractTopItem ( String searchString , String schema , int startIdx ) { String extracted = null ; int propIdx = schema . indexOf ( "\"properties\"" , startIdx ) ; if ( propIdx == - 1 ) { propIdx = Integer . MAX_VALUE ; } // check for second int idIdx = schema . indexOf ( "\"" + searchString + "\""...
Extracts the value of a specified parameter in a schema
276
12
13,373
public static JCodeModel buildBodyJCodeModel ( String basePackage , String schemaLocation , String name , String schema , Annotator annotator ) { JCodeModel codeModel = new JCodeModel ( ) ; SchemaStore schemaStore = new SchemaStore ( ) ; GenerationConfig config = Config . getPojoConfig ( ) ; if ( config == null ) { con...
Builds a JCodeModel for classes that will be used as Request or Response bodies
367
17
13,374
public static GenerationConfig getGenerationConfig ( Boolean generateBuilders , Boolean includeAdditionalProperties , Boolean includeDynamicAccessors , Boolean useLongIntegers ) { return new DefaultGenerationConfig ( ) { @ Override public boolean isGenerateBuilders ( ) { // set config option by // overriding method if ...
Returns a generation config with the supplied parameters . If any of these parameters are supplied null it will use the value defined in the default configuration
209
27
13,375
public static String getElementAsString ( JDeclaration type ) { StringBuilder builder = new StringBuilder ( ) ; JFormatter jFormatter = new JFormatter ( new StringBuilderWriter ( builder ) ) ; type . declare ( jFormatter ) ; return builder . toString ( ) ; }
Returns the string equivalent of the code model element
63
9
13,376
public void annotateFieldJSR303 ( JMethod getter , boolean addValidAnnotation ) { if ( isRequired ( ) ) { getter . annotate ( NotNull . class ) ; } if ( StringUtils . hasText ( getPattern ( ) ) ) { JAnnotationUse annotation = getter . annotate ( Pattern . class ) ; annotation . param ( "regexp" , getPattern ( ) ) ; } i...
Adds validation annotations to the supplied method
292
7
13,377
public static String getFirstAuthorizationGrant ( RamlAction action , RamlRoot document ) { List < String > grants = getAuthorizationGrants ( action , document ) ; if ( grants . isEmpty ( ) ) { return null ; } return grants . get ( 0 ) ; }
Returns authorization grant for provided action . It searches for authorization grants defined for provided action some of parent resources or the root of the document . If authorization grants found is a list - the method will return the first grant in the list .
60
46
13,378
public static List < String > removeDuplicates ( List < String > list ) { return list . stream ( ) . distinct ( ) . collect ( Collectors . toList ( ) ) ; }
Remove duplicates from provided list .
41
7
13,379
public static String getFormat ( TypeDeclaration param ) { if ( param == null ) { return null ; } if ( param instanceof NumberTypeDeclaration ) { return ( ( NumberTypeDeclaration ) param ) . format ( ) ; } if ( param instanceof DateTimeTypeDeclaration ) { return ( ( DateTimeTypeDeclaration ) param ) . format ( ) ; } re...
IF it has a format defined this will return it
83
10
13,380
public static String getDescription ( TypeDeclaration type ) { if ( type == null || type . description ( ) == null ) { return null ; } else { return type . description ( ) . value ( ) ; } }
Safely get description from a type with null checks
46
10
13,381
public static String getExample ( TypeDeclaration type ) { if ( type == null || type . example ( ) == null ) { return null ; } else { return type . example ( ) . value ( ) ; } }
Safely get example from a type with null checks
46
10
13,382
public static String getDisplayName ( TypeDeclaration type ) { if ( type == null || type . displayName ( ) == null ) { return null ; } else { return type . displayName ( ) . value ( ) ; } }
Safely get Display name from a type with null checks
49
11
13,383
public static boolean isRequired ( TypeDeclaration type ) { if ( type == null || type . required ( ) == null ) { return true ; } else { return type . required ( ) ; } }
Safely get required from a type with null checks
42
10
13,384
public boolean isArray ( ) { if ( type == null ) { return false ; } return type . isArray ( ) || List . class . isAssignableFrom ( type ) || Set . class . isAssignableFrom ( type ) ; }
Quick check to see if this is an array type or not
53
12
13,385
public static String convertContentTypeToQualifier ( String contentType ) { // lets start off simple since qualifers are better if they are simple // :) // if we have simple standard types lets add some heuristics if ( contentType . equals ( MediaType . APPLICATION_JSON_VALUE ) ) { return "AsJson" ; } if ( contentType ...
Converts an http contentType into a qualifier that can be used within a Java method
420
17
13,386
public static List < String > extractUriParams ( String url ) { List < String > outParams = new ArrayList <> ( ) ; if ( StringUtils . hasText ( url ) ) { String [ ] split = StringUtils . split ( url , "/" ) ; for ( String part : split ) { int indexOfStart = part . indexOf ( "{" ) ; int indexOfEnd = part . indexOf ( "}"...
Extracts a list of URI Parameters from a url
155
11
13,387
public static boolean isValidJavaClassName ( String input ) { if ( ! StringUtils . hasText ( input ) ) { return false ; } if ( ! Character . isJavaIdentifierStart ( input . charAt ( 0 ) ) ) { return false ; } if ( input . length ( ) > 1 ) { for ( int i = 1 ; i < input . length ( ) ; i ++ ) { if ( ! Character . isJavaId...
Utility method to check if a string can be used as a valid class name
117
16
13,388
public static String getAllResourcesNames ( String url , boolean singularize ) { StringBuilder stringBuilder = new StringBuilder ( ) ; if ( StringUtils . hasText ( url ) ) { String [ ] resources = SLASH . split ( url ) ; int lengthCounter = 0 ; for ( int i = resources . length - 1 ; i >= Config . getResourceTopLevelInC...
Attempts to infer the name of a resource from a resources s full URL .
213
15
13,389
public static String singularize ( String target ) { // TODO we should add this as an issue in the RamlBase project and // provide a pull request String result = Inflector . singularize ( target ) ; if ( ( target . endsWith ( "ss" ) ) && ( result . equals ( target . substring ( 0 , target . length ( ) - 1 ) ) ) ) { res...
Singularises a string . uses underlying raml parser system
92
12
13,390
public static String cleanNameForJavaEnum ( String enumConstant ) { if ( ! StringUtils . hasText ( enumConstant ) ) { return enumConstant ; } List < String > nameGroups = new ArrayList <> ( asList ( splitByCharacterTypeCamelCase ( enumConstant ) ) ) ; nameGroups . removeIf ( s -> containsOnly ( s . replaceAll ( ILLEGAL...
Cleans a string with characters that are not valid as a java identifier enum
186
15
13,391
private static String convertActionTypeToIntent ( RamlActionType actionType , boolean isIdInPath ) { switch ( actionType ) { case DELETE : return "delete" ; case GET : return "get" ; case POST : if ( ! isIdInPath ) { return "create" ; } case PUT : return "update" ; case PATCH : return "modify" ; default : return "do" ;...
Attempts to convert the Http Verb into a textual representation of Intent based on REST conventions
94
17
13,392
private void loadInfosFromSettings ( ScmProviderRepositoryWithHost repo ) { if ( username == null || password == null ) { String host = repo . getHost ( ) ; int port = repo . getPort ( ) ; if ( port > 0 ) { host += ":" + port ; } Server server = this . settings . getServer ( host ) ; if ( server != null ) { setPassword...
Load username password from settings .
125
6
13,393
protected InfoScmResult info ( ScmRepository repository , ScmFileSet fileSet ) throws ScmException { CommandParameters commandParameters = new CommandParameters ( ) ; // only for Git, we will make a test for shortRevisionLength parameter if ( GitScmProviderRepository . PROTOCOL_GIT . equals ( scmManager . getProviderBy...
Get info from scm .
330
6
13,394
private String format ( Object [ ] arguments ) { Locale l = Locale . getDefault ( ) ; if ( locale != null ) { String [ ] parts = locale . split ( "_" , 3 ) ; if ( parts . length <= 1 ) { l = new Locale ( locale ) ; } else if ( parts . length == 2 ) { l = new Locale ( parts [ 0 ] , parts [ 1 ] ) ; } else { l = new Local...
Formats the given argument using the configured format template and locale .
133
13
13,395
public String getScmBranch ( ) throws MojoExecutionException { try { ScmRepository repository = getScmRepository ( ) ; ScmProvider provider = scmManager . getProviderByRepository ( repository ) ; /* git branch can be obtained directly by a command */ if ( GitScmProviderRepository . PROTOCOL_GIT . equals ( provider . ge...
Get the branch info for this revision from the repository . For svn it is in svn info .
316
21
13,396
public String getRevision ( ) throws MojoExecutionException { if ( format != null && ! useScm ) { return revision ; } useScm = false ; try { return this . getScmRevision ( ) ; } catch ( ScmException e ) { if ( ! StringUtils . isEmpty ( revisionOnScmFailure ) ) { getLog ( ) . warn ( "Cannot get the revision information ...
Get the revision info from the repository . For svn it is svn info
189
16
13,397
public CreateIssueParams estimatedHours ( BigDecimal estimatedHours ) { if ( estimatedHours == null ) { parameters . add ( new NameValuePair ( "estimatedHours" , "" ) ) ; } else { parameters . add ( new NameValuePair ( "estimatedHours" , estimatedHours . setScale ( 2 , BigDecimal . ROUND_HALF_UP ) . toPlainString ( ) )...
Sets the issue estimate hours .
98
7
13,398
public CreateIssueParams actualHours ( BigDecimal actualHours ) { if ( actualHours == null ) { parameters . add ( new NameValuePair ( "actualHours" , "" ) ) ; } else { parameters . add ( new NameValuePair ( "actualHours" , actualHours . setScale ( 2 , BigDecimal . ROUND_HALF_UP ) . toPlainString ( ) ) ) ; } return this...
Sets the issue actual hours .
96
7
13,399
public CreateIssueParams milestoneIds ( List milestoneIds ) { for ( Object milestoneId : milestoneIds ) { parameters . add ( new NameValuePair ( "milestoneId[]" , milestoneId . toString ( ) ) ) ; } return this ; }
Sets the issue milestones .
58
6