idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
133,400
public List < Article > get ( String url ) { if ( url . equals ( KEY_FAVORITES ) ) return getFavorites ( ) ; return articleMap . get ( url ) ; }
Looks up the specified URL String from the saved HashMap .
133,401
public void deleteAllFavorites ( ) { long time = System . currentTimeMillis ( ) ; log ( "Deleting all favorites..." ) ; favoriteDatabase . deleteAll ( ) ; log ( "Deleting all favorites took " + ( System . currentTimeMillis ( ) - time ) + "ms" ) ; }
Clears the favorites database .
133,402
private void insert ( String url , List < Article > newArticles ) { if ( ! articleMap . containsKey ( url ) ) articleMap . put ( url , new ArrayList < Article > ( ) ) ; List < Article > articleList = articleMap . get ( url ) ; articleList . addAll ( newArticles ) ; log ( "New size for " + url + " is " + articleList . s...
Inserts the passed list into the article map database . This will be cleared once the instance dies .
133,403
private void getRead ( ) { new AsyncTask < Void , Void , Void > ( ) { protected Void doInBackground ( Void ... params ) { int size = mPrefs . getInt ( "READ_ARRAY_SIZE" , 0 ) ; boolean value ; if ( size < 1 ) return null ; for ( int i = 0 , key ; i < size ; i ++ ) { key = mPrefs . getInt ( "READ_ARRAY_KEY_" + i , 0 ) ;...
Asynchronously loads read data .
133,404
private void writeRead ( ) { new AsyncTask < Void , Void , Void > ( ) { protected Void doInBackground ( Void ... params ) { SharedPreferences . Editor editor = mPrefs . edit ( ) ; int size = readList . size ( ) ; boolean value ; editor . putInt ( "READ_ARRAY_SIZE" , size ) ; for ( int i = 0 , key ; i < size ; i ++ ) { ...
Asynchronously saves read data .
133,405
private String pullImageLink ( String encoded ) { try { XmlPullParserFactory factory = XmlPullParserFactory . newInstance ( ) ; XmlPullParser xpp = factory . newPullParser ( ) ; xpp . setInput ( new StringReader ( encoded ) ) ; int eventType = xpp . getEventType ( ) ; while ( eventType != XmlPullParser . END_DOCUMENT )...
Pulls an image URL from an encoded String .
133,406
public boolean validate ( URL url ) throws SAXException { String xmlText = null ; try { xmlText = IOUtils . toString ( url . openStream ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } return validate ( xmlText ) ; }
Validate XML text retrieved from URL
133,407
public boolean validate ( String xmlText ) throws SAXException { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setNamespaceAware ( true ) ; try { DocumentBuilder b = factory . newDocumentBuilder ( ) ; Document document = b . parse ( new ByteArrayInputStream ( xmlText . getBytes (...
Validate an XML text String against the STIX schema
133,408
public static String getNamespaceURI ( Object obj ) { Package pkg = obj . getClass ( ) . getPackage ( ) ; XmlSchema xmlSchemaAnnotation = pkg . getAnnotation ( XmlSchema . class ) ; return xmlSchemaAnnotation . namespace ( ) ; }
Return the namespace URI from the package for the class of the object .
133,409
public static String getName ( Object obj ) { try { return obj . getClass ( ) . getAnnotation ( XmlRootElement . class ) . name ( ) ; } catch ( NullPointerException e ) { return obj . getClass ( ) . getAnnotation ( XmlType . class ) . name ( ) ; } }
Return the name from the JAXB model object .
133,410
public static QName getQualifiedName ( Object obj ) { return new QName ( STIXSchema . getNamespaceURI ( obj ) , STIXSchema . getName ( obj ) ) ; }
Return the QualifiedNam from the JAXB model object .
133,411
public RequestCreator nextPage ( ) { Request request = data . build ( ) ; String url = request . url ; int page = request . page ; if ( request . search != null ) url += "?s=" + request . search ; Map < String , Integer > pageTracker = singleton . getPageTracker ( ) ; if ( pageTracker . containsKey ( url ) ) page = pag...
Loads the next page of the current RSS feed . If no page was previously loaded this will request the first page .
133,412
public static Document toDocument ( JAXBElement < ? > jaxbElement , boolean prettyPrint ) { Document document = null ; try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory . newInstance ( ) ; documentBuilderFactory . setNamespaceAware ( true ) ; documentBuilderFactory . setIgnoringElementContent...
Returns a Document for a JAXBElement
133,413
public static String toXMLString ( JAXBElement < ? > jaxbElement , boolean prettyPrint ) { Document document = toDocument ( jaxbElement ) ; return toXMLString ( document , prettyPrint ) ; }
Returns a String for a JAXBElement
133,414
private final static void traverse ( Element element , ElementVisitor visitor ) { visitor . visit ( element ) ; NodeList children = element . getChildNodes ( ) ; for ( int i = 0 ; i < children . getLength ( ) ; i ++ ) { Node node = children . item ( i ) ; if ( node . getNodeType ( ) != Node . ELEMENT_NODE ) continue ; ...
Used to traverse an XML document .
133,415
public static Document toDocument ( String xml ) { try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory . newInstance ( ) ; documentBuilderFactory . setNamespaceAware ( true ) ; documentBuilderFactory . setIgnoringElementContentWhitespace ( true ) ; documentBuilderFactory . isIgnoringComments ( ...
Creates a Document from XML String
133,416
public static String stripFormattingfromXMLString ( String xml ) { try { Document document = DocumentUtilities . toDocument ( xml ) ; DOMImplementationRegistry registry = DOMImplementationRegistry . newInstance ( ) ; DOMImplementationLS domImplementationLS = ( DOMImplementationLS ) registry . getDOMImplementation ( "LS...
Strips formatting from an XML String
133,417
public static PagerDuty create ( String apiKey ) { Retrofit retrofit = new Retrofit . Builder ( ) . baseUrl ( HOST ) . addConverterFactory ( GsonConverterFactory . create ( ) ) . build ( ) ; return create ( apiKey , retrofit ) ; }
Create a new instance using the specified API key .
133,418
public void add ( Article article ) { SQLiteDatabase db = this . getWritableDatabase ( ) ; ContentValues values = new ContentValues ( ) ; values . put ( KEY_TAGS , TextUtils . join ( "_PCX_" , article . getTags ( ) ) ) ; values . put ( KEY_MEDIA_CONTENT , Article . MediaContent . toByteArray ( article . getMediaContent...
Inserts an Article object to this database .
133,419
public void delete ( Article article ) { SQLiteDatabase db = this . getWritableDatabase ( ) ; db . delete ( TABLE_ARTICLES , KEY_ID + " = ?" , new String [ ] { String . valueOf ( article . getId ( ) ) } ) ; db . close ( ) ; }
Removes a specified Article from this database based on its ID value .
133,420
public void deleteAll ( ) { SQLiteDatabase db = this . getWritableDatabase ( ) ; db . delete ( TABLE_ARTICLES , null , null ) ; db . close ( ) ; }
Removes ALL content stored in this database!
133,421
public Article putExtra ( String key , String value ) { this . extras . putString ( key , value ) ; return this ; }
Inserts a given value into a Bundle associated with this Article instance .
133,422
public Article addMediaContent ( MediaContent mediaContent ) { if ( mediaContent == null ) return this ; if ( this . mediaContentVec == null ) this . mediaContentVec = new Vector < > ( ) ; this . mediaContentVec . add ( mediaContent ) ; return this ; }
Adds a single media content item to the list
133,423
public Article removeMediaContent ( MediaContent mediaContent ) { if ( mediaContent == null || this . mediaContentVec == null ) return this ; this . mediaContentVec . remove ( mediaContent ) ; return this ; }
Removes a single media content item from the list
133,424
public boolean markRead ( boolean read ) { if ( PkRSS . getInstance ( ) == null ) return false ; PkRSS . getInstance ( ) . markRead ( id , read ) ; return true ; }
Adds this article s id to the read index .
133,425
public boolean saveFavorite ( boolean favorite ) { if ( PkRSS . getInstance ( ) == null ) return false ; return PkRSS . getInstance ( ) . saveFavorite ( this , favorite ) ; }
Adds this article into the favorites database .
133,426
private boolean handleNode ( String tag , Article article ) { try { if ( xmlParser . next ( ) != XmlPullParser . TEXT ) return false ; if ( tag . equalsIgnoreCase ( "link" ) ) article . setSource ( Uri . parse ( xmlParser . getText ( ) ) ) ; else if ( tag . equalsIgnoreCase ( "title" ) ) article . setTitle ( xmlParser ...
Handles a node from the tag node and assigns it to the correct article value .
133,427
private void handleMediaContent ( String tag , Article article ) { String url = xmlParser . getAttributeValue ( null , "url" ) ; if ( url == null ) { throw new IllegalArgumentException ( "Url argument must not be null" ) ; } Article . MediaContent mc = new Article . MediaContent ( ) ; article . addMediaContent ( mc ) ;...
Parses the media content of the entry
133,428
public static boolean deleteDir ( File dir ) { if ( dir != null && dir . isDirectory ( ) ) { String [ ] children = dir . list ( ) ; for ( int i = 0 ; i < children . length ; i ++ ) { if ( ! deleteDir ( new File ( dir , children [ i ] ) ) ) return false ; } } return dir . delete ( ) ; }
Deletes the specified directory . Returns true if successful false if not .
133,429
public static Downloader createDefaultDownloader ( Context context ) { Downloader downloaderInstance = null ; try { Class . forName ( "com.squareup.okhttp.OkHttpClient" ) ; downloaderInstance = new OkHttpDownloader ( context ) ; } catch ( ClassNotFoundException ignored ) { } try { Class . forName ( "okhttp3.OkHttpClien...
Creates a Downloader object depending on the dependencies present .
133,430
public void start ( Class < ? extends Easing > clazz , EaseType type , double fromValue , double endValue , int durationMillis , long delayMillis ) { if ( ! mRunning ) { mEasing = createInstance ( clazz ) ; if ( null == mEasing ) { return ; } mMethod = getEasingMethod ( mEasing , type ) ; if ( mMethod == null ) { retur...
Start the easing with a delay
133,431
public static List < Map < String , Object > > mergeLists ( String [ ] names , List < Object > ... lists ) { List < Map < String , Object > > resultList = new ArrayList < Map < String , Object > > ( ) ; if ( lists . length != 0 ) { int expectedSize = lists [ 0 ] . size ( ) ; for ( int i = 1 ; i < lists . length ; i ++ ...
Merges any number of named lists into a single one containing their combined values . Can be very handy in case of a servlet request which might contain several lists of parameters that you want to iterate over in a combined way .
133,432
private void append ( StringBuilder buffer , char c ) { if ( c == escapeChar ) { if ( escaped || rawOutput ) { buffer . append ( c ) ; } escaped = ! escaped ; } else if ( c == quoteChar ) { if ( escaped ) { buffer . append ( c ) ; escaped = false ; } else { quoted = ! quoted ; if ( rawOutput ) { buffer . append ( c ) ;...
the heart of it all
133,433
public boolean variablesAvailable ( Map < String , Object > model , String ... vars ) { final TemplateContext context = new TemplateContext ( null , null , null , new ScopedMap ( model ) , modelAdaptor , this , new SilentErrorHandler ( ) , null ) ; for ( String var : vars ) { final IfToken token = new IfToken ( var , f...
Checks if all given variables are there and if so that they evaluate to true inside an if .
133,434
@ Deprecated ( ) public synchronized Set < String > getUsedVariables ( String template ) { Template templateImpl = getTemplate ( template , null ) ; return templateImpl . getUsedVariables ( ) ; }
Gets all variables used in the given template .
133,435
public synchronized List < VariableDescription > getUsedVariableDescriptions ( String template ) { Template templateImpl = getTemplate ( template , null ) ; return templateImpl . getUsedVariableDescriptions ( ) ; }
Gets all variables used in the given template as a detailed description .
133,436
public Token pop ( ) { if ( scopes . isEmpty ( ) ) { return null ; } else { Token token = scopes . remove ( scopes . size ( ) - 1 ) ; return token ; } }
Pops a token from the scope stack .
133,437
public Token peek ( ) { if ( scopes . isEmpty ( ) ) { return null ; } else { Token token = scopes . get ( scopes . size ( ) - 1 ) ; return token ; } }
Gets the top element from the stack without removing it .
133,438
public void notifyProcessListener ( Token token , Action action ) { if ( processListener != null ) { processListener . log ( this , token , action ) ; } }
Allows you to send additional notifications of executed processing steps .
133,439
public static String streamToString ( InputStream is , String charsetName ) { try { Reader r = null ; try { r = new BufferedReader ( new InputStreamReader ( is , charsetName ) ) ; return readerToString ( r ) ; } finally { if ( r != null ) { try { r . close ( ) ; } catch ( IOException e ) { } } } } catch ( Exception e )...
Transforms a stream into a string .
133,440
public static String resourceToString ( String resourceName , String charsetName ) { InputStream templateStream = Thread . currentThread ( ) . getContextClassLoader ( ) . getResourceAsStream ( resourceName ) ; String template = Util . streamToString ( templateStream , "UTF-8" ) ; return template ; }
Loads a stream from the classpath and transforms it into a string .
133,441
public static String readerToString ( Reader reader ) { try { StringBuilder sb = new StringBuilder ( ) ; char [ ] buf = new char [ 1024 ] ; int numRead = 0 ; while ( ( numRead = reader . read ( buf ) ) != - 1 ) { sb . append ( buf , 0 , numRead ) ; } return sb . toString ( ) ; } catch ( Exception e ) { throw new Runtim...
Transforms a reader into a string .
133,442
@ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public static List < Object > arrayAsList ( Object value ) { if ( value instanceof List ) { return ( List < Object > ) value ; } List list = null ; if ( value instanceof int [ ] ) { list = new ArrayList ( ) ; int [ ] array = ( int [ ] ) value ; for ( int i : array ) {...
Transforms any array to a matching list
133,443
public static String trimFront ( String input ) { int i = 0 ; while ( i < input . length ( ) && Character . isWhitespace ( input . charAt ( i ) ) ) i ++ ; return input . substring ( i ) ; }
Trims off white space from the beginning of a string .
133,444
public MisplacedClassProcessor getProcessorForName ( String name ) { if ( name == null ) { return getDefaultProcessor ( ) ; } switch ( Strategy . valueOf ( name . toUpperCase ( ) ) ) { case FATAL : return new FatalMisplacedClassProcessor ( ) ; case MOVE : return new MoveMisplacedClassProcessor ( ) ; case OMIT : return ...
Creates a MisplacedClassProcessor according for the given strategy name .
133,445
public static int safeRead ( final InputStream inputStream , final byte [ ] buffer ) throws IOException { int readBytes = inputStream . read ( buffer ) ; if ( readBytes == - 1 ) { return - 1 ; } if ( readBytes < buffer . length ) { int offset = readBytes ; int left = buffer . length ; left = left - readBytes ; do { try...
Read a number of bytes from the stream and store it in the buffer and fix the problem with incomplete reads by doing another read if we don t have all of the data yet .
133,446
public static boolean eofIsNext ( final RawPacket rawPacket ) { final ByteBuffer buf = rawPacket . getByteBuffer ( ) ; return ( buf . get ( 0 ) == ( byte ) 0xfe && buf . capacity ( ) < 9 ) ; }
Checks whether the next packet is EOF .
133,447
static RawPacket nextPacket ( final InputStream is ) throws IOException { byte [ ] lengthBuffer = readLengthSeq ( is ) ; int length = ( lengthBuffer [ 0 ] & 0xff ) + ( ( lengthBuffer [ 1 ] & 0xff ) << 8 ) + ( ( lengthBuffer [ 2 ] & 0xff ) << 16 ) ; if ( length == - 1 ) { return null ; } if ( length < 0 ) { throw new IO...
Get the next packet from the stream
133,448
public boolean execute ( final String query ) throws SQLException { startTimer ( ) ; try { if ( queryResult != null ) { queryResult . close ( ) ; } queryResult = protocol . executeQuery ( queryFactory . createQuery ( query ) ) ; if ( queryResult . getResultSetType ( ) == ResultSetType . SELECT ) { setResultSet ( new Dr...
executes a query .
133,449
public final int writeTo ( final OutputStream os , int offset , int maxWriteSize ) throws IOException { int bytesToWrite = Math . min ( blobReference . getBytes ( ) . length - offset , maxWriteSize ) ; os . write ( blobReference . getBytes ( ) , offset , blobReference . getBytes ( ) . length ) ; return bytesToWrite ; }
Writes the parameter to an outputstream .
133,450
public String readString ( final String charset ) throws IOException { byte ch ; int cnt = 0 ; final byte [ ] byteArrBuff = new byte [ byteBuffer . remaining ( ) ] ; while ( byteBuffer . remaining ( ) > 0 && ( ( ch = byteBuffer . get ( ) ) != 0 ) ) { byteArrBuff [ cnt ++ ] = ch ; } return new String ( byteArrBuff , 0 ,...
Reads a string from the buffer looks for a 0 to end the string
133,451
public ValueObject getValueObject ( final int i ) throws NoSuchColumnException { if ( i < 0 || i > resultSet . get ( rowPointer ) . size ( ) ) { throw new NoSuchColumnException ( "No such column: " + i ) ; } return resultSet . get ( rowPointer ) . get ( i ) ; }
gets the value at position i in the result set . i starts at zero!
133,452
public static String sqlEscapeString ( final String str ) { StringBuilder buffer = new StringBuilder ( str . length ( ) * 2 ) ; boolean neededEscaping = false ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { final char c = str . charAt ( i ) ; if ( needsEscaping ( ( byte ) c ) ) { neededEscaping = true ; buffer . ap...
escapes the given string new string length is at most twice the length of str
133,453
public static long unpackTime ( final int packedTime ) { final int hours = ( packedTime & MASK_HOURS ) ; final int minutes = ( packedTime & MASK_MINUTES ) >> ( START_BIT_MINUTES ) ; final int seconds = ( packedTime & MASK_SECONDS ) >> ( START_BIT_SECONDS ) ; final int millis = ( packedTime & MASK_MILLISECONDS ) >> ( ST...
unpacks an integer packed by packTime
133,454
public static boolean isJava5 ( ) { if ( ! java5Determined ) { try { java . util . Arrays . copyOf ( new byte [ 0 ] , 0 ) ; isJava5 = false ; } catch ( java . lang . NoSuchMethodError e ) { isJava5 = true ; } java5Determined = true ; } return isJava5 ; }
Returns if it is a Java version up to Java 5 .
133,455
public void setTime ( final int parameterIndex , final Time x ) throws SQLException { if ( x == null ) { setNull ( parameterIndex , Types . TIME ) ; return ; } setParameter ( parameterIndex , new TimeParameter ( x . getTime ( ) ) ) ; }
Since Drizzle has no TIME datatype time in milliseconds is stored in a packed integer
133,456
private QueryResult createDrizzleQueryResult ( final ResultSetPacket packet ) throws IOException , QueryException { final List < ColumnInformation > columnInformation = new ArrayList < ColumnInformation > ( ) ; for ( int i = 0 ; i < packet . getFieldCount ( ) ; i ++ ) { final RawPacket rawPacket = packetFetcher . getRa...
create a DrizzleQueryResult - precondition is that a result set packet has been read
133,457
public Time getTime ( ) throws ParseException { if ( rawBytes == null ) { return null ; } String rawValue = getString ( ) ; SimpleDateFormat sdf = new SimpleDateFormat ( "HH:mm:ss" ) ; sdf . setLenient ( false ) ; final java . util . Date utilTime = sdf . parse ( rawValue ) ; return new Time ( utilTime . getTime ( ) ) ...
Since drizzle has no TIME datatype JDBC Time is stored in a packed integer
133,458
public PreparedStatement prepareStatement ( final String sql ) throws SQLException { if ( parameterizedBatchHandlerFactory == null ) { this . parameterizedBatchHandlerFactory = new DefaultParameterizedBatchHandlerFactory ( ) ; } final String strippedQuery = Utils . stripQuery ( sql ) ; return new DrizzlePreparedStateme...
creates a new prepared statement . Only client side prepared statement emulation right now .
133,459
public boolean getAutoCommit ( ) throws SQLException { Statement stmt = createStatement ( ) ; ResultSet rs = stmt . executeQuery ( "select @@autocommit" ) ; rs . next ( ) ; boolean autocommit = rs . getBoolean ( 1 ) ; rs . close ( ) ; stmt . close ( ) ; return autocommit ; }
returns true if statements on this connection are auto commited .
133,460
public void close ( ) throws SQLException { if ( isClosed ( ) ) return ; try { this . timeoutExecutor . shutdown ( ) ; protocol . close ( ) ; } catch ( QueryException e ) { throw SQLExceptionMapper . get ( e ) ; } }
close the connection .
133,461
public DatabaseMetaData getMetaData ( ) throws SQLException { return new CommonDatabaseMetaData . Builder ( protocol . getDatabaseType ( ) , this ) . url ( "jdbc:drizzle://" + protocol . getHost ( ) + ":" + protocol . getPort ( ) + "/" + protocol . getDatabase ( ) ) . username ( protocol . getUsername ( ) ) . version (...
returns the meta data about the database .
133,462
public List < RawPacket > startBinlogDump ( final int position , final String logfile ) throws SQLException { try { return this . protocol . startBinlogDump ( position , logfile ) ; } catch ( BinlogDumpException e ) { throw SQLExceptionMapper . getSQLException ( "Could not dump binlog" , e ) ; } }
returns a list of binlog entries .
133,463
protected void addCommandLineArgument ( StringBuilder buffer , String argument , String value ) { if ( ( value != null ) && ( value . length ( ) > 0 ) ) { buffer . append ( argument ) ; buffer . append ( Fax4jExeConstants . SPACE_STR ) ; buffer . append ( Fax4jExeConstants . VALUE_WRAPPER ) ; buffer . append ( value ) ...
This function adds the given command line argument to the buffer .
133,464
protected String createProcessCommand ( String commandArguments ) { StringBuilder buffer = new StringBuilder ( 500 ) ; buffer . append ( "\"" ) ; buffer . append ( this . fax4jExecutableFileLocation ) ; buffer . append ( "\"" ) ; buffer . append ( Fax4jExeConstants . SPACE_STR ) ; buffer . append ( commandArguments ) ;...
This function creates and returns the fax4j . exe command .
133,465
protected String createProcessCommandArgumentsForSubmitFaxJob ( FaxJob faxJob ) { String targetAddress = faxJob . getTargetAddress ( ) ; String targetName = faxJob . getTargetName ( ) ; String senderName = faxJob . getSenderName ( ) ; File file = faxJob . getFile ( ) ; String fileName = null ; try { fileName = file . g...
This function creates and returns the command line arguments for the fax4j external exe when running the submit fax job action .
133,466
protected String createProcessCommandArgumentsForExistingFaxJob ( String faxActionTypeArgument , FaxJob faxJob ) { String faxJobID = faxJob . getID ( ) ; StringBuilder buffer = new StringBuilder ( ) ; this . addCommandLineArgument ( buffer , Fax4jExeConstants . ACTION_FAX4J_EXE_COMMAND_LINE_ARGUMENT . toString ( ) , fa...
This function creates and returns the command line arguments for the fax4j external exe when running an action on an existing fax job .
133,467
public final synchronized void initialize ( Object flowOwner ) { if ( this . initialized ) { throw new FaxException ( "Vendor policy already initialized." ) ; } if ( flowOwner == null ) { throw new FaxException ( "Flow owner not provided." ) ; } this . initialized = true ; this . vendorPolicyFlowOwner = flowOwner ; thi...
This function initializes the vendor policy .
133,468
protected HTTPClientConfiguration createHTTPClientConfiguration ( ) { CommonHTTPClientConfiguration configuration = new CommonHTTPClientConfiguration ( ) ; configuration . setHostName ( "api.phaxio.com" ) ; configuration . setSSL ( true ) ; configuration . setMethod ( FaxActionType . SUBMIT_FAX_JOB , HTTPMethod . POST ...
This function creates and returns the HTTP configuration object .
133,469
public void updateFaxJob ( FaxJob faxJob , HTTPResponse httpResponse , FaxActionType faxActionType ) { String path = this . getPathToResponseData ( faxActionType ) ; String id = this . findValue ( httpResponse , path ) ; if ( id != null ) { faxJob . setID ( id ) ; } }
Updates the fax job based on the data from the HTTP response data .
133,470
public FaxJobStatus getFaxJobStatus ( HTTPResponse httpResponse ) { String path = this . getPathToResponseData ( FaxActionType . GET_FAX_JOB_STATUS ) ; String faxJobStatusStr = this . findValue ( httpResponse , path ) ; FaxJobStatus faxJobStatus = FaxJobStatus . UNKNOWN ; if ( faxJobStatusStr != null ) { faxJobStatus =...
This function extracts the fax job status from the HTTP response data .
133,471
protected String getVBSFailedLineErrorMessage ( String errorPut ) { String message = "" ; if ( errorPut != null ) { String prefix = ".vbs(" ; int start = errorPut . indexOf ( prefix ) ; if ( start != - 1 ) { start = start + prefix . length ( ) ; int end = errorPut . indexOf ( ", " , start - 1 ) ; if ( end != - 1 ) { St...
This function returns the VBS error line for the exception message .
133,472
protected void logEvent ( FaxClientSpiProxyEventType eventType , Method method , Object [ ] arguments , Object output , Throwable throwable ) { int amount = 3 ; int argumentsAmount = 0 ; if ( arguments != null ) { argumentsAmount = arguments . length ; } if ( eventType == FaxClientSpiProxyEventType . POST_EVENT_TYPE ) ...
This function logs the event .
133,473
public final void preMethodInvocation ( Method method , Object [ ] arguments ) { this . logEvent ( FaxClientSpiProxyEventType . PRE_EVENT_TYPE , method , arguments , null , null ) ; }
This function is invoked by the fax client SPI proxy before invoking the method in the fax client SPI itself .
133,474
public final void postMethodInvocation ( Method method , Object [ ] arguments , Object output ) { this . logEvent ( FaxClientSpiProxyEventType . POST_EVENT_TYPE , method , arguments , output , null ) ; }
This function is invoked by the fax client SPI proxy after invoking the method in the fax client SPI itself .
133,475
public final void onMethodInvocationError ( Method method , Object [ ] arguments , Throwable throwable ) { this . logEvent ( FaxClientSpiProxyEventType . ERROR_EVENT_TYPE , method , arguments , null , throwable ) ; }
This function is invoked by the fax client SPI proxy in of an error while invoking the method in the fax client SPI itself .
133,476
public FaxJobPriority getPriority ( ) { int priority = Job . PRIORITY_NORMAL ; try { priority = this . JOB . getPriority ( ) ; } catch ( Exception exception ) { throw new FaxException ( "Error while extracting job priority." , exception ) ; } FaxJobPriority faxJobPriority = null ; switch ( priority ) { case Job . PRIOR...
This function returns the priority .
133,477
public void setPriority ( FaxJobPriority priority ) { try { if ( priority == FaxJobPriority . HIGH_PRIORITY ) { this . JOB . setPriority ( Job . PRIORITY_HIGH ) ; } else { this . JOB . setPriority ( Job . PRIORITY_NORMAL ) ; } } catch ( Exception exception ) { throw new FaxException ( "Error while setting job priority....
This function sets the priority .
133,478
public String getTargetAddress ( ) { String value = null ; try { value = this . JOB . getDialstring ( ) ; } catch ( Exception exception ) { throw new FaxException ( "Error while extracting job target address." , exception ) ; } return value ; }
This function returns the fax job target address .
133,479
public void setTargetAddress ( String targetAddress ) { try { this . JOB . setDialstring ( targetAddress ) ; } catch ( Exception exception ) { throw new FaxException ( "Error while setting job target address." , exception ) ; } }
This function sets the fax job target address .
133,480
public String getSenderName ( ) { String value = null ; try { value = this . JOB . getFromUser ( ) ; } catch ( Exception exception ) { throw new FaxException ( "Error while extracting job sender name." , exception ) ; } return value ; }
This function returns the fax job sender name .
133,481
public void setSenderName ( String senderName ) { try { this . JOB . setFromUser ( senderName ) ; } catch ( Exception exception ) { throw new FaxException ( "Error while setting job sender name." , exception ) ; } }
This function sets the fax job sender name .
133,482
public void setProperty ( String key , String value ) { try { this . JOB . setProperty ( key , value ) ; } catch ( Exception exception ) { throw new FaxException ( "Error while setting job property." , exception ) ; } }
This function sets the fax job property .
133,483
protected String formatHTTPResource ( HTTPFaxClientSpi faxClientSpi , FaxActionType faxActionType , FaxJob faxJob ) { String resourceTemplate = faxClientSpi . getHTTPResource ( faxActionType ) ; String resource = SpiUtil . formatTemplate ( resourceTemplate , faxJob , SpiUtil . URL_ENCODER , false , false ) ; return res...
This function formats the HTTP resource .
133,484
protected String formatHTTPURLParameters ( HTTPFaxClientSpi faxClientSpi , FaxJob faxJob ) { String urlParametersTemplate = faxClientSpi . getHTTPURLParameters ( ) ; String urlParameters = SpiUtil . formatTemplate ( urlParametersTemplate , faxJob , SpiUtil . URL_ENCODER , false , false ) ; return urlParameters ; }
This function formats the HTTP URL parameters .
133,485
private static void loadProperties ( Properties properties , InputStream inputStream , boolean internal ) { try { properties . load ( inputStream ) ; LibraryConfigurationLoader . closeResource ( inputStream ) ; } catch ( Exception exception ) { LibraryConfigurationLoader . closeResource ( inputStream ) ; String prefix ...
This function loads the properties from the input stream to the provided properties object .
133,486
public static Properties readInternalConfiguration ( ) { Properties properties = new Properties ( ) ; ClassLoader classLoader = ReflectionHelper . getThreadContextClassLoader ( ) ; InputStream inputStream = classLoader . getResourceAsStream ( "org/fax4j/" + LibraryConfigurationLoader . CONFIGURATION_FILE_NAME ) ; Libra...
This function reads and returns the internal fax4j properties .
133,487
public static Properties readInternalAndExternalConfiguration ( ) { Properties properties = LibraryConfigurationLoader . readInternalConfiguration ( ) ; ClassLoader classLoader = ReflectionHelper . getThreadContextClassLoader ( ) ; InputStream inputStream = classLoader . getResourceAsStream ( LibraryConfigurationLoader...
This function reads and returns the internal and external fax4j properties .
133,488
public boolean implies ( final MqttTopicPermission other ) { if ( other == null ) { return false ; } return implies ( other . getTopic ( ) , other . splitTopic , other . getQos ( ) , other . getActivity ( ) ) ; }
Checks the MqttTopicPermission implies a given MqttTopicPermission
133,489
private boolean topicImplicity ( final String topic , final String [ ] splitTopic ) { try { return topicMatcher . matches ( stripedTopic , this . splitTopic , nonWildCard , endsWithWildCard , rootWildCard , topic , splitTopic ) ; } catch ( InvalidTopicException e ) { return false ; } }
Checks if the topic implies a given MqttTopicPermissions topic
133,490
private boolean getQosImplicity ( final QOS qos ) { if ( this . getQos ( ) == QOS . ALL ) { return true ; } if ( qos == QOS . ALL ) { return false ; } else if ( this . getQos ( ) == QOS . ZERO_ONE ) { return ( qos == QOS . ZERO ) || ( qos == QOS . ONE ) || ( qos == QOS . ZERO_ONE ) ; } else if ( this . getQos ( ) == QO...
Checks if the MqttTopicPermission implies a given QoS
133,491
private boolean getActivityImplicity ( final ACTIVITY activity ) { if ( this . activity == ACTIVITY . ALL ) { return true ; } if ( ( activity == ACTIVITY . SUBSCRIBE ) && ( this . activity == ACTIVITY . PUBLISH ) ) { return false ; } else if ( ( activity == ACTIVITY . PUBLISH ) && ( this . activity == ACTIVITY . SUBSCR...
Checks if an activity implies another activity
133,492
protected void initializeMailTemplates ( ) { this . mailAddressTemplate = FaxClientSpiConfigurationConstants . MAIL_ADDRESS_TEMPLATE_VALUE . toString ( ) ; this . mailSubjectTemplate = FaxClientSpiConfigurationConstants . MAIL_SUBJECT_TEMPLATE_VALUE . toString ( ) ; }
This function initializes the mail templates .
133,493
protected Object [ ] setupSubmitFaxJobInput ( FaxJob faxJob ) { List < Object > inputList = new LinkedList < Object > ( ) ; inputList . add ( this . faxServerName ) ; File file = faxJob . getFile ( ) ; inputList . add ( file ) ; String documentName = faxJob . getProperty ( FaxJobExtendedPropertyConstants . DOCUMENT_NAM...
This function creates an input array with the needed info to submit a new fax job based on the provided data .
133,494
protected Object formatObject ( Object object ) { Object formattedObject = object ; if ( object == null ) { formattedObject = "" ; } else if ( object instanceof String ) { String string = ( String ) object ; string = string . replaceAll ( "\n" , "" ) ; string = string . replaceAll ( "\r" , "" ) ; string = string . repl...
This function formats the provided object to enable embedding in VBS code .
133,495
protected FaxJobStatus invokeExistingFaxJobAction ( String scriptName , FaxJob faxJob , FaxActionType faxActionType ) { Object [ ] input = new String [ 2 ] ; input [ 0 ] = this . faxServerName ; input [ 1 ] = faxJob . getID ( ) ; return this . invokeScript ( faxJob , scriptName , input , faxActionType ) ; }
Invokes a basic fax action
133,496
protected FaxJobStatus invokeScript ( FaxJob faxJob , String name , Object [ ] input , FaxActionType faxActionType ) { String script = this . generateScript ( name , input ) ; ProcessOutput processOutput = this . invokeScript ( script ) ; this . processOutputValidator . validateProcessOutput ( this , processOutput , fa...
Invokes the VB script and returns its output .
133,497
protected ProcessOutput invokeScript ( String script ) { File file = null ; try { file = File . createTempFile ( "fax4j_" , ".vbs" ) ; } catch ( IOException exception ) { throw new FaxException ( "Unable to create temporary vbscript file." , exception ) ; } file . deleteOnExit ( ) ; StringBuilder buffer = new StringBui...
Invokes the VB script and returns the output .
133,498
protected String generateScript ( String name , Object [ ] input ) { String template = VBSFaxClientSpi . VBS_SCRIPTS . get ( name ) ; if ( ( template == null ) || ( template . length ( ) == 0 ) ) { this . throwUnsupportedException ( ) ; } String commonScript = VBSFaxClientSpi . VBS_SCRIPTS . get ( VBSFaxClientSpi . VBS...
This function generates the script and returns it .
133,499
protected static final Logger initializeLogger ( ) { Logger logger = Logger . getLogger ( FaxClient . class . getName ( ) ) ; logger . setLevel ( Level . ALL ) ; logger . setFilter ( null ) ; logger . setUseParentHandlers ( true ) ; Formatter formatter = new SimpleFormatter ( ) ; Handler handler = new StreamHandler ( S...
This function initializes and returns the logger .