idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
32,900 | public static String constructAbsoluteUrl ( String theBase , String theEndpoint ) { if ( theEndpoint == null ) { return null ; } if ( isAbsolute ( theEndpoint ) ) { return theEndpoint ; } if ( theBase == null ) { return theEndpoint ; } try { return new URL ( new URL ( theBase ) , theEndpoint ) . toString ( ) ; } catch ... | Resolve a relative URL - THIS METHOD WILL NOT FAIL but will log a warning and return theEndpoint if the input is invalid . |
32,901 | public static String sanitizeUrlPart ( String theString ) { if ( theString == null ) { return null ; } boolean needsSanitization = isNeedsSanitization ( theString ) ; if ( needsSanitization ) { StringBuilder buffer = new StringBuilder ( theString . length ( ) + 10 ) ; for ( int j = 0 ; j < theString . length ( ) ; j ++... | This method specifically HTML - encodes the " ; and < ; characters in order to prevent injection attacks |
32,902 | public TokenOrListParam add ( String theSystem , String theValue ) { add ( new TokenParam ( theSystem , theValue ) ) ; return this ; } | Add a new token to this list |
32,903 | private static boolean isAvailable ( int thePort ) { ourLog . info ( "Testing a bind on thePort {}" , thePort ) ; try ( ServerSocket ss = new ServerSocket ( ) ) { ss . setReuseAddress ( true ) ; ss . bind ( new InetSocketAddress ( "0.0.0.0" , thePort ) ) ; try ( DatagramSocket ds = new DatagramSocket ( ) ) { ds . setRe... | This method checks if we are able to bind a given port to both 0 . 0 . 0 . 0 and localhost in order to be sure it s truly available . |
32,904 | public List < RuntimeSearchParam > getSearchParamsForCompartmentName ( String theCompartmentName ) { validateSealed ( ) ; List < RuntimeSearchParam > retVal = myCompartmentNameToSearchParams . get ( theCompartmentName ) ; if ( retVal == null ) { return Collections . emptyList ( ) ; } return retVal ; } | Will not return null |
32,905 | public Resource parse ( InputStream input ) throws IOException , FHIRFormatError { try { XmlPullParser xpp = loadXml ( input ) ; return parse ( xpp ) ; } catch ( XmlPullParserException e ) { throw new FHIRFormatError ( e . getMessage ( ) , e ) ; } } | Parse content that is known to be a resource |
32,906 | public Resource parse ( XmlPullParser xpp ) throws IOException , FHIRFormatError , XmlPullParserException { if ( xpp . getNamespace ( ) == null ) throw new FHIRFormatError ( "This does not appear to be a FHIR resource (no namespace '" + xpp . getNamespace ( ) + "') (@ /) " + Integer . toString ( xpp . getEventType ( ) ... | parse xml that is known to be a resource and that is already being read by an XML Pull Parser This is if a resource is in a bigger piece of XML . |
32,907 | private List < Element > findQuestionAnswers ( Element questionnaireResponse , String question ) { List < Element > retVal = new ArrayList < > ( ) ; List < Element > items = questionnaireResponse . getChildren ( ITEM_ELEMENT ) ; for ( Element next : items ) { if ( hasLinkId ( next , question ) ) { List < Element > answ... | Recursively look for answers to questions with the given link id |
32,908 | protected void sendNotification ( ResourceDeliveryMessage theMsg ) { Map < String , List < String > > params = new HashMap < > ( ) ; List < Header > headers = new ArrayList < > ( ) ; if ( theMsg . getSubscription ( ) . getHeaders ( ) != null ) { theMsg . getSubscription ( ) . getHeaders ( ) . stream ( ) . filter ( Obje... | Sends a POST notification without a payload |
32,909 | private List < BaseInvoker > getInvokersForPointcut ( Pointcut thePointcut ) { List < BaseInvoker > invokers ; synchronized ( myRegistryMutex ) { List < BaseInvoker > globalInvokers = myGlobalInvokers . get ( thePointcut ) ; List < BaseInvoker > anonymousInvokers = myAnonymousInvokers . get ( thePointcut ) ; List < Bas... | Returns an ordered list of invokers for the given pointcut . Note that a new and stable list is returned to .. do whatever you want with it . |
32,910 | private final List < BaseInvoker > union ( List < BaseInvoker > ... theInvokersLists ) { List < BaseInvoker > haveOne = null ; boolean haveMultiple = false ; for ( List < BaseInvoker > nextInvokerList : theInvokersLists ) { if ( nextInvokerList == null || nextInvokerList . isEmpty ( ) ) { continue ; } if ( haveOne == n... | First argument must be the global invoker list!! |
32,911 | boolean haveAppropriateParams ( Pointcut thePointcut , HookParams theParams ) { Validate . isTrue ( theParams . getParamsForType ( ) . values ( ) . size ( ) == thePointcut . getParameterTypes ( ) . size ( ) , "Wrong number of params for pointcut %s - Wanted %s but found %s" , thePointcut . name ( ) , toErrorString ( th... | Only call this when assertions are enabled it s expensive |
32,912 | public String getEstimatedTimeRemaining ( double theCompleteToDate , double theTotal ) { double millis = getMillis ( ) ; long millisRemaining = ( long ) ( ( ( theTotal / theCompleteToDate ) * millis ) - ( millis ) ) ; return formatMillis ( millisRemaining ) ; } | Given an amount of something completed so far and a total amount calculates how long it will take for something to complete |
32,913 | static private void append ( StringBuilder tgt , String pfx , int dgt , long val ) { tgt . append ( pfx ) ; if ( dgt > 1 ) { int pad = ( dgt - 1 ) ; for ( long xa = val ; xa > 9 && pad > 0 ; xa /= 10 ) { pad -- ; } for ( int xa = 0 ; xa < pad ; xa ++ ) { tgt . append ( '0' ) ; } } tgt . append ( val ) ; } | Append a right - aligned and zero - padded numeric value to a StringBuilder . |
32,914 | public static String cleanWhitespace ( String theResult ) { StringBuilder b = new StringBuilder ( ) ; boolean inWhitespace = false ; boolean betweenTags = false ; boolean lastNonWhitespaceCharWasTagEnd = false ; boolean inPre = false ; for ( int i = 0 ; i < theResult . length ( ) ; i ++ ) { char nextChar = theResult . ... | Trims the superfluous whitespace out of an HTML block |
32,915 | @ Path ( "/metadata" ) public Response conformance ( ) throws IOException { setUpPostConstruct ( ) ; Builder request = getRequest ( RequestTypeEnum . OPTIONS , RestOperationTypeEnum . METADATA ) ; IRestfulResponse response = request . build ( ) . getResponse ( ) ; response . addHeader ( Constants . HEADER_CORS_ALLOW_OR... | This method will retrieve the conformance using the http GET method |
32,916 | protected boolean shouldEncodePath ( IResource theResource , String thePath ) { if ( myDontEncodeElements != null ) { String resourceName = myContext . getResourceDefinition ( theResource ) . getName ( ) ; if ( myDontEncodeElements . stream ( ) . anyMatch ( t -> t . equalsPath ( resourceName + "." + thePath ) ) ) { ret... | Used for DSTU2 only |
32,917 | protected AllergyIntoleranceReactionComponent processAdverseReactionObservation ( Element reaction ) throws Exception { checkNoNegationOrNullFlavor ( reaction , "Adverse Reaction Observation" ) ; checkNoSubject ( reaction , "Adverse Reaction Observation" ) ; AllergyIntoleranceReactionComponent ar = new AllergyIntoleran... | this is going to be a contained resource so we aren t going to generate any narrative |
32,918 | protected IHttpRequest createHttpRequest ( String theUrl , EncodingEnum theEncoding , RequestTypeEnum theRequestType ) { IHttpClient httpClient = getRestfulClientFactory ( ) . getHttpClient ( new StringBuilder ( theUrl ) , null , null , theRequestType , myHeaders ) ; return httpClient . createGetRequest ( getContext ( ... | Create an HTTP request for the given url encoding and request - type |
32,919 | private void addNewVersion ( Patient thePatient , Long theId ) { InstantDt publishedDate ; if ( ! myIdToPatientVersions . containsKey ( theId ) ) { myIdToPatientVersions . put ( theId , new LinkedList < Patient > ( ) ) ; publishedDate = InstantDt . withCurrentTime ( ) ; } else { Patient currentPatitne = myIdToPatientVe... | Stores a new version of the patient in memory so that it can be retrieved later . |
32,920 | private void validateResource ( Patient thePatient ) { if ( thePatient . getNameFirstRep ( ) . getFamilyFirstRep ( ) . isEmpty ( ) ) { OperationOutcome outcome = new OperationOutcome ( ) ; outcome . addIssue ( ) . setSeverity ( IssueSeverityEnum . FATAL ) . setDetails ( "No family name provided, Patient resources must ... | This method just provides simple business validation for resources we are storing . |
32,921 | public static void main ( String [ ] args ) throws IOException { FhirContext ctx = FhirContext . forDstu2 ( ) ; String serverBase = "http://fhir.healthintersections.com.au/open" ; ClientInterface client = ctx . newRestfulClient ( ClientInterface . class , serverBase ) ; List < Patient > patients = client . findPatients... | The main method here will directly call an open FHIR server and retrieve a list of resources matching a given criteria then load a linked resource . |
32,922 | public static void addIssue ( FhirContext theCtx , IBaseOperationOutcome theOperationOutcome , String theSeverity , String theDetails , String theLocation , String theCode ) { IBase issue = createIssue ( theCtx , theOperationOutcome ) ; populateDetails ( theCtx , issue , theSeverity , theDetails , theLocation , theCode... | Add an issue to an OperationOutcome |
32,923 | public static boolean hasIssues ( FhirContext theCtx , IBaseOperationOutcome theOutcome ) { if ( theOutcome == null ) { return false ; } RuntimeResourceDefinition ooDef = theCtx . getResourceDefinition ( theOutcome ) ; BaseRuntimeChildDefinition issueChild = ooDef . getChildByName ( "issue" ) ; return issueChild . getA... | Returns true if the given OperationOutcome has 1 or more Operation . issue repetitions |
32,924 | public void setDivAsString ( String theString ) { XhtmlNode div ; if ( StringUtils . isNotBlank ( theString ) ) { div = new XhtmlNode ( ) ; div . setValueAsString ( theString ) ; } else { div = null ; } setDiv ( div ) ; } | Sets the value of |
32,925 | public String getStringProperty ( String pstrSection , String pstrProp ) { String strRet = null ; INIProperty objProp = null ; INISection objSec = null ; objSec = ( INISection ) this . mhmapSections . get ( pstrSection ) ; if ( objSec != null ) { objProp = objSec . getProperty ( pstrProp ) ; if ( objProp != null ) { st... | Returns the specified string property from the specified section . |
32,926 | public Integer getIntegerProperty ( String pstrSection , String pstrProp ) { Integer intRet = null ; String strVal = null ; INIProperty objProp = null ; INISection objSec = null ; objSec = ( INISection ) this . mhmapSections . get ( pstrSection ) ; if ( objSec != null ) { objProp = objSec . getProperty ( pstrProp ) ; t... | Returns the specified integer property from the specified section . |
32,927 | public Long getLongProperty ( String pstrSection , String pstrProp ) { Long lngRet = null ; String strVal = null ; INIProperty objProp = null ; INISection objSec = null ; objSec = ( INISection ) this . mhmapSections . get ( pstrSection ) ; if ( objSec != null ) { objProp = objSec . getProperty ( pstrProp ) ; try { if (... | Returns the specified long property from the specified section . |
32,928 | public Double getDoubleProperty ( String pstrSection , String pstrProp ) { Double dblRet = null ; String strVal = null ; INIProperty objProp = null ; INISection objSec = null ; objSec = ( INISection ) this . mhmapSections . get ( pstrSection ) ; if ( objSec != null ) { objProp = objSec . getProperty ( pstrProp ) ; try ... | Returns the specified double property from the specified section . |
32,929 | public void addSection ( String pstrSection , String pstrComments ) { INISection objSec = null ; objSec = ( INISection ) this . mhmapSections . get ( pstrSection ) ; if ( objSec == null ) { objSec = new INISection ( pstrSection ) ; this . mhmapSections . put ( pstrSection , objSec ) ; } objSec . setSecComments ( delRem... | Sets the comments associated with a section . |
32,930 | public void setStringProperty ( String pstrSection , String pstrProp , String pstrVal , String pstrComments ) { INISection objSec = null ; objSec = ( INISection ) this . mhmapSections . get ( pstrSection ) ; if ( objSec == null ) { objSec = new INISection ( pstrSection ) ; this . mhmapSections . put ( pstrSection , obj... | Sets the specified string property . |
32,931 | public void setBooleanProperty ( String pstrSection , String pstrProp , boolean pblnVal , String pstrComments ) { INISection objSec = null ; objSec = ( INISection ) this . mhmapSections . get ( pstrSection ) ; if ( objSec == null ) { objSec = new INISection ( pstrSection ) ; this . mhmapSections . put ( pstrSection , o... | Sets the specified boolean property . |
32,932 | public void setIntegerProperty ( String pstrSection , String pstrProp , int pintVal , String pstrComments ) { INISection objSec = null ; objSec = ( INISection ) this . mhmapSections . get ( pstrSection ) ; if ( objSec == null ) { objSec = new INISection ( pstrSection ) ; this . mhmapSections . put ( pstrSection , objSe... | Sets the specified integer property . |
32,933 | public void setLongProperty ( String pstrSection , String pstrProp , long plngVal , String pstrComments ) { INISection objSec = null ; objSec = ( INISection ) this . mhmapSections . get ( pstrSection ) ; if ( objSec == null ) { objSec = new INISection ( pstrSection ) ; this . mhmapSections . put ( pstrSection , objSec ... | Sets the specified long property . |
32,934 | public void setDoubleProperty ( String pstrSection , String pstrProp , double pdblVal , String pstrComments ) { INISection objSec = null ; objSec = ( INISection ) this . mhmapSections . get ( pstrSection ) ; if ( objSec == null ) { objSec = new INISection ( pstrSection ) ; this . mhmapSections . put ( pstrSection , obj... | Sets the specified double property . |
32,935 | public void setDateProperty ( String pstrSection , String pstrProp , Date pdtVal , String pstrComments ) { INISection objSec = null ; objSec = ( INISection ) this . mhmapSections . get ( pstrSection ) ; if ( objSec == null ) { objSec = new INISection ( pstrSection ) ; this . mhmapSections . put ( pstrSection , objSec )... | Sets the specified java . util . Date property . |
32,936 | public void setTimestampProperty ( String pstrSection , String pstrProp , Timestamp ptsVal , String pstrComments ) { INISection objSec = null ; objSec = ( INISection ) this . mhmapSections . get ( pstrSection ) ; if ( objSec == null ) { objSec = new INISection ( pstrSection ) ; this . mhmapSections . put ( pstrSection ... | Sets the specified java . sql . Timestamp property . |
32,937 | public String [ ] getAllSectionNames ( ) { int iCntr = 0 ; Iterator < String > iter = null ; String [ ] arrRet = null ; try { if ( this . mhmapSections . size ( ) > 0 ) { arrRet = new String [ this . mhmapSections . size ( ) ] ; for ( iter = this . mhmapSections . keySet ( ) . iterator ( ) ; ; iter . hasNext ( ) ) { ar... | Returns a string array containing names of all sections in INI file . |
32,938 | public String [ ] getPropertyNames ( String pstrSection ) { String [ ] arrRet = null ; INISection objSec = null ; objSec = ( INISection ) this . mhmapSections . get ( pstrSection ) ; if ( objSec != null ) { arrRet = objSec . getPropNames ( ) ; objSec = null ; } return arrRet ; } | Returns a string array containing names of all the properties under specified section . |
32,939 | public Map < String , INIProperty > getProperties ( String pstrSection ) { Map < String , INIProperty > hmRet = null ; INISection objSec = null ; objSec = ( INISection ) this . mhmapSections . get ( pstrSection ) ; if ( objSec != null ) { hmRet = objSec . getProperties ( ) ; objSec = null ; } return hmRet ; } | Returns a map containing all the properties under specified section . |
32,940 | public void removeProperty ( String pstrSection , String pstrProp ) { INISection objSec = null ; objSec = ( INISection ) this . mhmapSections . get ( pstrSection ) ; if ( objSec != null ) { objSec . removeProperty ( pstrProp ) ; objSec = null ; } } | Removed specified property from the specified section . If the specified section or the property does not exist does nothing . |
32,941 | public boolean save ( ) { boolean blnRet = false ; File objFile = null ; String strName = null ; String strTemp = null ; Iterator < String > itrSec = null ; INISection objSec = null ; FileWriter objWriter = null ; try { if ( this . mhmapSections . size ( ) == 0 ) return false ; objFile = new CSFile ( this . mstrFile ) ... | Flush changes back to the disk file . If the disk file does not exists then creates the new one . |
32,942 | private boolean checkDateTimeFormat ( String pstrDtFmt ) { boolean blnRet = false ; DateFormat objFmt = null ; try { objFmt = new SimpleDateFormat ( pstrDtFmt ) ; blnRet = true ; } catch ( NullPointerException NPExIgnore ) { } catch ( IllegalArgumentException IAExIgnore ) { } finally { if ( objFmt != null ) objFmt = nu... | Helper function to check the date time formats . |
32,943 | private void loadStream ( InputStream stream ) { int iPos = - 1 ; String strLine = null ; String strSection = null ; String strRemarks = null ; BufferedReader objBRdr = null ; InputStreamReader objFRdr = null ; INISection objSec = null ; try { objFRdr = new InputStreamReader ( stream ) ; if ( objFRdr != null ) { objBRd... | Reads the INI file and load its contentens into a section collection after parsing the file line by line . |
32,944 | private boolean checkFile ( String pstrFile ) { boolean blnRet = false ; File objFile = null ; try { objFile = new CSFile ( pstrFile ) ; blnRet = ( objFile . exists ( ) && objFile . isFile ( ) ) ; } catch ( Exception e ) { blnRet = false ; } finally { if ( objFile != null ) objFile = null ; } return blnRet ; } | Helper method to check the existance of a file . |
32,945 | private String utilDateToStr ( Date pdt , String pstrFmt ) { String strRet = null ; SimpleDateFormat dtFmt = null ; try { dtFmt = new SimpleDateFormat ( pstrFmt ) ; strRet = dtFmt . format ( pdt ) ; } catch ( Exception e ) { strRet = null ; } finally { if ( dtFmt != null ) dtFmt = null ; } return strRet ; } | Converts a java . util . date into String |
32,946 | private String timeToStr ( Timestamp pobjTS , String pstrFmt ) { String strRet = null ; SimpleDateFormat dtFmt = null ; try { dtFmt = new SimpleDateFormat ( pstrFmt ) ; strRet = dtFmt . format ( pobjTS ) ; } catch ( IllegalArgumentException iae ) { strRet = "" ; } catch ( NullPointerException npe ) { strRet = "" ; } fi... | Converts the given sql timestamp object to a string representation . The format to be used is to be obtained from the configuration file . |
32,947 | private String delRemChars ( String pstrSrc ) { int intPos = 0 ; if ( pstrSrc == null ) return null ; while ( ( intPos = pstrSrc . indexOf ( ";" ) ) >= 0 ) { if ( intPos == 0 ) pstrSrc = pstrSrc . substring ( intPos + 1 ) ; else if ( intPos > 0 ) pstrSrc = pstrSrc . substring ( 0 , intPos ) + pstrSrc . substring ( intP... | This function deletes the remark characters ; from source string |
32,948 | private String addRemChars ( String pstrSrc ) { int intLen = 2 ; int intPos = 0 ; int intPrev = 0 ; String strLeft = null ; String strRight = null ; if ( pstrSrc == null ) return null ; while ( intPos >= 0 ) { intLen = 2 ; intPos = pstrSrc . indexOf ( "\r\n" , intPrev ) ; if ( intPos < 0 ) { intLen = 1 ; intPos = pstrS... | This function adds a remark character ; in source string . |
32,949 | public static void main ( String [ ] pstrArgs ) { IniFile objINI = null ; String strFile = null ; if ( pstrArgs . length == 0 ) return ; strFile = pstrArgs [ 0 ] ; objINI = new IniFile ( strFile ) ; objINI . setStringProperty ( "Folders" , "folder1" , "G:\\Temp" , null ) ; objINI . setStringProperty ( "Folders" , "fold... | The main entry point for testing . |
32,950 | public boolean hasTypeChildren ( TypeRefComponent type ) throws DefinitionException { if ( typeChildren == null || typeOfChildren != type ) { loadTypedChildren ( type ) ; } return ! typeChildren . isEmpty ( ) ; } | if you have a typed element the tree might end at that point . And you may or may not want to walk into the tree of that type It depends what you are doing . So this is a choice . You can ask for the children and then if you get no children you can see if there are children defined for the type and then get them |
32,951 | public Tag addTag ( String theScheme , String theTerm ) { Tag retVal = new Tag ( theScheme , theTerm ) ; add ( retVal ) ; myOrderedTags = null ; return retVal ; } | Add a new tag instance |
32,952 | public synchronized < T extends IRestfulClient > T newClient ( Class < T > theClientType , String theServerBase ) { validateConfigured ( ) ; if ( ! theClientType . isInterface ( ) ) { throw new ConfigurationException ( theClientType . getCanonicalName ( ) + " is not an interface" ) ; } ClientInvocationHandlerFactory in... | Instantiates a new client instance |
32,953 | public void setFhirContext ( FhirContext theContext ) { if ( myContext != null && myContext != theContext ) { throw new IllegalStateException ( "RestfulClientFactory instance is already associated with one FhirContext. RestfulClientFactory instances can not be shared." ) ; } myContext = theContext ; } | Sets the context associated with this client factory . Must not be called more than once . |
32,954 | public < T extends IElement > List < T > getAllPopulatedChildElementsOfType ( Class < T > theType ) { return Collections . emptyList ( ) ; } | NOP implementation of this method . |
32,955 | public Meta addTag ( String theSystem , String theCode , String theDisplay ) { addTag ( ) . setSystem ( theSystem ) . setCode ( theCode ) . setDisplay ( theDisplay ) ; return this ; } | Convenience method which adds a tag |
32,956 | public static < T extends IElement > List < T > allPopulatedChildElements ( Class < T > theType , Object ... theElements ) { ArrayList < T > retVal = new ArrayList < T > ( ) ; for ( Object next : theElements ) { if ( next == null ) { continue ; } else if ( next instanceof IElement ) { addElement ( retVal , ( IElement )... | Note that this method does not work on HL7 . org structures |
32,957 | public String [ ] parseLine ( ) throws IOException , FHIRException { List < String > res = new ArrayList < String > ( ) ; StringBuilder b = new StringBuilder ( ) ; boolean inQuote = false ; while ( inQuote || ( peek ( ) != '\r' && peek ( ) != '\n' ) ) { char c = peek ( ) ; next ( ) ; if ( c == '"' ) inQuote = ! inQuote... | Split one line in a CSV file into its rows . Comma s appearing in double quoted strings will not be seen as a separator . |
32,958 | @ SuppressWarnings ( "unchecked" ) protected < T extends Resource > T unmarshalReference ( HttpResponse response , String format ) { T resource = null ; OperationOutcome error = null ; byte [ ] cnt = log ( response ) ; if ( cnt != null ) { try { resource = ( T ) getParser ( format ) . parse ( cnt ) ; if ( resource inst... | Unmarshals a resource from the response stream . |
32,959 | protected Bundle unmarshalFeed ( HttpResponse response , String format ) { Bundle feed = null ; byte [ ] cnt = log ( response ) ; String contentType = response . getHeaders ( "Content-Type" ) [ 0 ] . getValue ( ) ; OperationOutcome error = null ; try { if ( cnt != null ) { if ( contentType . contains ( ResourceFormat .... | Unmarshals Bundle from response stream . |
32,960 | protected String writeInputStreamAsString ( InputStream instream ) { String value = null ; try { value = IOUtils . toString ( instream , "UTF-8" ) ; System . out . println ( value ) ; } catch ( IOException ioe ) { } return value ; } | Used for debugging |
32,961 | public static ResponseEncoding determineResponseEncodingNoDefault ( RequestDetails theReq , EncodingEnum thePrefer ) { return determineResponseEncodingNoDefault ( theReq , thePrefer , null ) ; } | Returns null if the request doesn t express that it wants FHIR . If it expresses that it wants XML and JSON equally returns thePrefer . |
32,962 | public List < String > list ( String folder ) throws IOException { List < String > res = new ArrayList < String > ( ) ; if ( path != null ) { File f = new File ( Utilities . path ( path , folder ) ) ; if ( f . exists ( ) && f . isDirectory ( ) ) for ( String s : f . list ( ) ) res . add ( s ) ; } else { for ( String s ... | Accessing the contents of the package - get a list of files in a subfolder of the package |
32,963 | public InputStream load ( String folder , String file ) throws IOException { if ( content . containsKey ( folder + "/" + file ) ) return new ByteArrayInputStream ( content . get ( folder + "/" + file ) ) ; else { File f = new File ( Utilities . path ( path , folder , file ) ) ; if ( f . exists ( ) ) return new FileInpu... | get a stream that contains the contents of one of the files in a folder |
32,964 | public String fhirVersion ( ) { if ( "hl7.fhir.core" . equals ( npm . get ( "name" ) . getAsString ( ) ) ) return npm . get ( "version" ) . getAsString ( ) ; else return npm . getAsJsonObject ( "dependencies" ) . get ( "hl7.fhir.core" ) . getAsString ( ) ; } | convenience method for getting the package fhir version |
32,965 | static long hash ( String ... theValues ) { Hasher hasher = HASH_FUNCTION . newHasher ( ) ; for ( String next : theValues ) { if ( next == null ) { hasher . putByte ( ( byte ) 0 ) ; } else { next = UrlUtil . escapeUrlParam ( next ) ; byte [ ] bytes = next . getBytes ( Charsets . UTF_8 ) ; hasher . putBytes ( bytes ) ; ... | Applies a fast and consistent hashing algorithm to a set of strings |
32,966 | public TranslationRequest addCode ( String theSystem , String theCode ) { Validate . notBlank ( theSystem , "theSystem must not be null" ) ; Validate . notBlank ( theCode , "theCode must not be null" ) ; if ( getCodeableConcept ( ) == null ) { setCodeableConcept ( new CodeableConcept ( ) ) ; } getCodeableConcept ( ) . ... | This is just a convenience method that creates a codeableconcept if one doesn t already exist and adds a coding to it |
32,967 | public Set < String > getResourceNames ( ) { Set < String > resourceNames = new HashSet < > ( ) ; if ( myNameToResourceDefinition . isEmpty ( ) ) { Properties props = new Properties ( ) ; try { props . load ( myVersion . getFhirVersionPropertiesFile ( ) ) ; } catch ( IOException theE ) { throw new ConfigurationExceptio... | Returns an unmodifiable set containing all resource names known to this context |
32,968 | public IRestfulClientFactory getRestfulClientFactory ( ) { if ( myRestfulClientFactory == null ) { try { myRestfulClientFactory = ( IRestfulClientFactory ) ReflectionUtil . newInstance ( Class . forName ( "ca.uhn.fhir.rest.client.apache.ApacheRestfulClientFactory" ) , FhirContext . class , this ) ; } catch ( ClassNotFo... | Get the restful client factory . If no factory has been set this will be initialized with a new ApacheRestfulClientFactory . |
32,969 | public ListMultimap < Class < ? > , Object > getParamsForType ( ) { ArrayListMultimap < Class < ? > , Object > retVal = ArrayListMultimap . create ( ) ; myParams . entries ( ) . forEach ( entry -> retVal . put ( entry . getKey ( ) , unwrapValue ( entry . getValue ( ) ) ) ) ; return Multimaps . unmodifiableListMultimap ... | Returns an unmodifiable multimap of the params where the key is the param type and the value is the actual instance |
32,970 | public boolean incomingServerRequestMatchesMethod ( RequestDetails theRequest ) { if ( ! Constants . PARAM_HISTORY . equals ( theRequest . getOperation ( ) ) ) { return false ; } if ( theRequest . getResourceName ( ) == null ) { return myResourceOperationType == RestOperationTypeEnum . HISTORY_SYSTEM ; } if ( ! StringU... | ObjectUtils . equals is replaced by a JDK7 method .. |
32,971 | public BaseServerResponseException addResponseHeader ( String theName , String theValue ) { Validate . notBlank ( theName , "theName must not be null or empty" ) ; Validate . notBlank ( theValue , "theValue must not be null or empty" ) ; if ( getResponseHeaders ( ) . containsKey ( theName ) == false ) { getResponseHead... | Add a header which will be added to any responses |
32,972 | public Response create ( final String resource ) throws IOException { return execute ( getRequest ( RequestTypeEnum . POST , RestOperationTypeEnum . TRANSACTION ) . resource ( resource ) ) ; } | Create all resources in one transaction |
32,973 | public void setMaxSubmitPerPass ( Integer theMaxSubmitPerPass ) { Integer maxSubmitPerPass = theMaxSubmitPerPass ; if ( maxSubmitPerPass == null ) { maxSubmitPerPass = DEFAULT_MAX_SUBMIT ; } Validate . isTrue ( maxSubmitPerPass > 0 , "theMaxSubmitPerPass must be > 0" ) ; myMaxSubmitPerPass = maxSubmitPerPass ; } | Sets the maximum number of resources that will be submitted in a single pass |
32,974 | public final void checkParams ( Object [ ] params , int expected ) { if ( params == null || params . length != expected ) { throw new RuntimeException ( "Liquid error: wrong number of arguments (" + ( params == null ? 0 : params . length + 1 ) + " for " + ( expected + 1 ) + ")" ) ; } } | Check the number of parameters and throws an exception if needed . |
32,975 | protected Object get ( int index , Object ... params ) { if ( index >= params . length ) { throw new RuntimeException ( "error in filter '" + name + "': cannot get param index: " + index + " from: " + Arrays . toString ( params ) ) ; } return params [ index ] ; } | Returns a value at a specific index from an array of parameters . If no such index exists a RuntimeException is thrown . |
32,976 | public void extractInlineReferences ( IBaseResource theResource ) { if ( ! myDaoConfig . isAllowInlineMatchUrlReferences ( ) ) { return ; } FhirTerser terser = myContext . newTerser ( ) ; List < IBaseReference > allRefs = terser . getAllPopulatedChildElementsOfType ( theResource , IBaseReference . class ) ; for ( IBase... | Handle references within the resource that are match URLs for example references like Patient?identifier = foo . These match URLs are resolved and replaced with the ID of the matching resource . |
32,977 | public Future < OAuth2AccessToken > getAccessTokenClientCredentialsGrant ( OAuthAsyncRequestCallback < OAuth2AccessToken > callback ) { final OAuthRequest request = createAccessTokenClientCredentialsGrantRequest ( null ) ; return sendAccessTokenRequestAsync ( request , callback ) ; } | Start the request to retrieve the access token using client - credentials grant . The optionally provided callback will be called with the Token when it is available . |
32,978 | public void addOAuthParameter ( String key , String value ) { oauthParameters . put ( checkKey ( key ) , value ) ; } | Adds an OAuth parameter . |
32,979 | public String getSanitizedUrl ( ) { if ( url . startsWith ( "http://" ) && ( url . endsWith ( ":80" ) || url . contains ( ":80/" ) ) ) { return url . replaceAll ( "\\?.*" , "" ) . replaceAll ( ":80" , "" ) ; } else if ( url . startsWith ( "https://" ) && ( url . endsWith ( ":443" ) || url . contains ( ":443/" ) ) ) { r... | Returns the URL without the port and the query string part . |
32,980 | public static String getStreamContents ( InputStream is ) throws IOException { Preconditions . checkNotNull ( is , "Cannot get String from a null object" ) ; final char [ ] buffer = new char [ 0x10000 ] ; final StringBuilder out = new StringBuilder ( ) ; try ( Reader in = new InputStreamReader ( is , "UTF-8" ) ) { int ... | Returns the stream contents as an UTF - 8 encoded string |
32,981 | public static String getGzipStreamContents ( InputStream is ) throws IOException { Preconditions . checkNotNull ( is , "Cannot get String from a null object" ) ; final GZIPInputStream gis = new GZIPInputStream ( is ) ; return getStreamContents ( gis ) ; } | Return String content from a gzip stream |
32,982 | public static void pushImageTag ( DockerClient docker , String imageName , List < String > imageTags , Log log , boolean skipPush ) throws MojoExecutionException , DockerException , IOException , InterruptedException { if ( skipPush ) { log . info ( "Skipping docker push" ) ; return ; } if ( imageTags . isEmpty ( ) ) {... | push just the tags listed in the pom rather than all images using imageName |
32,983 | protected RegistryAuth registryAuth ( ) throws MojoExecutionException { if ( settings != null && serverId != null ) { final Server server = settings . getServer ( serverId ) ; if ( server != null ) { final RegistryAuth . Builder registryAuthBuilder = RegistryAuth . builder ( ) ; final String username = server . getUser... | Builds the registryAuth object from server details . |
32,984 | public static boolean setOnce ( AtomicReference < Disposable > upstream , Disposable next , Class < ? > observer ) { AutoDisposeUtil . checkNotNull ( next , "next is null" ) ; if ( ! upstream . compareAndSet ( null , next ) ) { next . dispose ( ) ; if ( upstream . get ( ) != AutoDisposableHelper . DISPOSED ) { reportDo... | Atomically updates the target upstream AtomicReference from null to the non - null next Disposable otherwise disposes next and reports a ProtocolViolationException if the AtomicReference doesn t contain the shared disposed indicator . |
32,985 | public static boolean setOnce ( AtomicReference < Subscription > upstream , Subscription next , Class < ? > subscriber ) { AutoDisposeUtil . checkNotNull ( next , "next is null" ) ; if ( ! upstream . compareAndSet ( null , next ) ) { next . cancel ( ) ; if ( upstream . get ( ) != AutoSubscriptionHelper . CANCELLED ) { ... | Atomically updates the target upstream AtomicReference from null to the non - null next Subscription otherwise cancels next and reports a ProtocolViolationException if the AtomicReference doesn t contain the shared cancelled indicator . |
32,986 | public static < E > CompletableSource resolveScopeFromLifecycle ( final LifecycleScopeProvider < E > provider ) throws OutsideScopeException { return resolveScopeFromLifecycle ( provider , true ) ; } | Overload for resolving lifecycle providers that defaults to checking start and end boundaries of lifecycles . That is they will ensure that the lifecycle has both started and not ended . |
32,987 | private Description describe ( MethodInvocationTree methodInvocationTree , VisitorState state ) { ExpressionTree identifierExpr = ASTHelpers . getRootAssignable ( methodInvocationTree ) ; String identifierStr = null ; Type identifierType = null ; if ( identifierExpr != null ) { identifierStr = state . getSourceForNode ... | Fixes the error by assigning the result of the call to the receiver reference or deleting the method call . |
32,988 | public static < T > boolean onNext ( Subscriber < ? super T > subscriber , T value , AtomicInteger wip , AtomicThrowable error ) { if ( wip . get ( ) == 0 && wip . compareAndSet ( 0 , 1 ) ) { subscriber . onNext ( value ) ; if ( wip . decrementAndGet ( ) != 0 ) { Throwable ex = error . terminate ( ) ; if ( ex != null )... | Emits the given value if possible and terminates if there was an onComplete or onError while emitting drops the value otherwise . |
32,989 | public boolean containsDirectoryOfType ( Class < ? extends Directory > type ) { for ( Directory dir : _directories ) { if ( type . isAssignableFrom ( dir . getClass ( ) ) ) return true ; } return false ; } | Indicates whether an instance of the given directory type exists in this Metadata instance . |
32,990 | public void processTiff ( final RandomAccessReader reader , final TiffHandler handler , final int tiffHeaderOffset ) throws TiffProcessingException , IOException { short byteOrderIdentifier = reader . getInt16 ( tiffHeaderOffset ) ; if ( byteOrderIdentifier == 0x4d4d ) { reader . setMotorolaByteOrder ( true ) ; } else ... | Processes a TIFF data sequence . |
32,991 | public void addPath ( T value , byte [ ] ... parts ) { int depth = 0 ; ByteTrieNode < T > node = _root ; for ( byte [ ] part : parts ) { for ( byte b : part ) { ByteTrieNode < T > child = node . _children . get ( b ) ; if ( child == null ) { child = new ByteTrieNode < T > ( ) ; node . _children . put ( b , child ) ; } ... | Store the given value at the specified path . |
32,992 | private static void print ( Metadata metadata , String method ) { System . out . println ( ) ; System . out . println ( "-------------------------------------------------" ) ; System . out . print ( ' ' ) ; System . out . print ( method ) ; System . out . println ( "-------------------------------------------------" ) ... | Write all extracted values to stdout . |
32,993 | @ java . lang . SuppressWarnings ( { "UnnecessaryBoxing" } ) public boolean containsTag ( int tagType ) { return _tagMap . containsKey ( Integer . valueOf ( tagType ) ) ; } | Indicates whether the specified tag type has been set . |
32,994 | public void processRiff ( final SequentialReader reader , final RiffHandler handler ) throws RiffProcessingException , IOException { reader . setMotorolaByteOrder ( false ) ; final String fileFourCC = reader . getString ( 4 ) ; if ( ! fileFourCC . equals ( "RIFF" ) ) throw new RiffProcessingException ( "Invalid RIFF he... | Processes a RIFF data sequence . |
32,995 | public Iterable < JpegSegmentType > getSegmentTypes ( ) { Set < JpegSegmentType > segmentTypes = new HashSet < JpegSegmentType > ( ) ; for ( Byte segmentTypeByte : _segmentDataMap . keySet ( ) ) { JpegSegmentType segmentType = JpegSegmentType . fromByte ( segmentTypeByte ) ; if ( segmentType == null ) { throw new Illeg... | Gets the set of JPEG segment type identifiers . |
32,996 | public Iterable < byte [ ] > getSegments ( byte segmentType ) { final List < byte [ ] > segmentList = getSegmentList ( segmentType ) ; return segmentList == null ? new ArrayList < byte [ ] > ( ) : segmentList ; } | Returns all instances of a given JPEG segment . If no instances exist an empty sequence is returned . |
32,997 | public int getSegmentCount ( byte segmentType ) { final List < byte [ ] > segmentList = getSegmentList ( segmentType ) ; return segmentList == null ? 0 : segmentList . size ( ) ; } | Returns the count of segment data byte arrays stored for a given segment type . |
32,998 | private static String getReaderString ( final RandomAccessReader reader , final int makernoteOffset , final int bytesRequested ) throws IOException { try { return reader . getString ( makernoteOffset , bytesRequested , Charsets . UTF_8 ) ; } catch ( BufferBoundsException e ) { return "" ; } } | Read a given number of bytes from the stream |
32,999 | public static String convertISO2022CharsetToJavaCharset ( final byte [ ] bytes ) { if ( bytes . length > 2 && bytes [ 0 ] == ESC && bytes [ 1 ] == PERCENT_SIGN && bytes [ 2 ] == LATIN_CAPITAL_G ) return UTF_8 ; if ( bytes . length > 3 && bytes [ 0 ] == ESC && ( bytes [ 3 ] & 0xFF | ( ( bytes [ 2 ] & 0xFF ) << 8 ) | ( (... | Converts the given ISO2022 char set to a Java charset name . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.