idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
1,900 | public boolean addDataStyle ( final DataStyle dataStyle ) { if ( dataStyle . isHidden ( ) ) { return this . dataStylesContainer . add ( dataStyle . getName ( ) , Dest . CONTENT_AUTOMATIC_STYLES , dataStyle ) ; } else { return this . dataStylesContainer . add ( dataStyle . getName ( ) , Dest . STYLES_COMMON_STYLES , dat... | Create a new data style into styles container . No duplicate style name is allowed . Must be used if the table - cell style already exists . |
1,901 | public boolean addMasterPageStyle ( final MasterPageStyle masterPageStyle ) { if ( this . masterPageStylesContainer . add ( masterPageStyle . getName ( ) , masterPageStyle ) ) { masterPageStyle . addEmbeddedStyles ( this ) ; return true ; } else return false ; } | Create a new master page style into styles container . No duplicate style name is allowed . |
1,902 | public boolean addNewDataStyleFromCellStyle ( final TableCellStyle style ) { final boolean ret = this . addContentStyle ( style ) ; return this . addDataStyle ( style . getDataStyle ( ) ) && ret ; } | Add the data style taken from a cell style |
1,903 | public boolean addPageStyle ( final PageStyle ps ) { boolean ret = this . addMasterPageStyle ( ps . getMasterPageStyle ( ) ) ; ret = this . addPageLayoutStyle ( ps . getPageLayoutStyle ( ) ) && ret ; return ret ; } | Add a page style |
1,904 | public void writeContentAutomaticStyles ( final XMLUtil util , final Appendable appendable ) throws IOException { final Iterable < ObjectStyle > styles = this . objectStylesContainer . getValues ( Dest . CONTENT_AUTOMATIC_STYLES ) ; for ( final ObjectStyle style : styles ) assert style . isHidden ( ) : style . toString... | Write the various styles in the automatic styles . |
1,905 | public RegionPageSectionBuilder region ( final PageSectionContent . Region region ) { switch ( region ) { case LEFT : this . curRegionBox = this . leftRegionBox ; break ; case CENTER : this . curRegionBox = this . centerRegionBox ; break ; case RIGHT : this . curRegionBox = this . rightRegionBox ; break ; default : thr... | Switch to a new region |
1,906 | public boolean add ( final K key , final S subcontainer , final V value ) { final S curSubcontainer = this . subcontainerByKey . get ( key ) ; if ( curSubcontainer == null ) { if ( this . mode == Mode . UPDATE ) return false ; } else { if ( this . mode == Mode . CREATE ) return false ; if ( subcontainer != curSubcontai... | Add a value to this multi container |
1,907 | public void setTooltip ( final String tooltip ) { String escapedXMLContent = this . xmlUtil . escapeXMLContent ( tooltip ) ; if ( escapedXMLContent . contains ( "\n" ) ) { escapedXMLContent = escapedXMLContent . replaceAll ( "\r?\n" , "</text:p><text:p>" ) ; } this . tooltip = escapedXMLContent ; } | Set a tooltip |
1,908 | public void setTooltip ( final String tooltip , final Length width , final Length height , final boolean visible ) { this . setTooltip ( tooltip ) ; this . tooltipParameter = TooltipParameter . create ( width , height , visible ) ; } | Set a tooltip of a given size |
1,909 | public ParagraphBuilder span ( final String text ) { final ParagraphElement paragraphElement = new Span ( text ) ; this . paragraphElements . add ( paragraphElement ) ; return this ; } | Create a span in the current paragraph . |
1,910 | public ParagraphBuilder styledSpan ( final String text , final TextStyle ts ) { final ParagraphElement paragraphElement = new Span ( text , ts ) ; this . paragraphElements . add ( paragraphElement ) ; return this ; } | Create a styled span with a text content |
1,911 | public static TableBuilder create ( final PositionUtil positionUtil , final WriteUtil writeUtil , final XMLUtil xmlUtil , final StylesContainer stylesContainer , final DataStyles format , final boolean libreOfficeMode , final String name , final int rowCapacity , final int columnCapacity ) { final ConfigItemMapEntrySet... | Create a new table builder |
1,912 | public void flushEndTable ( final TableAppender appender ) throws IOException { this . observer . update ( new EndTableFlusher ( appender , this . tableRows . subList ( this . lastFlushedRowIndex , this . tableRows . usedSize ( ) ) ) ) ; } | Flush the end of the table |
1,913 | public TableRow nextRow ( final Table table , final TableAppender appender ) throws IOException { return this . getRowSecure ( table , appender , this . curRowIndex + 1 , true ) ; } | Get the next row |
1,914 | public void setStyle ( final TableStyle style ) { this . stylesContainer . addPageStyle ( style . getPageStyle ( ) ) ; this . stylesContainer . addContentStyle ( style ) ; this . style = style ; } | Set a new TableFamilyStyle |
1,915 | public static void appendXMLToTable ( final TableRow row , final XMLUtil xmlUtil , final Appendable appendable ) throws IOException { if ( row == null ) appendable . append ( "<row />" ) ; else row . appendXMLToTable ( xmlUtil , appendable ) ; } | Append the XML corresponding to a given row to the appendable |
1,916 | public void setColumnsSpanned ( final int colIndex , final int n ) { if ( n <= 1 ) return ; final TableCell firstCell = this . getOrCreateCell ( colIndex ) ; if ( firstCell . isCovered ( ) ) return ; firstCell . markColumnsSpanned ( n ) ; this . coverRightCells ( colIndex , n ) ; } | Add a span across columns |
1,917 | public void setRowsSpanned ( final int rowIndex , final int n ) throws IOException { if ( n <= 1 ) return ; final TableCell firstCell = this . getOrCreateCell ( rowIndex ) ; if ( firstCell . isCovered ( ) ) return ; this . parent . setRowsSpanned ( this . rowIndex , rowIndex , n ) ; } | Add a span across rows |
1,918 | public TableCell getOrCreateCell ( final int colIndex ) { TableCell cell = this . cells . get ( colIndex ) ; if ( cell == null ) { cell = new TableCellImpl ( this . writeUtil , this . xmlUtil , this . stylesContainer , this . dataStyles , this . libreOfficeMode , this , colIndex ) ; this . cells . set ( colIndex , cell... | Get the cell at given index . If the cell was not created before then it is created by this method . |
1,919 | public void setStyle ( final TableRowStyle rowStyle ) { this . stylesContainer . addContentFontFaceContainerStyle ( rowStyle ) ; this . stylesContainer . addContentStyle ( rowStyle ) ; this . rowStyle = rowStyle ; } | Set the row style |
1,920 | public TableRow getRow ( final String pos ) throws FastOdsException , IOException { return this . builder . getRow ( this , this . appender , pos ) ; } | Return a row from a position |
1,921 | public void setCellMerge ( final int rowIndex , final int colIndex , final int rowMerge , final int columnMerge ) throws IOException { this . builder . setCellMerge ( this , this . appender , rowIndex , colIndex , rowMerge , columnMerge ) ; } | Set a span over cells |
1,922 | public void addEmbeddedStyles ( final StylesContainer stylesContainer ) { if ( this . header != null ) this . header . addEmbeddedStyles ( stylesContainer ) ; if ( this . footer != null ) this . footer . addEmbeddedStyles ( stylesContainer ) ; } | Add the style embedded in this master page style to a container |
1,923 | public void appendXMLToMasterStyle ( final XMLUtil util , final Appendable appendable ) throws IOException { appendable . append ( "<style:master-page" ) ; util . appendEAttribute ( appendable , "style:name" , this . name ) ; util . appendEAttribute ( appendable , "style:page-layout-name" , this . layoutName ) ; append... | Return the master - style informations for this PageStyle . |
1,924 | public ZipUTF8Writer build ( final OutputStream out ) { final OutputStream bufferedOut ; switch ( this . zipBufferSize ) { case NO_BUFFER : bufferedOut = out ; break ; case DEFAULT_BUFFER : bufferedOut = new BufferedOutputStream ( out ) ; break ; default : bufferedOut = new BufferedOutputStream ( out , this . zipBuffer... | Build the new writer with a given output stream |
1,925 | public int hashObjects ( final Object ... objects ) { final int prime = 31 ; int result = 1 ; for ( final Object object : objects ) { result = prime * result + ( ( object == null ) ? 0 : object . hashCode ( ) ) ; } return result ; } | Hash a bunch of objects |
1,926 | public int hashInts ( final int ... integers ) { final int prime = 31 ; int result = 1 ; for ( final int integer : integers ) result = prime * result + integer ; return result ; } | Hash a bunch of integers |
1,927 | static AnonymousOdsDocument create ( final Logger logger , final XMLUtil xmlUtil , final OdsElements odsElements ) { return new AnonymousOdsDocument ( logger , xmlUtil , odsElements , new CommonOdsDocument ( odsElements ) ) ; } | Create a new anonymous ODS document . |
1,928 | public void appendLVAttributes ( final XMLUtil util , final Appendable appendable ) throws IOException { this . appendLocaleAttributes ( util , appendable ) ; this . appendVolatileAttribute ( util , appendable ) ; } | Append locale and volatile attributes |
1,929 | static Settings create ( final ConfigItemSet viewSettings , final ConfigItemMapEntrySet firstView , final ConfigItemSet configurationSettings ) { final List < ConfigBlock > rootBlocks = new ArrayList < ConfigBlock > ( ) ; final ConfigItemMapIndexed views = new ConfigItemMapIndexed ( "Views" ) ; final Map < String , Con... | Create a new settings representation |
1,930 | void appendXMLHelper ( final XMLUtil util , final Appendable appendable , final String numberStyleName , final CharSequence number ) throws IOException { this . numberStyle . appendXMLHelper ( util , appendable , numberStyleName , number ) ; } | A helper to create the XML representation of the float style |
1,931 | void appendXMLHelper ( final XMLUtil util , final Appendable appendable , final String numberStyleName , final CharSequence number ) throws IOException { this . appendOpenTag ( util , appendable , numberStyleName , this . dataStyle . getName ( ) ) ; appendable . append ( number ) ; this . appendCloseTag ( appendable , ... | A helper to append XML content |
1,932 | public void appendNumberAttribute ( final XMLUtil util , final Appendable appendable ) throws IOException { this . appendMinIntegerDigitsAttribute ( util , appendable ) ; this . appendGroupingAttribute ( util , appendable ) ; } | Append the attributes of the number |
1,933 | private void appendStyleColor ( final XMLUtil util , final Appendable appendable ) throws IOException { appendable . append ( "<style:text-properties" ) ; util . appendAttribute ( appendable , "fo:color" , this . negativeValueColor . hexValue ( ) ) ; appendable . append ( "/>" ) ; } | Appends the style color . |
1,934 | public String set ( final int i , final String value ) { final ConfigBlock block = this . blocks . get ( i ) ; if ( block instanceof ConfigItem ) { final ConfigItem item = ( ConfigItem ) block ; final String previousValue = item . getValue ( ) ; item . setValue ( value ) ; return previousValue ; } return null ; } | Set a value for an item at a given index |
1,935 | public void addChildCellStyle ( final TableCellStyle style , final TableCell . Type type ) { this . contentElement . addChildCellStyle ( style , type ) ; } | Create an automatic style for this TableCellStyle and this type of cell . Do not produce any effect if the type is Type . STRING or Type . VOID |
1,936 | public Table addTableToContent ( final String name , final int rowCapacity , final int columnCapacity ) throws IOException { final Table previousTable = this . contentElement . getLastTable ( ) ; final Table table = this . contentElement . addTable ( name , rowCapacity , columnCapacity ) ; this . settingsElement . addT... | Add a new table to content . The config for this table is added to the settings . If the OdsElements is observed the previous table is flushed . If there is no previous table meta . xml styles . xml and the preamble of content . xml are written to destination . |
1,937 | public void createEmptyElements ( final ZipUTF8Writer writer ) throws IOException { this . logger . log ( Level . FINER , "Writing empty ods elements to zip file" ) ; for ( final String elementName : EMPTY_ELEMENT_NAMES ) { this . logger . log ( Level . FINEST , "Writing odselement: {0} to zip file" , elementName ) ; w... | Create empty elements for package . Used on save or by the ImmutableElementsFlusher . |
1,938 | public void finalizeContent ( final XMLUtil xmlUtil , final ZipUTF8Writer writer ) throws IOException { this . contentElement . flushTables ( xmlUtil , writer ) ; this . contentElement . writePostamble ( xmlUtil , writer ) ; } | Flush tables and write end of document |
1,939 | public void flushRows ( final XMLUtil util , final ZipUTF8Writer writer ) throws IOException { this . contentElement . flushRows ( util , writer , this . settingsElement ) ; } | Flush the rows |
1,940 | public void flushTables ( final XMLUtil util , final ZipUTF8Writer writer ) throws IOException { this . contentElement . flushTables ( util , writer ) ; } | Flush the tables |
1,941 | public void save ( ) throws IOException { final Table previousTable = this . contentElement . getLastTable ( ) ; if ( previousTable != null ) previousTable . flush ( ) ; this . observer . update ( new FinalizeFlusher ( this . contentElement , this . settingsElement ) ) ; } | Save the elements |
1,942 | public void writeContent ( final XMLUtil xmlUtil , final ZipUTF8Writer writer ) throws IOException { this . logger . log ( Level . FINER , "Writing odselement: contentElement to zip file" ) ; this . contentElement . write ( xmlUtil , writer ) ; } | Write the content element to a writer . |
1,943 | public void writeImmutableElements ( final XMLUtil xmlUtil , final ZipUTF8Writer writer ) throws IOException { this . logger . log ( Level . FINER , "Writing odselement: mimeTypeEntry to zip file" ) ; this . mimetypeElement . write ( xmlUtil , writer ) ; this . logger . log ( Level . FINER , "Writing odselement: manife... | Write the mimetype and manifest elements to a writer . |
1,944 | public void writeMeta ( final XMLUtil xmlUtil , final ZipUTF8Writer writer ) throws IOException { this . logger . log ( Level . FINER , "Writing odselement: metaElement to zip file" ) ; this . metaElement . write ( xmlUtil , writer ) ; } | Write the meta element to a writer . |
1,945 | public void writeSettings ( final XMLUtil xmlUtil , final ZipUTF8Writer writer ) throws IOException { this . settingsElement . setTables ( this . getTables ( ) ) ; this . logger . log ( Level . FINER , "Writing odselement: settingsElement to zip file" ) ; this . settingsElement . write ( xmlUtil , writer ) ; } | Write the settings element to a writer . |
1,946 | public void writeStyles ( final XMLUtil xmlUtil , final ZipUTF8Writer writer ) throws IOException { this . logger . log ( Level . FINER , "Writing odselement: stylesElement to zip file" ) ; this . stylesElement . write ( xmlUtil , writer ) ; } | Write the styles element to a writer . |
1,947 | public void appendPreamble ( final XMLUtil util , final Appendable appendable ) throws IOException { if ( this . preambleWritten ) return ; appendable . append ( "<table:table" ) ; util . appendEAttribute ( appendable , "table:name" , this . builder . getName ( ) ) ; util . appendEAttribute ( appendable , "table:style-... | Append the preamble |
1,948 | public XceliteSheet getSheet ( int sheetIndex ) { Sheet sheet = workbook . getSheetAt ( sheetIndex ) ; if ( sheet == null ) { throw new XceliteException ( String . format ( "Could not find sheet at index %s" , sheetIndex ) ) ; } return new XceliteSheetImpl ( sheet , file ) ; } | Gets the sheet at the specified index . |
1,949 | public XceliteSheet getSheet ( String sheetName ) { Sheet sheet = workbook . getSheet ( sheetName ) ; if ( sheet == null ) { throw new XceliteException ( String . format ( "Could not find sheet named \"%s\"" , sheetName ) ) ; } return new XceliteSheetImpl ( sheet , file ) ; } | Gets the sheet with the specified index . |
1,950 | public void write ( File file ) { FileOutputStream out = null ; try { out = new FileOutputStream ( file , false ) ; workbook . write ( out ) ; } catch ( FileNotFoundException e ) { throw new RuntimeException ( e ) ; } catch ( IOException e ) { new RuntimeException ( e ) ; } finally { if ( out != null ) try { out . clos... | Saves data to a new file . |
1,951 | public byte [ ] getBytes ( ) { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; try { workbook . write ( baos ) ; } catch ( IOException e ) { new RuntimeException ( e ) ; } finally { if ( baos != null ) try { baos . close ( ) ; } catch ( IOException e ) { new RuntimeException ( e ) ; } } return baos . toByt... | Gets the excel file as byte array . |
1,952 | static public void set ( int level ) { Log . level = level ; ERROR = level <= LEVEL_ERROR ; WARN = level <= LEVEL_WARN ; INFO = level <= LEVEL_INFO ; DEBUG = level <= LEVEL_DEBUG ; TRACE = level <= LEVEL_TRACE ; } | Sets the level to log . If a version of this class is being used that has a final log level this has no affect . |
1,953 | public static String queryString ( Map < String , Object > values ) { StringBuilder sbuf = new StringBuilder ( ) ; String separator = "" ; for ( Map . Entry < String , Object > entry : values . entrySet ( ) ) { Object entryValue = entry . getValue ( ) ; if ( entryValue instanceof Object [ ] ) { for ( Object value : ( O... | Convert a Map to a query string . |
1,954 | public static JSONObject toJsonObject ( byte [ ] bytes ) { String json ; try { json = new String ( bytes , Const . UTF8 ) ; return new JSONObject ( json ) ; } catch ( UnsupportedEncodingException e ) { throw new WebbException ( e ) ; } catch ( JSONException e ) { throw new WebbException ( "payload is not a valid JSON o... | Convert a byte array to a JSONObject . |
1,955 | public static JSONArray toJsonArray ( byte [ ] bytes ) { String json ; try { json = new String ( bytes , Const . UTF8 ) ; return new JSONArray ( json ) ; } catch ( UnsupportedEncodingException e ) { throw new WebbException ( e ) ; } catch ( JSONException e ) { throw new WebbException ( "payload is not a valid JSON arra... | Convert a byte array to a JSONArray . |
1,956 | private void sendStream ( InputStream in ) { new Thread ( ( ) -> { try { con . sendData ( in ) ; con . sendResponse ( 226 , "File sent!" ) ; } catch ( ResponseException ex ) { con . sendResponse ( ex . getCode ( ) , ex . getMessage ( ) ) ; } catch ( Exception ex ) { con . sendResponse ( 451 , ex . getMessage ( ) ) ; } ... | Sends a stream asynchronously sending a response after it s done |
1,957 | private void receiveStream ( OutputStream out ) { new Thread ( ( ) -> { try { con . receiveData ( out ) ; con . sendResponse ( 226 , "File received!" ) ; } catch ( ResponseException ex ) { con . sendResponse ( ex . getCode ( ) , ex . getMessage ( ) ) ; } catch ( Exception ex ) { con . sendResponse ( 451 , ex . getMessa... | Receives a stream asynchronously sending a response after it s done |
1,958 | public void listen ( InetAddress address , int port ) throws IOException { if ( auth == null ) throw new NullPointerException ( "The Authenticator is null" ) ; if ( socket != null ) throw new IOException ( "Server already started" ) ; socket = Utils . createServer ( port , 50 , address , ssl , ! explicitSecurity ) ; se... | Starts the FTP server asynchronously . |
1,959 | public void listenSync ( InetAddress address , int port ) throws IOException { if ( auth == null ) throw new NullPointerException ( "The Authenticator is null" ) ; if ( socket != null ) throw new IOException ( "Server already started" ) ; socket = Utils . createServer ( port , 50 , address , ssl , ! explicitSecurity ) ... | Starts the FTP server synchronously blocking the current thread . |
1,960 | protected void addConnection ( Socket socket ) throws IOException { FTPConnection con = createConnection ( socket ) ; synchronized ( listeners ) { for ( IFTPListener l : listeners ) { l . onConnected ( con ) ; } } synchronized ( connections ) { connections . add ( con ) ; } } | Called when a connection is created . |
1,961 | protected void removeConnection ( FTPConnection con ) throws IOException { synchronized ( listeners ) { for ( IFTPListener l : listeners ) { l . onDisconnected ( con ) ; } } synchronized ( connections ) { connections . remove ( con ) ; } } | Called when a connection is terminated |
1,962 | protected void dispose ( ) { if ( serverThread != null ) { serverThread . interrupt ( ) ; serverThread = null ; } synchronized ( connections ) { for ( FTPConnection con : connections ) { try { con . stop ( true ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; } } connections . clear ( ) ; } } | Starts disposing server resources . |
1,963 | public void close ( ) throws IOException { dispose ( ) ; if ( socket != null ) { socket . close ( ) ; socket = null ; } } | Stops the server and dispose its resources . |
1,964 | public void sendResponse ( int code , String response ) { if ( con . isClosed ( ) ) return ; if ( response == null || response . isEmpty ( ) ) { response = "Unknown" ; } try { if ( response . charAt ( 0 ) == '-' ) { writer . write ( code + response + "\r\n" ) ; } else { writer . write ( code + " " + response + "\r\n" )... | Sends a response to the connection |
1,965 | public void sendData ( byte [ ] data ) throws ResponseException { if ( con . isClosed ( ) ) return ; Socket socket = null ; try { socket = conHandler . createDataSocket ( ) ; dataConnections . add ( socket ) ; OutputStream out = socket . getOutputStream ( ) ; Utils . write ( out , data , data . length , conHandler . is... | Sends an array of bytes through a data connection |
1,966 | public void sendData ( InputStream in ) throws ResponseException { if ( con . isClosed ( ) ) return ; Socket socket = null ; try { socket = conHandler . createDataSocket ( ) ; dataConnections . add ( socket ) ; OutputStream out = socket . getOutputStream ( ) ; byte [ ] buffer = new byte [ bufferSize ] ; int len ; while... | Sends a stream through a data connection |
1,967 | public void abortDataTransfers ( ) { while ( ! dataConnections . isEmpty ( ) ) { Socket socket = dataConnections . poll ( ) ; if ( socket != null ) Utils . closeQuietly ( socket ) ; } } | Aborts all data transfers |
1,968 | public void registerOption ( String option , String value ) { options . put ( option . toUpperCase ( ) , value ) ; } | Registers an option for the OPTS command |
1,969 | protected void addSiteCommand ( String label , String help , Command cmd ) { siteCommands . put ( label . toUpperCase ( ) , new CommandInfo ( cmd , help , true ) ) ; } | Internally registers a SITE sub - command |
1,970 | protected void addCommand ( String label , String help , Command cmd , boolean needsAuth ) { commands . put ( label . toUpperCase ( ) , new CommandInfo ( cmd , help , needsAuth ) ) ; } | Internally registers a command |
1,971 | public String getSiteHelpMessage ( String label ) { CommandInfo info = siteCommands . get ( label ) ; return info != null ? info . help : null ; } | Gets the help message from a SITE command |
1,972 | public String getHelpMessage ( String label ) { CommandInfo info = commands . get ( label ) ; return info != null ? info . help : null ; } | Gets the help message from a command |
1,973 | protected void update ( ) { if ( conHandler . shouldStop ( ) ) { Utils . closeQuietly ( this ) ; return ; } String line ; try { line = reader . readLine ( ) ; } catch ( SocketTimeoutException ex ) { if ( ! dataConnections . isEmpty ( ) && ( System . currentTimeMillis ( ) - lastUpdate ) >= timeout ) { Utils . closeQuiet... | Updates the connection |
1,974 | protected void stop ( boolean close ) throws IOException { if ( ! thread . isInterrupted ( ) ) { thread . interrupt ( ) ; } conHandler . onDisconnected ( ) ; if ( close ) con . close ( ) ; } | Stops the connection but does not removes it from the list . |
1,975 | public Properties generate ( Properties instructions , ProjectDependencies dependencies ) { Properties result = new Properties ( ) ; result . putAll ( instructions ) ; StringBuilder include = new StringBuilder ( ) ; if ( instructions . getProperty ( Constants . INCLUDE_RESOURCE ) != null ) { include . append ( instruct... | Generates the new set of instruction containing the original set of instructions enhanced with the embed dependencies results . |
1,976 | public static boolean isInDirectory ( File file , File directory ) { try { return FilenameUtils . directoryContains ( directory . getCanonicalPath ( ) , file . getCanonicalPath ( ) ) ; } catch ( IOException e ) { return false ; } } | Checks whether the given file is inside the given directory . |
1,977 | public static boolean hasExtension ( File file , String ... extensions ) { String extension = FilenameUtils . getExtension ( file . getName ( ) ) ; for ( String s : extensions ) { if ( extension . equalsIgnoreCase ( s ) || ( "." + extension ) . equalsIgnoreCase ( s ) ) { return true ; } } return false ; } | Checks whether the given file has one of the given extension . |
1,978 | public List < org . wisdom . api . router . Route > routes ( ) { if ( configuration . getBooleanWithDefault ( "documentation.standalone" , true ) ) { return ImmutableList . of ( new RouteBuilder ( ) . route ( HttpMethod . GET ) . on ( "/" ) . to ( this , "doc" ) ) ; } else { return Collections . emptyList ( ) ; } } | Default implementation of the routes method . |
1,979 | public static List < String > extractResponseCodes ( JavadocComment jdoc ) { List < String > list = new ArrayList < > ( ) ; list . addAll ( extractDocAnnotation ( DOC_RESPONSE_CODE , jdoc ) ) ; return list ; } | Return the response codes as String from a JavaDoc comment block . |
1,980 | public static List < String > extractResponseDescription ( JavadocComment jdoc ) { List < String > list = new ArrayList < > ( ) ; list . addAll ( extractDocAnnotation ( DOC_RESPONSE_DESCRIPTION , jdoc ) ) ; return list ; } | Return the response descriptions as String from a JavaDoc comment block . |
1,981 | public static List < String > extractResponseBodies ( JavadocComment jdoc ) { List < String > list = new ArrayList < > ( ) ; list . addAll ( extractDocAnnotation ( DOC_RESPONSE_BODY , jdoc ) ) ; return list ; } | Return the response bodies as String from a JavaDoc comment block . |
1,982 | public static String extractDescription ( JavadocComment jdoc ) { String content = jdoc . getContent ( ) . replaceAll ( "\n[ \t]+\\* ?" , "\n" ) ; int end = content . indexOf ( "\n@" ) ; if ( end > 0 ) { return content . substring ( 1 , end ) . trim ( ) ; } return content . substring ( 1 ) . trim ( ) ; } | Get a text description from JavaDoc block comment . |
1,983 | public final Version version ( ) { return new Version ( bundle . getVersion ( ) . getMajor ( ) , bundle . getVersion ( ) . getMinor ( ) , bundle . getVersion ( ) . getMicro ( ) , null , null , null ) ; } | Retrieves the version from the bundle version . |
1,984 | public static DefaultCookie convertWisdomCookieToNettyCookie ( Cookie cookie ) { DefaultCookie nettyCookie = new DefaultCookie ( cookie . name ( ) , cookie . value ( ) ) ; nettyCookie . setMaxAge ( cookie . maxAge ( ) ) ; if ( cookie . domain ( ) != null ) { nettyCookie . setDomain ( cookie . domain ( ) ) ; } if ( cook... | Converts the Wisdom s cookie to a Netty s cookie . |
1,985 | public static Cookie convertNettyCookieToWisdomCookie ( DefaultCookie cookie ) { Preconditions . checkNotNull ( cookie ) ; String value = cookie . value ( ) ; Cookie . Builder builder = Cookie . builder ( cookie . name ( ) , value ) ; builder . setMaxAge ( cookie . maxAge ( ) ) ; if ( cookie . domain ( ) != null ) { bu... | Converts the Netty s cookie to a Wisdom s cookie . |
1,986 | public static String getCookieValue ( String name , Cookies cookies ) { Cookie c = cookies . get ( name ) ; if ( c != null ) { return c . value ( ) ; } return null ; } | Gets the value of the cookie having the given name . The cookie is looked from the given cookies set . |
1,987 | public static void ensureOrGenerateSecret ( MavenProject project , Log log ) throws IOException { File conf = new File ( project . getBasedir ( ) , "src/main/configuration/application.conf" ) ; if ( conf . isFile ( ) ) { List < String > lines = FileUtils . readLines ( conf ) ; boolean changed = false ; for ( int i = 0 ... | Checks whether the application configuration file as the application secret . If not generates one . |
1,988 | public static String getBuildPluginVersion ( AbstractWisdomMojo mojo , String plugin ) { List < Plugin > plugins = mojo . project . getBuildPlugins ( ) ; for ( Plugin plug : plugins ) { if ( plug . getArtifactId ( ) . equals ( plugin ) ) { return plug . getVersion ( ) ; } } return null ; } | Retrieves the plugin version from Maven Project . |
1,989 | public static Xpp3Dom getBuildPluginConfiguration ( AbstractWisdomMojo mojo , String artifactId , String goal ) { List < Plugin > plugins = mojo . project . getBuildPlugins ( ) ; Plugin plugin = null ; for ( Plugin plug : plugins ) { if ( plug . getArtifactId ( ) . equals ( artifactId ) ) { plugin = plug ; } } if ( plu... | Retrieves the main configuration of the given plugin from the Maven Project . |
1,990 | private void clearPipelineError ( ) { File dir = new File ( buildDirectory , "pipeline" ) ; if ( dir . isDirectory ( ) ) { try { FileUtils . cleanDirectory ( dir ) ; } catch ( IOException e ) { getLog ( ) . warn ( "Cannot clean the pipeline directory" , e ) ; } } } | Deletes all error report from the pipeline error directory . |
1,991 | public static void store ( MavenProject project ) throws IOException { final File output = new File ( project . getBasedir ( ) , Constants . DEPENDENCIES_FILE ) ; output . getParentFile ( ) . mkdirs ( ) ; ProjectDependencies dependencies = new ProjectDependencies ( project ) ; mapper . writer ( ) . withDefaultPrettyPri... | Stores the dependencies from the given project into the dependencies . json file . |
1,992 | public static ProjectDependencies load ( File basedir ) throws IOException { return mapper . reader ( ProjectDependencies . class ) . readValue ( new File ( basedir , Constants . DEPENDENCIES_FILE ) ) ; } | Reloads the dependencies stored in the dependencies . json file . |
1,993 | public Thread newThread ( final Runnable runnable ) { Runnable wrapped = new Runnable ( ) { public void run ( ) { try { runnable . run ( ) ; } catch ( Exception e ) { log . error ( "Error while executing " + Thread . currentThread ( ) . getName ( ) , e ) ; } } } ; Thread thread = factory . newThread ( wrapped ) ; threa... | Creates a new threads . |
1,994 | public void execute ( ) throws MojoExecutionException { if ( ! watch ) { removeFromWatching ( ) ; } if ( extensions == null || extensions . isEmpty ( ) ) { extensions = ImmutableList . of ( "ad" , "asciidoc" , "adoc" ) ; } if ( instance == null ) { instance = getAsciidoctorInstance ( ) ; } final OptionsBuilder optionsB... | Compiles Asciidoc files from the internal and external assets to HTML . |
1,995 | @ Route ( method = HttpMethod . GET , uri = "i18n/bundles/{file<.+>}.json" ) public Result getBundleResourceForI18Next ( @ QueryParameter ( "locales" ) String listOfLocales , @ HttpParameter ( HeaderNames . IF_NONE_MATCH ) String ifNoneMatch ) { List < Locale > locales = new ArrayList < > ( ) ; if ( ! Strings . isNullO... | Gets the internationalized messages as a JSON document compliant with the I18Next format . |
1,996 | @ Route ( method = HttpMethod . GET , uri = "i18n/{key}" ) public Result getMessage ( @ Parameter ( "key" ) String key , @ QueryParameter ( "locale" ) Locale locale ) { String message ; if ( locale != null && ! locale . equals ( InternationalizationService . DEFAULT_LOCALE ) ) { message = service . get ( locale , key )... | Gets a specific internationalized message . |
1,997 | public boolean check ( ) { if ( ! method . getReturnType ( ) . equals ( Void . TYPE ) ) { WebSocketRouter . getLogger ( ) . error ( "The method {} annotated with a web socket callback is not well-formed. " + "These methods receive only parameter annotated with @Parameter and do not return anything" , method . getName (... | Checks that the callback is well - formed . |
1,998 | public void invoke ( String uri , String client , byte [ ] content ) throws InvocationTargetException , IllegalAccessException { Map < String , String > values = getPathParametersEncoded ( uri ) ; Object [ ] parameters = new Object [ arguments . size ( ) ] ; for ( int i = 0 ; i < arguments . size ( ) ; i ++ ) { ActionP... | Invokes the callback . |
1,999 | private void publish ( String buffer ) { CommandResult out = new CommandResult ( myType ) ; out . setContent ( buffer ) ; synchronized ( lock ) { publisher . publish ( topic , out . toString ( ) ) ; } } | Use the Publisher in order to broadcast the command result through the web - socket . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.