idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
146,200 | private static String getColumnTitle ( final PropertyDescriptor _property ) { final StringBuilder buffer = new StringBuilder ( ) ; final String name = _property . getName ( ) ; buffer . append ( Character . toUpperCase ( name . charAt ( 0 ) ) ) ; for ( int i = 1 ; i < name . length ( ) ; i ++ ) { final char c = name . ... | Calculates a column title using camel humps to separate words . |
146,201 | private static boolean isValidPropertyClass ( final PropertyDescriptor _property ) { final Class type = _property . getPropertyType ( ) ; return Number . class . isAssignableFrom ( type ) || type == String . class || Date . class . isAssignableFrom ( type ) || type == Boolean . class ; } | Checks if a property s type is valid to be included in the report . |
146,202 | private static int getColumnWidth ( final PropertyDescriptor _property ) { final Class type = _property . getPropertyType ( ) ; if ( Float . class . isAssignableFrom ( type ) || Double . class . isAssignableFrom ( type ) ) { return 70 ; } else if ( type == Boolean . class ) { return 10 ; } else if ( Number . class . is... | Calculates the column width according to its type . |
146,203 | public void addSerie ( AbstractColumn column , StringExpression labelExpression ) { series . add ( column ) ; seriesLabels . put ( column , labelExpression ) ; } | Adds the specified serie column to the dataset with custom label expression . |
146,204 | public DynamicReport build ( ) { if ( built ) { throw new DJBuilderException ( "DynamicReport already built. Cannot use more than once." ) ; } else { built = true ; } report . setOptions ( options ) ; if ( ! globalVariablesGroup . getFooterVariables ( ) . isEmpty ( ) || ! globalVariablesGroup . getHeaderVariables ( ) .... | Builds the DynamicReport object . Cannot be used twice since this produced undesired results on the generated DynamicReport object |
146,205 | protected void concatenateReports ( ) { if ( ! concatenatedReports . isEmpty ( ) ) { DJGroup globalGroup = createDummyGroup ( ) ; report . getColumnsGroups ( ) . add ( 0 , globalGroup ) ; } for ( Subreport subreport : concatenatedReports ) { DJGroup globalGroup = createDummyGroup ( ) ; globalGroup . getFooterSubreports... | Create dummy groups for each concatenated report and in the footer of each group adds the subreport . |
146,206 | public DynamicReportBuilder setTemplateFile ( String path , boolean importFields , boolean importVariables , boolean importParameters , boolean importDatasets ) { report . setTemplateFileName ( path ) ; report . setTemplateImportFields ( importFields ) ; report . setTemplateImportParameters ( importParameters ) ; repor... | The full path of a jrxml file or the path in the classpath of a jrxml resource . |
146,207 | public DynamicReportBuilder addStyle ( Style style ) throws DJBuilderException { if ( style . getName ( ) == null ) { throw new DJBuilderException ( "Invalid style. The style must have a name" ) ; } report . addStyle ( style ) ; return this ; } | You can register styles object for later reference them directly . Parent styles should be registered this way |
146,208 | public DynamicReportBuilder setQuery ( String text , String language ) { this . report . setQuery ( new DJQuery ( text , language ) ) ; return this ; } | Adds main report query . |
146,209 | public DynamicReportBuilder setProperty ( String name , String value ) { this . report . setProperty ( name , value ) ; return this ; } | Adds a property to report design this properties are mostly used by exporters to know if any specific configuration is needed |
146,210 | public DynamicReportBuilder setColspan ( int colNumber , int colQuantity , String colspanTitle ) { this . setColspan ( colNumber , colQuantity , colspanTitle , null ) ; return this ; } | Set a colspan in a group of columns . First add the cols to the report |
146,211 | public void setTotalColorForColumn ( int column , Color color ) { int map = ( colors . length - 1 ) - column ; colors [ map ] [ colors [ 0 ] . length - 1 ] = color ; } | Set the color for each total for the column |
146,212 | public void setColorForTotal ( int row , int column , Color color ) { int mapC = ( colors . length - 1 ) - column ; int mapR = ( colors [ 0 ] . length - 1 ) - row ; colors [ mapC ] [ mapR ] = color ; } | Sets the color for the big total between the column and row |
146,213 | public static void copyThenClose ( InputStream input , OutputStream output ) throws IOException { copy ( input , output ) ; input . close ( ) ; output . close ( ) ; } | Copies information between specified streams and then closes both of the streams . |
146,214 | public SubReportBuilder setParameterMapPath ( String path ) { subreport . setParametersExpression ( path ) ; subreport . setParametersMapOrigin ( DJConstants . SUBREPORT_PARAMETER_MAP_ORIGIN_PARAMETER ) ; return this ; } | defines the KEY in the parent report parameters map where to get the subreport parameters map . |
146,215 | public List < ColumnProperty > getAllFields ( ) { ArrayList < ColumnProperty > l = new ArrayList < ColumnProperty > ( ) ; for ( AbstractColumn abstractColumn : this . getColumns ( ) ) { if ( abstractColumn instanceof SimpleColumn && ! ( abstractColumn instanceof ExpressionColumn ) ) { l . add ( ( ( SimpleColumn ) abstr... | Collects all the fields from columns and also the fields not bounds to columns |
146,216 | protected void registerValueFormatter ( DJGroupVariable djVariable , String variableName ) { if ( djVariable . getValueFormatter ( ) == null ) { return ; } JRDesignParameter dparam = new JRDesignParameter ( ) ; dparam . setName ( variableName + "_vf" ) ; dparam . setValueClassName ( DJValueFormatter . class . getName (... | Registers the parameter for the value formatter for the given variable and puts it s implementation in the parameters map . |
146,217 | protected void setWhenNoDataBand ( ) { log . debug ( "setting up WHEN NO DATA band" ) ; String whenNoDataText = getReport ( ) . getWhenNoDataText ( ) ; Style style = getReport ( ) . getWhenNoDataStyle ( ) ; if ( whenNoDataText == null || "" . equals ( whenNoDataText ) ) return ; JRDesignBand band = new JRDesignBand ( )... | Creates the graphic element to be shown when the datasource is empty |
146,218 | protected void ensureDJStyles ( ) { for ( Style style : getReport ( ) . getStyles ( ) . values ( ) ) { addStyleToDesign ( style ) ; } Style defaultDetailStyle = getReport ( ) . getOptions ( ) . getDefaultDetailStyle ( ) ; Style defaultHeaderStyle = getReport ( ) . getOptions ( ) . getDefaultHeaderStyle ( ) ; for ( Abst... | Sets a default style for every element that doesn t have one |
146,219 | protected void setColumnsFinalWidth ( ) { log . debug ( "Setting columns final width." ) ; float factor ; int printableArea = report . getOptions ( ) . getColumnWidth ( ) ; List visibleColums = getVisibleColumns ( ) ; if ( report . getOptions ( ) . isUseFullPageWidth ( ) ) { int columnsWidth = 0 ; int notRezisableWidth... | Sets the columns width by reading some report options like the printableArea and useFullPageWidth . columns with fixedWidth property set in TRUE will not be modified |
146,220 | protected void setBandsFinalHeight ( ) { log . debug ( "Setting bands final height..." ) ; List < JRBand > bands = new ArrayList < JRBand > ( ) ; Utils . addNotNull ( bands , design . getPageHeader ( ) ) ; Utils . addNotNull ( bands , design . getPageFooter ( ) ) ; Utils . addNotNull ( bands , design . getColumnHeader ... | Sets the necessary height for all bands in the report to hold their children |
146,221 | private void setBandFinalHeight ( JRDesignBand band , int currHeigth , boolean fitToContent ) { if ( band != null ) { int finalHeight = LayoutUtils . findVerticalOffset ( band ) ; if ( finalHeight < currHeigth && ! fitToContent ) { } else { band . setHeight ( finalHeight ) ; } } } | Removes empty space when fitToContent is true and real height of object is taller than current bands height otherwise it is not modified |
146,222 | protected JRDesignGroup getParent ( JRDesignGroup group ) { int index = realGroups . indexOf ( group ) ; return ( index > 0 ) ? ( JRDesignGroup ) realGroups . get ( index - 1 ) : group ; } | Finds the parent group of the given one and returns it |
146,223 | public static int findVerticalOffset ( JRDesignBand band ) { int finalHeight = 0 ; if ( band != null ) { for ( JRChild jrChild : band . getChildren ( ) ) { JRDesignElement element = ( JRDesignElement ) jrChild ; int currentHeight = element . getY ( ) + element . getHeight ( ) ; if ( currentHeight > finalHeight ) finalH... | Finds Y coordinate value in which more elements could be added in the band |
146,224 | public static void moveBandsElemnts ( int yOffset , JRDesignBand band ) { if ( band == null ) return ; for ( JRChild jrChild : band . getChildren ( ) ) { JRDesignElement elem = ( JRDesignElement ) jrChild ; elem . setY ( elem . getY ( ) + yOffset ) ; } } | Moves the elements contained in band in the Y axis yOffset |
146,225 | public static JRDesignGroup getJRDesignGroup ( DynamicJasperDesign jd , LayoutManager layoutManager , DJGroup group ) { Map references = layoutManager . getReferencesMap ( ) ; for ( Object o : references . keySet ( ) ) { String groupName = ( String ) o ; DJGroup djGroup = ( DJGroup ) references . get ( groupName ) ; if... | Returns the JRDesignGroup for the DJGroup passed |
146,226 | protected void applyBanners ( ) { DynamicReportOptions options = getReport ( ) . getOptions ( ) ; if ( options . getFirstPageImageBanners ( ) . isEmpty ( ) && options . getImageBanners ( ) . isEmpty ( ) ) { return ; } JRDesignBand title = ( JRDesignBand ) getDesign ( ) . getTitle ( ) ; if ( title == null && ! options .... | Create the image elements for the banners tha goes into the title and header bands depending on the case |
146,227 | protected void generateTitleBand ( ) { log . debug ( "Generating title band..." ) ; JRDesignBand band = ( JRDesignBand ) getDesign ( ) . getPageHeader ( ) ; int yOffset = 0 ; if ( getReport ( ) . getTitle ( ) == null ) return ; if ( band != null && ! getDesign ( ) . isTitleNewPage ( ) ) { yOffset = band . getHeight ( )... | Adds title and subtitle to the TitleBand when it applies . If title is not present then subtitle will be ignored |
146,228 | protected void layoutGroupFooterLabels ( DJGroup djgroup , JRDesignGroup jgroup , int x , int y , int width , int height ) { DJGroupLabel label = djgroup . getFooterLabel ( ) ; JRDesignBand band = LayoutUtils . getBandFromSection ( ( JRDesignSection ) jgroup . getGroupFooterSection ( ) ) ; JRDesignExpression labelExp ;... | Creates needed textfields for general label in footer groups . |
146,229 | private int findYOffsetForGroupLabel ( JRDesignBand band ) { int offset = 0 ; for ( JRChild jrChild : band . getChildren ( ) ) { JRDesignElement elem = ( JRDesignElement ) jrChild ; if ( elem . getKey ( ) != null && elem . getKey ( ) . startsWith ( "variable_for_column_" ) ) { offset = elem . getY ( ) ; break ; } } ret... | Used to ensure that the general footer label will be at the same Y position as the variables in the band . |
146,230 | protected void layoutGroupSubreports ( DJGroup columnsGroup , JRDesignGroup jgroup ) { log . debug ( "Starting subreport layout..." ) ; JRDesignBand footerBand = ( JRDesignBand ) ( ( JRDesignSection ) jgroup . getGroupFooterSection ( ) ) . getBandsList ( ) . get ( 0 ) ; JRDesignBand headerBand = ( JRDesignBand ) ( ( JR... | If there is a SubReport on a Group we do the layout here |
146,231 | protected void sendPageBreakToBottom ( JRDesignBand band ) { JRElement [ ] elems = band . getElements ( ) ; JRElement aux = null ; for ( JRElement elem : elems ) { if ( ( "" + elem . getKey ( ) ) . startsWith ( PAGE_BREAK_FOR_ ) ) { aux = elem ; break ; } } if ( aux != null ) ( ( JRDesignElement ) aux ) . setY ( band .... | page breaks should be near the bottom of the band this method used while adding subreports which has the start on new page option . |
146,232 | public DJCrosstab build ( ) { if ( crosstab . getMeasures ( ) . isEmpty ( ) ) { throw new LayoutException ( "Crosstabs must have at least one measure" ) ; } if ( crosstab . getColumns ( ) . isEmpty ( ) ) { throw new LayoutException ( "Crosstabs must have at least one column" ) ; } if ( crosstab . getRows ( ) . isEmpty ... | Build the crosstab . Throws LayoutException if anything is wrong |
146,233 | public CrosstabBuilder useMainReportDatasource ( boolean preSorted ) { DJDataSource datasource = new DJDataSource ( "ds" , DJConstants . DATA_SOURCE_ORIGIN_REPORT_DATASOURCE , DJConstants . DATA_SOURCE_TYPE_JRDATASOURCE ) ; datasource . setPreSorted ( preSorted ) ; crosstab . setDatasource ( datasource ) ; return this ... | To use main report datasource . There should be nothing else in the detail band |
146,234 | public CrosstabBuilder addInvisibleMeasure ( String property , String className , String title ) { DJCrosstabMeasure measure = new DJCrosstabMeasure ( property , className , DJCalculation . NOTHING , title ) ; measure . setVisible ( false ) ; crosstab . getMeasures ( ) . add ( measure ) ; return this ; } | Adds a measure to the crosstab . A crosstab can have many measures . DJ will lay out one measure above the other . |
146,235 | public CrosstabBuilder setRowStyles ( Style headerStyle , Style totalStyle , Style totalHeaderStyle ) { crosstab . setRowHeaderStyle ( headerStyle ) ; crosstab . setRowTotalheaderStyle ( totalHeaderStyle ) ; crosstab . setRowTotalStyle ( totalStyle ) ; return this ; } | Should be called after all rows have been created |
146,236 | public CrosstabBuilder setColumnStyles ( Style headerStyle , Style totalStyle , Style totalHeaderStyle ) { crosstab . setColumnHeaderStyle ( headerStyle ) ; crosstab . setColumnTotalheaderStyle ( totalHeaderStyle ) ; crosstab . setColumnTotalStyle ( totalStyle ) ; return this ; } | Should be called after all columns have been created |
146,237 | public FastReportBuilder addBarcodeColumn ( String title , String property , String className , int barcodeType , boolean showText , int width , boolean fixedWidth , ImageScaleMode imageScaleMode , Style style ) throws ColumnBuilderException , ClassNotFoundException { AbstractColumn column = ColumnBuilder . getNew ( ) ... | By default uses InputStream as the type of the image |
146,238 | public FastReportBuilder addGroups ( int numgroups ) { groupCount = numgroups ; for ( int i = 0 ; i < groupCount ; i ++ ) { GroupBuilder gb = new GroupBuilder ( ) ; PropertyColumn col = ( PropertyColumn ) report . getColumns ( ) . get ( i ) ; gb . setCriteriaColumn ( col ) ; report . getColumnsGroups ( ) . add ( gb . b... | This method should be called after all column have been added to the report . |
146,239 | protected Object transformEntity ( Entity entity ) { PropertyColumn propertyColumn = ( PropertyColumn ) entity ; JRDesignField field = new JRDesignField ( ) ; ColumnProperty columnProperty = propertyColumn . getColumnProperty ( ) ; field . setName ( columnProperty . getProperty ( ) ) ; field . setValueClassName ( colum... | Receives a PropertyColumn and returns a JRDesignField |
146,240 | public String getTextForExpression ( DJGroup group , DJGroup childGroup , String type ) { return "new Double( $V{" + getReportName ( ) + "_" + getGroupVariableName ( childGroup ) + "}.doubleValue() / $V{" + getReportName ( ) + "_" + getGroupVariableName ( type , group . getColumnToGroupBy ( ) . getColumnProperty ( ) . ... | Returns the formula for the percentage |
146,241 | public ReportWriter getReportWriter ( final JasperPrint _jasperPrint , final String _format , final Map < JRExporterParameter , Object > _parameters ) { final JRExporter exporter = FormatInfoRegistry . getInstance ( ) . getExporter ( _format ) ; exporter . setParameters ( _parameters ) ; if ( _jasperPrint . getPages ( ... | Returns a ReportWriter that which will use memory or a file depending on the parameter PAGES_THRESHOLD |
146,242 | public static HorizontalBandAlignment buildAligment ( byte aligment ) { if ( aligment == RIGHT . getAlignment ( ) ) return RIGHT ; else if ( aligment == LEFT . getAlignment ( ) ) return LEFT ; else if ( aligment == CENTER . getAlignment ( ) ) return CENTER ; return LEFT ; } | To be used with AutoText class constants ALIGMENT_LEFT ALIGMENT_CENTER and ALIGMENT_RIGHT |
146,243 | protected Map getParametersMap ( ActionInvocation _invocation ) { Map map = ( Map ) _invocation . getStack ( ) . findValue ( this . parameters ) ; if ( map == null ) map = new HashMap ( ) ; return map ; } | Returns the object pointed by the result - type parameter parameters |
146,244 | protected LayoutManager getLayOutManagerObj ( ActionInvocation _invocation ) { if ( layoutManager == null || "" . equals ( layoutManager ) ) { LOG . warn ( "No valid LayoutManager, using ClassicLayoutManager" ) ; return new ClassicLayoutManager ( ) ; } Object los = conditionalParse ( layoutManager , _invocation ) ; if ... | Returns the export format indicated in the result - type parameter layoutManager |
146,245 | protected AbstractColumn buildSimpleBarcodeColumn ( ) { BarCodeColumn column = new BarCodeColumn ( ) ; populateCommonAttributes ( column ) ; column . setColumnProperty ( columnProperty ) ; column . setExpressionToGroupBy ( customExpressionToGroupBy ) ; column . setScaleMode ( imageScaleMode ) ; column . setApplicationI... | When creating barcode columns |
146,246 | protected AbstractColumn buildSimpleImageColumn ( ) { ImageColumn column = new ImageColumn ( ) ; populateCommonAttributes ( column ) ; populateExpressionAttributes ( column ) ; column . setExpression ( customExpression ) ; column . setExpressionToGroupBy ( customExpressionToGroupBy ) ; column . setExpressionForCalculat... | When creating image columns |
146,247 | protected AbstractColumn buildExpressionColumn ( ) { ExpressionColumn column = new ExpressionColumn ( ) ; populateCommonAttributes ( column ) ; populateExpressionAttributes ( column ) ; column . setExpression ( customExpression ) ; column . setExpressionToGroupBy ( customExpressionToGroupBy ) ; column . setExpressionFo... | For creating expression columns |
146,248 | protected AbstractColumn buildSimpleColumn ( ) { SimpleColumn column = new SimpleColumn ( ) ; populateCommonAttributes ( column ) ; columnProperty . getFieldProperties ( ) . putAll ( fieldProperties ) ; column . setColumnProperty ( columnProperty ) ; column . setExpressionToGroupBy ( customExpressionToGroupBy ) ; colum... | For creating regular columns |
146,249 | public ColumnBuilder addFieldProperty ( String propertyName , String value ) { fieldProperties . put ( propertyName , value ) ; return this ; } | When the JRField needs properties use this method . |
146,250 | public static void copyProperties ( Object dest , Object orig ) { try { if ( orig != null && dest != null ) { BeanUtils . copyProperties ( dest , orig ) ; PropertyUtils putils = new PropertyUtils ( ) ; PropertyDescriptor origDescriptors [ ] = putils . getPropertyDescriptors ( orig ) ; for ( PropertyDescriptor origDescr... | This takes into account objects that breaks the JavaBean convention and have as getter for Boolean objects an isXXX method . |
146,251 | private void printSuggestion ( String arg , List < ConfigOption > co ) { List < ConfigOption > sortedList = new ArrayList < ConfigOption > ( co ) ; Collections . sort ( sortedList , new ConfigOptionLevenshteinDistance ( arg ) ) ; System . err . println ( "Parse error for argument \"" + arg + "\", did you mean " + sorte... | Prints a suggestion to stderr for the argument based on the levenshtein distance metric |
146,252 | public static ReportGenerator . Format getFormat ( String ... args ) { ConfigOptionParser configParser = new ConfigOptionParser ( ) ; List < ConfigOption > configOptions = Arrays . asList ( format , help ) ; for ( ConfigOption co : configOptions ) { if ( co . hasDefault ( ) ) { configParser . parsedOptions . put ( co .... | Terminates with a help message if the parse is not successful |
146,253 | static List < List < String > > handleNewLines ( List < List < String > > tableModel ) { List < List < String > > result = Lists . newArrayListWithExpectedSize ( tableModel . size ( ) ) ; for ( List < String > row : tableModel ) { if ( hasNewline ( row ) ) { result . addAll ( splitRow ( row ) ) ; } else { result . add ... | Handles newlines by removing them and add new rows instead |
146,254 | public static AbstractReportGenerator generateHtml5Report ( ) { AbstractReportGenerator report ; try { Class < ? > aClass = new ReportGenerator ( ) . getClass ( ) . getClassLoader ( ) . loadClass ( "com.tngtech.jgiven.report.html5.Html5ReportGenerator" ) ; report = ( AbstractReportGenerator ) aClass . newInstance ( ) ;... | Searches the Html5ReportGenerator in Java path and instantiates the report |
146,255 | private static void flushCurrentWord ( StringBuilder currentWords , List < Word > formattedWords , boolean cutWhitespace ) { if ( currentWords . length ( ) > 0 ) { if ( cutWhitespace && currentWords . charAt ( currentWords . length ( ) - 1 ) == ' ' ) { currentWords . setLength ( currentWords . length ( ) - 1 ) ; } form... | Appends the accumulated words to the resulting words . Trailing whitespace is removed because of the postprocessing that inserts custom whitespace |
146,256 | private static int nextIndex ( String description , int defaultIndex ) { Pattern startsWithNumber = Pattern . compile ( "(\\d+).*" ) ; Matcher matcher = startsWithNumber . matcher ( description ) ; if ( matcher . matches ( ) ) { return Integer . parseInt ( matcher . group ( 1 ) ) - 1 ; } return defaultIndex ; } | Returns the next index of the argument by decrementing 1 from the possibly parsed number |
146,257 | public static String capitalize ( String text ) { if ( text == null || text . isEmpty ( ) ) { return text ; } return text . substring ( 0 , 1 ) . toUpperCase ( ) . concat ( text . substring ( 1 , text . length ( ) ) ) ; } | Returns the given text with the first letter in upper case . |
146,258 | private void deleteUnusedCaseSteps ( ReportModel model ) { for ( ScenarioModel scenarioModel : model . getScenarios ( ) ) { if ( scenarioModel . isCasesAsTable ( ) && ! hasAttachment ( scenarioModel ) ) { List < ScenarioCaseModel > cases = scenarioModel . getScenarioCases ( ) ; for ( int i = 1 ; i < cases . size ( ) ; ... | Deletes all steps of scenario cases where a data table is generated to reduce the size of the data file . In this case only the steps of the first scenario case are actually needed . |
146,259 | boolean attachmentsAreStructurallyDifferent ( List < AttachmentModel > firstAttachments , List < AttachmentModel > otherAttachments ) { if ( firstAttachments . size ( ) != otherAttachments . size ( ) ) { return true ; } for ( int i = 0 ; i < firstAttachments . size ( ) ; i ++ ) { if ( attachmentIsStructurallyDifferent ... | Attachments are only structurally different if one step has an inline attachment and the other step either has no inline attachment or the inline attachment is different . |
146,260 | List < List < Word > > getDifferentArguments ( List < List < Word > > argumentWords ) { List < List < Word > > result = Lists . newArrayList ( ) ; for ( int i = 0 ; i < argumentWords . size ( ) ; i ++ ) { result . add ( Lists . < Word > newArrayList ( ) ) ; } int nWords = argumentWords . get ( 0 ) . size ( ) ; for ( in... | Returns a list with argument words that are not equal in all cases |
146,261 | public final TagConfiguration . Builder configureTag ( Class < ? extends Annotation > tagAnnotation ) { TagConfiguration configuration = new TagConfiguration ( tagAnnotation ) ; tagConfigurations . put ( tagAnnotation , configuration ) ; return new TagConfiguration . Builder ( configuration ) ; } | Configures the given annotation as a tag . |
146,262 | private StepFormatter . Formatting < ? , ? > getFormatting ( Annotation [ ] annotations , Set < Class < ? > > visitedTypes , Annotation originalAnnotation , String parameterName ) { List < StepFormatter . Formatting < ? , ? > > foundFormatting = Lists . newArrayList ( ) ; Table tableAnnotation = null ; for ( Annotation... | Recursively searches for formatting annotations . |
146,263 | public static < GIVEN , WHEN , THEN > Scenario < GIVEN , WHEN , THEN > create ( Class < GIVEN > givenClass , Class < WHEN > whenClass , Class < THEN > thenClass ) { return new Scenario < GIVEN , WHEN , THEN > ( givenClass , whenClass , thenClass ) ; } | Creates a scenario with 3 different steps classes . |
146,264 | public Scenario < GIVEN , WHEN , THEN > startScenario ( String description ) { super . startScenario ( description ) ; return this ; } | Describes the scenario . Must be called before any step invocation . |
146,265 | public void wireSteps ( CanWire canWire ) { for ( StageState steps : stages . values ( ) ) { canWire . wire ( steps . instance ) ; } } | Used for DI frameworks to inject values into stages . |
146,266 | public void finished ( ) throws Throwable { if ( state == FINISHED ) { return ; } State previousState = state ; state = FINISHED ; methodInterceptor . enableMethodInterception ( false ) ; try { if ( previousState == STARTED ) { callFinishLifeCycleMethods ( ) ; } } finally { listener . scenarioFinished ( ) ; } } | Has to be called when the scenario is finished in order to execute after methods . |
146,267 | public void startScenario ( Class < ? > testClass , Method method , List < NamedArgument > arguments ) { listener . scenarioStarted ( testClass , method , arguments ) ; if ( method . isAnnotationPresent ( Pending . class ) ) { Pending annotation = method . getAnnotation ( Pending . class ) ; if ( annotation . failIfPas... | Starts the scenario with the given method and arguments . Derives the description from the method name . |
146,268 | public ConfigOptionBuilder setCommandLineOptionWithArgument ( CommandLineOption commandLineOption , StringConverter converter ) { co . setCommandLineOption ( commandLineOption ) ; return setStringConverter ( converter ) ; } | if you want to parse an argument you need a converter from String to Object |
146,269 | public ConfigOptionBuilder setCommandLineOptionWithoutArgument ( CommandLineOption commandLineOption , Object value ) { co . setCommandLineOption ( commandLineOption ) ; co . setValue ( value ) ; return this ; } | if you don t have an argument choose the value that is going to be inserted into the map instead |
146,270 | public ConfigOptionBuilder setDefaultWith ( Object defaultValue ) { co . setHasDefault ( true ) ; co . setValue ( defaultValue ) ; return setOptional ( ) ; } | if you have a default it s automatically optional |
146,271 | public ConfigOptionBuilder setStringConverter ( StringConverter converter ) { co . setConverter ( converter ) ; co . setHasArgument ( true ) ; return this ; } | if you want to convert some string to an object you have an argument to parse |
146,272 | static List < NamedArgument > getNamedArgs ( ExtensionContext context ) { List < NamedArgument > namedArgs = new ArrayList < > ( ) ; if ( context . getTestMethod ( ) . get ( ) . getParameterCount ( ) > 0 ) { try { if ( context . getClass ( ) . getCanonicalName ( ) . equals ( METHOD_EXTENSION_CONTEXT ) ) { Field field =... | This is a very ugly workaround to get the method arguments from the JUnit 5 context via reflection . |
146,273 | public static Attachment fromBinaryBytes ( byte [ ] bytes , MediaType mediaType ) { if ( ! mediaType . isBinary ( ) ) { throw new IllegalArgumentException ( "MediaType must be binary" ) ; } return new Attachment ( BaseEncoding . base64 ( ) . encode ( bytes ) , mediaType , null ) ; } | Creates an attachment from a given array of bytes . The bytes will be Base64 encoded . |
146,274 | public static Attachment fromBinaryInputStream ( InputStream inputStream , MediaType mediaType ) throws IOException { return fromBinaryBytes ( ByteStreams . toByteArray ( inputStream ) , mediaType ) ; } | Creates an attachment from a binary input stream . The content of the stream will be transformed into a Base64 encoded string |
146,275 | public static MediaType binary ( MediaType . Type type , String subType ) { return new MediaType ( type , subType , true ) ; } | Creates a binary media type with the given type and subtype |
146,276 | public static MediaType nonBinary ( MediaType . Type type , String subType , Charset charSet ) { ApiUtil . notNull ( charSet , "charset must not be null" ) ; return new MediaType ( type , subType , charSet ) ; } | Creates a non - binary media type with the given type subtype and charSet |
146,277 | public static MediaType nonBinaryUtf8 ( MediaType . Type type , String subType ) { return new MediaType ( type , subType , UTF_8 ) ; } | Creates a non - binary media type with the given type subtype and UTF - 8 encoding |
146,278 | public static MediaType text ( String subType , Charset charset ) { return nonBinary ( TEXT , subType , charset ) ; } | Creates a non - binary text media type with the given subtype and a specified encoding |
146,279 | public void parseVersion ( String version ) { DefaultVersioning artifactVersion = new DefaultVersioning ( version ) ; getLog ( ) . debug ( "Parsed Version" ) ; getLog ( ) . debug ( " major: " + artifactVersion . getMajor ( ) ) ; getLog ( ) . debug ( " minor: " + artifactVersion . getMinor ( ) ) ; getLog... | Parse a version String and add the components to a properties object . |
146,280 | private int findAvailablePortNumber ( Integer portNumberStartingPoint , List < Integer > reservedPorts ) { assert portNumberStartingPoint != null ; int candidate = portNumberStartingPoint ; while ( reservedPorts . contains ( candidate ) ) { candidate ++ ; } return candidate ; } | Returns the first number available starting at portNumberStartingPoint that s not already in the reservedPorts list . |
146,281 | public void populateFromAttributes ( final Template template , final Map < String , Attribute > attributes , final PObject requestJsonAttributes ) { if ( requestJsonAttributes . has ( JSON_REQUEST_HEADERS ) && requestJsonAttributes . getObject ( JSON_REQUEST_HEADERS ) . has ( JSON_REQUEST_HEADERS ) && ! attributes . co... | Process the requestJsonAttributes using the attributes and the MapfishParser and add all resulting values to this values object . |
146,282 | public void addRequiredValues ( final Values sourceValues ) { Object taskDirectory = sourceValues . getObject ( TASK_DIRECTORY_KEY , Object . class ) ; MfClientHttpRequestFactoryProvider requestFactoryProvider = sourceValues . getObject ( CLIENT_HTTP_REQUEST_FACTORY_KEY , MfClientHttpRequestFactoryProvider . class ) ; ... | Add the elements that all values objects require from the provided values object . |
146,283 | public void put ( final String key , final Object value ) { if ( TASK_DIRECTORY_KEY . equals ( key ) && this . values . keySet ( ) . contains ( TASK_DIRECTORY_KEY ) ) { throw new IllegalArgumentException ( "Invalid key: " + key ) ; } if ( value == null ) { throw new IllegalArgumentException ( "A null value was attempte... | Put a new value in map . |
146,284 | public < V > V getObject ( final String key , final Class < V > type ) { final Object obj = this . values . get ( key ) ; return type . cast ( obj ) ; } | Get a value as a string . |
146,285 | public Boolean getBoolean ( final String key ) { return ( Boolean ) this . values . get ( key ) ; } | Get a boolean value from the values or null . |
146,286 | @ SuppressWarnings ( "unchecked" ) public < T > Map < String , T > find ( final Class < T > valueTypeToFind ) { return ( Map < String , T > ) this . values . entrySet ( ) . stream ( ) . filter ( input -> valueTypeToFind . isInstance ( input . getValue ( ) ) ) . collect ( Collectors . toMap ( Map . Entry :: getKey , Map... | Find all the values of the requested type . |
146,287 | public ConfigurableRequest createRequest ( final URI uri , final HttpMethod httpMethod ) throws IOException { HttpRequestBase httpRequest = ( HttpRequestBase ) createHttpUriRequest ( httpMethod , uri ) ; return new Request ( getHttpClient ( ) , httpRequest , createHttpContext ( httpMethod , uri ) ) ; } | allow extension only for testing |
146,288 | public final PJsonObject toJSON ( ) { try { JSONObject json = new JSONObject ( ) ; for ( String key : this . obj . keySet ( ) ) { Object opt = opt ( key ) ; if ( opt instanceof PYamlObject ) { opt = ( ( PYamlObject ) opt ) . toJSON ( ) . getInternalObj ( ) ; } else if ( opt instanceof PYamlArray ) { opt = ( ( PYamlArra... | Convert this object to a json object . |
146,289 | public static MatchInfo fromUri ( final URI uri , final HttpMethod method ) { int newPort = uri . getPort ( ) ; if ( newPort < 0 ) { try { newPort = uri . toURL ( ) . getDefaultPort ( ) ; } catch ( MalformedURLException | IllegalArgumentException e ) { newPort = ANY_PORT ; } } return new MatchInfo ( uri . getScheme ( )... | Create an info object from a uri and the http method object . |
146,290 | @ SuppressWarnings ( "StringEquality" ) public static MatchInfo fromAuthScope ( final AuthScope authscope ) { String newScheme = StringUtils . equals ( authscope . getScheme ( ) , AuthScope . ANY_SCHEME ) ? ANY_SCHEME : authscope . getScheme ( ) ; String newHost = StringUtils . equals ( authscope . getHost ( ) , AuthSc... | Create an info object from an authscope object . |
146,291 | public Style createStyle ( final List < Rule > styleRules ) { final Rule [ ] rulesArray = styleRules . toArray ( new Rule [ 0 ] ) ; final FeatureTypeStyle featureTypeStyle = this . styleBuilder . createFeatureTypeStyle ( null , rulesArray ) ; final Style style = this . styleBuilder . createStyle ( ) ; style . featureTy... | Create a style from a list of rules . |
146,292 | protected LineSymbolizer createLineSymbolizer ( final PJsonObject styleJson ) { final Stroke stroke = createStroke ( styleJson , true ) ; if ( stroke == null ) { return null ; } else { return this . styleBuilder . createLineSymbolizer ( stroke ) ; } } | Add a line symbolizer definition to the rule . |
146,293 | protected PolygonSymbolizer createPolygonSymbolizer ( final PJsonObject styleJson ) { if ( this . allowNullSymbolizer && ! styleJson . has ( JSON_FILL_COLOR ) ) { return null ; } final PolygonSymbolizer symbolizer = this . styleBuilder . createPolygonSymbolizer ( ) ; symbolizer . setFill ( createFill ( styleJson ) ) ; ... | Add a polygon symbolizer definition to the rule . |
146,294 | protected TextSymbolizer createTextSymbolizer ( final PJsonObject styleJson ) { final TextSymbolizer textSymbolizer = this . styleBuilder . createTextSymbolizer ( ) ; textSymbolizer . getOptions ( ) . put ( "partials" , "true" ) ; if ( styleJson . has ( JSON_LABEL ) ) { final Expression label = parseExpression ( null ,... | Add a text symbolizer definition to the rule . |
146,295 | public static void configureProtocolHandler ( ) { final String pkgs = System . getProperty ( "java.protocol.handler.pkgs" ) ; String newValue = "org.mapfish.print.url" ; if ( pkgs != null && ! pkgs . contains ( newValue ) ) { newValue = newValue + "|" + pkgs ; } else if ( pkgs != null ) { newValue = pkgs ; } System . s... | Adds the parent package to the java . protocol . handler . pkgs system property . |
146,296 | protected final StyleSupplier < FeatureSource > createStyleFunction ( final Template template , final String styleString ) { return new StyleSupplier < FeatureSource > ( ) { public Style load ( final MfClientHttpRequestFactory requestFactory , final FeatureSource featureSource ) { if ( featureSource == null ) { throw n... | Create a function that will create the style on demand . This is called later in a separate thread so any blocking calls will not block the parsing of the layer attributes . |
146,297 | public static URI makeWmsGetLayerRequest ( final WmsLayerParam wmsLayerParam , final URI commonURI , final Dimension imageSize , final double dpi , final double angle , final ReferencedEnvelope bounds ) throws FactoryException , URISyntaxException , IOException { if ( commonURI == null || commonURI . getAuthority ( ) =... | Make a WMS getLayer request and return the image read from the server . |
146,298 | private static boolean isDpiSet ( final Multimap < String , String > extraParams ) { String searchKey = "FORMAT_OPTIONS" ; for ( String key : extraParams . keys ( ) ) { if ( key . equalsIgnoreCase ( searchKey ) ) { for ( String value : extraParams . get ( key ) ) { if ( value . toLowerCase ( ) . contains ( "dpi:" ) ) {... | Checks if the DPI value is already set for GeoServer . |
146,299 | private static void setDpiValue ( final Multimap < String , String > extraParams , final int dpi ) { String searchKey = "FORMAT_OPTIONS" ; for ( String key : extraParams . keys ( ) ) { if ( key . equalsIgnoreCase ( searchKey ) ) { Collection < String > values = extraParams . removeAll ( key ) ; List < String > newValue... | Set the DPI value for GeoServer if there are already FORMAT_OPTIONS . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.