idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
7,100 | public EChange addListener ( final EventListener aListener ) { ValueEnforcer . notNull ( aListener , "Listener" ) ; if ( ! ( aListener instanceof ServletContextListener ) && ! ( aListener instanceof HttpSessionListener ) && ! ( aListener instanceof ServletRequestListener ) ) { LOGGER . warn ( "Passed mock listener is none of ServletContextListener, HttpSessionListener or ServletRequestListener and therefore has no effect. The listener class is: " + aListener . getClass ( ) ) ; } return m_aRWLock . writeLocked ( ( ) -> EChange . valueOf ( m_aListener . add ( aListener ) ) ) ; } | Add a new listener . |
7,101 | public static void forEachURLSet ( final Consumer < ? super XMLSitemapURLSet > aConsumer ) { ValueEnforcer . notNull ( aConsumer , "Consumer" ) ; for ( final IXMLSitemapProviderSPI aSPI : s_aProviders ) { final XMLSitemapURLSet aURLSet = aSPI . createURLSet ( ) ; aConsumer . accept ( aURLSet ) ; } } | Create URL sets from every provider and invoke the provided consumer with it . |
7,102 | public Matrix4f getViewMatrix ( ) { if ( updateViewMatrix ) { rotationMatrixInverse = Matrix4f . createRotation ( rotation ) ; final Matrix4f rotationMatrix = Matrix4f . createRotation ( rotation . invert ( ) ) ; final Matrix4f positionMatrix = Matrix4f . createTranslation ( position . negate ( ) ) ; viewMatrix = rotationMatrix . mul ( positionMatrix ) ; updateViewMatrix = false ; } return viewMatrix ; } | Returns the view matrix which is the transformation matrix for the position and rotation . |
7,103 | public static Camera createPerspective ( float fieldOfView , int windowWidth , int windowHeight , float near , float far ) { return new Camera ( Matrix4f . createPerspective ( fieldOfView , ( float ) windowWidth / windowHeight , near , far ) ) ; } | Creates a new camera with a standard perspective projection matrix . |
7,104 | public static X509Certificate readPemCertificate ( final File file ) throws IOException , CertificateException { final String privateKeyAsString = readPemFileAsBase64 ( file ) ; final byte [ ] decoded = new Base64 ( ) . decode ( privateKeyAsString ) ; return readCertificate ( decoded ) ; } | Read pem certificate . |
7,105 | protected boolean isLogRequest ( final HttpServletRequest aHttpRequest , final HttpServletResponse aHttpResponse ) { boolean bLog = isGloballyEnabled ( ) && m_aLogger . isInfoEnabled ( ) ; if ( bLog ) { final String sRequestURI = ServletHelper . getRequestRequestURI ( aHttpRequest ) ; for ( final String sExcludedPath : m_aExcludedPaths ) if ( sRequestURI . startsWith ( sExcludedPath ) ) { bLog = false ; break ; } } return bLog ; } | Check if this request should be logged or not . |
7,106 | public CloseableHttpResponse execute ( final HttpUriRequest aRequest ) throws IOException { return execute ( aRequest , ( HttpContext ) null ) ; } | Execute the provided request without any special context . Caller is responsible for consuming the response correctly! |
7,107 | public CloseableHttpResponse execute ( final HttpUriRequest aRequest , final HttpContext aHttpContext ) throws IOException { checkIfClosed ( ) ; HttpDebugger . beforeRequest ( aRequest , aHttpContext ) ; CloseableHttpResponse ret = null ; Throwable aCaughtException = null ; try { ret = m_aHttpClient . execute ( aRequest , aHttpContext ) ; return ret ; } catch ( final IOException ex ) { aCaughtException = ex ; throw ex ; } finally { HttpDebugger . afterRequest ( aRequest , ret , aCaughtException ) ; } } | Execute the provided request with an optional special context . Caller is responsible for consuming the response correctly! |
7,108 | public < T > T execute ( final HttpUriRequest aRequest , final ResponseHandler < T > aResponseHandler ) throws IOException { return execute ( aRequest , ( HttpContext ) null , aResponseHandler ) ; } | Execute the provided request without any special context . The response handler is invoked as a callback . This method automatically cleans up all used resources and as such is preferred over the execute methods returning the CloseableHttpResponse . |
7,109 | public static EChange setMailQueueSize ( final int nMaxMailQueueLen , final int nMaxMailSendCount ) { ValueEnforcer . isGT0 ( nMaxMailQueueLen , "MaxMailQueueLen" ) ; ValueEnforcer . isGT0 ( nMaxMailSendCount , "MaxMailSendCount" ) ; ValueEnforcer . isTrue ( nMaxMailQueueLen >= nMaxMailSendCount , ( ) -> "MaxMailQueueLen (" + nMaxMailQueueLen + ") must be >= than MaxMailSendCount (" + nMaxMailSendCount + ")" ) ; return s_aRWLock . writeLocked ( ( ) -> { if ( nMaxMailQueueLen == s_nMaxMailQueueLen && nMaxMailSendCount == s_nMaxMailSendCount ) return EChange . UNCHANGED ; s_nMaxMailQueueLen = nMaxMailQueueLen ; s_nMaxMailSendCount = nMaxMailSendCount ; return EChange . CHANGED ; } ) ; } | Set mail queue settings . Changing these settings has no effect on existing mail queues! |
7,110 | public static EChange setUseSSL ( final boolean bUseSSL ) { return s_aRWLock . writeLocked ( ( ) -> { if ( s_bUseSSL == bUseSSL ) return EChange . UNCHANGED ; s_bUseSSL = bUseSSL ; return EChange . CHANGED ; } ) ; } | Use SSL by default? |
7,111 | public static EChange setUseSTARTTLS ( final boolean bUseSTARTTLS ) { return s_aRWLock . writeLocked ( ( ) -> { if ( s_bUseSTARTTLS == bUseSTARTTLS ) return EChange . UNCHANGED ; s_bUseSTARTTLS = bUseSTARTTLS ; return EChange . CHANGED ; } ) ; } | Use STARTTLS by default? |
7,112 | public static EChange setConnectionTimeoutMilliSecs ( final long nMilliSecs ) { return s_aRWLock . writeLocked ( ( ) -> { if ( s_nConnectionTimeoutMilliSecs == nMilliSecs ) return EChange . UNCHANGED ; if ( nMilliSecs <= 0 ) LOGGER . warn ( "You are setting an indefinite connection timeout for the mail transport api: " + nMilliSecs ) ; s_nConnectionTimeoutMilliSecs = nMilliSecs ; return EChange . CHANGED ; } ) ; } | Set the connection timeout in milliseconds . Values &le ; 0 are interpreted as indefinite timeout which is not recommended! Changing these settings has no effect on existing mail queues! |
7,113 | public static EChange setTimeoutMilliSecs ( final long nMilliSecs ) { return s_aRWLock . writeLocked ( ( ) -> { if ( s_nTimeoutMilliSecs == nMilliSecs ) return EChange . UNCHANGED ; if ( nMilliSecs <= 0 ) LOGGER . warn ( "You are setting an indefinite socket timeout for the mail transport api: " + nMilliSecs ) ; s_nTimeoutMilliSecs = nMilliSecs ; return EChange . CHANGED ; } ) ; } | Set the socket timeout in milliseconds . Values &le ; 0 are interpreted as indefinite timeout which is not recommended! Changing these settings has no effect on existing mail queues! |
7,114 | public static void addConnectionListener ( final ConnectionListener aConnectionListener ) { ValueEnforcer . notNull ( aConnectionListener , "ConnectionListener" ) ; s_aRWLock . writeLocked ( ( ) -> s_aConnectionListeners . add ( aConnectionListener ) ) ; } | Add a new mail connection listener . |
7,115 | public static EChange removeConnectionListener ( final ConnectionListener aConnectionListener ) { if ( aConnectionListener == null ) return EChange . UNCHANGED ; return s_aRWLock . writeLocked ( ( ) -> s_aConnectionListeners . removeObject ( aConnectionListener ) ) ; } | Remove an existing mail connection listener . |
7,116 | public static void addEmailDataTransportListener ( final IEmailDataTransportListener aEmailDataTransportListener ) { ValueEnforcer . notNull ( aEmailDataTransportListener , "EmailDataTransportListener" ) ; s_aRWLock . writeLocked ( ( ) -> s_aEmailDataTransportListeners . add ( aEmailDataTransportListener ) ) ; } | Add a new mail transport listener . |
7,117 | public static EChange removeEmailDataTransportListener ( final IEmailDataTransportListener aEmailDataTransportListener ) { if ( aEmailDataTransportListener == null ) return EChange . UNCHANGED ; return s_aRWLock . writeLocked ( ( ) -> s_aEmailDataTransportListeners . removeObject ( aEmailDataTransportListener ) ) ; } | Remove an existing mail transport listener . |
7,118 | @ SuppressFBWarnings ( "LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE" ) public static void enableJavaxMailDebugging ( final boolean bDebug ) { java . util . logging . Logger . getLogger ( "com.sun.mail.smtp" ) . setLevel ( bDebug ? Level . FINEST : Level . INFO ) ; java . util . logging . Logger . getLogger ( "com.sun.mail.smtp.protocol" ) . setLevel ( bDebug ? Level . FINEST : Level . INFO ) ; SystemProperties . setPropertyValue ( "mail.socket.debug" , bDebug ) ; SystemProperties . setPropertyValue ( "java.security.debug" , bDebug ? "certpath" : null ) ; SystemProperties . setPropertyValue ( "javax.net.debug" , bDebug ? "trustmanager" : null ) ; } | Enable or disable javax . mail debugging . By default debugging is disabled . |
7,119 | public static void setToDefault ( ) { s_aRWLock . writeLocked ( ( ) -> { s_nMaxMailQueueLen = DEFAULT_MAX_QUEUE_LENGTH ; s_nMaxMailSendCount = DEFAULT_MAX_SEND_COUNT ; s_bUseSSL = DEFAULT_USE_SSL ; s_bUseSTARTTLS = DEFAULT_USE_STARTTLS ; s_nConnectionTimeoutMilliSecs = DEFAULT_CONNECT_TIMEOUT_MILLISECS ; s_nTimeoutMilliSecs = DEFAULT_TIMEOUT_MILLISECS ; s_bDebugSMTP = GlobalDebug . isDebugMode ( ) ; s_aConnectionListeners . clear ( ) ; s_aEmailDataTransportListeners . clear ( ) ; } ) ; } | Set all settings to the default . This is helpful for testing . |
7,120 | public static byte [ ] convertToKeyByteArray ( String yourGooglePrivateKeyString ) { yourGooglePrivateKeyString = yourGooglePrivateKeyString . replace ( '-' , '+' ) ; yourGooglePrivateKeyString = yourGooglePrivateKeyString . replace ( '_' , '/' ) ; return Base64 . getDecoder ( ) . decode ( yourGooglePrivateKeyString ) ; } | Converts the given private key as String to an base 64 encoded byte array . |
7,121 | public static String signRequest ( final String yourGooglePrivateKeyString , final String path , final String query ) throws NoSuchAlgorithmException , InvalidKeyException , UnsupportedEncodingException , URISyntaxException { final String resource = path + '?' + query ; final SecretKeySpec sha1Key = new SecretKeySpec ( convertToKeyByteArray ( yourGooglePrivateKeyString ) , "HmacSHA1" ) ; final Mac mac = Mac . getInstance ( "HmacSHA1" ) ; mac . init ( sha1Key ) ; final byte [ ] sigBytes = mac . doFinal ( resource . getBytes ( ) ) ; String signature = Base64 . getEncoder ( ) . encodeToString ( sigBytes ) ; signature = signature . replace ( '+' , '-' ) ; signature = signature . replace ( '/' , '_' ) ; return resource + "&signature=" + signature ; } | Returns the context path with the signature as parameter . |
7,122 | public static String signRequest ( final URL url , final String yourGooglePrivateKeyString ) throws NoSuchAlgorithmException , InvalidKeyException , UnsupportedEncodingException , URISyntaxException { final String resource = url . getPath ( ) + '?' + url . getQuery ( ) ; final SecretKeySpec sha1Key = new SecretKeySpec ( convertToKeyByteArray ( yourGooglePrivateKeyString ) , "HmacSHA1" ) ; final Mac mac = Mac . getInstance ( "HmacSHA1" ) ; mac . init ( sha1Key ) ; final byte [ ] sigBytes = mac . doFinal ( resource . getBytes ( ) ) ; String signature = Base64 . getEncoder ( ) . encodeToString ( sigBytes ) ; signature = signature . replace ( '+' , '-' ) ; signature = signature . replace ( '/' , '_' ) ; final String signedRequestPath = resource + "&signature=" + signature ; final String urlGoogleMapSignedRequest = url . getProtocol ( ) + "://" + url . getHost ( ) + signedRequestPath ; return urlGoogleMapSignedRequest ; } | Returns the full url as String object with the signature as parameter . |
7,123 | public static void setResponseHeader ( final String sName , final String sValue ) { ValueEnforcer . notEmpty ( sName , "Name" ) ; ValueEnforcer . notEmpty ( sValue , "Value" ) ; s_aRWLock . writeLocked ( ( ) -> s_aResponseHeaderMap . setHeader ( sName , sValue ) ) ; } | Sets a response header to the response according to the passed name and value . An existing header entry with the same name is overridden . |
7,124 | public static void addResponseHeader ( final String sName , final String sValue ) { ValueEnforcer . notEmpty ( sName , "Name" ) ; ValueEnforcer . notEmpty ( sValue , "Value" ) ; s_aRWLock . writeLocked ( ( ) -> s_aResponseHeaderMap . addHeader ( sName , sValue ) ) ; } | Adds a response header to the response according to the passed name and value . If an existing header with the same is present the value is added to the list so that the header is emitted more than once . |
7,125 | public static < S , T > Map < S , T > merge ( Map < S , T > map , Map < S , T > toMerge ) { Map < S , T > ret = new HashMap < S , T > ( ) ; ret . putAll ( ensure ( map ) ) ; ret . putAll ( ensure ( toMerge ) ) ; return ret ; } | toMerge will overwrite map values . |
7,126 | public void addHeader ( final String sName , final String sValue ) { ValueEnforcer . notNull ( sName , "HeaderName" ) ; final String sNameLower = sName . toLowerCase ( Locale . US ) ; m_aRWLock . writeLocked ( ( ) -> { ICommonsList < String > aHeaderValueList = m_aHeaderNameToValueListMap . get ( sNameLower ) ; if ( aHeaderValueList == null ) { aHeaderValueList = new CommonsArrayList < > ( ) ; m_aHeaderNameToValueListMap . put ( sNameLower , aHeaderValueList ) ; m_aHeaderNameList . add ( sNameLower ) ; } aHeaderValueList . add ( sValue ) ; } ) ; } | Method to add header values to this instance . |
7,127 | public static void checkVersion ( GLVersioned required , GLVersioned object ) { if ( ! debug ) { return ; } final GLVersion requiredVersion = required . getGLVersion ( ) ; final GLVersion objectVersion = object . getGLVersion ( ) ; if ( objectVersion . getMajor ( ) > requiredVersion . getMajor ( ) && objectVersion . getMinor ( ) > requiredVersion . getMinor ( ) ) { throw new IllegalStateException ( "Versions not compatible: expected " + requiredVersion + " or lower, got " + objectVersion ) ; } } | Checks if two OpenGL versioned object have compatible version . Throws an exception if that s not the case . A version is determined to be compatible with another is it s lower than the said version . This isn t always true when deprecation is involved but it s an acceptable way of doing this in most implementations . |
7,128 | public static int [ ] getPackedPixels ( ByteBuffer imageData , Format format , Rectangle size ) { final int [ ] pixels = new int [ size . getArea ( ) ] ; final int width = size . getWidth ( ) ; final int height = size . getHeight ( ) ; for ( int x = 0 ; x < width ; x ++ ) { for ( int y = 0 ; y < height ; y ++ ) { final int srcIndex = ( x + y * width ) * format . getComponentCount ( ) ; final int destIndex = x + ( height - y - 1 ) * width ; if ( format . hasRed ( ) ) { pixels [ destIndex ] |= ( imageData . get ( srcIndex ) & 0xff ) << 16 ; } if ( format . hasGreen ( ) ) { pixels [ destIndex ] |= ( imageData . get ( srcIndex + 1 ) & 0xff ) << 8 ; } if ( format . hasBlue ( ) ) { pixels [ destIndex ] |= imageData . get ( srcIndex + 2 ) & 0xff ; } if ( format . hasAlpha ( ) ) { pixels [ destIndex ] |= ( imageData . get ( srcIndex + 3 ) & 0xff ) << 24 ; } else { pixels [ destIndex ] |= 0xff000000 ; } } } return pixels ; } | Converts a byte buffer of image data to a flat integer array integer where each pixel is and integer in the ARGB format . Input data is expected to be 8 bits per component . If the format has no alpha 0xFF is written as the value . |
7,129 | public static BufferedImage getImage ( ByteBuffer imageData , Format format , Rectangle size ) { final int width = size . getWidth ( ) ; final int height = size . getHeight ( ) ; final BufferedImage image = new BufferedImage ( width , height , BufferedImage . TYPE_INT_ARGB ) ; final int [ ] pixels = ( ( DataBufferInt ) image . getRaster ( ) . getDataBuffer ( ) ) . getData ( ) ; for ( int x = 0 ; x < width ; x ++ ) { for ( int y = 0 ; y < height ; y ++ ) { final int srcIndex = ( x + y * width ) * format . getComponentCount ( ) ; final int destIndex = x + ( height - y - 1 ) * width ; if ( format . hasRed ( ) ) { pixels [ destIndex ] |= ( imageData . get ( srcIndex ) & 0xff ) << 16 ; } if ( format . hasGreen ( ) ) { pixels [ destIndex ] |= ( imageData . get ( srcIndex + 1 ) & 0xff ) << 8 ; } if ( format . hasBlue ( ) ) { pixels [ destIndex ] |= imageData . get ( srcIndex + 2 ) & 0xff ; } if ( format . hasAlpha ( ) ) { pixels [ destIndex ] |= ( imageData . get ( srcIndex + 3 ) & 0xff ) << 24 ; } else { pixels [ destIndex ] |= 0xff000000 ; } } } return image ; } | Converts a byte buffer of image data to a buffered image in the ARGB format . Input data is expected to be 8 bits per component . If the format has no alpha 0xFF is written as the value . |
7,130 | public static Vector4f fromIntRGBA ( int r , int g , int b , int a ) { return new Vector4f ( ( r & 0xff ) / 255f , ( g & 0xff ) / 255f , ( b & 0xff ) / 255f , ( a & 0xff ) / 255f ) ; } | Converts 4 byte color components to a normalized float color . |
7,131 | public static ByteBuffer createByteBuffer ( int capacity ) { return ByteBuffer . allocateDirect ( capacity * DataType . BYTE . getByteSize ( ) ) . order ( ByteOrder . nativeOrder ( ) ) ; } | Creates a byte buffer of the desired capacity . |
7,132 | protected UnmappedReads < Read > getUnmappedMatesOfMappedReads ( String readsetId ) throws GeneralSecurityException , IOException { LOG . info ( "Collecting unmapped mates of mapped reads for injection" ) ; final Iterable < Read > unmappedReadsIterable = getUnmappedReadsIterator ( readsetId ) ; final UnmappedReads < Read > unmappedReads = createUnmappedReads ( ) ; for ( Read read : unmappedReadsIterable ) { unmappedReads . maybeAddRead ( read ) ; } LOG . info ( "Finished collecting unmapped mates of mapped reads: " + unmappedReads . getReadCount ( ) + " found." ) ; return unmappedReads ; } | Gets unmapped mates so we can inject them besides their mapped pairs . |
7,133 | public void set ( Rectangle rectangle ) { set ( rectangle . getX ( ) , rectangle . getY ( ) , rectangle . getWidth ( ) , rectangle . getHeight ( ) ) ; } | Sets the rectangle to be an exact copy of the provided one . |
7,134 | public static ISessionWebScope getSessionWebScopeOfSession ( final HttpSession aHttpSession ) { return aHttpSession == null ? null : getSessionWebScopeOfID ( aHttpSession . getId ( ) ) ; } | Get the session web scope of the passed HTTP session . |
7,135 | public static void destroyAllWebSessions ( ) { for ( final ISessionWebScope aSessionScope : getAllSessionWebScopes ( ) ) { if ( aSessionScope . selfDestruct ( ) . isContinue ( ) ) { ScopeSessionManager . getInstance ( ) . onScopeEnd ( aSessionScope ) ; } } } | Destroy all available web scopes . |
7,136 | private void writeObject ( final ObjectOutputStream aOS ) throws IOException { if ( m_aDFOS . isInMemory ( ) ) { _ensureCachedContentIsPresent ( ) ; } else { m_aCachedContent = null ; m_aDFOSFile = m_aDFOS . getFile ( ) ; } aOS . defaultWriteObject ( ) ; } | Writes the state of this object during serialization . |
7,137 | public long getSize ( ) { if ( m_nSize >= 0 ) return m_nSize ; if ( m_aCachedContent != null ) return m_aCachedContent . length ; if ( m_aDFOS . isInMemory ( ) ) return m_aDFOS . getDataLength ( ) ; return m_aDFOS . getFile ( ) . length ( ) ; } | Returns the size of the file . |
7,138 | @ ReturnsMutableObject ( "Speed" ) @ SuppressFBWarnings ( "EI_EXPOSE_REP" ) public byte [ ] directGet ( ) { if ( isInMemory ( ) ) { _ensureCachedContentIsPresent ( ) ; return m_aCachedContent ; } return SimpleFileIO . getAllFileBytes ( m_aDFOS . getFile ( ) ) ; } | Returns the contents of the file as an array of bytes . If the contents of the file were not yet cached in memory they will be loaded from the disk storage and cached . |
7,139 | public String getStringWithFallback ( final Charset aFallbackCharset ) { final String sCharset = getCharSet ( ) ; final Charset aCharset = CharsetHelper . getCharsetFromNameOrDefault ( sCharset , aFallbackCharset ) ; return getString ( aCharset ) ; } | Get the string with the charset defined in the content type . |
7,140 | public void run ( String [ ] args ) { LOG . info ( "Starting GA4GHPicardRunner" ) ; try { parseCmdLine ( args ) ; buildPicardCommand ( ) ; startProcess ( ) ; pumpInputData ( ) ; waitForProcessEnd ( ) ; } catch ( Exception e ) { System . out . println ( e . getMessage ( ) ) ; e . printStackTrace ( ) ; } } | Sets up required streams and pipes and then spawns the Picard tool |
7,141 | void parseCmdLine ( String [ ] args ) { JCommander parser = new JCommander ( this , args ) ; parser . setProgramName ( "GA4GHPicardRunner" ) ; LOG . info ( "Cmd line parsed" ) ; } | Parses cmd line with JCommander |
7,142 | private void buildPicardCommand ( ) throws IOException , GeneralSecurityException , URISyntaxException { File picardJarPath = new File ( picardPath , "picard.jar" ) ; if ( ! picardJarPath . exists ( ) ) { throw new IOException ( "Picard tool not found at " + picardJarPath . getAbsolutePath ( ) ) ; } command . add ( "java" ) ; command . add ( picardJVMArgs ) ; command . add ( "-jar" ) ; command . add ( picardJarPath . getAbsolutePath ( ) ) ; command . add ( picardTool ) ; for ( String picardArg : picardArgs ) { if ( picardArg . startsWith ( INPUT_PREFIX ) ) { String inputPath = picardArg . substring ( INPUT_PREFIX . length ( ) ) ; inputs . add ( processInput ( inputPath ) ) ; } else { command . add ( picardArg ) ; } } for ( Input input : inputs ) { command . add ( "INPUT=" + input . pipeName ) ; } } | Adds relevant parts to the cmd line for Picard tool finds and extracts INPUT = arguments and processes them by creating appropriate data pumps . |
7,143 | private Input processGA4GHInput ( String input ) throws IOException , GeneralSecurityException , URISyntaxException { GA4GHUrl url = new GA4GHUrl ( input ) ; SAMFilePump pump ; if ( usingGrpc ) { factoryGrpc . configure ( url . getRootUrl ( ) , new Settings ( clientSecretsFilename , apiKey , noLocalServer ) ) ; pump = new ReadIteratorToSAMFilePump < com . google . genomics . v1 . Read , com . google . genomics . v1 . ReadGroupSet , com . google . genomics . v1 . Reference > ( factoryGrpc . get ( url . getRootUrl ( ) ) . getReads ( url ) ) ; } else { factoryRest . configure ( url . getRootUrl ( ) , new Settings ( clientSecretsFilename , apiKey , noLocalServer ) ) ; pump = new ReadIteratorToSAMFilePump < com . google . api . services . genomics . model . Read , com . google . api . services . genomics . model . ReadGroupSet , com . google . api . services . genomics . model . Reference > ( factoryRest . get ( url . getRootUrl ( ) ) . getReads ( url ) ) ; } return new Input ( input , STDIN_FILE_NAME , pump ) ; } | Processes GA4GH based input creates required API connections and data pump |
7,144 | private Input processRegularFileInput ( String input ) throws IOException { File inputFile = new File ( input ) ; if ( ! inputFile . exists ( ) ) { throw new IOException ( "Input does not exist: " + input ) ; } if ( pipeFiles ) { SamReader samReader = SamReaderFactory . makeDefault ( ) . open ( inputFile ) ; return new Input ( input , STDIN_FILE_NAME , new SamReaderToSAMFilePump ( samReader ) ) ; } else { return new Input ( input , input , null ) ; } } | Processes regular non GA4GH based file input |
7,145 | private void startProcess ( ) throws IOException { LOG . info ( "Building process" ) ; ProcessBuilder processBuilder = new ProcessBuilder ( command ) ; processBuilder . redirectError ( ProcessBuilder . Redirect . INHERIT ) ; processBuilder . redirectOutput ( ProcessBuilder . Redirect . INHERIT ) ; LOG . info ( "Starting process" ) ; process = processBuilder . start ( ) ; LOG . info ( "Process started" ) ; } | Starts the Picard tool process based on constructed command . |
7,146 | private void pumpInputData ( ) throws IOException { for ( Input input : inputs ) { if ( input . pump == null ) { continue ; } OutputStream os ; if ( input . pipeName . equals ( STDIN_FILE_NAME ) ) { os = process . getOutputStream ( ) ; } else { throw new IOException ( "Only stdin piping is supported so far." ) ; } input . pump . pump ( os ) ; } } | Loops through inputs and for each pumps the data into the proper pipe stream connected to the executing process . |
7,147 | public static DefaultTreeWithGlobalUniqueID < String , NetworkInterface > createNetworkInterfaceTree ( ) { final DefaultTreeWithGlobalUniqueID < String , NetworkInterface > ret = new DefaultTreeWithGlobalUniqueID < > ( ) ; final ICommonsList < NetworkInterface > aNonRootNIs = new CommonsArrayList < > ( ) ; try { for ( final NetworkInterface aNI : IteratorHelper . getIterator ( NetworkInterface . getNetworkInterfaces ( ) ) ) if ( aNI . getParent ( ) == null ) ret . getRootItem ( ) . createChildItem ( aNI . getName ( ) , aNI ) ; else aNonRootNIs . add ( aNI ) ; } catch ( final Throwable t ) { throw new IllegalStateException ( "Failed to get all network interfaces" , t ) ; } int nNotFound = 0 ; while ( aNonRootNIs . isNotEmpty ( ) ) { final NetworkInterface aNI = aNonRootNIs . removeFirst ( ) ; final DefaultTreeItemWithID < String , NetworkInterface > aParentItem = ret . getItemWithID ( aNI . getParent ( ) . getName ( ) ) ; if ( aParentItem != null ) { aParentItem . createChildItem ( aNI . getName ( ) , aNI ) ; nNotFound = 0 ; } else { aNonRootNIs . add ( aNI ) ; nNotFound ++ ; if ( nNotFound > aNonRootNIs . size ( ) ) throw new IllegalStateException ( "Seems like we have a data structure inconsistency! Remaining are: " + aNonRootNIs ) ; } } return ret ; } | Create a hierarchical tree of the network interfaces . |
7,148 | public static Runner runnerForClass0 ( RunnerBuilder builder , Class < ? > testClass ) throws Throwable { if ( recursiveDepth > 1 || isOnStack ( 0 , CoverageRunner . class . getCanonicalName ( ) ) ) { return builder . runnerForClass ( testClass ) ; } AffectingBuilder affectingBuilder = new AffectingBuilder ( ) ; Runner runner = affectingBuilder . runnerForClass ( testClass ) ; if ( runner != null ) { return runner ; } CoverageMonitor . clean ( ) ; Runner wrapped = builder . runnerForClass ( testClass ) ; return new CoverageRunner ( testClass , wrapped , CoverageMonitor . getURLs ( ) ) ; } | JUnit4 support . |
7,149 | private static boolean isOnStack ( int moreThan , String canonicalName ) { StackTraceElement [ ] stackTrace = Thread . currentThread ( ) . getStackTrace ( ) ; int count = 0 ; for ( StackTraceElement element : stackTrace ) { if ( element . getClassName ( ) . startsWith ( canonicalName ) ) { count ++ ; } } return count > moreThan ; } | Checks if the given name is on stack more than the given number of times . This method uses startsWith to check if the given name is on stack so one can pass a package name too . |
7,150 | public static void validateHTMLConfiguration ( ) throws IllegalStateException { PhotonCSS . readCSSIncludesForGlobal ( new ClassPathResource ( PhotonCSS . DEFAULT_FILENAME ) ) ; PhotonJS . readJSIncludesForGlobal ( new ClassPathResource ( PhotonJS . DEFAULT_FILENAME ) ) ; } | Check if the referenced JS and CSS files exist |
7,151 | public FineUploader5Form setElementID ( final String sElementID ) { ValueEnforcer . notEmpty ( sElementID , "ElementID" ) ; m_sFormElementID = sElementID ; return this ; } | This can be the ID of the < ; form> ; or a reference to the < ; form> ; element . |
7,152 | public static void setAuditor ( final IAuditor aAuditor ) { ValueEnforcer . notNull ( aAuditor , "Auditor" ) ; s_aRWLock . writeLocked ( ( ) -> s_aAuditor = aAuditor ) ; } | Set the global auditor to use . |
7,153 | private static boolean startsWith ( String str , String ... prefixes ) { for ( String prefix : prefixes ) { if ( str . startsWith ( prefix ) ) return true ; } return false ; } | Checks if the given string starts with any of the given prefixes . |
7,154 | private static List < String > extractClassNames ( String jarName ) throws IOException { List < String > classes = new LinkedList < String > ( ) ; ZipInputStream orig = new ZipInputStream ( new FileInputStream ( jarName ) ) ; for ( ZipEntry entry = orig . getNextEntry ( ) ; entry != null ; entry = orig . getNextEntry ( ) ) { String fullName = entry . getName ( ) . replaceAll ( "/" , "." ) . replace ( ".class" , "" ) ; classes . add ( fullName ) ; } orig . close ( ) ; return classes ; } | Extract class names from the given jar . This method is for debugging purpose . |
7,155 | public static void main ( String [ ] args ) throws IOException { if ( args . length != 1 ) { System . out . println ( "There should be an argument: path to a jar." ) ; System . exit ( 0 ) ; } String jarInput = args [ 0 ] ; extract ( new File ( jarInput ) , new File ( "/tmp/junit-ekstazi-agent.jar" ) , new String [ ] { Names . EKSTAZI_PACKAGE_BIN } , new String [ ] { } ) ; for ( String name : extractClassNames ( "/tmp/junit-ekstazi-agent.jar" ) ) { System . out . println ( name ) ; } } | Simple test to print all classes in the given jar . |
7,156 | public static boolean isJSNode ( final IHCNode aNode ) { final IHCNode aUnwrappedNode = HCHelper . getUnwrappedNode ( aNode ) ; return isDirectJSNode ( aUnwrappedNode ) ; } | Check if the passed node is a JS node after unwrapping . |
7,157 | public static boolean isJSInlineNode ( final IHCNode aNode ) { final IHCNode aUnwrappedNode = HCHelper . getUnwrappedNode ( aNode ) ; return isDirectJSInlineNode ( aUnwrappedNode ) ; } | Check if the passed node is an inline JS node after unwrapping . |
7,158 | public static boolean isJSFileNode ( final IHCNode aNode ) { final IHCNode aUnwrappedNode = HCHelper . getUnwrappedNode ( aNode ) ; return isDirectJSFileNode ( aUnwrappedNode ) ; } | Check if the passed node is a file JS node after unwrapping . |
7,159 | public JSVar param ( final String sName ) { final JSVar aVar = new JSVar ( sName , null ) ; m_aParams . add ( aVar ) ; return aVar ; } | Add the specified variable to the list of parameters for this function signature . |
7,160 | public JSBlock body ( ) { if ( m_aBody == null ) m_aBody = new JSBlock ( ) . newlineAtEnd ( false ) ; return m_aBody ; } | Get the block that makes up body of this function |
7,161 | public static HCCol perc ( final int nPerc ) { return new HCCol ( ) . setWidth ( ECSSUnit . perc ( nPerc ) ) ; } | Create a new column with a certain percentage . |
7,162 | public int enrichXml ( final MMOs root ) throws SQLException { int count = 0 ; for ( final MMO mmo : root . getMMO ( ) ) { for ( final Utterance utterance : mmo . getUtterances ( ) . getUtterance ( ) ) { for ( final Phrase phrase : utterance . getPhrases ( ) . getPhrase ( ) ) { System . out . printf ( "Phrase: %s\n" , phrase . getPhraseText ( ) ) ; for ( final Mapping mapping : phrase . getMappings ( ) . getMapping ( ) ) { System . out . printf ( "Score: %s\n" , mapping . getMappingScore ( ) ) ; for ( final Candidate candidate : mapping . getMappingCandidates ( ) . getCandidate ( ) ) { final Collection < String > semTypes = new ArrayList < > ( ) ; for ( final SemType st : candidate . getSemTypes ( ) . getSemType ( ) ) { semTypes . add ( st . getvalue ( ) ) ; } count += addSnomedId ( candidate ) ? 1 : 0 ; System . out . printf ( " %-5s %-9s %s %s %s %s\n" , candidate . getCandidateScore ( ) , candidate . getCandidateCUI ( ) , candidate . getSnomedId ( ) , candidate . getCandidatePreferred ( ) , semTypes , candidate . getSources ( ) . getSource ( ) ) ; } } System . out . println ( ) ; } } } return count ; } | Tries to look up each Mapping Candidate in the SNOMED CT db to add more data . |
7,163 | public boolean addSnomedId ( final Candidate candidate ) throws SQLException { final SnomedTerm result = findFromCuiAndDesc ( candidate . getCandidateCUI ( ) , candidate . getCandidatePreferred ( ) ) ; if ( result != null ) { candidate . setSnomedId ( result . snomedId ) ; candidate . setTermType ( result . termType ) ; return true ; } else { System . err . printf ( "WARNING! Could not find the SNOMED CT concept id for UMLS CUI: %s: '%s'\n" , candidate . getCandidateCUI ( ) , candidate . getCandidatePreferred ( ) ) ; return false ; } } | Tries to find this candidate in the SNOMED CT database and if found adds the SNOMED id and term type to the instance . |
7,164 | public static boolean looksLikeXHTML ( final String sText ) { return StringHelper . hasText ( sText ) && RegExHelper . stringMatchesPattern ( "(?s).*<[a-zA-Z].+" , sText ) ; } | Check whether the passed text looks like it contains XHTML code . This is a heuristic check only and does not perform actual parsing! |
7,165 | public boolean isValidXHTMLFragment ( final String sXHTMLFragment ) { return StringHelper . hasNoText ( sXHTMLFragment ) || parseXHTMLFragment ( sXHTMLFragment ) != null ; } | Check if the given fragment is valid XHTML 1 . 1 mark - up . This method tries to parse the XHTML fragment so it is potentially slow! |
7,166 | public IMicroContainer unescapeXHTMLFragment ( final String sXHTML ) { final IMicroDocument aDoc = parseXHTMLFragment ( sXHTML ) ; if ( aDoc != null && aDoc . getDocumentElement ( ) != null ) { final IMicroElement eBody = aDoc . getDocumentElement ( ) . getFirstChildElement ( EHTMLElement . BODY . getElementName ( ) ) ; if ( eBody != null ) { final IMicroContainer ret = new MicroContainer ( ) ; if ( eBody . hasChildren ( ) ) { for ( final IMicroNode aChildNode : eBody . getAllChildren ( ) ) ret . appendChild ( aChildNode . detachFromParent ( ) ) ; } return ret ; } } return null ; } | Interpret the passed XHTML fragment as HTML and retrieve a result container with all body elements . |
7,167 | public static LocalDateTime readAsLocalDateTime ( final IMicroElement aElement , final IMicroQName aLDTName , final String aDTName ) { LocalDateTime aLDT = aElement . getAttributeValueWithConversion ( aLDTName , LocalDateTime . class ) ; if ( aLDT == null ) { final ZonedDateTime aDT = aElement . getAttributeValueWithConversion ( aDTName , ZonedDateTime . class ) ; if ( aDT != null ) aLDT = aDT . toLocalDateTime ( ) ; } return aLDT ; } | For migration purposes - read LocalDateTime - if no present fall back to DateTime |
7,168 | public BootstrapDisplayBuilder display ( final EBootstrapDisplayType eDisplay ) { ValueEnforcer . notNull ( eDisplay , "eDisplay" ) ; m_eDisplay = eDisplay ; return this ; } | Set the display type . Default is block . |
7,169 | public final HCHead addCSSAt ( final int nIndex , final IHCNode aCSS ) { ValueEnforcer . notNull ( aCSS , "CSS" ) ; if ( ! HCCSSNodeDetector . isCSSNode ( aCSS ) ) throw new IllegalArgumentException ( aCSS + " is not a valid CSS node!" ) ; m_aCSS . add ( nIndex , aCSS ) ; return this ; } | Add a CSS node at the specified index . |
7,170 | public final HCHead addJS ( final IHCNode aJS ) { ValueEnforcer . notNull ( aJS , "JS" ) ; if ( ! HCJSNodeDetector . isJSNode ( aJS ) ) throw new IllegalArgumentException ( aJS + " is not a valid JS node!" ) ; m_aJS . add ( aJS ) ; return this ; } | Append some JavaScript code |
7,171 | public final HCHead addJSAt ( final int nIndex , final IHCNode aJS ) { ValueEnforcer . notNull ( aJS , "JS" ) ; if ( ! HCJSNodeDetector . isJSNode ( aJS ) ) throw new IllegalArgumentException ( aJS + " is not a valid JS node!" ) ; m_aJS . add ( nIndex , aJS ) ; return this ; } | Append some JavaScript code at the specified index |
7,172 | public static Ekstazi inst ( ) { if ( inst != null ) return inst ; synchronized ( Ekstazi . class ) { if ( inst == null ) { inst = new Ekstazi ( ) ; } } return inst ; } | Returns the only instance of this class . This method will construct and initialize the instance if it was not previously constructed . |
7,173 | public void endClassCoverage ( String className , boolean isFailOrError ) { File testResultsDir = new File ( Config . ROOT_DIR_V , Names . TEST_RESULTS_DIR_NAME ) ; File outcomeFile = new File ( testResultsDir , className ) ; if ( isFailOrError ) { testResultsDir . mkdirs ( ) ; try { outcomeFile . createNewFile ( ) ; } catch ( IOException e ) { Log . e ( "Unable to create file for a failing test: " + className , e ) ; } } else { outcomeFile . delete ( ) ; } endClassCoverage ( className ) ; } | Saves info about the results of running the given test class . |
7,174 | private boolean initAndReportSuccess ( ) { Config . loadConfig ( ) ; mDependencyAnalyzer = Config . createDepenencyAnalyzer ( ) ; boolean isEnabled = establishIfEnabled ( ) ; if ( ! isEnabled || ! Config . X_INSTRUMENT_CODE_V || isEkstaziSystemClassLoader ( ) ) { return isEnabled ; } Instrumentation instrumentation = EkstaziAgent . getInstrumentation ( ) ; if ( instrumentation == null ) { Log . d ( "Agent has not been set previously" ) ; instrumentation = DynamicEkstazi . initAgentAtRuntimeAndReportSuccess ( ) ; if ( instrumentation == null ) { Log . d ( "No Instrumentation object found; enabling Ekstazi without using any instrumentation" ) ; return true ; } } else { Log . d ( "Agent has been set previously" ) ; } return true ; } | Initializes this facade . This method should be invoked only once . |
7,175 | protected void emitPluginLines ( final MarkdownHCStack aOut , final Line aLines , final String sMeta ) { Line aLine = aLines ; String sIDPlugin = sMeta ; String sParams = null ; ICommonsMap < String , String > aParams = null ; final int nIdxOfSpace = sMeta . indexOf ( ' ' ) ; if ( nIdxOfSpace != - 1 ) { sIDPlugin = sMeta . substring ( 0 , nIdxOfSpace ) ; sParams = sMeta . substring ( nIdxOfSpace + 1 ) ; if ( sParams != null ) { aParams = parsePluginParams ( sParams ) ; } } if ( aParams == null ) { aParams = new CommonsHashMap < > ( ) ; } final ICommonsList < String > aList = new CommonsArrayList < > ( ) ; while ( aLine != null ) { if ( aLine . m_bIsEmpty ) aList . add ( "" ) ; else aList . add ( aLine . m_sValue ) ; aLine = aLine . m_aNext ; } final AbstractMarkdownPlugin aPlugin = m_aPlugins . get ( sIDPlugin ) ; if ( aPlugin != null ) { aPlugin . emit ( aOut , aList , aParams ) ; } } | interprets a plugin block into the StringBuilder . |
7,176 | public static Date copy ( final Date d ) { if ( d == null ) { return null ; } else { return new Date ( d . getTime ( ) ) ; } } | Creates a copy on a Date . |
7,177 | public static < A > List < A > list ( A ... elements ) { final List < A > list = new ArrayList < A > ( elements . length ) ; for ( A element : elements ) { list . add ( element ) ; } return list ; } | Returns an array list of elements |
7,178 | public static < A > Set < A > set ( A ... elements ) { final Set < A > set = new HashSet < A > ( elements . length ) ; for ( A element : elements ) { set . add ( element ) ; } return set ; } | Returns a hash set of elements |
7,179 | public static < A > A execute ( ExceptionAction < A > action ) { try { return action . doAction ( ) ; } catch ( RuntimeException e ) { throw e ; } catch ( Error e ) { throw e ; } catch ( Throwable e ) { throw new RuntimeException ( e ) ; } } | delegate to your to an ExceptionAction and wraps checked exceptions in RuntimExceptions leaving unchecked exceptions alone . |
7,180 | public void addFieldInfo ( final String sFieldName , final String sText ) { add ( SingleError . builderInfo ( ) . setErrorFieldName ( sFieldName ) . setErrorText ( sText ) . build ( ) ) ; } | Add a field specific information message . |
7,181 | public void addFieldWarning ( final String sFieldName , final String sText ) { add ( SingleError . builderWarn ( ) . setErrorFieldName ( sFieldName ) . setErrorText ( sText ) . build ( ) ) ; } | Add a field specific warning message . |
7,182 | public void addFieldError ( final String sFieldName , final String sText ) { add ( SingleError . builderError ( ) . setErrorFieldName ( sFieldName ) . setErrorText ( sText ) . build ( ) ) ; } | Add a field specific error message . |
7,183 | public IUserGroup createNewUserGroup ( final String sName , final String sDescription , final Map < String , String > aCustomAttrs ) { final UserGroup aUserGroup = new UserGroup ( sName , sDescription , aCustomAttrs ) ; m_aRWLock . writeLocked ( ( ) -> { internalCreateItem ( aUserGroup ) ; } ) ; AuditHelper . onAuditCreateSuccess ( UserGroup . OT , aUserGroup . getID ( ) , sName , sDescription , aCustomAttrs ) ; m_aCallbacks . forEach ( aCB -> aCB . onUserGroupCreated ( aUserGroup , false ) ) ; return aUserGroup ; } | Create a new user group . |
7,184 | public IUserGroup createPredefinedUserGroup ( final String sID , final String sName , final String sDescription , final Map < String , String > aCustomAttrs ) { final UserGroup aUserGroup = new UserGroup ( StubObject . createForCurrentUserAndID ( sID , aCustomAttrs ) , sName , sDescription ) ; m_aRWLock . writeLocked ( ( ) -> { internalCreateItem ( aUserGroup ) ; } ) ; AuditHelper . onAuditCreateSuccess ( UserGroup . OT , aUserGroup . getID ( ) , "predefined-usergroup" , sName , sDescription , aCustomAttrs ) ; m_aCallbacks . forEach ( aCB -> aCB . onUserGroupCreated ( aUserGroup , true ) ) ; return aUserGroup ; } | Create a predefined user group . |
7,185 | public EChange deleteUserGroup ( final String sUserGroupID ) { if ( StringHelper . hasNoText ( sUserGroupID ) ) return EChange . UNCHANGED ; final UserGroup aDeletedUserGroup = getOfID ( sUserGroupID ) ; if ( aDeletedUserGroup == null ) { AuditHelper . onAuditDeleteFailure ( UserGroup . OT , "no-such-usergroup-id" , sUserGroupID ) ; return EChange . UNCHANGED ; } if ( aDeletedUserGroup . isDeleted ( ) ) { AuditHelper . onAuditDeleteFailure ( UserGroup . OT , "already-deleted" , sUserGroupID ) ; return EChange . UNCHANGED ; } m_aRWLock . writeLock ( ) . lock ( ) ; try { if ( BusinessObjectHelper . setDeletionNow ( aDeletedUserGroup ) . isUnchanged ( ) ) { AuditHelper . onAuditDeleteFailure ( UserGroup . OT , "already-deleted" , sUserGroupID ) ; return EChange . UNCHANGED ; } internalMarkItemDeleted ( aDeletedUserGroup ) ; } finally { m_aRWLock . writeLock ( ) . unlock ( ) ; } AuditHelper . onAuditDeleteSuccess ( UserGroup . OT , sUserGroupID ) ; m_aCallbacks . forEach ( aCB -> aCB . onUserGroupDeleted ( aDeletedUserGroup ) ) ; return EChange . CHANGED ; } | Delete the user group with the specified ID |
7,186 | public EChange undeleteUserGroup ( final String sUserGroupID ) { final UserGroup aUserGroup = getOfID ( sUserGroupID ) ; if ( aUserGroup == null ) { AuditHelper . onAuditUndeleteFailure ( UserGroup . OT , sUserGroupID , "no-such-id" ) ; return EChange . UNCHANGED ; } m_aRWLock . writeLock ( ) . lock ( ) ; try { if ( BusinessObjectHelper . setUndeletionNow ( aUserGroup ) . isUnchanged ( ) ) return EChange . UNCHANGED ; internalMarkItemUndeleted ( aUserGroup ) ; } finally { m_aRWLock . writeLock ( ) . unlock ( ) ; } AuditHelper . onAuditUndeleteSuccess ( UserGroup . OT , sUserGroupID ) ; m_aCallbacks . forEach ( aCB -> aCB . onUserGroupUndeleted ( aUserGroup ) ) ; return EChange . CHANGED ; } | Undelete the user group with the specified ID . |
7,187 | public EChange renameUserGroup ( final String sUserGroupID , final String sNewName ) { final UserGroup aUserGroup = getOfID ( sUserGroupID ) ; if ( aUserGroup == null ) { AuditHelper . onAuditModifyFailure ( UserGroup . OT , sUserGroupID , "no-such-usergroup-id" , "name" ) ; return EChange . UNCHANGED ; } m_aRWLock . writeLock ( ) . lock ( ) ; try { if ( aUserGroup . setName ( sNewName ) . isUnchanged ( ) ) return EChange . UNCHANGED ; BusinessObjectHelper . setLastModificationNow ( aUserGroup ) ; internalUpdateItem ( aUserGroup ) ; } finally { m_aRWLock . writeLock ( ) . unlock ( ) ; } AuditHelper . onAuditModifySuccess ( UserGroup . OT , "name" , sUserGroupID , sNewName ) ; m_aCallbacks . forEach ( aCB -> aCB . onUserGroupRenamed ( aUserGroup ) ) ; return EChange . CHANGED ; } | Rename the user group with the specified ID |
7,188 | public EChange unassignUserFromAllUserGroups ( final String sUserID ) { if ( StringHelper . hasNoText ( sUserID ) ) return EChange . UNCHANGED ; final ICommonsList < IUserGroup > aAffectedUserGroups = new CommonsArrayList < > ( ) ; m_aRWLock . writeLock ( ) . lock ( ) ; try { EChange eChange = EChange . UNCHANGED ; for ( final UserGroup aUserGroup : internalDirectGetAll ( ) ) if ( aUserGroup . unassignUser ( sUserID ) . isChanged ( ) ) { aAffectedUserGroups . add ( aUserGroup ) ; BusinessObjectHelper . setLastModificationNow ( aUserGroup ) ; internalUpdateItem ( aUserGroup ) ; eChange = EChange . CHANGED ; } if ( eChange . isUnchanged ( ) ) return EChange . UNCHANGED ; } finally { m_aRWLock . writeLock ( ) . unlock ( ) ; } AuditHelper . onAuditModifySuccess ( UserGroup . OT , "unassign-user-from-all-usergroups" , sUserID ) ; for ( final IUserGroup aUserGroup : aAffectedUserGroups ) m_aCallbacks . forEach ( aCB -> aCB . onUserGroupUserAssignment ( aUserGroup , sUserID , false ) ) ; return EChange . CHANGED ; } | Unassign the passed user ID from all user groups . |
7,189 | public ICommonsList < IUserGroup > getAllUserGroupsWithAssignedUser ( final String sUserID ) { if ( StringHelper . hasNoText ( sUserID ) ) return new CommonsArrayList < > ( ) ; return getAll ( aUserGroup -> aUserGroup . containsUserID ( sUserID ) ) ; } | Get a collection of all user groups to which a certain user is assigned to . |
7,190 | public ICommonsList < String > getAllUserGroupIDsWithAssignedUser ( final String sUserID ) { if ( StringHelper . hasNoText ( sUserID ) ) return new CommonsArrayList < > ( ) ; return getAllMapped ( aUserGroup -> aUserGroup . containsUserID ( sUserID ) , aUserGroup -> aUserGroup . getID ( ) ) ; } | Get a collection of all user group IDs to which a certain user is assigned to . |
7,191 | public EChange unassignRoleFromAllUserGroups ( final String sRoleID ) { if ( StringHelper . hasNoText ( sRoleID ) ) return EChange . UNCHANGED ; final ICommonsList < IUserGroup > aAffectedUserGroups = new CommonsArrayList < > ( ) ; m_aRWLock . writeLock ( ) . lock ( ) ; try { EChange eChange = EChange . UNCHANGED ; for ( final UserGroup aUserGroup : internalDirectGetAll ( ) ) if ( aUserGroup . unassignRole ( sRoleID ) . isChanged ( ) ) { aAffectedUserGroups . add ( aUserGroup ) ; BusinessObjectHelper . setLastModificationNow ( aUserGroup ) ; internalUpdateItem ( aUserGroup ) ; eChange = EChange . CHANGED ; } if ( eChange . isUnchanged ( ) ) return EChange . UNCHANGED ; } finally { m_aRWLock . writeLock ( ) . unlock ( ) ; } AuditHelper . onAuditModifySuccess ( UserGroup . OT , "unassign-role-from-all-usergroups" , sRoleID ) ; for ( final IUserGroup aUserGroup : aAffectedUserGroups ) m_aCallbacks . forEach ( aCB -> aCB . onUserGroupRoleAssignment ( aUserGroup , sRoleID , false ) ) ; return EChange . CHANGED ; } | Unassign the passed role ID from existing user groups . |
7,192 | public ICommonsList < String > getAllUserGroupIDsWithAssignedRole ( final String sRoleID ) { if ( StringHelper . hasNoText ( sRoleID ) ) return getNone ( ) ; return getAllMapped ( aUserGroup -> aUserGroup . containsRoleID ( sRoleID ) , IUserGroup :: getID ) ; } | Get a collection of all user group IDs to which a certain role is assigned to . |
7,193 | public final void internalSetNodeState ( final EHCNodeState eNodeState ) { if ( DEBUG_NODE_STATE ) { ValueEnforcer . notNull ( eNodeState , "NodeState" ) ; if ( m_eNodeState . isAfter ( eNodeState ) ) HCConsistencyChecker . consistencyError ( "The new node state is invalid. Got " + eNodeState + " but having " + m_eNodeState ) ; } m_eNodeState = eNodeState ; } | Change the node state internally . Handle with care! |
7,194 | public static boolean check ( Class < ? > clz ) { if ( Config . CACHE_SEEN_CLASSES_V ) { int index = hash ( clz ) ; if ( CACHE [ index ] == clz ) { return true ; } CACHE [ index ] = clz ; } return false ; } | Checks if the given class is in cache . If not puts the class in the cache and returns false ; otherwise it returns true . |
7,195 | public Map < String , String > getResults ( ) { final Map < String , String > results = new HashMap < String , String > ( sinks . size ( ) ) ; for ( Map . Entry < String , StringSink > entry : sinks . entrySet ( ) ) { results . put ( entry . getKey ( ) , entry . getValue ( ) . result ( ) ) ; } return Collections . unmodifiableMap ( results ) ; } | Get the results as a Map from names to String data . The names are composed of |
7,196 | public static void main ( String [ ] args ) { String coverageDirName = null ; if ( args . length == 0 ) { System . out . println ( "Incorrect arguments. Directory with coverage has to be specified." ) ; System . exit ( 1 ) ; } coverageDirName = args [ 0 ] ; String mode = null ; if ( args . length > 1 ) { mode = args [ 1 ] ; } boolean forceCacheUse = false ; if ( args . length > 2 ) { forceCacheUse = args [ 2 ] . equals ( FORCE_CACHE_USE ) ; } Set < String > allClasses = new HashSet < String > ( ) ; Set < String > affectedClasses = new HashSet < String > ( ) ; if ( args . length > 3 ) { String options = args [ 3 ] ; Config . loadConfig ( options , true ) ; } else { Config . loadConfig ( ) ; } List < String > nonAffectedClasses = findNonAffectedClasses ( coverageDirName , forceCacheUse , allClasses , affectedClasses ) ; printNonAffectedClasses ( allClasses , affectedClasses , nonAffectedClasses , mode ) ; } | The user has to specify directory that keep coverage and optionally mode that should be used to print non affected classes . |
7,197 | private static List < String > findNonAffectedClasses ( String workingDirectory ) { Set < String > allClasses = new HashSet < String > ( ) ; Set < String > affectedClasses = new HashSet < String > ( ) ; loadConfig ( workingDirectory ) ; List < String > nonAffectedClasses = findNonAffectedClasses ( Config . ROOT_DIR_V , true , allClasses , affectedClasses ) ; return formatNonAffectedClassesForAntAndMaven ( nonAffectedClasses ) ; } | Returns list of non affected classes as discovered from the given directory with dependencies . |
7,198 | private static void printNonAffectedClasses ( Set < String > allClasses , Set < String > affectedClasses , List < String > nonAffectedClasses , String mode ) { if ( mode != null && mode . equals ( ANT_MODE ) ) { StringBuilder sb = new StringBuilder ( ) ; for ( String className : nonAffectedClasses ) { className = className . replaceAll ( "\\." , "/" ) ; sb . append ( "<exclude name=\"" + className + ".java\"/>" ) ; } System . out . println ( sb ) ; } else if ( mode != null && mode . equals ( MAVEN_SIMPLE_MODE ) ) { StringBuilder sb = new StringBuilder ( ) ; for ( String className : nonAffectedClasses ) { className = className . replaceAll ( "\\." , "/" ) ; sb . append ( "<exclude>" ) ; sb . append ( className ) . append ( ".java" ) ; sb . append ( "</exclude>" ) ; } System . out . println ( sb ) ; } else if ( mode != null && mode . equals ( MAVEN_MODE ) ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "<excludes>" ) ; for ( String className : nonAffectedClasses ) { className = className . replaceAll ( "\\." , "/" ) ; sb . append ( "<exclude>" ) ; sb . append ( className ) . append ( ".java" ) ; sb . append ( "</exclude>" ) ; } sb . append ( "</excludes>" ) ; System . out . println ( sb ) ; } else if ( mode != null && mode . equals ( DEBUG_MODE ) ) { System . out . println ( "AFFECTED: " + affectedClasses ) ; System . out . println ( "NONAFFECTED: " + nonAffectedClasses ) ; } else { for ( String className : nonAffectedClasses ) { System . out . println ( className ) ; } } } | Prints non affected classes in the given mode . If mode is not specified one class is printed per line . |
7,199 | private static void includeAffected ( Set < String > allClasses , Set < String > affectedClasses , List < File > sortedFiles ) { Storer storer = Config . createStorer ( ) ; Hasher hasher = Config . createHasher ( ) ; NameBasedCheck classCheck = Config . DEBUG_MODE_V != Config . DebugMode . NONE ? new DebugNameCheck ( storer , hasher , DependencyAnalyzer . CLASS_EXT ) : new NameBasedCheck ( storer , hasher , DependencyAnalyzer . CLASS_EXT ) ; NameBasedCheck covCheck = new NameBasedCheck ( storer , hasher , DependencyAnalyzer . COV_EXT ) ; MethodCheck methodCheck = new MethodCheck ( storer , hasher ) ; String prevClassName = null ; for ( File file : sortedFiles ) { String fileName = file . getName ( ) ; String dirName = file . getParent ( ) ; String className = null ; if ( file . isDirectory ( ) ) { continue ; } if ( fileName . endsWith ( DependencyAnalyzer . COV_EXT ) ) { className = covCheck . includeAll ( fileName , dirName ) ; } else if ( fileName . endsWith ( DependencyAnalyzer . CLASS_EXT ) ) { className = classCheck . includeAll ( fileName , dirName ) ; } else { className = methodCheck . includeAll ( fileName , dirName ) ; } if ( prevClassName != null && className != null && ! prevClassName . equals ( className ) ) { methodCheck . includeAffected ( affectedClasses ) ; methodCheck = new MethodCheck ( Config . createStorer ( ) , Config . createHasher ( ) ) ; } if ( className != null ) { allClasses . add ( className ) ; prevClassName = className ; } } classCheck . includeAffected ( affectedClasses ) ; covCheck . includeAffected ( affectedClasses ) ; methodCheck . includeAffected ( affectedClasses ) ; } | Find all non affected classes . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.