idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
12,400 | public static NodeImpl createMethodNode ( final String name , final NodeImpl parent , final Class < ? > [ ] parameterTypes ) { return new NodeImpl ( name , parent , false , null , null , ElementKind . METHOD , parameterTypes , null , null , null , null ) ; } | create method node . |
12,401 | public static NodeImpl createConstructorNode ( final String name , final NodeImpl parent , final Class < ? > [ ] parameterTypes ) { return new NodeImpl ( name , parent , false , null , null , ElementKind . CONSTRUCTOR , parameterTypes , null , null , null , null ) ; } | create constructor node . |
12,402 | public static NodeImpl createBeanNode ( final NodeImpl parent ) { return new NodeImpl ( null , parent , false , null , null , ElementKind . BEAN , EMPTY_CLASS_ARRAY , null , null , null , null ) ; } | create bean node . |
12,403 | public static NodeImpl createReturnValue ( final NodeImpl parent ) { return new NodeImpl ( RETURN_VALUE_NODE_NAME , parent , false , null , null , ElementKind . RETURN_VALUE , EMPTY_CLASS_ARRAY , null , null , null , null ) ; } | create return node . |
12,404 | public static NodeImpl makeIterable ( final NodeImpl node ) { return new NodeImpl ( node . name , node . parent , true , null , null , node . kind , node . parameterTypes , node . parameterIndex , node . value , node . containerClass , node . typeArgumentIndex ) ; } | make it iterable . |
12,405 | public static NodeImpl makeIterableAndSetIndex ( final NodeImpl node , final Integer index ) { return new NodeImpl ( node . name , node . parent , true , index , null , node . kind , node . parameterTypes , node . parameterIndex , node . value , node . containerClass , node . typeArgumentIndex ) ; } | make it iterable and set index . |
12,406 | public static NodeImpl makeIterableAndSetMapKey ( final NodeImpl node , final Object key ) { return new NodeImpl ( node . name , node . parent , true , null , key , node . kind , node . parameterTypes , node . parameterIndex , node . value , node . containerClass , node . typeArgumentIndex ) ; } | make it iterable and set map key . |
12,407 | public static NodeImpl setPropertyValue ( final NodeImpl node , final Object value ) { return new NodeImpl ( node . name , node . parent , node . isIterableValue , node . index , node . key , node . kind , node . parameterTypes , node . parameterIndex , value , node . containerClass , node . typeArgumentIndex ) ; } | set property value to a copied node . |
12,408 | public static NodeImpl setTypeParameter ( final NodeImpl node , final Class < ? > containerClass , final Integer typeArgumentIndex ) { return new NodeImpl ( node . name , node . parent , node . isIterableValue , node . index , node . key , node . kind , node . parameterTypes , node . parameterIndex , node . value , containerClass , typeArgumentIndex ) ; } | set type parameter to a copied node . |
12,409 | public final int buildHashCode ( ) { return Objects . hash ( this . index , this . isIterableValue , this . key , this . kind , this . name , this . parameterIndex , this . parameterTypes , this . parent , this . containerClass , this . typeArgumentIndex ) ; } | build hash code . |
12,410 | public static void addToHeader ( final String scriptname ) { if ( ! CssResources . isInHeader ( scriptname ) ) { final LinkElement styleLinkElement = Browser . getDocument ( ) . createLinkElement ( ) ; styleLinkElement . setRel ( CssResources . REL_TYPE ) ; styleLinkElement . setType ( CssResources . SCRIPT_TYPE ) ; styleLinkElement . setHref ( scriptname ) ; Browser . getDocument ( ) . getHead ( ) . appendChild ( styleLinkElement ) ; } } | add css script to header . |
12,411 | public boolean isValid ( final CharSequence value , final ConstraintValidatorContext context ) { if ( value == null ) { return true ; } final String valueAsString = value . toString ( ) ; String digitsAsString ; char checkDigit ; try { digitsAsString = this . extractVerificationString ( valueAsString ) ; checkDigit = this . extractCheckDigit ( valueAsString ) ; } catch ( final IndexOutOfBoundsException e ) { return false ; } digitsAsString = this . stripNonDigitsIfRequired ( digitsAsString ) ; List < Integer > digits ; try { digits = this . extractDigits ( digitsAsString ) ; } catch ( final NumberFormatException e ) { return false ; } return this . isCheckDigitValid ( digits , checkDigit ) ; } | valid check . |
12,412 | public void clearErrors ( ) { errorLabel . setText ( StringUtils . EMPTY ) ; errorLabel . getElement ( ) . getStyle ( ) . setDisplay ( Display . NONE ) ; if ( contents . getWidget ( ) != null ) { contents . getWidget ( ) . removeStyleName ( decoratorStyle . errorInputStyle ( ) ) ; contents . getWidget ( ) . removeStyleName ( decoratorStyle . validInputStyle ( ) ) ; } } | clear errors . |
12,413 | public final String get ( final String pkey ) { try { return pkey == null ? null : messages . getString ( pkey . replace ( "." , "_" ) ) ; } catch ( final MissingResourceException e ) { return null ; } } | get localized message for key . |
12,414 | @ SuppressWarnings ( "unchecked" ) public static < T > List < T > getInstanceList ( Class < T > type ) { if ( type == null ) { throw new IllegalArgumentException ( "Type should not be empty" ) ; } List < T > loader = ( List < T > ) EXTENSION_LOCATOR . get ( type ) ; if ( loader == null ) { try { lock . lock ( ) ; List < T > instanceList = new ArrayList < T > ( ) ; ServiceLoader < T > serviceLoader = ServiceLoader . load ( type ) ; for ( T service : serviceLoader ) { instanceList . add ( service ) ; } loader = instanceList ; if ( EXTENSION_LOCATOR . putIfAbsent ( type , instanceList ) != instanceList ) { loader = ( List < T > ) EXTENSION_LOCATOR . get ( type ) ; } } catch ( Exception e ) { LOG . error ( "Error to load SPI instances from META-INF/services/" + type , e ) ; } finally { lock . unlock ( ) ; } } return loader ; } | Get instances dynamically for a class type |
12,415 | protected void initialize ( DDFManager manager , Object data , Class < ? > [ ] typeSpecs , String name , Schema schema ) throws DDFException { this . validateSchema ( schema ) ; this . setManager ( manager ) ; if ( typeSpecs != null ) { this . getRepresentationHandler ( ) . set ( data , typeSpecs ) ; } this . getSchemaHandler ( ) . setSchema ( schema ) ; if ( schema != null && schema . getTableName ( ) == null ) { String tableName = this . getSchemaHandler ( ) . newTableName ( ) ; schema . setTableName ( tableName ) ; } manager . setDDFUUID ( this , UUID . randomUUID ( ) ) ; if ( ! Strings . isNullOrEmpty ( name ) ) manager . setDDFName ( this , name ) ; this . ML = new MLFacade ( this , this . getMLSupporter ( ) ) ; this . VIEWS = new ViewsFacade ( this , this . getViewHandler ( ) ) ; this . Transform = new TransformFacade ( this , this . getTransformationHandler ( ) ) ; this . R = new RFacade ( this , this . getAggregationHandler ( ) ) ; } | Initialization to be done after constructor assignments such as setting of the all - important DDFManager . |
12,416 | private void validateName ( String name ) throws DDFException { Boolean isNameExisted ; try { this . getManager ( ) . getDDFByName ( name ) ; isNameExisted = true ; } catch ( DDFException e ) { isNameExisted = false ; } if ( isNameExisted ) { throw new DDFException ( String . format ( "DDF with name %s already exists" , name ) ) ; } Pattern p = Pattern . compile ( "^[a-zA-Z0-9_-]*$" ) ; Matcher m = p . matcher ( name ) ; if ( ! m . find ( ) ) { throw new DDFException ( String . format ( "Invalid name %s, only allow alphanumeric (uppercase and lowercase a-z, " + "numbers 0-9) and dash (\"-\") and underscore (\"_\")" , name ) ) ; } } | Also only allow alphanumberic and dash - and underscore _ |
12,417 | public final void init ( final ConfigurationState configState ) { final ConstraintValidatorFactory configConstraintValidatorFactory = configState . getConstraintValidatorFactory ( ) ; constraintValidatorFactory = configConstraintValidatorFactory == null ? GWT . < ConstraintValidatorFactory > create ( ConstraintValidatorFactory . class ) : configConstraintValidatorFactory ; final TraversableResolver configTraversableResolver = configState . getTraversableResolver ( ) ; traversableResolver = configTraversableResolver == null ? new DefaultTraversableResolver ( ) : configTraversableResolver ; final MessageInterpolator configMessageInterpolator = configState . getMessageInterpolator ( ) ; messageInterpolator = configMessageInterpolator == null ? new GwtMessageInterpolator ( ) : configMessageInterpolator ; parameterNameProvider = configState . getParameterNameProvider ( ) ; } | initialize factory . |
12,418 | public static SafeHtml messagesToList ( final Set < String > messages ) { final SafeHtmlBuilder sbList = new SafeHtmlBuilder ( ) ; sbList . appendHtmlConstant ( "<ul>" ) ; for ( final String message : messages ) { sbList . appendHtmlConstant ( "<li>" ) ; sbList . appendEscaped ( message ) ; sbList . appendHtmlConstant ( "</li>" ) ; } sbList . appendHtmlConstant ( "</ul>" ) ; return sbList . toSafeHtml ( ) ; } | build a html list out of given message set . |
12,419 | public static String messagesToString ( final Set < String > messages ) { final SafeHtmlBuilder sb = new SafeHtmlBuilder ( ) ; for ( final String message : messages ) { sb . appendEscaped ( message ) ; sb . appendEscaped ( "\n" ) ; } return sb . toSafeHtml ( ) . asString ( ) ; } | build a linefeed separated String with all messages out of given set . |
12,420 | public JClassType getAssociationType ( final PropertyDescriptor ppropertyDescriptor , final boolean puseField ) { final JType type = getElementType ( ppropertyDescriptor , puseField ) ; if ( type == null ) { return null ; } final JArrayType jarray = type . isArray ( ) ; if ( jarray != null ) { return jarray . getComponentType ( ) . isClassOrInterface ( ) ; } final JParameterizedType jptype = type . isParameterized ( ) ; JClassType [ ] typeArgs ; if ( jptype == null ) { final JRawType jrtype = type . isRawType ( ) ; typeArgs = jrtype . getGenericType ( ) . getTypeParameters ( ) ; } else { typeArgs = jptype . getTypeArgs ( ) ; } return typeArgs [ typeArgs . length - 1 ] . isClassOrInterface ( ) ; } | get association type . |
12,421 | public void checkDefaultGroupSequenceIsExpandable ( final List < Class < ? > > defaultGroupSequence ) throws GroupDefinitionException { for ( final Map . Entry < Class < ? > , List < Group > > entry : sequenceMap . entrySet ( ) ) { final Class < ? > sequence = entry . getKey ( ) ; final List < Group > groups = entry . getValue ( ) ; final List < Group > defaultGroupList = buildTempGroupList ( defaultGroupSequence , sequence ) ; final int defaultGroupIndex = containsDefaultGroupAtIndex ( sequence , groups ) ; if ( defaultGroupIndex != - 1 ) { ensureDefaultGroupSequenceIsExpandable ( groups , defaultGroupList , defaultGroupIndex ) ; } } } | check if default group sequence is expandable . |
12,422 | public static ConstraintViolationImpl < Object > instantiate ( final SerializationStreamReader streamReader ) throws SerializationException { final String messageTemplate = null ; final String interpolatedMessage = streamReader . readString ( ) ; final Class < Object > rootBeanClass = null ; final Object rootBean = null ; final Object leafBeanInstance = null ; final Object value = null ; final Path propertyPath = ( Path ) streamReader . readObject ( ) ; final ConstraintDescriptor < ? > constraintDescriptor = null ; final ElementType elementType = null ; final Map < String , Object > messageParameters = new HashMap < > ( ) ; final Map < String , Object > expressionVariables = new HashMap < > ( ) ; return ( ConstraintViolationImpl < Object > ) ConstraintViolationImpl . forBeanValidation ( messageTemplate , messageParameters , expressionVariables , interpolatedMessage , rootBeanClass , rootBean , leafBeanInstance , value , propertyPath , constraintDescriptor , elementType , null ) ; } | instantiate a ConstraintViolationImpl . |
12,423 | public static void checkOffsetAndCount ( final byte [ ] buffer , final int byteOffset , final int byteCount ) { if ( buffer == null ) { throw new NullPointerException ( ) ; } checkOffsetAndCount ( buffer . length , byteOffset , byteCount ) ; } | Validates the offset and the byte count for the given array of bytes . |
12,424 | public static void checkOffsetAndCount ( final char [ ] buffer , final int charOffset , final int charCount ) { if ( buffer == null ) { throw new NullPointerException ( ) ; } checkOffsetAndCount ( buffer . length , charOffset , charCount ) ; } | Validates the offset and the byte count for the given array of characters . |
12,425 | private static void checkOffsetAndCount ( final int length , final int offset , final int count ) { if ( offset < 0 || count < 0 || offset + count > length ) { throw new IndexOutOfBoundsException ( ) ; } } | Validates the offset and the byte count for the given array length . |
12,426 | public static void doesNotContain ( final String textToSearch , final String substring , final Supplier < String > messageSupplier ) { if ( StringUtils . hasLength ( textToSearch ) && StringUtils . hasLength ( substring ) && textToSearch . contains ( substring ) ) { throw new IllegalArgumentException ( Assert . nullSafeGet ( messageSupplier ) ) ; } } | Assert that the given text does not contain the given substring . |
12,427 | protected static Resources getDefaultResources ( ) { if ( SelectBoxWithIconInputWidget . defaultResource == null ) { synchronized ( Resources . class ) { if ( SelectBoxWithIconInputWidget . defaultResource == null ) { SelectBoxWithIconInputWidget . defaultResource = GWT . create ( Resources . class ) ; } } } return SelectBoxWithIconInputWidget . defaultResource ; } | get default resource if not set create one . |
12,428 | public void fillEntries ( final List < IdAndNamePlusIconBean < T > > pentries ) { this . entries . clear ( ) ; this . radioButtons . clear ( ) ; this . entries . addAll ( pentries ) ; boolean selected = false ; for ( final IdAndNamePlusIconBean < T > entry : this . entries ) { final FlowPanel option = new FlowPanel ( ) ; option . setStylePrimaryName ( this . resource . selectBoxInputStyle ( ) . option ( ) ) ; final RadioButton radioButton = new RadioButton ( ) ; radioButton . getElement ( ) . setId ( this . idBase + entry . getId ( ) ) ; radioButton . setFormValue ( Objects . toString ( entry . getId ( ) ) ) ; radioButton . setName ( this . idBase ) ; if ( ! selected ) { radioButton . setValue ( Boolean . TRUE , false ) ; selected = true ; } radioButton . addClickHandler ( this . clickHandler ) ; option . add ( radioButton ) ; this . radioButtons . add ( radioButton ) ; final SafeHtmlBuilder labelShb = new SafeHtmlBuilder ( ) ; labelShb . appendHtmlConstant ( "<img src=\"" + SafeHtmlUtils . htmlEscape ( entry . getIconUrl ( ) ) + "\" alt=\"" + SafeHtmlUtils . htmlEscape ( entry . getName ( ) ) + "\" />" ) ; labelShb . appendEscaped ( entry . getName ( ) ) ; final InputLabel label = new InputLabel ( ) ; label . setFor ( radioButton ) ; label . setHtml ( labelShb . toSafeHtml ( ) ) ; option . add ( label ) ; this . options . add ( option ) ; } } | fill entries for the select box . |
12,429 | public RocMetric addIn ( RocMetric other ) { int i = 0 ; int j = 1 ; while ( i < this . pred . length ) { if ( this . pred [ i ] != null ) { if ( other . pred [ i ] != null ) { j = 1 ; while ( j < this . pred [ i ] . length ) { this . pred [ i ] [ j ] = this . pred [ i ] [ j ] + other . pred [ i ] [ j ] ; j ++ ; } } } else { if ( other . pred [ i ] != null ) { j = 0 ; this . pred [ i ] = new double [ 3 ] ; while ( j < other . pred [ i ] . length ) { this . pred [ i ] [ j ] = other . pred [ i ] [ j ] ; j = j + 1 ; } } } i = i + 1 ; } return ( this ) ; } | Sum in - place to avoid new object alloc |
12,430 | public void addSourceActiveParticipant ( String userId , String altUserId , String userName , String networkId , boolean isRequestor ) { addActiveParticipant ( userId , altUserId , userName , isRequestor , Collections . singletonList ( new DICOMActiveParticipantRoleIdCodes . Source ( ) ) , networkId ) ; } | Adds an Active Participant block representing the source participant |
12,431 | public void addDestinationActiveParticipant ( String userId , String altUserId , String userName , String networkId , boolean isRequestor ) { addActiveParticipant ( userId , altUserId , userName , isRequestor , Collections . singletonList ( new DICOMActiveParticipantRoleIdCodes . Destination ( ) ) , networkId ) ; } | Adds an Active Participant block representing the destination participant |
12,432 | public void addSubmissionSetParticipantObject ( String submissionSetUniqueId ) { addParticipantObjectIdentification ( new IHETransactionParticipantObjectIDTypeCodes . SubmissionSet ( ) , null , null , null , submissionSetUniqueId , RFC3881ParticipantObjectTypeCodes . SYSTEM , RFC3881ParticipantObjectTypeRoleCodes . JOB , null , null ) ; } | Adds a Participant Object representing an XDS Submission Set |
12,433 | public void addDocumentUriParticipantObject ( String documentRetrieveUri , String documentUniqueId ) { List < TypeValuePairType > tvp = new LinkedList < > ( ) ; if ( documentUniqueId != null ) { tvp . add ( getTypeValuePair ( "XDSDocumentEntry.uniqueId" , documentUniqueId . getBytes ( ) ) ) ; } addParticipantObjectIdentification ( new RFC3881ParticipantObjectCodes . RFC3881ParticipantObjectIDTypeCodes . URI ( ) , null , null , tvp , documentRetrieveUri , RFC3881ParticipantObjectTypeCodes . SYSTEM , RFC3881ParticipantObjectTypeRoleCodes . REPORT , null , null ) ; } | Adds a Participant Object representing a URI |
12,434 | public void addDocumentParticipantObject ( String documentUniqueId , String repositoryUniqueId , String homeCommunityId ) { List < TypeValuePairType > tvp = new LinkedList < > ( ) ; if ( ! EventUtils . isEmptyOrNull ( repositoryUniqueId ) ) { tvp . add ( getTypeValuePair ( "Repository Unique Id" , repositoryUniqueId . getBytes ( ) ) ) ; } if ( ! EventUtils . isEmptyOrNull ( homeCommunityId ) ) { tvp . add ( getTypeValuePair ( "ihe:homeCommunityID" , homeCommunityId . getBytes ( ) ) ) ; } addParticipantObjectIdentification ( new RFC3881ParticipantObjectCodes . RFC3881ParticipantObjectIDTypeCodes . ReportNumber ( ) , null , null , tvp , documentUniqueId , RFC3881ParticipantObjectTypeCodes . SYSTEM , RFC3881ParticipantObjectTypeRoleCodes . REPORT , null , null ) ; } | Adds a Participant Object representing a document for XDS Exports |
12,435 | public void addValueSetParticipantObject ( String valueSetUniqueId , String valueSetName , String valueSetVersion ) { if ( valueSetName == null ) { valueSetName = "" ; } if ( valueSetVersion == null ) { valueSetVersion = "" ; } List < TypeValuePairType > tvp = new LinkedList < > ( ) ; tvp . add ( getTypeValuePair ( "Value Set Version" , valueSetVersion . getBytes ( ) ) ) ; addParticipantObjectIdentification ( new RFC3881ParticipantObjectCodes . RFC3881ParticipantObjectIDTypeCodes . ReportNumber ( ) , valueSetName , null , tvp , valueSetUniqueId , RFC3881ParticipantObjectTypeCodes . SYSTEM , RFC3881ParticipantObjectTypeRoleCodes . REPORT , null , null ) ; } | Adds a Participant Object representing a value set for SVS Exports |
12,436 | public static XCARespondingGatewayAuditor getAuditor ( ) { AuditorModuleContext ctx = AuditorModuleContext . getContext ( ) ; return ( XCARespondingGatewayAuditor ) ctx . getAuditor ( XCARespondingGatewayAuditor . class ) ; } | Get an instance of the XCA Responding Gateway Auditor from the global context |
12,437 | public void auditCrossGatewayQueryEvent ( RFC3881EventOutcomeCodes eventOutcome , String initiatingGatewayUserId , String initiatingGatewayUserName , String initiatingGatewayIpAddress , String respondingGatewayEndpointUri , String storedQueryUUID , String adhocQueryRequestPayload , String homeCommunityId , String patientId , List < CodedValueType > purposesOfUse , List < CodedValueType > userRoles ) { if ( ! isAuditorEnabled ( ) ) { return ; } auditQueryEvent ( false , new IHETransactionEventTypeCodes . CrossGatewayQuery ( ) , eventOutcome , getAuditSourceId ( ) , getAuditEnterpriseSiteId ( ) , initiatingGatewayUserId , null , initiatingGatewayUserName , initiatingGatewayIpAddress , initiatingGatewayUserName , initiatingGatewayUserName , false , respondingGatewayEndpointUri , getSystemAltUserId ( ) , storedQueryUUID , adhocQueryRequestPayload , homeCommunityId , patientId , purposesOfUse , userRoles ) ; } | Audits an ITI - 38 Cross Gateway Query event for XCA Responding Gateway actors . |
12,438 | public void auditCrossGatewayRetrieveEvent ( RFC3881EventOutcomeCodes eventOutcome , String initiatingGatewayUserId , String initiatingGatewayIpAddress , String respondingGatewayEndpointUri , String initiatingGatewayUserName , String [ ] documentUniqueIds , String [ ] repositoryUniqueIds , String homeCommunityIds [ ] , List < CodedValueType > purposesOfUse , List < CodedValueType > userRoles ) { if ( ! isAuditorEnabled ( ) ) { return ; } ExportEvent exportEvent = new ExportEvent ( true , eventOutcome , new IHETransactionEventTypeCodes . CrossGatewayRetrieve ( ) , purposesOfUse ) ; exportEvent . setAuditSourceId ( getAuditSourceId ( ) , getAuditEnterpriseSiteId ( ) ) ; exportEvent . addSourceActiveParticipant ( respondingGatewayEndpointUri , getSystemAltUserId ( ) , null , EventUtils . getAddressForUrl ( respondingGatewayEndpointUri , false ) , false ) ; if ( ! EventUtils . isEmptyOrNull ( initiatingGatewayUserName ) ) { exportEvent . addHumanRequestorActiveParticipant ( initiatingGatewayUserName , null , initiatingGatewayUserName , userRoles ) ; } exportEvent . addDestinationActiveParticipant ( initiatingGatewayUserId , null , null , initiatingGatewayIpAddress , true ) ; if ( ! EventUtils . isEmptyOrNull ( documentUniqueIds ) ) { for ( int i = 0 ; i < documentUniqueIds . length ; i ++ ) { exportEvent . addDocumentParticipantObject ( documentUniqueIds [ i ] , repositoryUniqueIds [ i ] , homeCommunityIds [ i ] ) ; } } audit ( exportEvent ) ; } | Audits an ITI - 39 Cross Gateway Retrieve event for XCA Responding Gateway actors . |
12,439 | public void auditRetrieveDocumentSetEvent ( RFC3881EventOutcomeCodes eventOutcome , String repositoryEndpointUri , String userName , String [ ] documentUniqueIds , String [ ] repositoryUniqueIds , String homeCommunityIds [ ] , List < CodedValueType > purposesOfUse , List < CodedValueType > userRoles ) { if ( ! isAuditorEnabled ( ) ) { return ; } XDSConsumerAuditor . getAuditor ( ) . auditRetrieveDocumentSetEvent ( eventOutcome , repositoryEndpointUri , userName , documentUniqueIds , repositoryUniqueIds , homeCommunityIds , null , purposesOfUse , userRoles ) ; } | Audits an ITI - 43 Retrieve Document Set event for XCA Responding Gateway actors . |
12,440 | public void auditRegistryStoredQueryEvent ( RFC3881EventOutcomeCodes eventOutcome , String registryEndpointUri , String consumerUserName , String storedQueryUUID , String adhocQueryRequestPayload , String homeCommunityId , String patientId , List < CodedValueType > purposesOfUse , List < CodedValueType > userRoles ) { if ( ! isAuditorEnabled ( ) ) { return ; } XDSConsumerAuditor . getAuditor ( ) . auditRegistryStoredQueryEvent ( eventOutcome , registryEndpointUri , consumerUserName , storedQueryUUID , adhocQueryRequestPayload , homeCommunityId , patientId , purposesOfUse , userRoles ) ; } | Audits an ITI - 18 Registry Stored Query event for XCA Responding Gateway actors . |
12,441 | public void write ( DataWriter writer ) throws IOException { writer . writeInt ( pos ) ; writer . writeInt ( val ) ; writer . writeLong ( scn ) ; } | Writes this EntryValue to entry log file via a data writer . |
12,442 | public synchronized byte [ ] getBuf ( int len ) { for ( int i = 0 ; i < mBuffersBySize . size ( ) ; i ++ ) { byte [ ] buf = mBuffersBySize . get ( i ) ; if ( buf . length >= len ) { mCurrentSize -= buf . length ; mBuffersBySize . remove ( i ) ; mBuffersByLastUse . remove ( buf ) ; return buf ; } } return new byte [ len ] ; } | Returns a buffer from the pool if one is available in the requested size or allocates a new one if a pooled one is not available . |
12,443 | public synchronized void returnBuf ( byte [ ] buf ) { if ( buf == null || buf . length > mSizeLimit ) { return ; } mBuffersByLastUse . add ( buf ) ; int pos = Collections . binarySearch ( mBuffersBySize , buf , BUF_COMPARATOR ) ; if ( pos < 0 ) { pos = - pos - 1 ; } mBuffersBySize . add ( pos , buf ) ; mCurrentSize += buf . length ; trim ( ) ; } | Returns a buffer to the pool throwing away old buffers if the pool would exceed its allotted size . |
12,444 | protected byte [ ] ensure128BitMD5 ( byte [ ] digest ) { if ( digest . length == MD5_LENGTH ) { return digest ; } else if ( digest . length > MD5_LENGTH ) { byte [ ] b = new byte [ MD5_LENGTH ] ; System . arraycopy ( digest , 0 , b , 0 , MD5_LENGTH ) ; return b ; } else { byte [ ] b = new byte [ MD5_LENGTH ] ; System . arraycopy ( digest , 0 , b , 0 , digest . length ) ; Arrays . fill ( b , digest . length , b . length , ( byte ) 0 ) ; return b ; } } | Ensure that the specified MD5 digest has 128 bits . |
12,445 | protected void ensureCapacity ( ) { if ( _buffer . remaining ( ) < 8 ) { ByteBuffer b = ByteBuffer . allocate ( _buffer . capacity ( ) << 1 ) ; _buffer . flip ( ) ; b . put ( _buffer ) ; _buffer = b ; } } | Ensure that the internal backing buffer has enough capacity for a new pair of index and offset . |
12,446 | public Position get ( Position pos , List < Event < T > > list ) { EventBatch < T > b ; if ( pos . getOffset ( ) < getOrigin ( ) || pos . isIndexed ( ) ) { return null ; } b = _batch ; if ( b . getOrigin ( ) <= pos . getOffset ( ) ) { long newOffset = b . get ( pos . getOffset ( ) , list ) ; Clock clock = pos . getOffset ( ) < newOffset ? b . getClock ( newOffset - 1 ) : pos . getClock ( ) ; return new SimplePosition ( getId ( ) , newOffset , clock ) ; } b = _lastBatch ; if ( b != null && b . getOrigin ( ) <= pos . getOffset ( ) ) { long newOffset = b . get ( pos . getOffset ( ) , list ) ; Clock clock = pos . getOffset ( ) < newOffset ? b . getClock ( newOffset - 1 ) : pos . getClock ( ) ; return new SimplePosition ( getId ( ) , newOffset , clock ) ; } int cnt = 0 ; Iterator < EventBatchCursor > iter = _retentionQueue . iterator ( ) ; while ( iter . hasNext ( ) ) { EventBatchCursor c = iter . next ( ) ; if ( c . getHeader ( ) . getOrigin ( ) <= pos . getOffset ( ) ) { byte [ ] dat = _store . get ( c . getLookup ( ) ) ; try { b = _eventBatchSerializer . deserialize ( dat ) ; long newOffset = b . get ( pos . getOffset ( ) , list ) ; if ( pos . getOffset ( ) < newOffset ) { Clock clock = b . getClock ( newOffset - 1 ) ; return new SimplePosition ( getId ( ) , newOffset , clock ) ; } } catch ( Exception e ) { _logger . warn ( "Ignored EventBatch: " + c . getHeader ( ) . getOrigin ( ) ) ; } } else { if ( cnt == 0 ) { break ; } } cnt ++ ; } return null ; } | Gets a number of events starting from a given position in the Retention . The number of events is determined internally by the Retention and it is up to the batch size . |
12,447 | protected boolean mergeEventsToLastBatch ( ) throws IOException { if ( _lastBatch != null && _eventBatchSize >= ( _lastBatch . getSize ( ) + _batch . getSize ( ) ) ) { _batch . setCompletionTime ( System . currentTimeMillis ( ) ) ; if ( _flushListener != null ) { _flushListener . beforeFlush ( _batch ) ; } SimpleEventBatch < T > copy = ( ( SimpleEventBatch < T > ) _lastBatch ) . clone ( ) ; try { Iterator < Event < T > > iter = _batch . iterator ( ) ; while ( iter . hasNext ( ) ) { copy . put ( iter . next ( ) ) ; } copy . setCompletionTime ( _batch . getCompletionTime ( ) ) ; byte [ ] bytes = _eventBatchSerializer . serialize ( copy ) ; _store . set ( _lastBatchCursor . getLookup ( ) , bytes , getOffset ( ) ) ; } catch ( Exception e ) { _logger . info ( "events merge aborted" , e ) ; return false ; } if ( _flushListener != null ) { _flushListener . afterFlush ( _batch ) ; } _batchLock . lock ( ) ; try { _lastBatch = copy ; _lastBatchCursor . setHeader ( copy . getHeader ( ) ) ; _logger . info ( _batch . getSize ( ) + " events merged to EventBatch " + _lastBatchCursor . getLookup ( ) ) ; _batch = nextEventBatch ( _batch . getOrigin ( ) + _batch . getSize ( ) , _batch . getMaxClock ( ) ) ; } finally { _batchLock . unlock ( ) ; } return true ; } return false ; } | Try to merge events from the current batch to the last persisted batch in order to reduce the number of smaller batches in the retention . |
12,448 | static Schema createPersonSchema ( ) { List < Field > fields = new ArrayList < Field > ( ) ; fields . add ( new Field ( "id" , Schema . create ( Type . INT ) , null , null ) ) ; fields . add ( new Field ( "age" , Schema . create ( Type . INT ) , null , null ) ) ; fields . add ( new Field ( "fname" , Schema . create ( Type . STRING ) , null , null ) ) ; fields . add ( new Field ( "lname" , Schema . create ( Type . STRING ) , null , null ) ) ; Schema schema = Schema . createRecord ( "Person" , null , "avro.test" , false ) ; schema . setFields ( fields ) ; return schema ; } | Creates the Avro schema for the Person store . |
12,449 | public CountDownLatch get ( States . GenericState state ) throws Exception { CountDownLatch latch = new CountDownLatch ( state . targetBacklog ) ; if ( state . pipeline == Pipeline . JusDef ) { Request < NetworkResponse > request ; for ( int i = 0 ; i < state . targetBacklog ; i ++ ) { request = state . jusRequests . get ( i ) ; request . addResponseListener ( new LatchedJusCallback ( latch ) ) ; state . requestPipeline . addRequest ( request ) ; } } else if ( state . pipeline == Pipeline . VolleyDef ) { MockVolleyRequest request ; for ( int i = 0 ; i < state . targetBacklog ; i ++ ) { request = state . volleyRequests . get ( i ) ; request . setListener ( new LatchedVolleyCallback ( latch ) ) ; state . requestPipeline . addRequest ( request ) ; } } latch . await ( ) ; return latch ; } | This is a dummy benchmark showing the time it takes for a complete async request - response round trip considering no or negligible network latency |
12,450 | public void remap ( ) throws IOException { if ( _mmapArray == null ) { open ( ) ; return ; } long length = _raf . length ( ) ; long mappedLength = getMappedLength ( ) ; if ( length != mappedLength ) { int cnt = 0 ; long position = 0 ; cnt = ( int ) ( length >> BUFFER_BITS ) ; cnt += ( length & BUFFER_MASK ) > 0 ? 1 : 0 ; MappedByteBuffer [ ] mmapArray = new MappedByteBuffer [ cnt ] ; int sharedCnt = Math . min ( mmapArray . length , _mmapArray . length ) - 1 ; for ( int i = 0 ; i < sharedCnt ; i ++ ) { mmapArray [ i ] = _mmapArray [ i ] ; position += BUFFER_SIZE ; } for ( int i = sharedCnt ; i < cnt ; i ++ ) { long size = Math . min ( length - position , BUFFER_SIZE ) ; mmapArray [ i ] = _raf . getChannel ( ) . map ( FileChannel . MapMode . READ_ONLY , position , size ) ; position += BUFFER_SIZE ; } _mmapArray = mmapArray ; _currentPosition = 0 ; } } | Performs re - mapping operation to synchronize with the underling file . |
12,451 | public final long getMappedLength ( ) { MappedByteBuffer [ ] mmapArray = _mmapArray ; long length = 0 ; if ( mmapArray != null ) { for ( MappedByteBuffer mmap : mmapArray ) { length += mmap . capacity ( ) ; } } return length ; } | Gets the total number of bytes of all mapped buffers . |
12,452 | public static < T > Response < T > success ( T result , Cache . Entry cacheEntry ) { return new Response < T > ( result , cacheEntry ) ; } | Returns a successful response containing the parsed result . |
12,453 | public synchronized void setOption ( String key , String value ) { if ( key == null || value == null ) { return ; } config . put ( key , value ) ; } | Set a value to the backed properties in this module config . |
12,454 | protected void auditQueryEvent ( boolean systemIsSource , IHETransactionEventTypeCodes transaction , RFC3881EventOutcomeCodes eventOutcome , String auditSourceId , String auditSourceEnterpriseSiteId , String sourceUserId , String sourceAltUserId , String sourceUserName , String sourceNetworkId , String humanRequestor , String humanRequestorName , boolean humanAfterDestination , String registryEndpointUri , String registryAltUserId , String storedQueryUUID , String adhocQueryRequestPayload , String homeCommunityId , String patientId , List < CodedValueType > purposesOfUse , List < CodedValueType > userRoles ) { QueryEvent queryEvent = new QueryEvent ( systemIsSource , eventOutcome , transaction , purposesOfUse ) ; queryEvent . setAuditSourceId ( auditSourceId , auditSourceEnterpriseSiteId ) ; queryEvent . addSourceActiveParticipant ( sourceUserId , sourceAltUserId , sourceUserName , sourceNetworkId , true ) ; if ( humanAfterDestination ) { queryEvent . addDestinationActiveParticipant ( registryEndpointUri , registryAltUserId , null , EventUtils . getAddressForUrl ( registryEndpointUri , false ) , false ) ; } if ( ! EventUtils . isEmptyOrNull ( humanRequestorName ) ) { queryEvent . addHumanRequestorActiveParticipant ( humanRequestorName , null , humanRequestorName , userRoles ) ; } if ( ! humanAfterDestination ) { queryEvent . addDestinationActiveParticipant ( registryEndpointUri , registryAltUserId , null , EventUtils . getAddressForUrl ( registryEndpointUri , false ) , false ) ; } if ( ! EventUtils . isEmptyOrNull ( patientId ) ) { queryEvent . addPatientParticipantObject ( patientId ) ; } byte [ ] queryRequestPayloadBytes = null ; if ( ! EventUtils . isEmptyOrNull ( adhocQueryRequestPayload ) ) { queryRequestPayloadBytes = adhocQueryRequestPayload . getBytes ( ) ; } queryEvent . addQueryParticipantObject ( storedQueryUUID , homeCommunityId , queryRequestPayloadBytes , null , transaction ) ; audit ( queryEvent ) ; } | Audits a QUERY event for IHE XDS transactions notably XDS Registry Query and XDS Registry Stored Query transactions . |
12,455 | static Set < String > parsePathParameters ( String path ) { Matcher m = PARAM_URL_REGEX . matcher ( path ) ; Set < String > patterns = new LinkedHashSet < > ( ) ; while ( m . find ( ) ) { patterns . add ( m . group ( 1 ) ) ; } return patterns ; } | Gets the set of unique path parameters used in the given URI . If a parameter is used twice in the URI it will only show up once in the set . |
12,456 | public byte [ ] getPostBody ( ) throws AuthFailureError { Map < String , String > postParams = getPostParams ( ) ; if ( postParams != null && postParams . size ( ) > 0 ) { return encodeParameters ( postParams , getPostParamsEncoding ( ) ) ; } return null ; } | Returns the raw POST body to be sent . |
12,457 | public byte [ ] getBody ( ) throws AuthFailureError { Map < String , String > params = getParams ( ) ; if ( params != null && params . size ( ) > 0 ) { return encodeParameters ( params , getParamsEncoding ( ) ) ; } return null ; } | Returns the raw POST or PUT body to be sent . |
12,458 | protected DataStore < byte [ ] , byte [ ] > createDataStore ( File homeDir , int initialCapacity ) throws Exception { StoreConfig config = new StoreConfig ( homeDir , initialCapacity ) ; config . setBatchSize ( 10000 ) ; config . setNumSyncBatches ( 100 ) ; config . setSegmentFactory ( new WriteBufferSegmentFactory ( ) ) ; config . setSegmentFileSizeMB ( 128 ) ; config . setSegmentCompactFactor ( 0.67 ) ; config . setInt ( StoreParams . PARAM_INDEX_SEGMENT_FILE_SIZE_MB , 32 ) ; config . setDouble ( StoreParams . PARAM_INDEX_SEGMENT_COMPACT_FACTOR , 0.5 ) ; int indexInitialCapacity = initialCapacity / 8 ; config . setInt ( StoreParams . PARAM_INDEX_INITIAL_CAPACITY , indexInitialCapacity ) ; config . setDataHandler ( new HashIndexDataHandler ( ) ) ; config . setHashLoadFactor ( 1.0 ) ; return StoreFactory . createIndexedDataStore ( config ) ; } | Creates a DataStore instance . |
12,459 | public void populate ( ) throws Exception { for ( int i = 0 ; i < _initialCapacity ; i ++ ) { String str = "key." + i ; byte [ ] key = str . getBytes ( ) ; byte [ ] value = createDataForKey ( str ) ; _store . put ( key , value ) ; } _store . sync ( ) ; } | Populates the underlying data store . |
12,460 | public void doRandomReads ( int readCnt ) { Random rand = new Random ( ) ; for ( int i = 0 ; i < readCnt ; i ++ ) { int keyId = rand . nextInt ( _initialCapacity ) ; String str = "key." + keyId ; byte [ ] key = str . getBytes ( ) ; byte [ ] value = _store . get ( key ) ; System . out . printf ( "Key=%s\tValue=%s%n" , str , new String ( value ) ) ; } } | Perform a number of random reads from the underlying data store . |
12,461 | public void init ( ServletConfig config ) throws ServletException { super . init ( config ) ; this . expiresMinutes = readLong ( config . getInitParameter ( INIT_PARAM_EXPIRES_MINUTES ) , this . expiresMinutes ) ; this . cacheControl = config . getInitParameter ( INIT_PARAM_CACHE_CONTROL ) != null ? config . getInitParameter ( INIT_PARAM_CACHE_CONTROL ) : this . cacheControl ; this . autoCorrectUrlsInCSS = readBoolean ( config . getInitParameter ( INIT_PARAM_AUTO_CORRECT_URLS_IN_CSS ) , this . autoCorrectUrlsInCSS ) ; this . turnOffETag = readBoolean ( config . getInitParameter ( INIT_PARAM_TURN_OFF_E_TAG ) , this . turnOffETag ) ; this . turnOffUrlFingerPrinting = readBoolean ( config . getInitParameter ( INIT_PARAM_TURN_OFF_URL_FINGERPRINTING ) , this . turnOffUrlFingerPrinting ) ; this . customContextPathForCSSUrls = config . getInitParameter ( INIT_PARAM_CUSTOM_CONTEXT_PATH_FOR_CSS_URLS ) ; this . overrideExistingHeaders = readBoolean ( config . getInitParameter ( INIT_PARAM_OVERRIDE_EXISTING_HEADERS ) , this . overrideExistingHeaders ) ; LOGGER . debug ( "Servlet initialized: {\n\t{}:{},\n\t{}:{},\n\t{}:{},\n\t{}:{}\n\t{}:{}\n:{}\n}" , INIT_PARAM_EXPIRES_MINUTES , String . valueOf ( this . expiresMinutes ) , INIT_PARAM_CACHE_CONTROL , this . cacheControl , INIT_PARAM_AUTO_CORRECT_URLS_IN_CSS , String . valueOf ( this . autoCorrectUrlsInCSS ) , INIT_PARAM_TURN_OFF_E_TAG , String . valueOf ( this . turnOffETag ) , INIT_PARAM_TURN_OFF_URL_FINGERPRINTING , String . valueOf ( this . turnOffUrlFingerPrinting ) , INIT_PARAM_OVERRIDE_EXISTING_HEADERS , String . valueOf ( this . overrideExistingHeaders ) ) ; } | default enabled fingerprinting |
12,462 | public void addApplicationParticipant ( String userId , String altUserId , String userName , String networkId ) { addActiveParticipant ( userId , altUserId , userName , false , Collections . singletonList ( new DICOMActiveParticipantRoleIdCodes . Application ( ) ) , networkId ) ; } | Add an Application Active Participant to this message |
12,463 | public void addApplicationStarterParticipant ( String userId , String altUserId , String userName , String networkId ) { addActiveParticipant ( userId , altUserId , userName , true , Collections . singletonList ( new DICOMActiveParticipantRoleIdCodes . ApplicationLauncher ( ) ) , networkId ) ; } | Add an Application Starter Active Participant to this message |
12,464 | public synchronized void invalidate ( String key , boolean fullExpire ) { Entry entry = get ( key ) ; if ( entry != null ) { entry . softTtl = 0 ; if ( fullExpire ) { entry . ttl = 0 ; } put ( key , entry ) ; } } | Invalidates an entry in the cache . |
12,465 | private String getFilenameForKey ( String key ) { int firstHalfLength = key . length ( ) / 2 ; String localFilename = String . valueOf ( key . substring ( 0 , firstHalfLength ) . hashCode ( ) ) ; localFilename += String . valueOf ( key . substring ( firstHalfLength ) . hashCode ( ) ) ; return localFilename ; } | Creates a pseudo - unique filename for the specified cache key . |
12,466 | private void removeEntry ( String key ) { CacheHeader entry = mEntries . get ( key ) ; if ( entry != null ) { mTotalSize -= entry . size ; mEntries . remove ( key ) ; } } | Removes the entry identified by key from the cache . |
12,467 | public synchronized void wrap ( List < Segment > segments ) throws IOException { int newWorkingGeneration = ( _workingGeneration + 1 ) % Integer . MAX_VALUE ; int newWorkingSectionOffset = ( _workingSectionOffset + _bytesPerSection ) % _bytesPerSegment ; int cnt = segments . size ( ) ; int pos = _segmentDataStart + newWorkingSectionOffset ; ensureCapacity ( cnt ) ; int newLiveSegmentCount = 0 ; for ( int index = 0 ; index < cnt ; index ++ ) { if ( segments . get ( index ) != null ) newLiveSegmentCount ++ ; } for ( int index = 0 ; index < cnt ; index ++ ) { Segment seg = segments . get ( index ) ; if ( seg != null ) { if ( seg . getLoadSize ( ) > 0 ) { writeInt ( pos , LIVE_SEGMENT ) ; writeInt ( pos + 4 , seg . getLoadSize ( ) ) ; } else { writeInt ( pos , FREE_SEGMENT ) ; writeInt ( pos + 4 , 0 ) ; newLiveSegmentCount -- ; } } else { writeInt ( pos , FREE_SEGMENT ) ; writeInt ( pos + 4 , 0 ) ; } pos += _bytesPerSegment ; } _mmapBuffer . force ( ) ; writeInt ( newWorkingSectionOffset , newWorkingGeneration ) ; writeInt ( newWorkingSectionOffset + 4 , newLiveSegmentCount ) ; _mmapBuffer . force ( ) ; _liveSegmentCount = newLiveSegmentCount ; _workingGeneration = newWorkingGeneration ; _workingSectionOffset = newWorkingSectionOffset ; _log . info ( _metaFile . getCanonicalPath ( ) + " updated" ) ; _log . info ( "workingGeneration=" + _workingGeneration + " liveSegmentCount=" + _liveSegmentCount ) ; } | Wrap a list of segments and persist meta data into the . meta file . |
12,468 | public static Document createDomDocument ( ) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setNamespaceAware ( true ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; return builder . newDocument ( ) ; } | Simple method to create an empty well - formed DOM Document |
12,469 | public FormEncodingBuilder add ( String name , String value ) { if ( content . size ( ) > 0 ) { content . writeByte ( '&' ) ; } HttpUrl . canonicalize ( content , name , 0 , name . length ( ) , HttpUrl . FORM_ENCODE_SET , false , false , true , true ) ; content . writeByte ( '=' ) ; HttpUrl . canonicalize ( content , value , 0 , value . length ( ) , HttpUrl . FORM_ENCODE_SET , false , false , true , true ) ; return this ; } | Add new key - value pair . |
12,470 | public static String toPackageName ( String nsUri ) { if ( nsUri == null || nsUri . length ( ) == 0 ) { return null ; } int idx = nsUri . indexOf ( ':' ) ; String scheme = "" ; if ( idx >= 0 ) { scheme = nsUri . substring ( 0 , idx ) ; if ( scheme . equalsIgnoreCase ( "http" ) || scheme . equalsIgnoreCase ( "urn" ) ) nsUri = nsUri . substring ( idx + 1 ) ; } List < String > tokens = tokenize ( nsUri , "/: " ) ; if ( tokens . size ( ) == 0 ) { return null ; } if ( tokens . size ( ) > 1 ) { String lastToken = tokens . get ( tokens . size ( ) - 1 ) ; idx = lastToken . lastIndexOf ( '.' ) ; if ( idx > 0 ) { lastToken = lastToken . substring ( 0 , idx ) ; tokens . set ( tokens . size ( ) - 1 , lastToken ) ; } } String domain = tokens . get ( 0 ) ; idx = domain . indexOf ( ':' ) ; if ( idx >= 0 ) domain = domain . substring ( 0 , idx ) ; ArrayList < String > r = reverse ( tokenize ( domain , scheme . equals ( "urn" ) ? ".-" : "." ) ) ; if ( r . get ( r . size ( ) - 1 ) . equalsIgnoreCase ( "www" ) ) { r . remove ( r . size ( ) - 1 ) ; } tokens . addAll ( 1 , r ) ; tokens . remove ( 0 ) ; for ( int i = 0 ; i < tokens . size ( ) ; i ++ ) { String token = tokens . get ( i ) ; token = removeIllegalIdentifierChars ( token ) ; if ( keywords . contains ( token . toLowerCase ( ) ) ) { token = '_' + token ; } tokens . set ( i , token . toLowerCase ( ) ) ; } return combine ( tokens , '.' ) ; } | Create a java package name out of an XML namespace . |
12,471 | public static String toNamespace ( String packageName ) { if ( packageName == null || packageName . length ( ) == 0 ) { return null ; } List < String > tokens = reverse ( tokenize ( packageName , "." ) ) ; StringBuilder buf = new StringBuilder ( "http://" ) ; for ( int i = 1 ; i < tokens . size ( ) ; i ++ ) { buf . append ( tokens . get ( i ) ) ; buf . append ( "." ) ; } if ( buf . charAt ( buf . length ( ) - 1 ) == '.' ) { buf . deleteCharAt ( buf . length ( ) - 1 ) ; buf . append ( "/" ) ; } buf . append ( tokens . get ( 0 ) ) ; return buf . toString ( ) ; } | Create an XML namespace out of a java package name . |
12,472 | public static XCAInitiatingGatewayAuditor getAuditor ( ) { AuditorModuleContext ctx = AuditorModuleContext . getContext ( ) ; return ( XCAInitiatingGatewayAuditor ) ctx . getAuditor ( XCAInitiatingGatewayAuditor . class ) ; } | Get an instance of the XCA Initiating Gateway from the global context |
12,473 | public void auditRetrieveDocumentSetEvent ( RFC3881EventOutcomeCodes eventOutcome , String consumerUserId , String consumerUserName , String consumerIpAddress , String repositoryEndpointUri , String [ ] documentUniqueIds , String [ ] repositoryUniqueIds , String [ ] homeCommunityIds , List < CodedValueType > purposesOfUse , List < CodedValueType > userRoles ) { if ( ! isAuditorEnabled ( ) ) { return ; } XDSRepositoryAuditor . getAuditor ( ) . auditRetrieveDocumentSetEvent ( eventOutcome , consumerUserId , consumerUserName , consumerIpAddress , repositoryEndpointUri , documentUniqueIds , repositoryUniqueIds , homeCommunityIds , purposesOfUse , userRoles ) ; } | Audits an ITI - 43 Retrieve Document Set - b event for XCA Initiating Gateway actors . Audits as a XDS Document Registry . |
12,474 | public Position get ( Position pos , Map < K , Event < V > > map ) { ArrayList < Event < K > > list = new ArrayList < Event < K > > ( 1000 ) ; Position nextPos = get ( pos , list ) ; for ( Event < K > evt : list ) { K key = evt . getValue ( ) ; if ( key != null ) { try { V value = get ( key ) ; map . put ( key , new SimpleEvent < V > ( value , evt . getClock ( ) ) ) ; } catch ( Exception e ) { logger . warn ( e . getMessage ( ) ) ; } } } return nextPos ; } | Gets a number of value events starting from a give position in the Retention . The number of events is determined internally by the Retention and it is up to the batch size . |
12,475 | public boolean isValid ( CobolContext cobolContext , byte [ ] hostData , int start ) { return isValid ( javaClass , cobolContext , hostData , start ) ; } | Check if a byte array contains valid mainframe data for this type characteristics . |
12,476 | public FromHostPrimitiveResult < T > fromHost ( CobolContext cobolContext , byte [ ] hostData , int start ) { return fromHost ( javaClass , cobolContext , hostData , start ) ; } | Convert mainframe data into a Java object . |
12,477 | protected static String formatMessage ( String message , byte [ ] hostData , int start , int curPos , int bytesLen ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( message ) ; if ( hostData != null && hostData . length > 0 && curPos < hostData . length && curPos >= start && bytesLen > 0 && start + bytesLen <= hostData . length ) { sb . append ( ". Error at offset " ) ; sb . append ( curPos ) ; sb . append ( " : [0x" ) ; int spyStart = Math . max ( start - SPYBUF_MAX_LEN , 0 ) ; appendData ( sb , hostData , spyStart , start - spyStart ) ; sb . append ( start > spyStart ? "->" : "" ) ; if ( curPos > start ) { appendData ( sb , hostData , start , curPos - start ) ; sb . append ( "^" ) ; appendData ( sb , hostData , curPos , bytesLen + start - curPos ) ; } else { appendData ( sb , hostData , start , bytesLen ) ; } int spyStop = Math . min ( start + bytesLen + SPYBUF_MAX_LEN , hostData . length ) ; sb . append ( spyStop > start + bytesLen ? "<-" : "" ) ; appendData ( sb , hostData , start + bytesLen , spyStop - start - bytesLen ) ; sb . append ( "]" ) ; } else { sb . append ( ". Position is " ) ; sb . append ( curPos ) ; } return sb . toString ( ) ; } | Format the data to make it easy to locate the error in the incoming byte stream . |
12,478 | public static IHEAuditor getAuditor ( Class < ? extends IHEAuditor > clazz , AuditorModuleConfig configToUse , AuditorModuleContext contextToUse ) { IHEAuditor auditor = AuditorFactory . getAuditorForClass ( clazz ) ; if ( auditor != null ) { auditor . setConfig ( configToUse ) ; auditor . setContext ( contextToUse ) ; } return auditor ; } | Get an auditor instance for the specified auditor class auditor configuration and auditor context . |
12,479 | public static IHEAuditor getAuditor ( Class < ? extends IHEAuditor > clazz , AuditorModuleConfig config , boolean useGlobalContext ) { AuditorModuleContext context ; if ( ! useGlobalContext ) { context = ( AuditorModuleContext ) ContextInitializer . initialize ( config ) ; } else { context = AuditorModuleContext . getContext ( ) ; } return getAuditor ( clazz , config , context ) ; } | Get an auditor instance for the specified auditor class module configuration . Auditor will use a standalone context if a non - global context is requested . |
12,480 | public static IHEAuditor getAuditor ( String className , AuditorModuleConfig config , AuditorModuleContext context ) { Class < ? extends IHEAuditor > clazz = AuditorFactory . getAuditorClassForClassName ( className ) ; return getAuditor ( clazz , config , context ) ; } | Get an auditor instance for the specified auditor class name auditor configuration and auditor context . |
12,481 | public static IHEAuditor getAuditor ( String className , AuditorModuleConfig config , boolean useGlobalContext ) { Class < ? extends IHEAuditor > clazz = AuditorFactory . getAuditorClassForClassName ( className ) ; return getAuditor ( clazz , config , useGlobalContext ) ; } | Get an auditor instance for the specified auditor class name module configuration . Auditor will use a standalone context if a non - global context is requested |
12,482 | @ SuppressWarnings ( "unchecked" ) public static Class < ? extends IHEAuditor > getAuditorClassForClassName ( String className ) { try { Class < ? > clazz = Class . forName ( className ) ; return ( Class < ? extends IHEAuditor > ) clazz ; } catch ( ClassCastException e ) { LOGGER . error ( "The requested class " + className + " is not a valid auditor" , e ) ; } catch ( ClassNotFoundException e ) { LOGGER . error ( "Could not find the requested auditor class " + className , e ) ; } catch ( Exception e ) { LOGGER . error ( "Error creating the auditor for " + className , e ) ; } return null ; } | Get a Class instance for the fully - qualified class name specified . The specified class should have IHEAuditor as a superclass and implement the necessary methods to be an IHE Auditor . |
12,483 | private static IHEAuditor getAuditorForClass ( Class < ? extends IHEAuditor > clazz ) { if ( null == clazz ) { LOGGER . error ( "Error - Cannot specify a null auditor class" ) ; } else { try { return clazz . newInstance ( ) ; } catch ( ClassCastException e ) { LOGGER . error ( "The requested class " + clazz . getName ( ) + " is not a valid auditor" , e ) ; } catch ( Exception e ) { LOGGER . error ( "Error creating the auditor for class " + clazz . getName ( ) , e ) ; } } return null ; } | Create a new instance of the specified IHE Auditor non - abstract subclass that implements the auditor API . |
12,484 | public String encodedUsername ( ) { if ( username . isEmpty ( ) ) return "" ; int usernameStart = scheme . length ( ) + 3 ; int usernameEnd = delimiterOffset ( url , usernameStart , url . length ( ) , ":@" ) ; return url . substring ( usernameStart , usernameEnd ) ; } | Returns the username or an empty string if none is set . |
12,485 | public String encodedPassword ( ) { if ( password . isEmpty ( ) ) return "" ; int passwordStart = url . indexOf ( ':' , scheme . length ( ) + 3 ) + 1 ; int passwordEnd = url . indexOf ( '@' ) ; return url . substring ( passwordStart , passwordEnd ) ; } | Returns the password or an empty string if none is set . |
12,486 | public synchronized Bitmap getBitmap ( BitmapFactory . Options options ) { Bitmap bitmap = null ; synchronized ( bitmapsBySize ) { final Iterator < Bitmap > iterator = bitmapsBySize . iterator ( ) ; Bitmap item ; while ( iterator . hasNext ( ) ) { item = iterator . next ( ) ; if ( null != item && canBePooled ( item ) ) { if ( BitmapLruPool . canUseForInBitmap ( item , options ) ) { bitmap = item ; currentSize -= getBitmapSize ( bitmap ) ; iterator . remove ( ) ; bitmapsByLastUse . remove ( bitmap ) ; break ; } } else { currentSize -= getBitmapSize ( item ) ; iterator . remove ( ) ; bitmapsByLastUse . remove ( item ) ; } } } return bitmap ; } | Returns a bitmap from the pool if one is available in the requested size or allocates a new one if a pooled one is not available . |
12,487 | public synchronized void returnBitmap ( Bitmap bitmap ) { if ( bitmap == null || bitmapsBySize . contains ( bitmap ) ) { return ; } else if ( getBitmapSize ( bitmap ) > sizeLimit || ! canBePooled ( bitmap ) ) { return ; } bitmapsByLastUse . add ( bitmap ) ; int pos = Collections . binarySearch ( bitmapsBySize , bitmap , BITMAP_COMPARATOR ) ; if ( pos < 0 ) { pos = - pos - 1 ; } bitmapsBySize . add ( pos , bitmap ) ; currentSize += getBitmapSize ( bitmap ) ; trim ( ) ; } | Returns a bitmap to the pool throwing away old bitmaps if the pool would exceed its allotted size . |
12,488 | protected static int getBytesPerPixel ( Bitmap . Config config ) { if ( config == Bitmap . Config . ARGB_8888 ) { return 4 ; } else if ( config == Bitmap . Config . RGB_565 ) { return 2 ; } else if ( config == Bitmap . Config . ARGB_4444 ) { return 2 ; } else if ( config == Bitmap . Config . ALPHA_8 ) { return 1 ; } return 1 ; } | Return the byte usage per pixel of a bitmap based on its configuration . |
12,489 | public static String parseCharset ( Map < String , String > headers , String defaultCharset ) { String contentType = headers . get ( HTTP . CONTENT_TYPE ) ; if ( contentType != null ) { String [ ] params = contentType . split ( ";" ) ; for ( int i = 1 ; i < params . length ; i ++ ) { String [ ] pair = params [ i ] . trim ( ) . split ( "=" ) ; if ( pair . length == 2 ) { if ( pair [ 0 ] . equals ( "charset" ) ) { return pair [ 1 ] ; } } } } return defaultCharset ; } | Retrieve a charset from headers |
12,490 | public void stopWhenDone ( ) { Thread t = new Thread ( new Runnable ( ) { public void run ( ) { while ( getCurrentRequests ( ) > 0 ) { try { Thread . sleep ( 33 ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } } } } ) ; t . start ( ) ; try { t . join ( ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } stop ( ) ; } | Stops the queue when all requests are finished |
12,491 | public < R extends RequestQueue > R addQueueMarkerListener ( RequestListener . MarkerListener markerListener ) { if ( markerListener != null ) { synchronized ( markerListeners ) { this . markerListeners . add ( markerListener ) ; } } return ( R ) this ; } | Add marker listener for RequestQueue related events |
12,492 | public < R extends RequestQueue > R removeQueueMarkerListener ( RequestListener . MarkerListener markerListener ) { synchronized ( markerListeners ) { this . markerListeners . remove ( markerListener ) ; } return ( R ) this ; } | Remove marker listener for RequestQueue related events |
12,493 | public void cancelAll ( final Object tag ) { if ( tag == null ) { throw new IllegalArgumentException ( "Cannot cancelAll with a null tag" ) ; } cancelAll ( new RequestFilter ( ) { public boolean apply ( Request < ? > request ) { return request . getTag ( ) == tag ; } } ) ; } | Cancels all requests in this queue with the given tag . Tag must be non - null and equality is by identity . |
12,494 | public static Clock parseClock ( String str ) { if ( str == null || str . length ( ) == 0 ) { return Clock . ZERO ; } String [ ] parts = str . split ( ":" ) ; long [ ] values = new long [ parts . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) { values [ i ] = Long . parseLong ( parts [ i ] ) ; } return new Clock ( values ) ; } | Parses a Clock value from its string representation . |
12,495 | public static Clock parseClock ( byte [ ] raw ) { if ( raw == null || raw . length < 8 ) { return Clock . ZERO ; } int cnt = raw . length >> 3 ; long [ ] values = new long [ cnt ] ; ByteBuffer bb = ByteBuffer . wrap ( raw ) ; for ( int i = 0 ; i < values . length ; i ++ ) { values [ i ] = bb . getLong ( ) ; } return new Clock ( values ) ; } | Parses a Clock value from its raw bytes . |
12,496 | public Occurred compareTo ( Clock c ) { if ( this == c ) return Occurred . EQUICONCURRENTLY ; if ( ZERO == c ) return Occurred . AFTER ; if ( this == ZERO ) return Occurred . BEFORE ; int neg = 0 , pos = 0 , eq = 0 ; try { final long [ ] dst = c . values ( ) ; final int len = dst . length ; if ( _values . length == len ) { for ( int i = 0 ; i < len ; i ++ ) { long cmp = _values [ i ] - dst [ i ] ; if ( cmp < 0 ) { neg ++ ; } else if ( cmp > 0 ) { pos ++ ; } else { eq ++ ; } } if ( eq == len ) { return Occurred . EQUICONCURRENTLY ; } else if ( neg == len ) { return Occurred . BEFORE ; } else if ( pos == len ) { return Occurred . AFTER ; } else { neg += eq ; if ( neg == len ) { return Occurred . BEFORE ; } pos += eq ; if ( pos == len ) { return Occurred . AFTER ; } return Occurred . CONCURRENTLY ; } } } catch ( Exception e ) { } throw new IncomparableClocksException ( this , c ) ; } | Compares this clock with the specified clock for ordering . |
12,497 | public static String resolveFigurative ( final String value , final int length , final boolean quoteIsQuote ) { if ( value == null || value . length ( ) == 0 ) { return value ; } String ucValue = value . toUpperCase ( Locale . getDefault ( ) ) ; if ( ucValue . matches ( "^ZERO(S|ES)?$" ) ) { return "0" ; } if ( ucValue . matches ( "^SPACES?$" ) ) { return " " ; } if ( ucValue . matches ( "^QUOTES?$" ) ) { return quoteIsQuote ? "\"" : "\'" ; } if ( ucValue . matches ( "^APOST$" ) ) { return "\'" ; } if ( ucValue . matches ( "^HIGH-VALUES?$" ) ) { return fill ( "0x" , "FF" , length ) ; } if ( ucValue . matches ( "^LOW-VALUES?$" ) ) { return fill ( "0x" , "00" , length ) ; } if ( ucValue . matches ( "^NULLS?$" ) ) { return fill ( "0x" , "00" , length ) ; } if ( ucValue . startsWith ( "ALL " ) ) { String literal = value . substring ( "ALL " . length ( ) ) ; String resolvedLiteral = ValueUtil . resolveFigurative ( literal , length , quoteIsQuote ) ; if ( resolvedLiteral . length ( ) > 0 && resolvedLiteral . length ( ) < length ) { String filled = fill ( null , resolvedLiteral , length / resolvedLiteral . length ( ) ) ; if ( filled . length ( ) < length ) { return filled + resolvedLiteral . substring ( 0 , length - filled . length ( ) ) ; } else { return filled ; } } else { return resolvedLiteral ; } } return stripDelimiters ( value ) ; } | Translate individual figurative constants . |
12,498 | public static String fill ( final String prefix , final String charSequence , final int times ) { if ( times < 1 ) { return "" ; } StringBuilder sb = new StringBuilder ( ) ; if ( prefix != null ) { sb . append ( prefix ) ; } for ( int i = 0 ; i < times ; i ++ ) { sb . append ( charSequence ) ; } return sb . toString ( ) ; } | Create a string representation repeating a character sequence the requested number of times . |
12,499 | public static String stripDelimiters ( final String value ) { if ( value != null && value . length ( ) > 1 ) { if ( value . charAt ( 0 ) == value . charAt ( value . length ( ) - 1 ) && ( value . charAt ( 0 ) == '\'' ) ) { return value . substring ( 1 , value . length ( ) - 1 ) ; } if ( value . charAt ( 0 ) == value . charAt ( value . length ( ) - 1 ) && ( value . charAt ( 0 ) == '\"' ) ) { return value . substring ( 1 , value . length ( ) - 1 ) ; } } return value ; } | The parser does not strip delimiters from literal strings so we do it here if necessary . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.