idx int64 0 41.2k | question stringlengths 74 4.04k | target stringlengths 7 750 |
|---|---|---|
36,500 | public void doHttpFilePost ( String url , HttpResponse result , Map < String , Object > headers , File file ) { httpClient . post ( url , result , headers , file ) ; } | Performs POST to supplied url of a file as binary data . |
36,501 | public void doHttpFilePut ( String url , HttpResponse result , Map < String , Object > headers , File file ) { httpClient . put ( url , result , headers , file ) ; } | Performs PUT to supplied url of a file as binary data . |
36,502 | public void doHttpPut ( String url , String templateName , Object model , HttpResponse result ) { doHttpPut ( url , templateName , model , result , null , XmlHttpResponse . CONTENT_TYPE_XML_TEXT_UTF8 ) ; } | Performs PUT to supplied url of result of applying template with model . |
36,503 | public void doHttpPut ( String url , HttpResponse result , Map < String , Object > headers , String contentType ) { httpClient . put ( url , result , headers , contentType ) ; } | Performs PUT to supplied url of result s request . |
36,504 | public XmlHttpResponse doHttpGetXml ( String url ) { XmlHttpResponse response = new XmlHttpResponse ( ) ; doGet ( url , response ) ; setContext ( response ) ; return response ; } | GETs XML content from URL . |
36,505 | public void doHead ( String url , HttpResponse response , Map < String , Object > headers ) { response . setRequest ( url ) ; httpClient . head ( url , response , headers ) ; } | HEADs content from URL . |
36,506 | public void doDelete ( String url , HttpResponse response , Map < String , Object > headers ) { response . setRequest ( url ) ; httpClient . delete ( url , response , headers ) ; } | DELETEs content at URL . |
36,507 | public void doDelete ( String url , HttpResponse result , Map < String , Object > headers , String contentType ) { httpClient . delete ( url , result , headers , contentType ) ; } | Performs DELETE to supplied url of result s request . |
36,508 | public String getHtml ( Formatter formatter , String value ) { String result = null ; if ( value != null ) { if ( "" . equals ( value ) ) { result = "" ; } else { String formattedResponse = formatter . format ( value ) ; result = "<pre>" + StringEscapeUtils . escapeHtml4 ( formattedResponse ) + "</pre>" ; } } return result ; } | Formats supplied value for display as pre - formatted text in FitNesse page . |
36,509 | public static void handleErrorResponse ( String msg , String responseText ) { String responseHtml ; Environment instance = getInstance ( ) ; try { responseHtml = instance . getHtmlForXml ( responseText ) ; } catch ( Exception e ) { responseHtml = instance . getHtml ( value -> value , responseText ) ; } throw new FitFailureException ( msg + responseHtml ) ; } | Creates exception that will display nicely in a columnFixture . |
36,510 | public ProgramResponse invokeProgram ( int timeout , String directory , String command , String ... arguments ) { ProgramResponse result = new ProgramResponse ( ) ; result . setDirectory ( directory ) ; result . setCommand ( command ) ; result . setArguments ( arguments ) ; invokeProgram ( timeout , result ) ; return result ; } | Invokes an external program waits for it to complete and returns the result . |
36,511 | public String getWikiUrl ( String filePath ) { String wikiUrl = null ; String filesDir = getFitNesseFilesSectionDir ( ) ; if ( filePath . startsWith ( filesDir ) ) { String relativeFile = filePath . substring ( filesDir . length ( ) ) ; relativeFile = relativeFile . replace ( '\\' , '/' ) ; wikiUrl = "files" + relativeFile ; } return wikiUrl ; } | Converts a file path into a relative wiki path if the path is insides the wiki s files section . |
36,512 | public String getFilePathFromWikiUrl ( String wikiUrl ) { String url = getHtmlCleaner ( ) . getUrl ( wikiUrl ) ; File file ; if ( url . startsWith ( "files/" ) ) { String relativeFile = url . substring ( "files" . length ( ) ) ; relativeFile = relativeFile . replace ( '/' , File . separatorChar ) ; String pathname = getFitNesseFilesSectionDir ( ) + relativeFile ; file = new File ( pathname ) ; } else { file = new File ( url ) ; } return file . exists ( ) ? file . getAbsolutePath ( ) : url ; } | Gets absolute path from wiki url if file exists . |
36,513 | public void addSeleniumCookies ( HttpResponse response ) { CookieStore cookieStore = ensureResponseHasCookieStore ( response ) ; CookieConverter converter = getCookieConverter ( ) ; Set < Cookie > browserCookies = getSeleniumHelper ( ) . getCookies ( ) ; converter . copySeleniumCookies ( browserCookies , cookieStore ) ; } | Adds Selenium cookies to response s cookie store . |
36,514 | public long stopTimer ( String name ) { StopWatch sw = getStopWatch ( name ) ; sw . stop ( ) ; STOP_WATCHES . remove ( name ) ; return sw . getTime ( ) ; } | Stops named timer . |
36,515 | public Map < String , Long > stopAllTimers ( ) { Map < String , Long > result = allTimerTimes ( ) ; STOP_WATCHES . clear ( ) ; return result ; } | Stops all running timers . |
36,516 | public String createContainingValue ( String filename , String key ) { Object data = value ( key ) ; if ( data == null ) { throw new SlimFixtureException ( false , "No value for key: " + key ) ; } return createContaining ( filename , data ) ; } | Creates new file containing value key . |
36,517 | public String encode ( String fileUrl ) { String file = getFilePathFromWikiUrl ( fileUrl ) ; try { byte [ ] content = IOUtils . toByteArray ( new FileInputStream ( file ) ) ; return base64Encode ( content ) ; } catch ( IOException e ) { throw new SlimFixtureException ( "Unable to read: " + file , e ) ; } } | Gets the content of specified file base64 encoded . |
36,518 | public String createFrom ( String fileName , String base64String ) { String result ; String baseName = FilenameUtils . getBaseName ( fileName ) ; String target = saveBase + baseName ; String ext = FilenameUtils . getExtension ( fileName ) ; byte [ ] content = base64Decode ( base64String ) ; String downloadedFile = FileUtil . saveToFile ( target , ext , content ) ; String wikiUrl = getWikiUrl ( downloadedFile ) ; if ( wikiUrl != null ) { result = String . format ( "<a href=\"%s\">%s</a>" , wikiUrl , fileName ) ; } else { result = downloadedFile ; } return result ; } | Creates a new file with content read from base64 encoded string . |
36,519 | public void addValueToIn ( Object value , String name , Map < String , Object > map ) { Object val = getValue ( map , name ) ; if ( val instanceof Collection ) { Object cleanValue = getCleanValue ( value ) ; ( ( Collection ) val ) . add ( cleanValue ) ; } else if ( val == null ) { setValueForIn ( value , name + "[0]" , map ) ; } else { throw new SlimFixtureException ( false , "name is not a list but: " + val . getClass ( ) . getSimpleName ( ) ) ; } } | Adds a value to the end of a list . |
36,520 | public void copyValuesFromTo ( Map < String , Object > otherMap , Map < String , Object > map ) { map . putAll ( otherMap ) ; } | Adds all values in the otherMap to map . |
36,521 | public String applyTemplate ( String aTemplate ) { String result = getEnvironment ( ) . processTemplate ( aTemplate , getCurrentValues ( ) ) ; result = postProcess ( result ) ; result = formatResult ( aTemplate , result ) ; return result ; } | Applies template to current values . |
36,522 | public boolean loadValuesFrom ( String filename ) { String yamlStr = textIn ( filename ) ; Object y = yaml . load ( yamlStr ) ; if ( y instanceof Map ) { getCurrentValues ( ) . putAll ( ( Map ) y ) ; } else { getCurrentValues ( ) . put ( "elements" , y ) ; } return true ; } | Adds the yaml loaded from the specified file to current values . |
36,523 | public T apply ( T webElement ) { if ( firstFound == null ) { firstFound = webElement ; } return mayPass ( webElement ) ? webElement : null ; } | Filters out non - displayed elements . |
36,524 | private HttpEntity buildBodyWithFile ( File file ) { MultipartEntityBuilder builder = MultipartEntityBuilder . create ( ) ; builder . addBinaryBody ( "file" , file , ContentType . APPLICATION_OCTET_STREAM , file . getName ( ) ) ; HttpEntity multipart = builder . build ( ) ; return multipart ; } | Builds request body with a given file |
36,525 | protected static org . apache . http . client . HttpClient buildHttpClient ( boolean contentCompression , boolean sslVerification ) { RequestConfig rc = RequestConfig . custom ( ) . setCookieSpec ( CookieSpecs . STANDARD ) . build ( ) ; HttpClientBuilder builder = HttpClients . custom ( ) . useSystemProperties ( ) ; if ( ! contentCompression ) { builder . disableContentCompression ( ) ; } if ( ! sslVerification ) { try { builder . setSSLSocketFactory ( generateAllTrustingSSLConnectionSocketFactory ( ) ) ; } catch ( Exception e ) { throw new RuntimeException ( "Unable to create all-trusting SSLConnectionSocketFactory" , e ) ; } } return builder . setConnectionReuseStrategy ( NoConnectionReuseStrategy . INSTANCE ) . setUserAgent ( HttpClient . class . getName ( ) ) . setDefaultRequestConfig ( rc ) . build ( ) ; } | Builds an apache HttpClient instance |
36,526 | public static < T , K , U > Collector < T , ? , LinkedHashMap < K , U > > toLinkedMap ( Function < ? super T , ? extends K > keyMapper , Function < ? super T , ? extends U > valueMapper ) { BinaryOperator < U > mergeFunction = throwingMerger ( ) ; return toLinkedMap ( keyMapper , valueMapper , mergeFunction ) ; } | Collects a stream to a LinkedHashMap each stream element is expected to produce map entry . |
36,527 | public static < T , K , U > Collector < T , ? , LinkedHashMap < K , U > > toLinkedMap ( Function < ? super T , ? extends K > keyMapper , Function < ? super T , ? extends U > valueMapper , BinaryOperator < U > mergeFunction ) { return Collectors . toMap ( keyMapper , valueMapper , mergeFunction , LinkedHashMap :: new ) ; } | Collects a stream to a LinkedHashMap . |
36,528 | public static < T > BinaryOperator < T > throwingMerger ( ) { return ( u , v ) -> { throw new IllegalArgumentException ( String . format ( "Duplicate key: value %s was already present now %s is added" , u , v ) ) ; } ; } | Throws is same key is produced . |
36,529 | public boolean validateAgainst ( String xmlContent , String xsdContent ) { try { Source xsd = new SAXSource ( new InputSource ( new StringReader ( xsdContent ) ) ) ; Source xml = new SAXSource ( new InputSource ( new StringReader ( xmlContent ) ) ) ; SchemaFactory schemaFactory = SchemaFactory . newInstance ( XMLConstants . W3C_XML_SCHEMA_NS_URI ) ; Schema schema = schemaFactory . newSchema ( xsd ) ; Validator validator = schema . newValidator ( ) ; validator . validate ( xml ) ; return true ; } catch ( SAXException e ) { throw new SlimFixtureException ( false , "XML Validation failed: " + e . getMessage ( ) ) ; } catch ( IOException e ) { throw new SlimFixtureException ( e ) ; } } | Validate currently loaded xml against an xsd |
36,530 | public boolean loadValuesFrom ( String filename ) { String propContent = textIn ( filename ) ; PropertiesHelper propHelper = getEnvironment ( ) . getPropertiesHelper ( ) ; Properties properties = propHelper . parsePropertiesString ( propContent ) ; Map < String , Object > propAsMap = propHelper . convertPropertiesToMap ( properties ) ; getCurrentValues ( ) . putAll ( propAsMap ) ; return true ; } | Adds the properties loaded from the specified file to current values . |
36,531 | public boolean startDriver ( String driverClassName , final Map < String , Object > profile ) throws Exception { if ( OVERRIDE_ACTIVE ) { return true ; } DriverFactory driverFactory = new LocalDriverFactory ( driverClassName , profile ) ; WebDriver driver = setAndUseDriverFactory ( driverFactory ) ; return driver != null ; } | Creates an instance of the specified class an injects it into SeleniumHelper so other fixtures can use it . |
36,532 | public boolean connectToDriverForVersionOnAt ( String browser , String version , String platformName , String url ) throws MalformedURLException { Platform platform = Platform . valueOf ( platformName ) ; DesiredCapabilities desiredCapabilities = new DesiredCapabilities ( browser , version , platform ) ; desiredCapabilities . setVersion ( version ) ; return createAndSetRemoteDriver ( url , desiredCapabilities ) ; } | Connects SeleniumHelper to a remote web driver . |
36,533 | public static Integer getFileSizeOnFTPServer ( String hostName , Integer port , String userName , String password , String filePath ) { Integer result = null ; String replyString = executeCommandOnFTPServer ( hostName , port , userName , password , "SIZE" , filePath ) ; if ( replyString == null || ! replyString . contains ( " " ) ) { throw new RuntimeException ( String . format ( "Unable to get size of the %s file. Got [%s] reply from FTP server." , filePath , replyString ) ) ; } else { result = Integer . valueOf ( replyString . split ( " " ) [ 1 ] . replaceAll ( "[\r\n]" , "" ) ) ; } return result ; } | Get size of the FTP file . |
36,534 | public static String executeCommandOnFTPServer ( String hostName , Integer port , String userName , String password , String command , String commandArgs ) { String result = null ; if ( StringUtils . isNotBlank ( command ) ) { FTPClient ftpClient = new FTPClient ( ) ; String errorMessage = "Unable to connect and execute %s command with argumments '%s' for FTP server '%s'." ; try { connectAndLoginOnFTPServer ( ftpClient , hostName , port , userName , password ) ; if ( StringUtils . isBlank ( commandArgs ) ) { ftpClient . sendCommand ( command ) ; } else { ftpClient . sendCommand ( command , commandArgs ) ; } validatResponse ( ftpClient ) ; result = ftpClient . getReplyString ( ) ; } catch ( IOException ex ) { throw new RuntimeException ( String . format ( errorMessage , command , commandArgs , hostName ) , ex ) ; } finally { disconnectAndLogoutFromFTPServer ( ftpClient , hostName ) ; } } return result ; } | Execute command with supplied arguments on the FTP server . |
36,535 | public static String uploadFileToFTPServer ( String hostName , Integer port , String userName , String password , String localFileFullName , String remotePath ) { String result = null ; FTPClient ftpClient = new FTPClient ( ) ; String errorMessage = "Unable to upload file '%s' for FTP server '%s'." ; InputStream inputStream = null ; try { connectAndLoginOnFTPServer ( ftpClient , hostName , port , userName , password ) ; ftpClient . setFileType ( FTP . BINARY_FILE_TYPE ) ; ftpClient . enterLocalPassiveMode ( ) ; File localFile = new File ( localFileFullName ) ; String remoteFile = remotePath + FilenameUtils . getName ( localFileFullName ) ; inputStream = new FileInputStream ( localFile ) ; boolean uploadFinished = ftpClient . storeFile ( remoteFile , inputStream ) ; if ( uploadFinished ) { result = String . format ( "File '%s' successfully uploaded" , localFileFullName ) ; } else { result = String . format ( "Failed upload '%s' file to FTP server. Got reply: %s" , localFileFullName , ftpClient . getReplyString ( ) ) ; } } catch ( IOException ex ) { throw new RuntimeException ( String . format ( errorMessage , remotePath , hostName ) , ex ) ; } finally { closeInputStream ( inputStream ) ; disconnectAndLogoutFromFTPServer ( ftpClient , hostName ) ; } return result ; } | Upload a given file to FTP server . |
36,536 | public static String loadFileFromFTPServer ( String hostName , Integer port , String userName , String password , String filePath , int numberOfLines ) { String result = null ; FTPClient ftpClient = new FTPClient ( ) ; InputStream inputStream = null ; String errorMessage = "Unable to connect and download file '%s' from FTP server '%s'." ; try { connectAndLoginOnFTPServer ( ftpClient , hostName , port , userName , password ) ; ftpClient . enterLocalPassiveMode ( ) ; inputStream = ftpClient . retrieveFileStream ( filePath ) ; validatResponse ( ftpClient ) ; result = FileUtil . streamToString ( inputStream , filePath , numberOfLines ) ; ftpClient . completePendingCommand ( ) ; } catch ( IOException ex ) { throw new RuntimeException ( String . format ( errorMessage , filePath , hostName ) , ex ) ; } finally { closeInputStream ( inputStream ) ; disconnectAndLogoutFromFTPServer ( ftpClient , hostName ) ; } return result ; } | Reads content of file on from FTP server to String . |
36,537 | public static void connectAndLoginOnFTPServer ( FTPClient ftpClient , String hostName , Integer port , String userName , String password ) { try { if ( port != null && port . intValue ( ) > 0 ) { ftpClient . connect ( hostName , port ) ; } else { ftpClient . connect ( hostName ) ; } if ( ! FTPReply . isPositiveCompletion ( ftpClient . getReplyCode ( ) ) ) { throw new IOException ( String . format ( "FTP server '%s' refused connection." , hostName ) ) ; } if ( ! ftpClient . login ( userName , password ) ) { throw new IOException ( String . format ( "Unable to login to FTP server '%s'." , hostName ) ) ; } } catch ( IOException ex ) { throw new RuntimeException ( String . format ( "Unable to connect and login to FTP server '%s'. Cause: " , hostName ) , ex ) ; } } | Connect and login on given FTP server with provided credentials . |
36,538 | public static void disconnectAndLogoutFromFTPServer ( FTPClient ftpClient , String hostName ) { try { if ( ftpClient != null && ftpClient . isConnected ( ) ) { ftpClient . logout ( ) ; ftpClient . disconnect ( ) ; } } catch ( IOException e ) { throw new RuntimeException ( "Unable to logout and disconnect from : " + hostName , e ) ; } } | Disconnect and logout given FTP client . |
36,539 | public void addDerivedDates ( Map < String , Object > values ) { Map < String , Object > valuesToAdd = new HashMap < String , Object > ( ) ; for ( Map . Entry < String , Object > entry : values . entrySet ( ) ) { String key = entry . getKey ( ) ; Object object = entry . getValue ( ) ; if ( object != null ) { String stringValue = object . toString ( ) ; Matcher matcher = XML_DATE . matcher ( stringValue ) ; if ( matcher . matches ( ) ) { handleXmlMatch ( matcher , valuesToAdd , key ) ; } else { matcher = NL_DATE . matcher ( stringValue ) ; if ( matcher . matches ( ) ) { handleNLMatch ( matcher , valuesToAdd , key ) ; } } } } values . putAll ( valuesToAdd ) ; } | Adds derived values for dates in map . |
36,540 | public void setIntValueForIn ( int value , String name , Map < String , Object > map ) { setValueForIn ( Integer . valueOf ( value ) , name , map ) ; } | Stores integer value in map . |
36,541 | public void setDoubleValueForIn ( double value , String name , Map < String , Object > map ) { setValueForIn ( Double . valueOf ( value ) , name , map ) ; } | Stores double value in map . |
36,542 | public void setBooleanValueForIn ( boolean value , String name , Map < String , Object > map ) { setValueForIn ( Boolean . valueOf ( value ) , name , map ) ; } | Stores boolean value in map . |
36,543 | public void addValueToIn ( Object value , String name , Map < String , Object > map ) { getMapHelper ( ) . addValueToIn ( value , name , map ) ; } | Adds value to a list map . |
36,544 | public void copyValuesFromTo ( Map < String , Object > otherMap , Map < String , Object > map ) { getMapHelper ( ) . copyValuesFromTo ( otherMap , map ) ; } | Adds all values in the supplied map to the current values . |
36,545 | public String getXPath ( NamespaceContext context , String xml , String xPathExpr ) { return ( String ) evaluateXpath ( context , xml , xPathExpr , null ) ; } | Evaluates xPathExpr against xml returning single match . |
36,546 | public List < String > getAllXPath ( NamespaceContext context , String xml , String xPathExpr ) { List < String > result = null ; NodeList nodes = ( NodeList ) evaluateXpath ( context , xml , xPathExpr , XPathConstants . NODESET ) ; if ( nodes != null ) { result = new ArrayList < String > ( nodes . getLength ( ) ) ; for ( int i = 0 ; i < nodes . getLength ( ) ; i ++ ) { result . add ( nodes . item ( i ) . getNodeValue ( ) ) ; } } return result ; } | Evaluates xPathExpr against xml returning all matches . |
36,547 | public static < T > T firstNonNull ( Supplier < T > ... suppliers ) { return firstNonNull ( Supplier :: get , suppliers ) ; } | Gets first supplier s result which is not null . Suppliers are called sequentially . Once a non - null result is obtained the remaining suppliers are not called . |
36,548 | public static < T , R > R firstNonNull ( T input , Function < T , R > function , Function < T , R > ... functions ) { return firstNonNull ( f -> f . apply ( input ) , Stream . concat ( Stream . of ( function ) , Stream . of ( functions ) ) ) ; } | Gets first result of set of function which is not null . |
36,549 | public static < T , R > R firstNonNull ( Function < T , R > function , Stream < T > values ) { return values . map ( function ) . filter ( Objects :: nonNull ) . findFirst ( ) . orElse ( null ) ; } | Gets first element which is not null . |
36,550 | public static XPathCheckResult parse ( String value ) { XPathCheckResult parsed = new XPathCheckResult ( ) ; parsed . result = value ; return parsed ; } | Parse method to allow Fitnesse to determine expected values . |
36,551 | public void addMisMatch ( String name , String expected , String actual ) { result = "NOK" ; Mismatch mismatch = new Mismatch ( ) ; mismatch . name = name ; mismatch . expected = expected ; mismatch . actual = actual ; mismatches . add ( mismatch ) ; } | Adds a mismatch to this result . |
36,552 | public Properties parsePropertiesString ( String propertiesAsString ) { final Properties p = new Properties ( ) ; try ( StringReader reader = new StringReader ( propertiesAsString ) ) { p . load ( reader ) ; } catch ( IOException e ) { throw new IllegalArgumentException ( "Unable to parse .properties: " + propertiesAsString , e ) ; } return p ; } | Converts String to Properties . |
36,553 | public Map < String , Object > convertPropertiesToMap ( Properties properties ) { return properties . entrySet ( ) . stream ( ) . collect ( toLinkedMap ( e -> e . getKey ( ) . toString ( ) , e -> e . getValue ( ) ) ) ; } | Converts Properties to Map |
36,554 | protected String createFile ( String dir , String fileName , byte [ ] content ) { String baseName = FilenameUtils . getBaseName ( fileName ) ; String ext = FilenameUtils . getExtension ( fileName ) ; String downloadedFile = FileUtil . saveToFile ( dir + baseName , ext , content ) ; return linkToFile ( downloadedFile ) ; } | Creates a file using the supplied content . |
36,555 | protected String linkToFile ( File f ) { String url = getWikiUrl ( f . getAbsolutePath ( ) ) ; if ( url == null ) { url = f . toURI ( ) . toString ( ) ; } return String . format ( "<a href=\"%s\" target=\"_blank\">%s</a>" , url , f . getName ( ) ) ; } | Creates a wiki link to a file . |
36,556 | public void add ( String prefix , String uri ) { if ( uri == null ) { namespaces . remove ( prefix ) ; } else { if ( namespaces . containsKey ( prefix ) ) { String currentUri = namespaces . get ( prefix ) ; if ( ! currentUri . equals ( uri ) ) { throw new FitFailureException ( String . format ( "The prefix %s is already mapped to %s" , prefix , currentUri ) ) ; } } else { namespaces . put ( prefix , uri ) ; } } } | Adds registration for prefix . |
36,557 | public String html ( String htmlSource ) { String cleanSource = htmlCleaner . cleanupPreFormatted ( htmlSource ) ; return "<div>" + StringEscapeUtils . unescapeHtml4 ( cleanSource ) + "</div>" ; } | Unescapes supplied HTML content so it can be rendered inside a wiki page . |
36,558 | protected String generateResultXml ( String testName , Throwable exception , double executionTime ) { int errors = 0 ; int failures = 0 ; String failureXml = "" ; if ( exception != null ) { failureXml = "<failure type=\"" + exception . getClass ( ) . getName ( ) + "\" message=\"" + getMessage ( exception ) + "\"></failure>" ; if ( exception instanceof AssertionError ) failures = 1 ; else errors = 1 ; } return "<testsuite errors=\"" + errors + "\" skipped=\"0\" tests=\"1\" time=\"" + executionTime + "\" failures=\"" + failures + "\" name=\"" + testName + "\">" + "<properties></properties>" + "<testcase classname=\"" + testName + "\" time=\"" + executionTime + "\" name=\"" + testName + "\">" + failureXml + "</testcase>" + "</testsuite>" ; } | Creates XML string describing test outcome . |
36,559 | protected void writeResult ( String testName , String resultXml ) throws IOException { String finalPath = getXmlFileName ( testName ) ; Writer fw = null ; try { fw = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( finalPath ) , "UTF-8" ) ) ; fw . write ( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" ) ; fw . write ( resultXml ) ; } finally { if ( fw != null ) { fw . close ( ) ; } } } | Writes XML result to disk . |
36,560 | public static String getData ( String dataUrl ) { int indexOfComma = dataUrl . indexOf ( ',' ) ; return dataUrl . substring ( indexOfComma + 1 ) ; } | Gets data embedded in data url . |
36,561 | public Object getJsonPath ( String json , String jsonPath ) { if ( ! JsonPath . isPathDefinite ( jsonPath ) ) { throw new RuntimeException ( jsonPath + " returns a list of results, not a single." ) ; } return parseJson ( json ) . read ( jsonPath ) ; } | Evaluates a JsonPath expression returning a single element . |
36,562 | public List < Object > getAllJsonPath ( String json , String jsonPath ) { List < Object > result ; if ( JsonPath . isPathDefinite ( jsonPath ) ) { Object val = getJsonPath ( json , jsonPath ) ; if ( val == null ) { result = Collections . emptyList ( ) ; } else { result = Collections . singletonList ( val ) ; } } else { result = parseJson ( json ) . read ( jsonPath ) ; } return result ; } | Evaluates a JsonPath expression returning a multiple elements . |
36,563 | public String differenceBetweenAnd ( String first , String second ) { Formatter whitespaceFormatter = new Formatter ( ) { public String format ( String value ) { return ensureWhitespaceVisible ( value ) ; } } ; return getDifferencesHtml ( first , second , whitespaceFormatter ) ; } | Determines difference between two strings . |
36,564 | public String differenceBetweenExplicitWhitespaceAnd ( String first , String second ) { Formatter whitespaceFormatter = new Formatter ( ) { public String format ( String value ) { return explicitWhitespace ( value ) ; } } ; return getDifferencesHtml ( first , second , whitespaceFormatter ) ; } | Determines difference between two strings visualizing various forms of whitespace . |
36,565 | public String differenceBetweenIgnoreWhitespaceAnd ( String first , String second ) { String cleanFirst = allWhitespaceToSingleSpace ( first ) ; String cleanSecond = allWhitespaceToSingleSpace ( second ) ; String cleanDiff = differenceBetweenAnd ( cleanFirst , cleanSecond ) ; if ( cleanDiff != null ) { if ( ( "<div>" + cleanFirst + "</div>" ) . equals ( cleanDiff ) ) { cleanDiff = "<div>" + first + "</div>" ; } else if ( cleanFirst != null && cleanFirst . equals ( cleanDiff ) ) { cleanDiff = first ; } } return cleanDiff ; } | Determines difference between two strings ignoring whitespace changes . |
36,566 | protected static void registerNs ( String prefix , String url ) { Environment . getInstance ( ) . registerNamespace ( prefix , url ) ; } | Registers a namespace in the environment so the prefix can be used in XPath expressions . |
36,567 | protected Response callServiceImpl ( String urlSymbolKey , String soapAction ) { String url = getSymbol ( urlSymbolKey ) . toString ( ) ; Response response = getEnvironment ( ) . createInstance ( getResponseClass ( ) ) ; callSoapService ( url , getTemplateName ( ) , soapAction , response ) ; return response ; } | Creates response calls service using configured template and current row s values and calls SOAP service . |
36,568 | protected XmlHttpResponse callCheckServiceImpl ( String urlSymbolKey , String soapAction ) { String url = getSymbol ( urlSymbolKey ) . toString ( ) ; XmlHttpResponse response = getEnvironment ( ) . createInstance ( getCheckResponseClass ( ) ) ; callSoapService ( url , getCheckTemplateName ( ) , soapAction , response ) ; return response ; } | Creates check response calls service using configured check template and current row s values and calls SOAP service . |
36,569 | protected void callSoapService ( String url , String templateName , String soapAction , XmlHttpResponse response ) { Map < String , Object > headers = soapAction != null ? Collections . singletonMap ( "SOAPAction" , ( Object ) soapAction ) : null ; getEnvironment ( ) . callService ( url , templateName , getCurrentRowValues ( ) , response , headers ) ; } | Calls SOAP service using template and current row s values . |
36,570 | public String getUrl ( String htmlLink ) { String result = htmlLink ; if ( htmlLink != null ) { Matcher linkMatcher = LINKPATTERN . matcher ( htmlLink ) ; Matcher imgMatcher = IMAGEPATTERN . matcher ( htmlLink ) ; if ( linkMatcher . matches ( ) ) { String href = linkMatcher . group ( 2 ) ; href = StringEscapeUtils . unescapeHtml4 ( href ) ; result = href + linkMatcher . group ( 4 ) ; } else if ( imgMatcher . matches ( ) ) { String src = imgMatcher . group ( 2 ) ; result = StringEscapeUtils . unescapeHtml4 ( src ) ; } } return result ; } | Gets a URL from a wiki page value . |
36,571 | public static String getXPathForRowByValueInOtherColumn ( String selectIndex , String value ) { return String . format ( "/tr[td[%1$s]/descendant-or-self::text()[normalized(.)='%2$s']]" , selectIndex , value ) ; } | Creates an XPath expression - segment that will find a row selecting the row based on the text in a specific column . |
36,572 | public static String getXPathForColumnIndex ( String columnName ) { String headerXPath = getXPathForHeaderCellWithText ( columnName ) ; return String . format ( "count(ancestor::table[1]//tr/%1$s/preceding-sibling::th)+1" , headerXPath ) ; } | Creates an XPath expression that will determine for a row which index to use to select the cell in the column with the supplied header text value . |
36,573 | public static String getXPathForHeaderRowByHeaders ( String columnName , String ... extraColumnNames ) { String allHeadersPresent ; if ( extraColumnNames != null && extraColumnNames . length > 0 ) { int extraCount = extraColumnNames . length ; String [ ] columnNames = new String [ extraCount + 1 ] ; columnNames [ 0 ] = columnName ; System . arraycopy ( extraColumnNames , 0 , columnNames , 1 , extraCount ) ; allHeadersPresent = Stream . of ( columnNames ) . map ( GridBy :: getXPathForHeaderCellWithText ) . collect ( Collectors . joining ( " and " ) ) ; } else { allHeadersPresent = getXPathForHeaderCellWithText ( columnName ) ; } return String . format ( "/tr[%1$s]" , allHeadersPresent ) ; } | Creates an XPath expression that will find a header row selecting the row based on the header texts present . |
36,574 | private < T > T doWithLock ( LockCallback < T > callback ) throws JobPersistenceException { return doWithLock ( callback , null ) ; } | Perform Redis operations while possessing lock |
36,575 | private < T > T doWithLock ( LockCallback < T > callback , String errorMessage ) throws JobPersistenceException { JedisCommands jedis = null ; try { jedis = getResource ( ) ; try { storage . waitForLock ( jedis ) ; return callback . doWithLock ( jedis ) ; } catch ( ObjectAlreadyExistsException e ) { throw e ; } catch ( Exception e ) { if ( errorMessage == null || errorMessage . isEmpty ( ) ) { errorMessage = "Job storage error." ; } throw new JobPersistenceException ( errorMessage , e ) ; } finally { storage . unlock ( jedis ) ; } } finally { if ( jedis != null && jedis instanceof Jedis ) { ( ( Jedis ) jedis ) . close ( ) ; } } } | Perform a redis operation while lock is acquired |
36,576 | public boolean lock ( T jedis ) { UUID lockId = UUID . randomUUID ( ) ; final String setResponse = jedis . set ( redisSchema . lockKey ( ) , lockId . toString ( ) , "NX" , "PX" , lockTimeout ) ; boolean lockAcquired = ! isNullOrEmpty ( setResponse ) && setResponse . equals ( "OK" ) ; if ( lockAcquired ) { lockValue = lockId ; } return lockAcquired ; } | Attempt to acquire a lock |
36,577 | public void waitForLock ( T jedis ) { while ( ! lock ( jedis ) ) { try { logger . debug ( "Waiting for Redis lock." ) ; Thread . sleep ( randomInt ( 75 , 125 ) ) ; } catch ( InterruptedException e ) { logger . error ( "Interrupted while waiting for lock." , e ) ; } } } | Attempt to acquire lock . If lock cannot be acquired wait until lock is successfully acquired . |
36,578 | public boolean unlock ( T jedis ) { final String currentLock = jedis . get ( redisSchema . lockKey ( ) ) ; if ( ! isNullOrEmpty ( currentLock ) && UUID . fromString ( currentLock ) . equals ( lockValue ) ) { jedis . del ( redisSchema . lockKey ( ) ) ; return true ; } return false ; } | Attempt to remove lock |
36,579 | public JobDetail retrieveJob ( JobKey jobKey , T jedis ) throws JobPersistenceException , ClassNotFoundException { final String jobHashKey = redisSchema . jobHashKey ( jobKey ) ; final String jobDataMapHashKey = redisSchema . jobDataMapHashKey ( jobKey ) ; final Map < String , String > jobDetailMap = jedis . hgetAll ( jobHashKey ) ; if ( jobDetailMap == null || jobDetailMap . size ( ) == 0 ) { return null ; } JobDetailImpl jobDetail = mapper . convertValue ( jobDetailMap , JobDetailImpl . class ) ; jobDetail . setKey ( jobKey ) ; final Map < String , String > jobData = jedis . hgetAll ( jobDataMapHashKey ) ; if ( jobData != null && ! jobData . isEmpty ( ) ) { JobDataMap jobDataMap = new JobDataMap ( ) ; jobDataMap . putAll ( jobData ) ; jobDetail . setJobDataMap ( jobDataMap ) ; } return jobDetail ; } | Retrieve a job from redis |
36,580 | public OperableTrigger retrieveTrigger ( TriggerKey triggerKey , T jedis ) throws JobPersistenceException { final String triggerHashKey = redisSchema . triggerHashKey ( triggerKey ) ; Map < String , String > triggerMap = jedis . hgetAll ( triggerHashKey ) ; if ( triggerMap == null || triggerMap . isEmpty ( ) ) { logger . debug ( String . format ( "No trigger exists for key %s" , triggerHashKey ) ) ; return null ; } Class triggerClass ; try { triggerClass = Class . forName ( triggerMap . get ( TRIGGER_CLASS ) ) ; } catch ( ClassNotFoundException e ) { throw new JobPersistenceException ( String . format ( "Could not find class %s for trigger." , triggerMap . get ( TRIGGER_CLASS ) ) , e ) ; } triggerMap . remove ( TRIGGER_CLASS ) ; OperableTrigger operableTrigger = ( OperableTrigger ) mapper . convertValue ( triggerMap , triggerClass ) ; operableTrigger . setFireInstanceId ( schedulerInstanceId + "-" + operableTrigger . getKey ( ) + "-" + operableTrigger . getStartTime ( ) . getTime ( ) ) ; final Map < String , String > jobData = jedis . hgetAll ( redisSchema . triggerDataMapHashKey ( triggerKey ) ) ; if ( jobData != null && ! jobData . isEmpty ( ) ) { JobDataMap jobDataMap = new JobDataMap ( ) ; jobDataMap . putAll ( jobData ) ; operableTrigger . setJobDataMap ( jobDataMap ) ; } return operableTrigger ; } | Retrieve a trigger from Redis |
36,581 | public List < OperableTrigger > getTriggersForJob ( JobKey jobKey , T jedis ) throws JobPersistenceException { final String jobTriggerSetKey = redisSchema . jobTriggersSetKey ( jobKey ) ; final Set < String > triggerHashKeys = jedis . smembers ( jobTriggerSetKey ) ; List < OperableTrigger > triggers = new ArrayList < > ( ) ; for ( String triggerHashKey : triggerHashKeys ) { triggers . add ( retrieveTrigger ( redisSchema . triggerKey ( triggerHashKey ) , jedis ) ) ; } return triggers ; } | Retrieve triggers associated with the given job |
36,582 | public boolean setTriggerState ( final RedisTriggerState state , final double score , final String triggerHashKey , T jedis ) throws JobPersistenceException { boolean success = false ; if ( state != null ) { unsetTriggerState ( triggerHashKey , jedis ) ; success = jedis . zadd ( redisSchema . triggerStateKey ( state ) , score , triggerHashKey ) == 1 ; } return success ; } | Set a trigger state by adding the trigger to the relevant sorted set using its next fire time as the score . |
36,583 | public boolean checkExists ( JobKey jobKey , T jedis ) { return jedis . exists ( redisSchema . jobHashKey ( jobKey ) ) ; } | Check if the job identified by the given key exists in storage |
36,584 | public boolean checkExists ( TriggerKey triggerKey , T jedis ) { return jedis . exists ( redisSchema . triggerHashKey ( triggerKey ) ) ; } | Check if the trigger identified by the given key exists |
36,585 | public Calendar retrieveCalendar ( String name , T jedis ) throws JobPersistenceException { final String calendarHashKey = redisSchema . calendarHashKey ( name ) ; Calendar calendar ; try { final Map < String , String > calendarMap = jedis . hgetAll ( calendarHashKey ) ; if ( calendarMap == null || calendarMap . isEmpty ( ) ) { return null ; } final Class < ? > calendarClass = Class . forName ( calendarMap . get ( CALENDAR_CLASS ) ) ; calendar = ( Calendar ) mapper . readValue ( calendarMap . get ( CALENDAR_JSON ) , calendarClass ) ; } catch ( ClassNotFoundException e ) { logger . error ( "Class not found for calendar " + name ) ; throw new JobPersistenceException ( e . getMessage ( ) , e ) ; } catch ( IOException e ) { logger . error ( "Unable to deserialize calendar json for calendar " + name ) ; throw new JobPersistenceException ( e . getMessage ( ) , e ) ; } return calendar ; } | Retrieve a calendar |
36,586 | public void pauseJob ( JobKey jobKey , T jedis ) throws JobPersistenceException { for ( OperableTrigger trigger : getTriggersForJob ( jobKey , jedis ) ) { pauseTrigger ( trigger . getKey ( ) , jedis ) ; } } | Pause a job by pausing all of its triggers |
36,587 | public Set < String > getPausedTriggerGroups ( T jedis ) { final Set < String > triggerGroupSetKeys = jedis . smembers ( redisSchema . pausedTriggerGroupsSet ( ) ) ; Set < String > names = new HashSet < > ( triggerGroupSetKeys . size ( ) ) ; for ( String triggerGroupSetKey : triggerGroupSetKeys ) { names . add ( redisSchema . triggerGroup ( triggerGroupSetKey ) ) ; } return names ; } | Retrieve all currently paused trigger groups |
36,588 | protected boolean isActiveInstance ( String instanceId , T jedis ) { boolean isActive = ( System . currentTimeMillis ( ) - getLastInstanceActiveTime ( instanceId , jedis ) < clusterCheckInterval ) ; if ( ! isActive ) { removeLastInstanceActiveTime ( instanceId , jedis ) ; } return isActive ; } | Determine if the instance with the given id has been active in the last 4 minutes |
36,589 | protected void releaseOrphanedTriggers ( RedisTriggerState currentState , RedisTriggerState newState , T jedis ) throws JobPersistenceException { for ( Tuple triggerTuple : jedis . zrangeWithScores ( redisSchema . triggerStateKey ( currentState ) , 0 , - 1 ) ) { final String lockId = jedis . get ( redisSchema . triggerLockKey ( redisSchema . triggerKey ( triggerTuple . getElement ( ) ) ) ) ; if ( isNullOrEmpty ( lockId ) || ! isActiveInstance ( lockId , jedis ) ) { logger . debug ( String . format ( "Changing state of orphaned trigger %s from %s to %s." , triggerTuple . getElement ( ) , currentState , newState ) ) ; setTriggerState ( newState , triggerTuple . getScore ( ) , triggerTuple . getElement ( ) , jedis ) ; } } } | Release triggers from the given current state to the new state if its locking scheduler has not registered as alive in the last 10 minutes |
36,590 | protected void releaseTriggersCron ( T jedis ) throws JobPersistenceException { if ( isTriggerLockTimeoutExceeded ( jedis ) || ! isActiveInstance ( schedulerInstanceId , jedis ) ) { releaseOrphanedTriggers ( RedisTriggerState . ACQUIRED , RedisTriggerState . WAITING , jedis ) ; releaseOrphanedTriggers ( RedisTriggerState . BLOCKED , RedisTriggerState . WAITING , jedis ) ; releaseOrphanedTriggers ( RedisTriggerState . PAUSED_BLOCKED , RedisTriggerState . PAUSED , jedis ) ; settLastTriggerReleaseTime ( System . currentTimeMillis ( ) , jedis ) ; } } | Release triggers currently held by schedulers which have ceased to function |
36,591 | protected void settLastTriggerReleaseTime ( long time , T jedis ) { jedis . set ( redisSchema . lastTriggerReleaseTime ( ) , Long . toString ( time ) ) ; } | Set the last time at which orphaned triggers were released |
36,592 | protected void setLastInstanceActiveTime ( String instanceId , long time , T jedis ) { jedis . hset ( redisSchema . lastInstanceActiveTime ( ) , instanceId , Long . toString ( time ) ) ; } | Set the last time at which this instance was active |
36,593 | protected void removeLastInstanceActiveTime ( String instanceId , T jedis ) { jedis . hdel ( redisSchema . lastInstanceActiveTime ( ) , instanceId ) ; } | Remove the given instance from the hash |
36,594 | protected boolean isBlockedJob ( String jobHashKey , T jedis ) { JobKey jobKey = redisSchema . jobKey ( jobHashKey ) ; return jedis . sismember ( redisSchema . blockedJobsSet ( ) , jobHashKey ) && isActiveInstance ( jedis . get ( redisSchema . jobBlockedKey ( jobKey ) ) , jedis ) ; } | Determine if the given job is blocked by an active instance |
36,595 | protected boolean lockTrigger ( TriggerKey triggerKey , T jedis ) { return jedis . set ( redisSchema . triggerLockKey ( triggerKey ) , schedulerInstanceId , "NX" , "PX" , TRIGGER_LOCK_TIMEOUT ) . equals ( "OK" ) ; } | Lock the trigger with the given key to the current jobstore instance |
36,596 | protected List < String > split ( final String string ) { if ( null != prefix ) { return Arrays . asList ( string . substring ( prefix . length ( ) ) . split ( delimiter ) ) ; } else { return Arrays . asList ( string . split ( delimiter ) ) ; } } | Split a string on the configured delimiter |
36,597 | public void storeTrigger ( OperableTrigger trigger , boolean replaceExisting , JedisCluster jedis ) throws JobPersistenceException { final String triggerHashKey = redisSchema . triggerHashKey ( trigger . getKey ( ) ) ; final String triggerGroupSetKey = redisSchema . triggerGroupSetKey ( trigger . getKey ( ) ) ; final String jobTriggerSetKey = redisSchema . jobTriggersSetKey ( trigger . getJobKey ( ) ) ; if ( ! ( trigger instanceof SimpleTrigger ) && ! ( trigger instanceof CronTrigger ) ) { throw new UnsupportedOperationException ( "Only SimpleTrigger and CronTrigger are supported." ) ; } final boolean exists = jedis . exists ( triggerHashKey ) ; if ( exists && ! replaceExisting ) { throw new ObjectAlreadyExistsException ( trigger ) ; } Map < String , String > triggerMap = mapper . convertValue ( trigger , new TypeReference < HashMap < String , String > > ( ) { } ) ; triggerMap . put ( TRIGGER_CLASS , trigger . getClass ( ) . getName ( ) ) ; jedis . hmset ( triggerHashKey , triggerMap ) ; jedis . sadd ( redisSchema . triggersSet ( ) , triggerHashKey ) ; jedis . sadd ( redisSchema . triggerGroupsSet ( ) , triggerGroupSetKey ) ; jedis . sadd ( triggerGroupSetKey , triggerHashKey ) ; jedis . sadd ( jobTriggerSetKey , triggerHashKey ) ; if ( trigger . getCalendarName ( ) != null && ! trigger . getCalendarName ( ) . isEmpty ( ) ) { final String calendarTriggersSetKey = redisSchema . calendarTriggersSetKey ( trigger . getCalendarName ( ) ) ; jedis . sadd ( calendarTriggersSetKey , triggerHashKey ) ; } if ( trigger . getJobDataMap ( ) != null && ! trigger . getJobDataMap ( ) . isEmpty ( ) ) { final String triggerDataMapHashKey = redisSchema . triggerDataMapHashKey ( trigger . getKey ( ) ) ; jedis . hmset ( triggerDataMapHashKey , getStringDataMap ( trigger . getJobDataMap ( ) ) ) ; } if ( exists ) { unsetTriggerState ( triggerHashKey , jedis ) ; } Boolean triggerPausedResponse = jedis . sismember ( redisSchema . pausedTriggerGroupsSet ( ) , triggerGroupSetKey ) ; Boolean jobPausedResponse = jedis . sismember ( redisSchema . pausedJobGroupsSet ( ) , redisSchema . jobGroupSetKey ( trigger . getJobKey ( ) ) ) ; if ( triggerPausedResponse || jobPausedResponse ) { final long nextFireTime = trigger . getNextFireTime ( ) != null ? trigger . getNextFireTime ( ) . getTime ( ) : - 1 ; final String jobHashKey = redisSchema . jobHashKey ( trigger . getJobKey ( ) ) ; if ( isBlockedJob ( jobHashKey , jedis ) ) { setTriggerState ( RedisTriggerState . PAUSED_BLOCKED , ( double ) nextFireTime , triggerHashKey , jedis ) ; } else { setTriggerState ( RedisTriggerState . PAUSED , ( double ) nextFireTime , triggerHashKey , jedis ) ; } } else if ( trigger . getNextFireTime ( ) != null ) { setTriggerState ( RedisTriggerState . WAITING , ( double ) trigger . getNextFireTime ( ) . getTime ( ) , triggerHashKey , jedis ) ; } } | Store a trigger in redis |
36,598 | public boolean removeJob ( JobKey jobKey , Jedis jedis ) throws JobPersistenceException { final String jobHashKey = redisSchema . jobHashKey ( jobKey ) ; final String jobBlockedKey = redisSchema . jobBlockedKey ( jobKey ) ; final String jobDataMapHashKey = redisSchema . jobDataMapHashKey ( jobKey ) ; final String jobGroupSetKey = redisSchema . jobGroupSetKey ( jobKey ) ; final String jobTriggerSetKey = redisSchema . jobTriggersSetKey ( jobKey ) ; Pipeline pipe = jedis . pipelined ( ) ; Response < Long > delJobHashKeyResponse = pipe . del ( jobHashKey ) ; pipe . del ( jobBlockedKey ) ; pipe . del ( jobDataMapHashKey ) ; pipe . srem ( redisSchema . jobsSet ( ) , jobHashKey ) ; pipe . srem ( redisSchema . blockedJobsSet ( ) , jobHashKey ) ; pipe . srem ( jobGroupSetKey , jobHashKey ) ; Response < Set < String > > jobTriggerSetResponse = pipe . smembers ( jobTriggerSetKey ) ; pipe . del ( jobTriggerSetKey ) ; Response < Long > jobGroupSetSizeResponse = pipe . scard ( jobGroupSetKey ) ; pipe . sync ( ) ; if ( jobGroupSetSizeResponse . get ( ) == 0 ) { jedis . srem ( redisSchema . jobGroupsSet ( ) , jobGroupSetKey ) ; } pipe = jedis . pipelined ( ) ; for ( String triggerHashKey : jobTriggerSetResponse . get ( ) ) { final TriggerKey triggerKey = redisSchema . triggerKey ( triggerHashKey ) ; final String triggerGroupSetKey = redisSchema . triggerGroupSetKey ( triggerKey ) ; unsetTriggerState ( triggerHashKey , jedis ) ; pipe . srem ( redisSchema . triggersSet ( ) , triggerHashKey ) ; pipe . srem ( redisSchema . triggerGroupsSet ( ) , triggerGroupSetKey ) ; pipe . srem ( triggerGroupSetKey , triggerHashKey ) ; pipe . del ( triggerHashKey ) ; } pipe . sync ( ) ; return delJobHashKeyResponse . get ( ) == 1 ; } | Remove the given job from Redis |
36,599 | @ SuppressWarnings ( "unchecked" ) public void storeJob ( JobDetail jobDetail , boolean replaceExisting , Jedis jedis ) throws ObjectAlreadyExistsException { final String jobHashKey = redisSchema . jobHashKey ( jobDetail . getKey ( ) ) ; final String jobDataMapHashKey = redisSchema . jobDataMapHashKey ( jobDetail . getKey ( ) ) ; final String jobGroupSetKey = redisSchema . jobGroupSetKey ( jobDetail . getKey ( ) ) ; if ( ! replaceExisting && jedis . exists ( jobHashKey ) ) { throw new ObjectAlreadyExistsException ( jobDetail ) ; } Pipeline pipe = jedis . pipelined ( ) ; pipe . hmset ( jobHashKey , ( Map < String , String > ) mapper . convertValue ( jobDetail , new TypeReference < HashMap < String , String > > ( ) { } ) ) ; if ( jobDetail . getJobDataMap ( ) != null && ! jobDetail . getJobDataMap ( ) . isEmpty ( ) ) { pipe . hmset ( jobDataMapHashKey , getStringDataMap ( jobDetail . getJobDataMap ( ) ) ) ; } pipe . sadd ( redisSchema . jobsSet ( ) , jobHashKey ) ; pipe . sadd ( redisSchema . jobGroupsSet ( ) , jobGroupSetKey ) ; pipe . sadd ( jobGroupSetKey , jobHashKey ) ; pipe . sync ( ) ; } | Store a job in Redis |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.