idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
12,700 | public void auditProvideAndRegisterDocumentSetEvent ( RFC3881EventOutcomeCodes eventOutcome , String repositoryEndpointUri , String userName , String submissionSetUniqueId , String patientId ) { if ( ! isAuditorEnabled ( ) ) { return ; } auditProvideAndRegisterEvent ( new IHETransactionEventTypeCodes . ProvideAndRegisterDocumentSet ( ) , eventOutcome , repositoryEndpointUri , userName , submissionSetUniqueId , patientId , null , null ) ; } | Audits an ITI - 15 Provide And Register Document Set event for XDS . a Document Source actors . |
12,701 | public void auditProvideAndRegisterDocumentSetBEvent ( RFC3881EventOutcomeCodes eventOutcome , String repositoryEndpointUri , String userName , String submissionSetUniqueId , String patientId , List < CodedValueType > purposesOfUse , List < CodedValueType > userRoles ) { if ( ! isAuditorEnabled ( ) ) { return ; } auditProvideAndRegisterEvent ( new IHETransactionEventTypeCodes . ProvideAndRegisterDocumentSetB ( ) , eventOutcome , repositoryEndpointUri , userName , submissionSetUniqueId , patientId , purposesOfUse , userRoles ) ; } | Audits an ITI - 41 Provide And Register Document Set - b event for XDS . b Document Source actors . |
12,702 | protected void auditProvideAndRegisterEvent ( IHETransactionEventTypeCodes transaction , RFC3881EventOutcomeCodes eventOutcome , String repositoryEndpointUri , String userName , String submissionSetUniqueId , String patientId , List < CodedValueType > purposesOfUse , List < CodedValueType > userRoles ) { ExportEvent exportEvent = new ExportEvent ( true , eventOutcome , transaction , purposesOfUse ) ; exportEvent . setAuditSourceId ( getAuditSourceId ( ) , getAuditEnterpriseSiteId ( ) ) ; String replyToUri = "http://www.w3.org/2005/08/addressing/anonymous" ; exportEvent . addSourceActiveParticipant ( replyToUri , getSystemAltUserId ( ) , getSystemUserName ( ) , getSystemNetworkId ( ) , true ) ; if ( ! EventUtils . isEmptyOrNull ( userName ) ) { exportEvent . addHumanRequestorActiveParticipant ( userName , null , userName , userRoles ) ; } exportEvent . addDestinationActiveParticipant ( repositoryEndpointUri , null , null , EventUtils . getAddressForUrl ( repositoryEndpointUri , false ) , false ) ; if ( ! EventUtils . isEmptyOrNull ( patientId ) ) { exportEvent . addPatientParticipantObject ( patientId ) ; } exportEvent . addSubmissionSetParticipantObject ( submissionSetUniqueId ) ; audit ( exportEvent ) ; } | Generically sends audit messages for XDS Document Source Provide And Register Document Set events |
12,703 | public void addNodeActiveParticipant ( String userId , String altUserId , String userName , String networkId ) { addActiveParticipant ( userId , altUserId , userName , true , Collections . singletonList ( new DICOMActiveParticipantRoleIdCodes . Application ( ) ) , networkId ) ; } | Adds an Active Participant representing the node that is performing the authentication |
12,704 | public static String buildUrlQuery ( String baseUrl , Map < String , String > params ) { if ( baseUrl . isEmpty ( ) || params . isEmpty ( ) ) { return baseUrl ; } else { String query = baseUrl ; query += QUERY_STRING_SEPARATOR ; for ( String key : params . keySet ( ) ) { query += key ; query += PAIR_SEPARATOR ; query += encodeString ( params . get ( key ) ) ; query += PARAM_SEPARATOR ; } return query . substring ( 0 , query . length ( ) - 1 ) ; } } | Builds the URL String . |
12,705 | protected void setAuditMessageElements ( EventIdentificationType eventId , ActiveParticipantType [ ] participants , AuditSourceIdentificationType [ ] sourceIds , ParticipantObjectIdentificationType [ ] objectIds ) { AuditMessage auditMessage = getAuditMessage ( ) ; auditMessage . setEventIdentification ( eventId ) ; auditMessage . getActiveParticipant ( ) . clear ( ) ; if ( ! EventUtils . isEmptyOrNull ( participants , true ) ) { auditMessage . getActiveParticipant ( ) . addAll ( Arrays . asList ( participants ) ) ; } auditMessage . getAuditSourceIdentification ( ) . clear ( ) ; if ( ! EventUtils . isEmptyOrNull ( sourceIds , true ) ) { auditMessage . getAuditSourceIdentification ( ) . addAll ( Arrays . asList ( sourceIds ) ) ; } auditMessage . getParticipantObjectIdentification ( ) . clear ( ) ; if ( ! EventUtils . isEmptyOrNull ( objectIds , true ) ) { auditMessage . getParticipantObjectIdentification ( ) . addAll ( Arrays . asList ( objectIds ) ) ; } } | Clear and set the individual elements of the audit message payload in line with RFC 3881 |
12,706 | protected EventIdentificationType setEventIdentification ( RFC3881EventOutcomeCodes outcome , RFC3881EventActionCodes action , CodedValueType id , CodedValueType [ ] type , List < CodedValueType > purposesOfUse ) { EventIdentificationType eventBlock = new EventIdentificationType ( ) ; eventBlock . setEventID ( id ) ; eventBlock . setEventDateTime ( TimestampUtils . getRFC3881Timestamp ( eventDateTime ) ) ; if ( ! EventUtils . isEmptyOrNull ( action ) ) { eventBlock . setEventActionCode ( action . getCode ( ) ) ; } if ( ! EventUtils . isEmptyOrNull ( outcome ) ) { eventBlock . setEventOutcomeIndicator ( outcome . getCode ( ) ) ; } if ( ! EventUtils . isEmptyOrNull ( type , true ) ) { eventBlock . getEventTypeCode ( ) . addAll ( Arrays . asList ( type ) ) ; } eventBlock . setPurposesOfUse ( purposesOfUse ) ; getAuditMessage ( ) . setEventIdentification ( eventBlock ) ; return eventBlock ; } | Create and set an Event Identification block for this audit event message |
12,707 | protected ActiveParticipantType addActiveParticipant ( String userID , String altUserID , String userName , Boolean userIsRequestor , List < CodedValueType > roleIdCodes , String networkAccessPointID , RFC3881NetworkAccessPointTypeCodes networkAccessPointTypeCode ) { ActiveParticipantType activeParticipantBlock = new ActiveParticipantType ( ) ; activeParticipantBlock . setUserID ( userID ) ; activeParticipantBlock . setAlternativeUserID ( altUserID ) ; activeParticipantBlock . setUserName ( userName ) ; activeParticipantBlock . setUserIsRequestor ( userIsRequestor ) ; if ( ! EventUtils . isEmptyOrNull ( roleIdCodes , true ) ) { activeParticipantBlock . getRoleIDCode ( ) . addAll ( roleIdCodes ) ; } activeParticipantBlock . setNetworkAccessPointID ( networkAccessPointID ) ; if ( ! EventUtils . isEmptyOrNull ( networkAccessPointTypeCode ) ) { activeParticipantBlock . setNetworkAccessPointTypeCode ( networkAccessPointTypeCode . getCode ( ) ) ; } getAuditMessage ( ) . getActiveParticipant ( ) . add ( activeParticipantBlock ) ; return activeParticipantBlock ; } | Create and add an Active Participant block to this audit event message |
12,708 | protected AuditSourceIdentificationType addAuditSourceIdentification ( String sourceID , String enterpriseSiteID , RFC3881AuditSourceTypeCodes ... typeCodes ) { AuditSourceIdentificationType sourceBlock = new AuditSourceIdentificationType ( ) ; if ( ! EventUtils . isEmptyOrNull ( typeCodes , true ) ) { sourceBlock . setAuditSourceTypeCode ( typeCodes [ 0 ] ) ; } sourceBlock . setAuditSourceID ( sourceID ) ; sourceBlock . setAuditEnterpriseSiteID ( enterpriseSiteID ) ; getAuditMessage ( ) . getAuditSourceIdentification ( ) . add ( sourceBlock ) ; return sourceBlock ; } | Create and add an Audit Source Identification block to this audit event message |
12,709 | public ParticipantObjectIdentificationType addParticipantObjectIdentification ( CodedValueType objectIDTypeCode , String objectName , byte [ ] objectQuery , List < TypeValuePairType > objectDetail , String objectID , RFC3881ParticipantObjectTypeCodes objectTypeCode , RFC3881ParticipantObjectTypeRoleCodes objectTypeCodeRole , RFC3881ParticipantObjectDataLifeCycleCodes objectDataLifeCycle , String objectSensitivity ) { ParticipantObjectIdentificationType participantBlock = new ParticipantObjectIdentificationType ( ) ; participantBlock . setParticipantObjectIDTypeCode ( objectIDTypeCode ) ; participantBlock . setParticipantObjectName ( objectName ) ; participantBlock . setParticipantObjectQuery ( objectQuery ) ; if ( ! EventUtils . isEmptyOrNull ( objectDetail , true ) ) { participantBlock . getParticipantObjectDetail ( ) . addAll ( objectDetail ) ; } participantBlock . setParticipantObjectID ( objectID ) ; if ( ! EventUtils . isEmptyOrNull ( objectTypeCode ) ) { participantBlock . setParticipantObjectTypeCode ( objectTypeCode . getCode ( ) ) ; } if ( ! EventUtils . isEmptyOrNull ( objectTypeCodeRole ) ) { participantBlock . setParticipantObjectTypeCodeRole ( objectTypeCodeRole . getCode ( ) ) ; } if ( ! EventUtils . isEmptyOrNull ( objectDataLifeCycle ) ) { participantBlock . setParticipantObjectDataLifeCycle ( objectDataLifeCycle . getCode ( ) ) ; } participantBlock . setParticipantObjectSensitivity ( objectSensitivity ) ; getAuditMessage ( ) . getParticipantObjectIdentification ( ) . add ( participantBlock ) ; return participantBlock ; } | Create and add an Participant Object Identification block to this audit event message |
12,710 | protected ActiveParticipantType addActiveParticipant ( String userID , String altUserID , String userName , Boolean userIsRequestor , List < CodedValueType > roleIdCodes , String networkAccessPointID ) { return addActiveParticipant ( userID , altUserID , userName , userIsRequestor , roleIdCodes , networkAccessPointID , getNetworkAccessPointCodeFromAddress ( networkAccessPointID ) ) ; } | Create and add an Active Participant block to this audit event message but automatically determine the Network Access Point ID Type Code |
12,711 | protected RFC3881NetworkAccessPointTypeCodes getNetworkAccessPointCodeFromAddress ( String address ) { if ( EventUtils . isEmptyOrNull ( address ) ) { return null ; } if ( address . matches ( "^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$" ) ) { return RFC3881NetworkAccessPointTypeCodes . IP_ADDRESS ; } return RFC3881NetworkAccessPointTypeCodes . MACHINE_NAME ; } | Attempt to determine the proper Active Participant Network Access Point Type Code from a given string . |
12,712 | public static XCPDInitiatingGatewayAuditor getAuditor ( ) { AuditorModuleContext ctx = AuditorModuleContext . getContext ( ) ; return ( XCPDInitiatingGatewayAuditor ) ctx . getAuditor ( XCPDInitiatingGatewayAuditor . class ) ; } | Get an instance of the XCPD Initiating Gateway Auditor from the global context |
12,713 | public void auditXCPDQueryEvent ( RFC3881EventOutcomeCodes eventOutcome , String sourceUserId , String humanRequestorUserId , CodedValueType humanRequestorRoleIdCode , String XCPDRGUri , String homeCommunityId , String queryByParameter , List < CodedValueType > purposesOfUse ) { if ( ! isAuditorEnabled ( ) ) { return ; } QueryEvent queryEvent = new QueryEvent ( true , eventOutcome , new IHETransactionEventTypeCodes . CrossGatewayPatientDiscovery ( ) , purposesOfUse ) ; queryEvent . addSourceActiveParticipant ( sourceUserId , getSystemAltUserId ( ) , getSystemUserName ( ) , getSystemNetworkId ( ) , true ) ; if ( EventUtils . isEmptyOrNull ( humanRequestorUserId ) ) { humanRequestorUserId = getHumanRequestor ( ) ; } if ( ! EventUtils . isEmptyOrNull ( humanRequestorUserId ) ) { queryEvent . addHumanRequestorActiveParticipant ( humanRequestorUserId , null , null , humanRequestorRoleIdCode ) ; } queryEvent . addDestinationActiveParticipant ( XCPDRGUri , null , null , EventUtils . getAddressForUrl ( XCPDRGUri , false ) , false ) ; queryEvent . setAuditSourceId ( getAuditSourceId ( ) , getAuditEnterpriseSiteId ( ) ) ; byte [ ] queryByParameterBytes = null ; if ( queryByParameter != null ) { try { queryByParameterBytes = queryByParameter . getBytes ( "UTF-8" ) ; } catch ( UnsupportedEncodingException e ) { LOGGER . error ( "could not use UTF-8 encoding due to it being unsupported on this system, using system default which may cause problems downstream" , e ) ; queryByParameterBytes = queryByParameter . getBytes ( ) ; } } queryEvent . addQueryParticipantObject ( null , homeCommunityId , queryByParameterBytes , null , new IHETransactionEventTypeCodes . CrossGatewayQuery ( ) ) ; audit ( queryEvent ) ; } | Audits an ITI - 55 Cross Gateway Patient Discovery event for XCPD Initiating Gateway actors . |
12,714 | public static SVSConsumerAuditor getAuditor ( ) { AuditorModuleContext ctx = AuditorModuleContext . getContext ( ) ; return ( SVSConsumerAuditor ) ctx . getAuditor ( SVSConsumerAuditor . class ) ; } | Get an instance of the SVS Consumer Auditor from the global context |
12,715 | public void auditRetrieveValueSetEvent ( RFC3881EventOutcomeCodes eventOutcome , String repositoryEndpointUri , String valueSetUniqueId , String valueSetName , String valueSetVersion , List < CodedValueType > purposesOfUse , List < CodedValueType > userRoles ) { if ( ! isAuditorEnabled ( ) ) { return ; } ImportEvent importEvent = new ImportEvent ( false , eventOutcome , new IHETransactionEventTypeCodes . RetrieveValueSet ( ) , purposesOfUse ) ; importEvent . setAuditSourceId ( getAuditSourceId ( ) , getAuditEnterpriseSiteId ( ) ) ; importEvent . addSourceActiveParticipant ( EventUtils . getAddressForUrl ( repositoryEndpointUri , false ) , null , null , EventUtils . getAddressForUrl ( repositoryEndpointUri , false ) , false ) ; importEvent . addDestinationActiveParticipant ( getSystemUserId ( ) , getSystemAltUserId ( ) , getSystemUserName ( ) , getSystemNetworkId ( ) , true ) ; if ( ! EventUtils . isEmptyOrNull ( getHumanRequestor ( ) ) ) { importEvent . addHumanRequestorActiveParticipant ( getHumanRequestor ( ) , null , null , userRoles ) ; } importEvent . addValueSetParticipantObject ( valueSetUniqueId , valueSetName , valueSetVersion ) ; audit ( importEvent ) ; } | Audits an ITI - 48 Retrieve Value Set event for SVS Consumer actors . |
12,716 | public static void main ( String [ ] args ) { try { File homeDir = new File ( args [ 0 ] ) ; int initialCapacity = Integer . parseInt ( args [ 1 ] ) ; KratiDataStore store = new KratiDataStore ( homeDir , initialCapacity ) ; store . populate ( ) ; store . doRandomReads ( 10 ) ; store . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } | java - Xmx4G krati . examples . KratiDataStore homeDir initialCapacity |
12,717 | protected byte [ ] getTransportPayload ( AuditEventMessage msg ) throws UnsupportedEncodingException { if ( msg == null ) { return null ; } byte [ ] msgBytes = msg . getSerializedMessage ( false ) ; if ( EventUtils . isEmptyOrNull ( msgBytes ) ) { return null ; } StringBuilder sb = new StringBuilder ( ) ; sb . append ( "<" ) ; sb . append ( TRANSPORT_DEFAULT_PRIORITY ) ; sb . append ( ">" ) ; sb . append ( "1 " ) ; sb . append ( TimestampUtils . getRFC3881Timestamp ( msg . getDateTime ( ) ) ) ; sb . append ( " " ) ; sb . append ( getSystemHostName ( ) ) ; sb . append ( " " ) ; sb . append ( TRANSPORT_DEFAULT_APP ) ; sb . append ( " " ) ; sb . append ( getPROCID ( ) ) ; sb . append ( " " ) ; sb . append ( TRANSPORT_DEFAULT_MSGID ) ; sb . append ( " - " ) ; sb . append ( "\uFEFF" ) ; sb . append ( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ) ; sb . append ( new String ( msgBytes , "UTF-8" ) ) ; return sb . toString ( ) . trim ( ) . getBytes ( "UTF-8" ) ; } | Serialize format and prepare the message payload body for sending by this transport . This includes adding the syslog message header which is transport independent . |
12,718 | private String getSystemHostName ( ) { if ( EventUtils . isEmptyOrNull ( systemHostName ) ) { try { systemHostName = InetAddress . getLocalHost ( ) . getHostName ( ) ; } catch ( Throwable t ) { systemHostName = "localhost" ; } } return systemHostName ; } | Gets the hostname of the system managing this transport |
12,719 | private long fourByteToLong ( byte [ ] bytes , int offset ) { return ( byteToLong ( bytes [ offset + 0 ] ) + ( byteToLong ( bytes [ offset + 1 ] ) << 8 ) + ( byteToLong ( bytes [ offset + 2 ] ) << 16 ) + ( byteToLong ( bytes [ offset + 3 ] ) << 24 ) ) ; } | Convert 4 bytes from the buffer at offset into a long value . |
12,720 | private void hashMix ( ) { a = subtract ( a , b ) ; a = subtract ( a , c ) ; a = xor ( a , c >> 13 ) ; b = subtract ( b , c ) ; b = subtract ( b , a ) ; b = xor ( b , leftShift ( a , 8 ) ) ; c = subtract ( c , a ) ; c = subtract ( c , b ) ; c = xor ( c , ( b >> 13 ) ) ; a = subtract ( a , b ) ; a = subtract ( a , c ) ; a = xor ( a , ( c >> 12 ) ) ; b = subtract ( b , c ) ; b = subtract ( b , a ) ; b = xor ( b , leftShift ( a , 16 ) ) ; c = subtract ( c , a ) ; c = subtract ( c , b ) ; c = xor ( c , ( b >> 5 ) ) ; a = subtract ( a , b ) ; a = subtract ( a , c ) ; a = xor ( a , ( c >> 3 ) ) ; b = subtract ( b , c ) ; b = subtract ( b , a ) ; b = xor ( b , leftShift ( a , 10 ) ) ; c = subtract ( c , a ) ; c = subtract ( c , b ) ; c = xor ( c , ( b >> 15 ) ) ; } | Mix up the values in the hash function . |
12,721 | public long hash ( byte [ ] buffer , long initialValue ) { int len , pos ; a = 0x09e3779b9L ; b = 0x09e3779b9L ; c = initialValue ; pos = 0 ; for ( len = buffer . length ; len >= 12 ; len -= 12 ) { a = add ( a , fourByteToLong ( buffer , pos ) ) ; b = add ( b , fourByteToLong ( buffer , pos + 4 ) ) ; c = add ( c , fourByteToLong ( buffer , pos + 8 ) ) ; hashMix ( ) ; pos += 12 ; } c += buffer . length ; switch ( len ) { case 11 : c = add ( c , leftShift ( byteToLong ( buffer [ pos + 10 ] ) , 24 ) ) ; case 10 : c = add ( c , leftShift ( byteToLong ( buffer [ pos + 9 ] ) , 16 ) ) ; case 9 : c = add ( c , leftShift ( byteToLong ( buffer [ pos + 8 ] ) , 8 ) ) ; case 8 : b = add ( b , leftShift ( byteToLong ( buffer [ pos + 7 ] ) , 24 ) ) ; case 7 : b = add ( b , leftShift ( byteToLong ( buffer [ pos + 6 ] ) , 16 ) ) ; case 6 : b = add ( b , leftShift ( byteToLong ( buffer [ pos + 5 ] ) , 8 ) ) ; case 5 : b = add ( b , byteToLong ( buffer [ pos + 4 ] ) ) ; case 4 : a = add ( a , leftShift ( byteToLong ( buffer [ pos + 3 ] ) , 24 ) ) ; case 3 : a = add ( a , leftShift ( byteToLong ( buffer [ pos + 2 ] ) , 16 ) ) ; case 2 : a = add ( a , leftShift ( byteToLong ( buffer [ pos + 1 ] ) , 8 ) ) ; case 1 : a = add ( a , byteToLong ( buffer [ pos + 0 ] ) ) ; } hashMix ( ) ; return c ; } | Hash a variable - length key into a 32 - bit value . Every bit of the key affects every bit of the return value . Every 1 - bit and 2 - bit delta achieves avalanche . The best hash table sizes are powers of 2 . |
12,722 | public XmlSchemaComplexType createXmlSchemaComplexType ( final XsdDataItem xsdDataItem ) { XmlSchemaComplexType xmlSchemaComplexType = new XmlSchemaComplexType ( getXsd ( ) , true ) ; XmlSchemaChoice xmlSchemaChoice = null ; XmlSchemaSequence xmlSchemaSequence = new XmlSchemaSequence ( ) ; for ( XsdDataItem child : xsdDataItem . getChildren ( ) ) { XmlSchemaElement xmlSchemaElement = createXmlSchemaElement ( child ) ; if ( xmlSchemaElement != null ) { if ( child . isRedefined ( ) ) { xmlSchemaChoice = new XmlSchemaChoice ( ) ; xmlSchemaSequence . getItems ( ) . add ( xmlSchemaChoice ) ; xmlSchemaChoice . getItems ( ) . add ( xmlSchemaElement ) ; } else if ( child . getRedefines ( ) != null ) { if ( xmlSchemaChoice == null ) { _log . warn ( "Item " + child . getCobolName ( ) + " REDEFINES " + child . getRedefines ( ) + " but redefined item is not a sibling" ) ; xmlSchemaSequence . getItems ( ) . add ( xmlSchemaElement ) ; } else { xmlSchemaChoice . getItems ( ) . add ( xmlSchemaElement ) ; } } else { xmlSchemaSequence . getItems ( ) . add ( xmlSchemaElement ) ; } } } xmlSchemaComplexType . setParticle ( xmlSchemaSequence ) ; xmlSchemaComplexType . setName ( xsdDataItem . getXsdTypeName ( ) ) ; return xmlSchemaComplexType ; } | Create an XML schema complex type . We want to use Named complex types so we add them to the XSD directly . We add complex types before their children because its nicer for the XSD layout to list roots before leafs . Redefined and redefining elements are grouped into an XML Schema choice . A choice is created when an element marked as isRedefined is encountered and it groups all subsequent elements marked as redefines until a non redefining element is found . |
12,723 | public XmlSchemaElement createXmlSchemaElement ( final XsdDataItem xsdDataItem ) { XmlSchemaElement element = new XmlSchemaElement ( getXsd ( ) , false ) ; element . setName ( xsdDataItem . getXsdElementName ( ) ) ; if ( xsdDataItem . getMaxOccurs ( ) != 1 ) { element . setMaxOccurs ( xsdDataItem . getMaxOccurs ( ) ) ; } if ( xsdDataItem . getMinOccurs ( ) != 1 ) { element . setMinOccurs ( xsdDataItem . getMinOccurs ( ) ) ; } XmlSchemaType xmlSchemaType = createXmlSchemaType ( xsdDataItem ) ; if ( xmlSchemaType == null ) { return null ; } if ( xmlSchemaType instanceof XmlSchemaSimpleType ) { element . setSchemaType ( xmlSchemaType ) ; } else { element . setSchemaTypeName ( xmlSchemaType . getQName ( ) ) ; } if ( getConfig ( ) . addLegStarAnnotations ( ) ) { element . setAnnotation ( _annotationEmitter . createLegStarAnnotation ( xsdDataItem ) ) ; } return element ; } | Create an XML Schema element from a COBOL data item . |
12,724 | protected void addEnumerationFacets ( final XsdDataItem xsdDataItem , final XmlSchemaSimpleTypeRestriction restriction ) { if ( getConfig ( ) . mapConditionsToFacets ( ) ) { boolean hasValueThru = false ; for ( XsdDataItem child : xsdDataItem . getChildren ( ) ) { if ( child . getDataEntryType ( ) == DataEntryType . CONDITION ) { for ( String conditionValue : child . getConditionLiterals ( ) ) { restriction . getFacets ( ) . add ( createEnumerationFacet ( ValueUtil . resolveFigurative ( conditionValue , xsdDataItem . getMaxStorageLength ( ) , getConfig ( ) . quoteIsQuote ( ) ) ) ) ; } for ( Range conditionRange : child . getConditionRanges ( ) ) { if ( hasValueThru ) { _log . warn ( xsdDataItem . getCobolName ( ) + " has several VALUE THRU statements." + " Cannot translate to XSD." + " Only the first one will be converted." + " Ignoring: " + conditionRange . toString ( ) ) ; break ; } restriction . getFacets ( ) . add ( createMinInclusiveFacet ( ValueUtil . resolveFigurative ( conditionRange . getFrom ( ) , xsdDataItem . getMaxStorageLength ( ) , getConfig ( ) . quoteIsQuote ( ) ) ) ) ; restriction . getFacets ( ) . add ( createMaxInclusiveFacet ( ValueUtil . resolveFigurative ( conditionRange . getTo ( ) , xsdDataItem . getMaxStorageLength ( ) , getConfig ( ) . quoteIsQuote ( ) ) ) ) ; hasValueThru = true ; } } } } } | If simple type has conditions attached to it emit enumeration facets . |
12,725 | protected XmlSchemaSimpleType createXmlSchemaSimpleType ( final XmlSchemaSimpleTypeRestriction restriction ) { XmlSchemaSimpleType xmlSchemaSimpleType = new XmlSchemaSimpleType ( getXsd ( ) , false ) ; xmlSchemaSimpleType . setContent ( restriction ) ; return xmlSchemaSimpleType ; } | Create an XML schema simple type from a restriction . |
12,726 | protected XmlSchemaSimpleTypeRestriction createRestriction ( final String xsdTypeName ) { XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction ( ) ; restriction . setBaseTypeName ( new QName ( XMLConstants . W3C_XML_SCHEMA_NS_URI , xsdTypeName ) ) ; return restriction ; } | Create an XML schema restriction . |
12,727 | protected XmlSchemaMaxLengthFacet createMaxLengthFacet ( final int length ) { XmlSchemaMaxLengthFacet xmlSchemaMaxLengthFacet = new XmlSchemaMaxLengthFacet ( ) ; xmlSchemaMaxLengthFacet . setValue ( length ) ; return xmlSchemaMaxLengthFacet ; } | Create an XML schema maxLength facet . |
12,728 | protected XmlSchemaPatternFacet createPatternFacet ( final String pattern ) { XmlSchemaPatternFacet xmlSchemaPatternFacet = new XmlSchemaPatternFacet ( ) ; xmlSchemaPatternFacet . setValue ( pattern ) ; return xmlSchemaPatternFacet ; } | Create an XML schema pattern facet . |
12,729 | protected XmlSchemaEnumerationFacet createEnumerationFacet ( final String conditionValue ) { XmlSchemaEnumerationFacet xmlSchemaEnumerationFacet = new XmlSchemaEnumerationFacet ( ) ; xmlSchemaEnumerationFacet . setValue ( conditionValue ) ; return xmlSchemaEnumerationFacet ; } | Create an XML schema enumeration facet . |
12,730 | protected XmlSchemaTotalDigitsFacet createTotalDigitsFacet ( final int totalDigits ) { XmlSchemaTotalDigitsFacet xmlSchemaTotalDigitsFacet = new XmlSchemaTotalDigitsFacet ( ) ; xmlSchemaTotalDigitsFacet . setValue ( totalDigits ) ; return xmlSchemaTotalDigitsFacet ; } | Create an XML schema totalDigits facet . |
12,731 | protected XmlSchemaFractionDigitsFacet createFractionDigitsFacet ( final int fractionDigits ) { XmlSchemaFractionDigitsFacet xmlSchemaFractionDigitsFacet = new XmlSchemaFractionDigitsFacet ( ) ; xmlSchemaFractionDigitsFacet . setValue ( fractionDigits ) ; return xmlSchemaFractionDigitsFacet ; } | Create an XML schema fractionDigits facet . |
12,732 | protected XmlSchemaMinInclusiveFacet createMinInclusiveFacet ( final String minInclusive ) { XmlSchemaMinInclusiveFacet xmlSchemaMinInclusiveFacet = new XmlSchemaMinInclusiveFacet ( ) ; xmlSchemaMinInclusiveFacet . setValue ( minInclusive ) ; return xmlSchemaMinInclusiveFacet ; } | Create an XML schema minInclusive facet . |
12,733 | protected XmlSchemaMaxInclusiveFacet createMaxInclusiveFacet ( final String maxInclusive ) { XmlSchemaMaxInclusiveFacet xmlSchemaMaxInclusiveFacet = new XmlSchemaMaxInclusiveFacet ( ) ; xmlSchemaMaxInclusiveFacet . setValue ( maxInclusive ) ; return xmlSchemaMaxInclusiveFacet ; } | Create an XML schema maxInclusive facet . |
12,734 | public int read ( SegmentIndexBuffer sib , File sibFile ) throws IOException { check ( sibFile ) ; RandomAccessFile raf = new RandomAccessFile ( sibFile , "r" ) ; FileChannel channel = raf . getChannel ( ) ; readVersion ( channel ) ; int length = sib . read ( channel ) ; length += STORAGE_VERSION_LENGTH ; channel . close ( ) ; raf . close ( ) ; if ( _logger . isTraceEnabled ( ) ) { _logger . trace ( "read " + sibFile . getAbsolutePath ( ) ) ; } return length ; } | Reads from the specified segment index buffer file . |
12,735 | public int write ( SegmentIndexBuffer sib , File sibFile ) throws IOException { create ( sibFile ) ; RandomAccessFile raf = new RandomAccessFile ( sibFile , "rw" ) ; FileChannel channel = raf . getChannel ( ) ; writeVersion ( channel ) ; int length = sib . write ( channel ) ; length += STORAGE_VERSION_LENGTH ; raf . setLength ( length ) ; channel . force ( true ) ; channel . close ( ) ; raf . close ( ) ; if ( _logger . isTraceEnabled ( ) ) { _logger . trace ( "write " + sibFile . getAbsolutePath ( ) ) ; } return length ; } | Writes to the specified segment index buffer file . |
12,736 | protected int readVersion ( ReadableByteChannel channel ) throws IOException { ByteBuffer version = ByteBuffer . allocate ( STORAGE_VERSION_LENGTH ) ; int len = channel . read ( version ) ; if ( len < STORAGE_VERSION_LENGTH ) { throw new IOException ( "Invalid Version" ) ; } return version . getInt ( 0 ) ; } | Reads version from readable channel . |
12,737 | protected void writeVersion ( WritableByteChannel channel ) throws IOException { ByteBuffer version = ByteBuffer . allocate ( STORAGE_VERSION_LENGTH ) ; version . putInt ( STORAGE_VERSION ) ; version . flip ( ) ; channel . write ( version ) ; } | Writes the version to writable channel . |
12,738 | protected void create ( File file ) throws IOException { if ( ! file . exists ( ) ) { File dir = file . getParentFile ( ) ; if ( dir . exists ( ) ) file . createNewFile ( ) ; else if ( dir . mkdirs ( ) ) file . createNewFile ( ) ; else throw new IOException ( "Failed to create " + file . getAbsolutePath ( ) ) ; } if ( file . isDirectory ( ) ) { throw new IOException ( "Cannot open directory " + file . getAbsolutePath ( ) ) ; } } | Creates the specified file if needed . |
12,739 | protected void check ( File file ) throws IOException { if ( ! file . exists ( ) ) { throw new FileNotFoundException ( file . getAbsolutePath ( ) ) ; } if ( file . isDirectory ( ) ) { throw new IOException ( "Cannot open directory " + file . getAbsolutePath ( ) ) ; } } | Checks the existence of the specified file . |
12,740 | public static PAMSourceAuditor getAuditor ( ) { AuditorModuleContext ctx = AuditorModuleContext . getContext ( ) ; return ( PAMSourceAuditor ) ctx . getAuditor ( PAMSourceAuditor . class ) ; } | Get an instance of the PAM Source Auditor from the global context |
12,741 | public void add ( int pos , long val , long scn ) { if ( _index < _entryCapacity ) { _valArray . get ( _index ++ ) . reinit ( pos , val , scn ) ; maintainScn ( scn ) ; } else { throw new EntryOverflowException ( ) ; } } | Adds data to this Entry . |
12,742 | public final void save ( File file ) throws IOException { _entryFile = file ; Chronos c = new Chronos ( ) ; DataWriter out = new FastDataWriter ( file ) ; try { out . open ( ) ; out . writeLong ( STORAGE_VERSION ) ; out . writeLong ( _minScn ) ; out . writeLong ( _maxScn ) ; out . writeInt ( size ( ) ) ; saveDataSection ( out ) ; out . writeLong ( _minScn ) ; out . writeLong ( _maxScn ) ; } finally { out . close ( ) ; } if ( _log . isInfoEnabled ( ) ) { _log . info ( "Saved entry: minScn=" + _minScn + " maxScn=" + _maxScn + " size=" + size ( ) + " file=" + file . getName ( ) + " in " + c . getElapsedTime ( ) ) ; } } | Saves to a file . |
12,743 | public void load ( File file ) throws IOException { _entryFile = file ; Chronos c = new Chronos ( ) ; ChannelReader in = new ChannelReader ( file ) ; try { in . open ( ) ; long fileVersion = in . readLong ( ) ; if ( fileVersion != STORAGE_VERSION ) { throw new RuntimeException ( "Wrong storage version " + fileVersion + " encounted in " + file . getAbsolutePath ( ) + ". Version " + STORAGE_VERSION + " expected." ) ; } long minScnHead = in . readLong ( ) ; long maxScnHead = in . readLong ( ) ; int length = in . readInt ( ) ; loadDataSection ( in , length ) ; long minScnTail = in . readLong ( ) ; long maxScnTail = in . readLong ( ) ; if ( minScnHead != minScnTail ) { throw new IOException ( "min scns don't match: " + minScnHead + " vs " + minScnTail ) ; } if ( maxScnHead != maxScnTail ) { throw new IOException ( "max scns don't match:" + maxScnHead + " vs " + maxScnTail ) ; } _minScn = minScnHead ; _maxScn = maxScnHead ; if ( _log . isInfoEnabled ( ) ) { _log . info ( "loaded entry: minScn=" + _minScn + " maxScn=" + _maxScn + " size=" + size ( ) + " file=" + file . getName ( ) + " in " + c . getElapsedTime ( ) ) ; } } finally { in . close ( ) ; } } | Loads an entry from a given file . |
12,744 | public CodedValueType getAuditSourceTypeCode ( ) { if ( EventUtils . isEmptyOrNull ( auditSourceTypeCode ) ) { return null ; } AuditSourceType auditSourceType = auditSourceTypeCode . get ( 0 ) ; CodedValueType codedValueType = new CodedValueType ( ) ; codedValueType . setCode ( auditSourceType . getCode ( ) ) ; codedValueType . setCodeSystem ( auditSourceType . getCodeSystem ( ) ) ; codedValueType . setCodeSystemName ( auditSourceType . getCodeSystemName ( ) ) ; codedValueType . setOriginalText ( auditSourceType . getOriginalText ( ) ) ; return codedValueType ; } | Gets the value of the auditSourceTypeCode property . |
12,745 | public void setAuditSourceTypeCode ( CodedValueType auditSourceTypeCode ) { AuditSourceType auditSourceType = new AuditSourceType ( ) ; auditSourceType . setCode ( auditSourceTypeCode . getCode ( ) ) ; auditSourceType . setCodeSystem ( auditSourceTypeCode . getCodeSystem ( ) ) ; auditSourceType . setCodeSystemName ( auditSourceTypeCode . getCodeSystemName ( ) ) ; auditSourceType . setOriginalText ( auditSourceTypeCode . getOriginalText ( ) ) ; } | Sets the value of the auditSourceTypeCode property . |
12,746 | public static int getCacheSize ( Context ctx ) { final DisplayMetrics displayMetrics = ctx . getResources ( ) . getDisplayMetrics ( ) ; final int screenWidth = displayMetrics . widthPixels ; final int screenHeight = displayMetrics . heightPixels ; final int screenBytes = screenWidth * screenHeight * 4 ; return screenBytes * 3 ; } | Returns a cache size equal to approximately three screens worth of images . |
12,747 | public static AuditRecordRepositoryAuditor getAuditor ( ) { AuditorModuleContext ctx = AuditorModuleContext . getContext ( ) ; return ( AuditRecordRepositoryAuditor ) ctx . getAuditor ( AuditRecordRepositoryAuditor . class ) ; } | Get an instance of the Audit Record Repository auditor from the global context |
12,748 | public void auditAuditLogUsed ( RFC3881EventOutcomeCodes eventOutcome , String accessingUser , String accessingProcess , String auditLogUri ) { if ( ! isAuditorEnabled ( ) ) { return ; } AuditLogUsedEvent auditLogUsedEvent = new AuditLogUsedEvent ( eventOutcome ) ; auditLogUsedEvent . setAuditSourceId ( getAuditSourceId ( ) , getAuditEnterpriseSiteId ( ) ) ; if ( ! EventUtils . isEmptyOrNull ( accessingUser ) ) { auditLogUsedEvent . addAccessingParticipant ( accessingUser , null , null , getSystemNetworkId ( ) ) ; } if ( ! EventUtils . isEmptyOrNull ( accessingProcess ) ) { auditLogUsedEvent . addAccessingParticipant ( accessingProcess , null , null , getSystemNetworkId ( ) ) ; } auditLogUsedEvent . addAuditLogIdentity ( auditLogUri ) ; audit ( auditLogUsedEvent ) ; } | Audits a DICOM Audit Log Used event for a given User and Process . |
12,749 | public static < T extends EntryValue > void sortEntriesById ( List < Entry < T > > entryList ) { if ( entryList . size ( ) > 0 ) { Collections . sort ( entryList , new Comparator < Entry < ? > > ( ) { public int compare ( Entry < ? > e1 , Entry < ? > e2 ) { long v1 = getEntryId ( e1 . getFile ( ) . getName ( ) ) ; long v2 = getEntryId ( e2 . getFile ( ) . getName ( ) ) ; return ( v1 < v2 ) ? - 1 : ( ( v1 == v2 ) ? 0 : 1 ) ; } } ) ; } } | Sort entries in the ascending order of entry log IDs . |
12,750 | public static long getEntryId ( String entryFileName ) { int ind1 = entryFileName . indexOf ( "_" ) + 1 ; if ( ind1 > 0 ) { int ind2 = entryFileName . indexOf ( "_" , ind1 ) ; if ( ind2 > ind1 ) { String str = entryFileName . substring ( ind1 , ind2 ) ; try { return Long . parseLong ( str ) ; } catch ( Exception e ) { } } } return 0 ; } | Gets the entry ID based on the specified entry file name . |
12,751 | private void send ( byte [ ] msg , DatagramSocket socket , InetAddress destination , int port ) throws Exception { if ( EventUtils . isEmptyOrNull ( msg ) ) { return ; } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Auditing to " + destination . getHostAddress ( ) + ":" + port ) ; } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( new String ( msg ) ) ; } DatagramPacket packet = new DatagramPacket ( msg , getBufferLength ( msg ) , destination , port ) ; socket . send ( packet ) ; } | Send a byte buffer to a designated destination address and port using the datagram socket specified . |
12,752 | private void send ( AuditEventMessage msg , DatagramSocket socket , InetAddress destination , int port ) throws Exception { if ( EventUtils . isEmptyOrNull ( msg ) ) { return ; } int portToUse = getTransportPort ( port ) ; byte [ ] msgBytes = getTransportPayload ( msg ) ; send ( msgBytes , socket , destination , portToUse ) ; } | Send an audit message to a designated destination address and port using the datagram socket specified . |
12,753 | protected byte [ ] getTransportPayload ( AuditEventMessage msg ) { if ( msg == null ) { return null ; } byte [ ] msgBytes = msg . getSerializedMessage ( false ) ; if ( EventUtils . isEmptyOrNull ( msgBytes ) ) { return null ; } StringBuilder sb = new StringBuilder ( ) ; sb . append ( "<" ) ; sb . append ( TRANSPORT_DEFAULT_PRIORITY ) ; sb . append ( ">" ) ; sb . append ( TimestampUtils . getBSDSyslogDate ( msg . getDateTime ( ) ) ) ; sb . append ( " " ) ; sb . append ( getSystemHostName ( ) ) ; sb . append ( " " ) ; sb . append ( "<?xml version=\"1.0\" encoding=\"ASCII\"?>" ) ; sb . append ( new String ( msgBytes ) ) ; return sb . toString ( ) . trim ( ) . getBytes ( ) ; } | Serialize format and prepare the message payload body for sending by this transport . This includes adding the syslog message header . |
12,754 | protected void loadWaterMarks ( ) throws IOException { if ( file != null && file . exists ( ) ) { try { loadWaterMarks ( file ) ; } catch ( IOException e ) { if ( fileOriginal != null && fileOriginal . exists ( ) ) { loadWaterMarks ( fileOriginal ) ; } } } } | Load water marks from underlying files . |
12,755 | protected void loadWaterMarks ( File waterMarksFile ) throws IOException { Properties p = new Properties ( ) ; FileInputStream fis = new FileInputStream ( waterMarksFile ) ; logger . info ( "Loading " + waterMarksFile ) ; try { p . load ( fis ) ; Enumeration < ? > enm = p . propertyNames ( ) ; while ( enm . hasMoreElements ( ) ) { String source = ( String ) enm . nextElement ( ) ; String waterMarks = p . getProperty ( source ) ; String [ ] parts = waterMarks . split ( "," ) ; if ( parts . length == 2 ) { long lwmScn = Long . parseLong ( parts [ 0 ] . trim ( ) ) ; long hwmScn = Long . parseLong ( parts [ 1 ] . trim ( ) ) ; if ( hwmScn < lwmScn ) { lwmScn = hwmScn ; } else { hwmScn = lwmScn ; } WaterMarkEntry wmEntry = sourceWaterMarkMap . get ( source ) ; if ( wmEntry == null ) { wmEntry = new WaterMarkEntry ( source ) ; sourceWaterMarkMap . put ( source , wmEntry ) ; } wmEntry . setLWMScn ( lwmScn ) ; wmEntry . setHWMScn ( hwmScn ) ; } } } catch ( IOException e ) { logger . error ( "Failed to load source water marks from " + waterMarksFile . getName ( ) , e ) ; throw e ; } finally { fis . close ( ) ; fis = null ; } } | Load water marks from an underlying file . |
12,756 | public long getHWMScn ( String source ) { WaterMarkEntry e = sourceWaterMarkMap . get ( source ) ; return ( e == null ) ? 0 : e . getHWMScn ( ) ; } | Gets the high water mark of a source . |
12,757 | public long getLWMScn ( String source ) { WaterMarkEntry e = sourceWaterMarkMap . get ( source ) ; return ( e == null ) ? 0 : e . getLWMScn ( ) ; } | Gets the low water mark of a source . |
12,758 | public void setLWMScn ( String source , long scn ) { WaterMarkEntry e = sourceWaterMarkMap . get ( source ) ; if ( e == null ) { e = new WaterMarkEntry ( source ) ; sourceWaterMarkMap . put ( source , e ) ; } e . setLWMScn ( scn ) ; } | Sets the low water mark of a source |
12,759 | public void setWaterMarks ( String source , long lwmScn , long hwmScn ) { WaterMarkEntry e = sourceWaterMarkMap . get ( source ) ; if ( e == null ) { e = new WaterMarkEntry ( source ) ; sourceWaterMarkMap . put ( source , e ) ; } e . setLWMScn ( lwmScn ) ; e . setHWMScn ( hwmScn ) ; } | Sets the water marks of a source . |
12,760 | public boolean syncWaterMarks ( String source , long lwmScn , long hwmScn ) { setWaterMarks ( source , lwmScn , hwmScn ) ; return flush ( ) ; } | Sets and flushes the water marks of a source . |
12,761 | public boolean syncWaterMarks ( ) { for ( String source : sourceWaterMarkMap . keySet ( ) ) { WaterMarkEntry wmEntry = sourceWaterMarkMap . get ( source ) ; wmEntry . setLWMScn ( wmEntry . getHWMScn ( ) ) ; } return flush ( ) ; } | Sync up low water marks to high water marks for all the sources . |
12,762 | public boolean flush ( ) { boolean ret = true ; PrintWriter out = null ; try { if ( file . exists ( ) ) { if ( fileOriginal . exists ( ) ) { fileOriginal . delete ( ) ; } file . renameTo ( fileOriginal ) ; } out = new PrintWriter ( new FileOutputStream ( file ) ) ; for ( String source : sourceWaterMarkMap . keySet ( ) ) { WaterMarkEntry wmEntry = sourceWaterMarkMap . get ( source ) ; out . println ( wmEntry ) ; } out . flush ( ) ; } catch ( IOException ioe ) { logger . error ( "Failed to flush water marks" , ioe ) ; ret = false ; } finally { if ( out != null ) { out . close ( ) ; out = null ; } } return ret ; } | Flushes low water marks and high water marks for all the sources . |
12,763 | public void clear ( ) { sourceWaterMarkMap . clear ( ) ; flush ( ) ; if ( fileOriginal != null && fileOriginal . exists ( ) ) { fileOriginal . delete ( ) ; } } | Clears SourceWaterMark . |
12,764 | synchronized void loadImageIfNecessary ( final boolean isInLayoutPass ) { int width = getWidth ( ) ; int height = getHeight ( ) ; boolean wrapWidth = false , wrapHeight = false ; if ( getLayoutParams ( ) != null ) { wrapWidth = getLayoutParams ( ) . width == LayoutParams . WRAP_CONTENT ; wrapHeight = getLayoutParams ( ) . height == LayoutParams . WRAP_CONTENT ; } boolean isFullyWrapContent = wrapWidth && wrapHeight ; if ( width == 0 && height == 0 && ! isFullyWrapContent ) { return ; } if ( TextUtils . isEmpty ( url ) ) { if ( imageContainer != null ) { imageContainer . cancelRequest ( ) ; imageContainer = null ; } setDefaultImageOrNull ( ) ; return ; } if ( imageContainer != null && imageContainer . getRequestUrl ( ) != null ) { if ( imageContainer . getRequestUrl ( ) . equals ( url ) ) { return ; } else { imageContainer . cancelRequest ( ) ; setDefaultImageOrNull ( ) ; } } int maxWidth = wrapWidth ? 0 : width ; int maxHeight = wrapHeight ? 0 : height ; ImageContainer newContainer = imageLoader . get ( url , new ImageListener ( ) { public void onError ( JusError error ) { if ( errorImageId != 0 ) { setImageResource ( errorImageId ) ; } } public void onResponse ( final ImageContainer response , boolean isImmediate ) { if ( NetworkImageView . this . url == null || ! NetworkImageView . this . url . equals ( response . getRequestUrl ( ) ) ) { JusLog . error ( "NetworkImageView received: " + response . getRequestUrl ( ) + ", expected: " + NetworkImageView . this . url ) ; return ; } if ( isImmediate && isInLayoutPass ) { post ( new Runnable ( ) { public void run ( ) { onResponse ( response , false ) ; } } ) ; return ; } if ( response . getBitmap ( ) != null && isOk2Draw ( response . getBitmap ( ) ) ) { setImageBitmap ( response . getBitmap ( ) ) ; } else if ( defaultImageId != 0 ) { if ( ! isImmediate ) { JusLog . error ( "NetworkImageView received null for: " + response . getRequestUrl ( ) ) ; } setImageResource ( defaultImageId ) ; } } } , maxWidth , maxHeight , tag ) ; imageContainer = newContainer ; } | Loads the image for the view if it isn t already loaded . |
12,765 | public static PIXManagerAuditor getAuditor ( ) { AuditorModuleContext ctx = AuditorModuleContext . getContext ( ) ; return ( PIXManagerAuditor ) ctx . getAuditor ( PIXManagerAuditor . class ) ; } | Get an instance of the PIX Manager Auditor from the global context |
12,766 | private String getAnnotations ( final Properties properties , final String stringFromClient ) throws IOException , JDOMException { BufferedReader breader ; KAFDocument kaf ; String kafString = null ; String lang = properties . getProperty ( "language" ) ; String outputFormat = properties . getProperty ( "outputFormat" ) ; Boolean inputKafRaw = Boolean . valueOf ( properties . getProperty ( "inputkaf" ) ) ; Boolean noTok = Boolean . valueOf ( properties . getProperty ( "notok" ) ) ; String kafVersion = properties . getProperty ( "kafversion" ) ; Boolean offsets = Boolean . valueOf ( properties . getProperty ( "offsets" ) ) ; if ( noTok ) { final BufferedReader noTokReader = new BufferedReader ( new StringReader ( stringFromClient ) ) ; kaf = new KAFDocument ( lang , kafVersion ) ; final KAFDocument . LinguisticProcessor newLp = kaf . addLinguisticProcessor ( "text" , "ixa-pipe-tok-notok-" + lang , version + "-" + commit ) ; newLp . setBeginTimestamp ( ) ; Annotate . tokensToKAF ( noTokReader , kaf ) ; newLp . setEndTimestamp ( ) ; kafString = kaf . toString ( ) ; noTokReader . close ( ) ; } else { if ( inputKafRaw ) { final BufferedReader kafReader = new BufferedReader ( new StringReader ( stringFromClient ) ) ; kaf = KAFDocument . createFromStream ( kafReader ) ; final String text = kaf . getRawText ( ) ; final StringReader stringReader = new StringReader ( text ) ; breader = new BufferedReader ( stringReader ) ; } else { kaf = new KAFDocument ( lang , kafVersion ) ; breader = new BufferedReader ( new StringReader ( stringFromClient ) ) ; } final Annotate annotator = new Annotate ( breader , properties ) ; if ( outputFormat . equalsIgnoreCase ( "conll" ) ) { if ( offsets ) { kafString = annotator . tokenizeToCoNLL ( ) ; } else { kafString = annotator . tokenizeToCoNLLOffsets ( ) ; } } else if ( outputFormat . equalsIgnoreCase ( "oneline" ) ) { kafString = annotator . tokenizeToText ( ) ; } else { final KAFDocument . LinguisticProcessor newLp = kaf . addLinguisticProcessor ( "text" , "ixa-pipe-tok-" + lang , version + "-" + commit ) ; newLp . setBeginTimestamp ( ) ; annotator . tokenizeToKAF ( kaf ) ; newLp . setEndTimestamp ( ) ; kafString = kaf . toString ( ) ; } breader . close ( ) ; } return kafString ; } | Get tokens . |
12,767 | public static < T > Class < ? > [ ] resolveGenerics ( Class < T > superType , Class < ? extends T > subType ) { checkNotNull ( superType , "superType should not be null" ) ; checkNotNull ( subType , "subType should not be null" ) ; Class < ? > subTypeWithoutProxy = ProxyUtils . cleanProxy ( subType ) ; return TypeResolver . resolveRawArguments ( TypeResolver . resolveGenericType ( superType , subTypeWithoutProxy ) , subTypeWithoutProxy ) ; } | Resolve generics of a class relatively to a superclass . |
12,768 | @ SuppressWarnings ( "unchecked" ) public static < A extends AggregateRoot < I > , I > Class < I > resolveAggregateIdClass ( Class < A > aggregateRootClass ) { checkNotNull ( aggregateRootClass , "aggregateRootClass should not be null" ) ; return ( Class < I > ) resolveGenerics ( AggregateRoot . class , aggregateRootClass ) [ 0 ] ; } | Returns the identifier class for an aggregate root class . |
12,769 | public static Class < ? > [ ] getAggregateIdClasses ( Class < ? extends AggregateRoot < ? > > [ ] aggregateRootClasses ) { checkNotNull ( aggregateRootClasses , "aggregateRootClasses should not be null" ) ; Class < ? > [ ] result = new Class < ? > [ aggregateRootClasses . length ] ; for ( int i = 0 ; i < aggregateRootClasses . length ; i ++ ) { result [ i ] = resolveGenerics ( AggregateRoot . class , aggregateRootClasses [ i ] ) [ 0 ] ; } return result ; } | Returns an arrays of all identifier class corresponding the the given array of aggregate root classes . |
12,770 | @ SuppressWarnings ( "unchecked" ) public static < T > Stream < Class < ? extends T > > streamClasses ( Collection < Class < ? > > classes , Class < ? extends T > baseClass ) { return classes . stream ( ) . filter ( ClassPredicates . classIsDescendantOf ( baseClass ) ) . map ( c -> ( Class < T > ) c ) ; } | Checks that classes satisfying a specification are assignable to a base class and return a typed stream of it . |
12,771 | public static Optional < Annotation > getQualifier ( AnnotatedElement annotatedElement ) { AnnotatedElement cleanedAnnotatedElement ; if ( annotatedElement instanceof Class < ? > ) { cleanedAnnotatedElement = ProxyUtils . cleanProxy ( ( Class < ? > ) annotatedElement ) ; } else { cleanedAnnotatedElement = annotatedElement ; } return Annotations . on ( cleanedAnnotatedElement ) . findAll ( ) . filter ( AnnotationPredicates . annotationAnnotatedWith ( Qualifier . class , false ) ) . findFirst ( ) ; } | Optionally returns the qualifier annotation of a class . |
12,772 | @ SuppressWarnings ( "unchecked" ) public static < T > Optional < Key < T > > resolveDefaultQualifier ( Map < Key < ? > , Class < ? > > bindings , ClassConfiguration < ? > classConfiguration , String property , Class < ? > qualifiedClass , TypeLiteral < T > genericInterface ) { Key < T > key = null ; if ( classConfiguration != null && ! classConfiguration . isEmpty ( ) ) { String qualifierName = classConfiguration . get ( property ) ; if ( qualifierName != null && ! "" . equals ( qualifierName ) ) { try { ClassLoader classLoader = ClassLoaders . findMostCompleteClassLoader ( BusinessUtils . class ) ; Class < ? > qualifierClass = classLoader . loadClass ( qualifierName ) ; if ( Annotation . class . isAssignableFrom ( qualifierClass ) ) { key = Key . get ( genericInterface , ( Class < ? extends Annotation > ) qualifierClass ) ; } else { throw BusinessException . createNew ( BusinessErrorCode . CLASS_IS_NOT_AN_ANNOTATION ) . put ( "class" , qualifiedClass ) . put ( "qualifier" , qualifierName ) ; } } catch ( ClassNotFoundException e ) { key = Key . get ( genericInterface , Names . named ( qualifierName ) ) ; } } } if ( key == null || bindings . containsKey ( Key . get ( key . getTypeLiteral ( ) ) ) ) { return Optional . empty ( ) ; } else { return Optional . of ( key ) ; } } | Returns the Guice key qualified with the default qualifier configured for the specified class . |
12,773 | @ SuppressWarnings ( "unchecked" ) public static Set < Class < ? extends AggregateRoot < ? > > > includeSuperClasses ( Collection < Class < ? extends AggregateRoot > > aggregateClasses ) { Set < Class < ? extends AggregateRoot < ? > > > results = new HashSet < > ( ) ; for ( Class < ? > aggregateClass : aggregateClasses ) { Class < ? > classToAdd = aggregateClass ; while ( classToAdd != null ) { if ( AggregateRoot . class . isAssignableFrom ( classToAdd ) && ! classToAdd . equals ( BaseAggregateRoot . class ) && ! classToAdd . equals ( AggregateRoot . class ) ) { results . add ( ( Class < ? extends AggregateRoot < ? > > ) classToAdd ) ; classToAdd = classToAdd . getSuperclass ( ) ; } else { break ; } } } return results ; } | Walks the class hierarchy of each class in the given collection and adds its superclasses to the mix . |
12,774 | public void tokenizeToKAF ( final KAFDocument kaf ) throws IOException { int noSents = 0 ; int noParas = 1 ; List < List < Token > > tokens ; if ( isNoSeg ) { String [ ] sentences = text . toArray ( new String [ text . size ( ) ] ) ; tokens = tokenizer . tokenize ( sentences ) ; } else { final String [ ] sentences = segmenter . segmentSentence ( ) ; tokens = tokenizer . tokenize ( sentences ) ; } for ( final List < Token > tokenizedSentence : tokens ) { noSents = noSents + 1 ; for ( final Token token : tokenizedSentence ) { if ( token . getTokenValue ( ) . equals ( RuleBasedSegmenter . PARAGRAPH ) ) { ++ noParas ; if ( noSents < noParas ) { ++ noSents ; } } else { final WF wf = kaf . newWF ( token . startOffset ( ) , token . getTokenValue ( ) , noSents ) ; wf . setLength ( token . tokenLength ( ) ) ; wf . setPara ( noParas ) ; } } } } | Tokenize document to NAF . |
12,775 | public String tokenizeToText ( ) { final StringBuilder sb = new StringBuilder ( ) ; if ( isNoSeg ) { String [ ] sentences = text . toArray ( new String [ text . size ( ) ] ) ; final List < List < Token > > tokens = tokenizer . tokenize ( sentences ) ; for ( final List < Token > tokSentence : tokens ) { for ( final Token tok : tokSentence ) { String tokenValue = tok . getTokenValue ( ) ; sb . append ( tokenValue . trim ( ) ) . append ( DELIMITER ) ; } sb . append ( LINE_BREAK ) ; } } else { final String [ ] sentences = segmenter . segmentSentence ( ) ; final List < List < Token > > tokens = tokenizer . tokenize ( sentences ) ; for ( final List < Token > tokSentence : tokens ) { for ( final Token token : tokSentence ) { String tokenValue = token . getTokenValue ( ) ; if ( tokenValue . equals ( RuleBasedSegmenter . PARAGRAPH ) ) { sb . append ( DEFAULT_TOKEN_VALUE ) . append ( LINE_BREAK ) ; } else { sb . append ( tokenValue . trim ( ) ) . append ( DELIMITER ) ; } } sb . append ( LINE_BREAK ) ; } } return sb . toString ( ) . trim ( ) ; } | Tokenize and Segment input text . Outputs tokens in running text format one sentence per line . |
12,776 | void packageArtifacts ( final File compileDir , final MavenProject project , final Set < String > bundles ) throws IOException , XCodeException { File mainArtifact = createMainArtifactFile ( project ) ; attachBundle ( compileDir , project , bundles , mainArtifact ) ; final File mainArtifactFile = archiveMainArtifact ( project , mainArtifact ) ; setMainArtifact ( project , mainArtifactFile ) ; } | Packages all the artifacts . The main artifact is set and all side artifacts are attached for deployment . |
12,777 | Collection < BindingStrategy > collectFromAggregates ( Collection < Class < ? extends AggregateRoot > > aggregateClasses ) { Collection < BindingStrategy > bindingStrategies = new ArrayList < > ( ) ; Map < Type [ ] , Key < ? > > allGenerics = new HashMap < > ( ) ; for ( Class < ? extends AggregateRoot < ? > > aggregateClass : BusinessUtils . includeSuperClasses ( aggregateClasses ) ) { Type [ ] generics = getTypes ( aggregateClass ) ; TypeLiteral < ? > genericInterface = TypeLiteral . get ( newParameterizedType ( Repository . class , generics ) ) ; allGenerics . put ( generics , resolveDefaultQualifier ( bindings , application . getConfiguration ( aggregateClass ) , DEFAULT_REPOSITORY_KEY , aggregateClass , genericInterface ) . orElse ( null ) ) ; } for ( Class < ? extends Repository > defaultRepoImpl : defaultRepositoryImplementations ) { bindingStrategies . add ( new GenericBindingStrategy < > ( Repository . class , defaultRepoImpl , allGenerics ) ) ; } return bindingStrategies ; } | Prepares the binding strategies which bind default repositories . The specificity here is that it could have multiple implementations of default repository i . e . one per persistence . |
12,778 | @ SuppressWarnings ( "unchecked" ) public static < T extends Class < ? > > Map < T , Specification < ? extends T > > classpathRequestForDescendantTypesOf ( ClasspathScanRequestBuilder classpathScanRequestBuilder , Collection < T > interfaces ) { Map < T , Specification < ? extends T > > specsByInterface = new HashMap < > ( ) ; for ( T anInterface : interfaces ) { LOGGER . trace ( "Request implementations of: {}" , anInterface . getName ( ) ) ; Specification < Class < ? > > spec = new SpecificationBuilder < > ( classIsDescendantOf ( anInterface ) . and ( classIsInterface ( ) . negate ( ) ) . and ( classModifierIs ( Modifier . ABSTRACT ) . negate ( ) ) ) . build ( ) ; classpathScanRequestBuilder . specification ( spec ) ; specsByInterface . put ( anInterface , ( Specification < ? extends T > ) spec ) ; } return specsByInterface ; } | Builds a ClasspathScanRequest to find all the descendant of the given interfaces . |
12,779 | public final void run ( final String [ ] args ) throws IOException , JDOMException { try { Parameters parameters = cliArgumentsParser . parse ( args ) ; if ( parameters . getStrategy ( ) == Strategy . TOKENIZE ) { annotate ( parameters ) ; } else if ( parameters . getStrategy ( ) == Strategy . SERVER ) { server ( parameters ) ; } else if ( parameters . getStrategy ( ) == Strategy . CLIENT ) { client ( parameters ) ; } else { System . out . println ( String . format ( "Invalid sub-command [%s]. Sub-commands accepted are: (tok|server|client)" , parameters . getStrategyString ( ) ) ) ; } } catch ( final ArgumentParserException e ) { cliArgumentsParser . handleError ( e ) ; System . out . println ( "Run java -jar target/ixa-pipe-tok-" + VERSION + ".jar (tok|server|client) -help for details" ) ; System . exit ( 1 ) ; } } | Run the appropriate command based on the command line parameters . |
12,780 | public SortOption add ( String attribute , Direction direction ) { sortedAttributes . add ( new SortedAttribute ( attribute , direction ) ) ; return this ; } | Adds the specified attribute to the list of sorted attributes with the specified direction . |
12,781 | public < T > Comparator < T > buildComparator ( ) { if ( sortedAttributes . isEmpty ( ) ) { return ( o1 , o2 ) -> 0 ; } else { Comparator < T > comparator = null ; for ( SortedAttribute sortedAttribute : sortedAttributes ) { if ( comparator == null ) { comparator = buildComparator ( sortedAttribute ) ; } else { comparator = comparator . thenComparing ( buildComparator ( sortedAttribute ) ) ; } } return comparator ; } } | Builds a comparator allowing the sorting of objects according to the sort criteria . |
12,782 | private int findPartnerNodeId ( Tree < Row > current , Type type ) { switch ( type ) { case JOIN_FIRST : case JOIN_ALL : case WHILE_DO_END : return current . getPrevious ( ) . getContent ( ) . getId ( ) ; case DO_WHILE_BEGIN : return current . getNext ( ) . getContent ( ) . getMainElement ( ) . getId ( ) ; case END_IF : Tree < Row > if_ = current ; while ( ! Type . IF . equals ( if_ . getContent ( ) . getType ( ) ) ) { if_ = if_ . getPrevious ( ) ; } return if_ . getContent ( ) . getId ( ) ; default : throw new IllegalStateException ( ) ; } } | Some node producing elements do not define an id themselves but deduce their id based on their block - opening or block - closing partner . E . g . a WHILE_DO_END deduces its id based on its WHILE_DO_BEGIN partner . |
12,783 | protected File zipSubfolder ( File rootDir , String zipSubFolder , String zipFileName , String archiveFolder ) throws MojoExecutionException { int resultCode = 0 ; try { File scriptDirectory = new File ( project . getBuild ( ) . getDirectory ( ) , "scripts" ) . getCanonicalFile ( ) ; scriptDirectory . deleteOnExit ( ) ; if ( archiveFolder != null ) { resultCode = ScriptRunner . copyAndExecuteScript ( System . out , "/com/sap/prd/mobile/ios/mios/zip-subfolder.sh" , scriptDirectory , rootDir . getCanonicalPath ( ) , zipSubFolder , zipFileName , archiveFolder ) ; } else { resultCode = ScriptRunner . copyAndExecuteScript ( System . out , "/com/sap/prd/mobile/ios/mios/zip-subfolder.sh" , scriptDirectory , rootDir . getCanonicalPath ( ) , zipSubFolder , zipFileName ) ; } } catch ( Exception ex ) { throw new MojoExecutionException ( "Cannot create zip file " + zipFileName + ". Check log for details." , ex ) ; } if ( resultCode != 0 ) { throw new MojoExecutionException ( "Cannot create zip file " + zipFileName + ". Check log for details." ) ; } getLog ( ) . info ( "Zip file '" + zipFileName + "' created." ) ; return new File ( rootDir , zipFileName ) ; } | Calls a shell script in order to zip a folder . We have to call a shell script as Java cannot zip symbolic links . |
12,784 | @ RequestMapping ( method = RequestMethod . GET , value = "/workflowInstance/search" , produces = { MediaType . APPLICATION_JSON_VALUE , MediaType . TEXT_XML_VALUE } ) public ResponseEntity < List < WorkflowInstanceRestModel > > findInstances ( @ RequestParam ( required = false ) String label1 , @ RequestParam ( required = false ) String label2 , @ RequestParam ( required = false ) Boolean activeOnly ) { if ( activeOnly == null ) { activeOnly = true ; } label1 = StringUtils . trimToNull ( label1 ) ; label2 = StringUtils . trimToNull ( label2 ) ; List < WorkflowInstanceState > woins = facade . findWorkflowInstancesByLabels ( label1 , label2 , activeOnly ) ; return new ResponseEntity < > ( createInstancesModel ( woins ) , HttpStatus . OK ) ; } | Searches workflow instance s that match the given criteria . |
12,785 | public SmiSymbol resolveReference ( IdToken idToken , XRefProblemReporter reporter ) { SmiSymbol result = findSymbol ( idToken . getId ( ) ) ; if ( result == null ) { result = findImportedSymbol ( idToken . getId ( ) ) ; } if ( result == null ) { List < SmiSymbol > symbols = getMib ( ) . getSymbols ( ) . findAll ( idToken . getId ( ) ) ; if ( symbols . size ( ) == 1 ) { result = symbols . get ( 0 ) ; } else if ( symbols . size ( ) > 0 ) { result = determineBestMatch ( idToken , symbols ) ; } } if ( result == null && reporter != null ) { reporter . reportCannotFindSymbol ( idToken ) ; } return result ; } | Resolves a reference from within this module to a symbol in the same module an imported module or in the whole mib |
12,786 | public SmiOidNode findByOidPrefix ( int ... oid ) { SmiOidNode parent = getRootNode ( ) ; for ( int subId : oid ) { SmiOidNode result = parent . findChild ( subId ) ; if ( result == null ) { return parent ; } parent = result ; } return null ; } | This method can be used to find the best match for an OID . By comparing the length of the OID of the result and the input OID you can determine how many and which subIds where not matched . |
12,787 | private static void validateReservedVariableNames ( Graph graph , List < String > errors ) { for ( Node node : graph . getNodes ( ) ) { if ( node instanceof BeanAsyncCallActivity ) { validateReservedVariablesFromMapping ( ( ( BeanAsyncCallActivity ) node ) . getResultMapping ( ) , graph , node , errors ) ; } else if ( node instanceof BeanCallActivity ) { validateReservedVariablesFromMapping ( ( ( BeanCallActivity ) node ) . getResultMapping ( ) , graph , node , errors ) ; } else if ( node instanceof CreateNewInstanceActivity ) { MapMapping mapMapping = ( ( CreateNewInstanceActivity ) node ) . getArgumentsMapping ( ) ; if ( mapMapping != null && mapMapping . getEntryMappings ( ) != null ) { for ( String key : mapMapping . getEntryMappings ( ) . keySet ( ) ) { validateReservedVariable ( key , graph , node , errors ) ; } } } else if ( node instanceof HumanTaskActivity ) { validateReservedVariablesFromMapping ( ( ( HumanTaskActivity ) node ) . getResultMapping ( ) , graph , node , errors ) ; } else if ( node instanceof ObjectCallActivity ) { validateReservedVariablesFromMapping ( ( ( ObjectCallActivity ) node ) . getResultMapping ( ) , graph , node , errors ) ; } else if ( node instanceof SetAttributeActivity ) { validateReservedVariable ( ( ( SetAttributeActivity ) node ) . getAttribute ( ) , graph , node , errors ) ; } else if ( node instanceof CatchSignal ) { validateReservedVariablesFromMapping ( ( ( CatchSignal ) node ) . getResultMapping ( ) , graph , node , errors ) ; } } } | check through all the node types which use mappings which set Environment attributes |
12,788 | public SmiType createIntegerType ( IdToken idToken , IntKeywordToken intToken , Token applicationTagToken , List < SmiNamedNumber > namedNumbers , List < SmiRange > rangeConstraints ) { if ( idToken == null && intToken . getPrimitiveType ( ) == INTEGER && namedNumbers == null && rangeConstraints == null ) { return SmiConstants . INTEGER_TYPE ; } else if ( idToken != null || namedNumbers != null || rangeConstraints != null ) { SmiType type = createPotentiallyTaggedType ( idToken , applicationTagToken ) ; if ( intToken . getPrimitiveType ( ) == INTEGER ) { type . setBaseType ( SmiConstants . INTEGER_TYPE ) ; } else { type . setBaseType ( new SmiReferencedType ( intToken , m_module ) ) ; } type . setEnumValues ( namedNumbers ) ; type . setRangeConstraints ( rangeConstraints ) ; return type ; } return new SmiReferencedType ( intToken , m_module ) ; } | and resolve references to INTEGER BITS ... during the XRef phase |
12,789 | public static String asString ( Boolean flag ) { return flag == null ? null : ( flag ? YES_AS_STRING : NO_AS_STRING ) ; } | Converts the given flag into a string of either Y N or null . |
12,790 | public static Boolean asBoolean ( String flag ) { return flag == null ? null : flag . equals ( YES_AS_STRING ) ; } | Converts the given string into a Boolean flag of either true false or null . |
12,791 | protected PListAccessor getInfoPListAccessor ( XCodeContext . SourceCodeLocation location , String configuration , String sdk ) throws MojoExecutionException , XCodeException { File plistFile = getPListFile ( location , configuration , sdk ) ; if ( ! plistFile . isFile ( ) ) { throw new MojoExecutionException ( "The Xcode project refers to the Info.plist file '" + plistFile + "' that does not exist." ) ; } return new PListAccessor ( plistFile ) ; } | Retrieves the Info Plist out of the effective Xcode project settings and returns the accessor to it . |
12,792 | public List < WorkUnit > findNewWorkUnits ( Date now , String clusterName ) { if ( sqlCache == null || ! ObjectUtils . equals ( cachedSqlClusterName , clusterName ) ) { sqlCache = getSql ( clusterName ) ; cachedSqlClusterName = clusterName ; } Object [ ] args = { now } ; return getJdbcTemplate ( ) . query ( sqlCache , args , WorkUnitRowMapper . INSTANCE ) ; } | Retrieves the list of work units that can be performed at the given date . |
12,793 | @ SuppressWarnings ( "unchecked" ) public static < T extends Tuple > T create ( Object ... objects ) { Class < ? extends Tuple > tupleClass = classOfTuple ( objects . length ) ; try { return ( T ) tupleClass . getMethod ( "fromArray" , Object [ ] . class ) . invoke ( null , new Object [ ] { objects } ) ; } catch ( NoSuchMethodException | IllegalAccessException | InvocationTargetException e ) { throw BusinessException . wrap ( e , BusinessErrorCode . UNABLE_TO_CREATE_TUPLE ) ; } } | Builds a tuple from an array of objects . |
12,794 | public static Class < ? extends Tuple > classOfTuple ( int cardinality ) { switch ( cardinality ) { case 1 : return Unit . class ; case 2 : return Pair . class ; case 3 : return Triplet . class ; case 4 : return Quartet . class ; case 5 : return Quintet . class ; case 6 : return Sextet . class ; case 7 : return Septet . class ; case 8 : return Octet . class ; case 9 : return Ennead . class ; case 10 : return Decade . class ; default : throw new IllegalArgumentException ( "Cannot create a tuple with " + cardinality + " element(s)" ) ; } } | Returns the tuple class corresponding to the specified cardinality . |
12,795 | @ SuppressWarnings ( "unchecked" ) public static < T > Class < T > [ ] itemClasses ( Tuple tuple ) { Class < ? > [ ] itemClasses = new Class [ tuple . getSize ( ) ] ; int index = 0 ; for ( Object o : tuple ) { itemClasses [ index ++ ] = o . getClass ( ) ; } return ( Class < T > [ ] ) itemClasses ; } | Returns a list containing the classes of the elements of the tuple . |
12,796 | private String buildMessage ( String rawMessage ) { StringBuilder msg = new StringBuilder ( ) ; if ( changeLogName != null ) { msg . append ( changeLogName ) . append ( ": " ) ; } if ( changeSetName != null ) { msg . append ( changeSetName . replace ( changeLogName + "::" , "" ) ) . append ( ": " ) ; } msg . append ( rawMessage ) ; return msg . toString ( ) ; } | Build a log message with optional data if it exists . |
12,797 | public String toSqlString ( Object value ) { if ( value == null ) { return "null" ; } String val = String . valueOf ( value ) ; if ( value instanceof Integer || value instanceof Float || value instanceof Double || value instanceof Long ) { return val ; } else if ( value instanceof Boolean ) { return "'" + ( ( Boolean ) value ? "true" : "false" ) + "'" ; } else if ( value instanceof Date ) { return String . valueOf ( ( ( Date ) value ) . getTime ( ) ) ; } else { return "'" + val + "'" ; } } | Convert value object to sanitized SQL string |
12,798 | private static void createDirectory ( final File directory ) throws MojoExecutionException { try { com . sap . prd . mobile . ios . mios . FileUtils . deleteDirectory ( directory ) ; } catch ( IOException ex ) { throw new MojoExecutionException ( "" , ex ) ; } if ( ! directory . mkdirs ( ) ) throw new MojoExecutionException ( "Cannot create directory (" + directory + ")" ) ; } | Creates a directory . If the directory already exists the directory is deleted beforehand . |
12,799 | private Tree < Row > downRight ( Element token ) { return current = current . addChild ( Tree . of ( new Row ( token ) ) ) ; } | Starts a new row one indentation level to the right . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.