idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
27,900 | private boolean findAndSetManifestFromArtifactory ( ArtifactoryServer server , ArtifactoryDependenciesClient dependenciesClient , TaskListener listener ) throws IOException { String candidateImagePath = DockerUtils . getImagePath ( imageTag ) ; String manifestPath ; manifestPath = StringUtils . join ( new String [ ] { ... | Find and validate manifest . json file in Artifactory for the current image . Since provided imageTag differs between reverse - proxy and proxy - less configuration try to build the correct manifest path . |
27,901 | private boolean checkAndSetManifestAndImagePathCandidates ( String manifestPath , String candidateImagePath , ArtifactoryDependenciesClient dependenciesClient , TaskListener listener ) throws IOException { String candidateManifest = getManifestFromArtifactory ( dependenciesClient , manifestPath ) ; if ( candidateManife... | Check if the provided manifestPath is correct . Set the manifest and imagePath in case of the correct manifest . |
27,902 | private List < org . jfrog . hudson . pipeline . types . File > getBuildFilesList ( Stream < ? extends BaseBuildFileBean > buildFilesStream ) { return buildFilesStream . filter ( buildFile -> StringUtils . isNotBlank ( buildFile . getLocalPath ( ) ) ) . filter ( buildFile -> StringUtils . isNotBlank ( buildFile . getRe... | Return a list of Files of downloaded or uploaded files . Filters build files without local and remote paths . |
27,903 | public List < Integer > getConnectionRetries ( ) { List < Integer > items = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 10 ; i ++ ) { items . add ( i ) ; } return items ; } | To populate the dropdown list from the jelly |
27,904 | public CredentialsConfig getResolvingCredentialsConfig ( ) { if ( resolverCredentialsConfig != null && resolverCredentialsConfig . isCredentialsProvided ( ) ) { return getResolverCredentialsConfig ( ) ; } if ( deployerCredentialsConfig != null ) { return getDeployerCredentialsConfig ( ) ; } return CredentialsConfig . E... | Decides what are the preferred credentials to use for resolving the repo keys of the server |
27,905 | public Boolean invoke ( File pomFile , VirtualChannel channel ) throws IOException , InterruptedException { org . jfrog . build . extractor . maven . reader . ModuleName current = new org . jfrog . build . extractor . maven . reader . ModuleName ( currentModule . groupId , currentModule . artifactId ) ; Map < org . jfr... | Performs the transformation . |
27,906 | public void edit ( int currentChangeListId , FilePath filePath ) throws Exception { establishConnection ( ) . editFile ( currentChangeListId , new File ( filePath . getRemote ( ) ) ) ; } | Opens file for editing . |
27,907 | private void convertJdkPath ( Launcher launcher , EnvVars extendedEnv ) { String separator = launcher . isUnix ( ) ? "/" : "\\" ; String java_home = extendedEnv . get ( "JAVA_HOME" ) ; if ( StringUtils . isNotEmpty ( java_home ) ) { if ( ! StringUtils . endsWith ( java_home , separator ) ) { java_home += separator ; } ... | The Maven3Builder class is looking for the PATH + JDK environment variable due to legacy code . In The pipeline flow we need to convert the JAVA_HOME to PATH + JDK in order to reuse the code . |
27,908 | public static AbstractBuild < ? , ? > getRootBuild ( AbstractBuild < ? , ? > currentBuild ) { AbstractBuild < ? , ? > rootBuild = null ; AbstractBuild < ? , ? > parentBuild = getUpstreamBuild ( currentBuild ) ; while ( parentBuild != null ) { if ( isPassIdentifiedDownstream ( parentBuild ) ) { rootBuild = parentBuild ;... | Get the root build which triggered the current build . The build root is considered to be the one furthest one away from the current build which has the isPassIdentifiedDownstream active if no parent build exists check that the current build needs an upstream identifier if it does return it . |
27,909 | private static AbstractProject < ? , ? > getProject ( String fullName ) { Item item = Hudson . getInstance ( ) . getItemByFullName ( fullName ) ; if ( item != null && item instanceof AbstractProject ) { return ( AbstractProject < ? , ? > ) item ; } return null ; } | Get a project according to its full name . |
27,910 | public void pushDryRun ( ) throws Exception { if ( releaseAction . isCreateVcsTag ( ) ) { if ( scmManager . isTagExists ( scmManager . getRemoteConfig ( releaseAction . getTargetRemoteName ( ) ) , releaseAction . getTagUrl ( ) ) ) { throw new Exception ( String . format ( "Tag with name '%s' already exists" , releaseAc... | This method uses the configured git credentials and repo to test its validity . In addition in case the user requested creation of a new tag it checks that another tag with the same name doesn t exist |
27,911 | public synchronized static void registerImagOnAgents ( Launcher launcher , final String imageTag , final String host , final String targetRepo , final ArrayListMultimap < String , String > artifactsProps , final int buildInfoId ) throws IOException , InterruptedException { final String imageId = getImageIdFromAgent ( l... | Registers an image to be captured by the build - info proxy . |
27,912 | private static void registerImage ( String imageId , String imageTag , String targetRepo , ArrayListMultimap < String , String > artifactsProps , int buildInfoId ) throws IOException { DockerImage image = new DockerImage ( imageId , imageTag , targetRepo , buildInfoId , artifactsProps ) ; images . add ( image ) ; } | Registers an image to the images cache so that it can be captured by the build - info proxy . |
27,913 | public static List < DockerImage > getImagesByBuildId ( int buildInfoId ) { List < DockerImage > list = new ArrayList < DockerImage > ( ) ; Iterator < DockerImage > it = images . iterator ( ) ; while ( it . hasNext ( ) ) { DockerImage image = it . next ( ) ; if ( image . getBuildInfoId ( ) == buildInfoId && image . has... | Gets a list of registered docker images from the images cache if it has been registered to the cache for a specific build - info ID and if a docker manifest has been captured for it by the build - info proxy . |
27,914 | public static List < DockerImage > getAndDiscardImagesByBuildId ( int buildInfoId ) { List < DockerImage > list = new ArrayList < DockerImage > ( ) ; synchronized ( images ) { Iterator < DockerImage > it = images . iterator ( ) ; while ( it . hasNext ( ) ) { DockerImage image = it . next ( ) ; if ( image . getBuildInfo... | Gets a list of registered docker images from the images cache if it has been registered to the cache for a specific build - info ID and if a docker manifest has been captured for it by the build - info proxy . Additionally the methods also removes the returned images from the cache . |
27,915 | public static List < DockerImage > getDockerImagesFromAgents ( final int buildInfoId , TaskListener listener ) throws IOException , InterruptedException { List < DockerImage > dockerImages = new ArrayList < DockerImage > ( ) ; dockerImages . addAll ( getAndDiscardImagesByBuildId ( buildInfoId ) ) ; List < Node > nodes ... | Retrieves from all the Jenkins agents all the docker images which have been registered for a specific build - info ID Only images for which manifests have been captured are returned . |
27,916 | public static boolean pushImage ( Launcher launcher , final JenkinsBuildInfoLog log , final String imageTag , final String username , final String password , final String host ) throws IOException , InterruptedException { return launcher . getChannel ( ) . call ( new MasterToSlaveCallable < Boolean , IOException > ( ) ... | Execute push docker image on agent |
27,917 | public static boolean pullImage ( Launcher launcher , final String imageTag , final String username , final String password , final String host ) throws IOException , InterruptedException { return launcher . getChannel ( ) . call ( new MasterToSlaveCallable < Boolean , IOException > ( ) { public Boolean call ( ) throws... | Execute pull docker image on agent |
27,918 | public static boolean updateImageParentOnAgents ( final JenkinsBuildInfoLog log , final String imageTag , final String host , final int buildInfoId ) throws IOException , InterruptedException { boolean parentUpdated = updateImageParent ( log , imageTag , host , buildInfoId ) ; List < Node > nodes = Jenkins . getInstanc... | Updates property of parent id for the image provided . Returns false if image was not captured true otherwise . |
27,919 | public static String getImageIdFromAgent ( Launcher launcher , final String imageTag , final String host ) throws IOException , InterruptedException { return launcher . getChannel ( ) . call ( new MasterToSlaveCallable < String , IOException > ( ) { public String call ( ) throws IOException { return DockerUtils . getIm... | Get image ID from imageTag on the current agent . |
27,920 | public static String getParentIdFromAgent ( Launcher launcher , final String imageID , final String host ) throws IOException , InterruptedException { return launcher . getChannel ( ) . call ( new MasterToSlaveCallable < String , IOException > ( ) { public String call ( ) throws IOException { return DockerUtils . getPa... | Get image parent ID from imageID on the current agent . |
27,921 | protected void initBuilderSpecific ( ) throws Exception { reset ( ) ; FilePath workspace = getModuleRoot ( EnvVars . masterEnvVars ) ; FilePath gradlePropertiesPath = new FilePath ( workspace , "gradle.properties" ) ; if ( releaseProps == null ) { releaseProps = PropertyUtils . getModulesPropertiesFromPropFile ( gradle... | Initialize the version properties map from the gradle . properties file and the additional properties from the gradle . properties file . |
27,922 | public FilePath getModuleRoot ( Map < String , String > globalEnv ) throws IOException , InterruptedException { FilePath someWorkspace = project . getSomeWorkspace ( ) ; if ( someWorkspace == null ) { throw new IllegalStateException ( "Couldn't find workspace" ) ; } Map < String , String > workspaceEnv = Maps . newHash... | Get the root path where the build is located the project may be checked out to a sub - directory from the root workspace location . |
27,923 | private String extractNumericVersion ( Collection < String > versionStrings ) { if ( versionStrings == null ) { return "" ; } for ( String value : versionStrings ) { String releaseValue = calculateReleaseVersion ( value ) ; if ( ! releaseValue . equals ( value ) ) { return releaseValue ; } } return "" ; } | Try to extract a numeric version from a collection of strings . |
27,924 | @ SuppressWarnings ( "UnusedDeclaration" ) public void init ( ) throws Exception { initBuilderSpecific ( ) ; resetFields ( ) ; if ( ! UserPluginInfo . NO_PLUGIN_KEY . equals ( getSelectedStagingPluginName ( ) ) ) { PluginSettings selectedStagingPluginSettings = getSelectedStagingPlugin ( ) ; try { stagingStrategy = get... | invoked from the jelly file |
27,925 | @ SuppressWarnings ( { "UnusedDeclaration" } ) protected void doApi ( StaplerRequest req , StaplerResponse resp ) throws IOException , ServletException { try { log . log ( Level . INFO , "Initiating Artifactory Release Staging using API" ) ; project . checkPermission ( ArtifactoryPlugin . RELEASE ) ; init ( ) ; readSta... | This method is used to initiate a release staging process using the Artifactory Release Staging API . |
27,926 | protected String calculateNextVersion ( String fromVersion ) { fromVersion = calculateReleaseVersion ( fromVersion ) ; String nextVersion ; int lastDotIndex = fromVersion . lastIndexOf ( '.' ) ; try { if ( lastDotIndex != - 1 ) { String minorVersionToken = fromVersion . substring ( lastDotIndex + 1 ) ; String nextMinor... | Calculates the next snapshot version based on the current release version |
27,927 | public void addVars ( Map < String , String > env ) { if ( tagUrl != null ) { env . put ( "RELEASE_SCM_TAG" , tagUrl ) ; env . put ( RT_RELEASE_STAGING + "SCM_TAG" , tagUrl ) ; } if ( releaseBranch != null ) { env . put ( "RELEASE_SCM_BRANCH" , releaseBranch ) ; env . put ( RT_RELEASE_STAGING + "SCM_BRANCH" , releaseBr... | Add some of the release build properties to a map . |
27,928 | public String generateInitScript ( EnvVars env ) throws IOException , InterruptedException { StringBuilder initScript = new StringBuilder ( ) ; InputStream templateStream = getClass ( ) . getResourceAsStream ( "/initscripttemplate.gradle" ) ; String templateAsString = IOUtils . toString ( templateStream , Charsets . UT... | Generate the init script from the Artifactory URL . |
27,929 | public static int convertBytesToInt ( byte [ ] bytes , int offset ) { return ( BITWISE_BYTE_TO_INT & bytes [ offset + 3 ] ) | ( ( BITWISE_BYTE_TO_INT & bytes [ offset + 2 ] ) << 8 ) | ( ( BITWISE_BYTE_TO_INT & bytes [ offset + 1 ] ) << 16 ) | ( ( BITWISE_BYTE_TO_INT & bytes [ offset ] ) << 24 ) ; } | Take four bytes from the specified position in the specified block and convert them into a 32 - bit int using the big - endian convention . |
27,930 | public static int [ ] convertBytesToInts ( byte [ ] bytes ) { if ( bytes . length % 4 != 0 ) { throw new IllegalArgumentException ( "Number of input bytes must be a multiple of 4." ) ; } int [ ] ints = new int [ bytes . length / 4 ] ; for ( int i = 0 ; i < ints . length ; i ++ ) { ints [ i ] = convertBytesToInt ( bytes... | Convert an array of bytes into an array of ints . 4 bytes from the input data map to a single int in the output data . |
27,931 | public static long convertBytesToLong ( byte [ ] bytes , int offset ) { long value = 0 ; for ( int i = offset ; i < offset + 8 ; i ++ ) { byte b = bytes [ i ] ; value <<= 8 ; value |= b ; } return value ; } | Utility method to convert an array of bytes into a long . Byte ordered is assumed to be big - endian . |
27,932 | private double getExpectedProbability ( double x ) { double y = 1 / ( standardDeviation * Math . sqrt ( Math . PI * 2 ) ) ; double z = - ( Math . pow ( x - mean , 2 ) / ( 2 * Math . pow ( standardDeviation , 2 ) ) ) ; return y * Math . exp ( z ) ; } | This is the probability density function for the Gaussian distribution . |
27,933 | public final void reset ( ) { for ( int i = 0 ; i < permutationIndices . length ; i ++ ) { permutationIndices [ i ] = i ; } remainingPermutations = totalPermutations ; } | Resets the generator state . |
27,934 | @ SuppressWarnings ( "unchecked" ) public T [ ] nextPermutationAsArray ( ) { T [ ] permutation = ( T [ ] ) Array . newInstance ( elements . getClass ( ) . getComponentType ( ) , permutationIndices . length ) ; return nextPermutationAsArray ( permutation ) ; } | Generate the next permutation and return an array containing the elements in the appropriate order . |
27,935 | public List < T > nextPermutationAsList ( ) { List < T > permutation = new ArrayList < T > ( elements . length ) ; return nextPermutationAsList ( permutation ) ; } | Generate the next permutation and return a list containing the elements in the appropriate order . |
27,936 | private static long createLongSeed ( byte [ ] seed ) { if ( seed == null || seed . length != SEED_SIZE_BYTES ) { throw new IllegalArgumentException ( "Java RNG requires a 64-bit (8-byte) seed." ) ; } return BinaryUtils . convertBytesToLong ( seed , 0 ) ; } | Helper method to convert seed bytes into the long value required by the super class . |
27,937 | public void execute ( ) { Runnable task = new Runnable ( ) { public void run ( ) { final V result = performTask ( ) ; SwingUtilities . invokeLater ( new Runnable ( ) { public void run ( ) { postProcessing ( result ) ; latch . countDown ( ) ; } } ) ; } } ; new Thread ( task , "SwingBackgroundTask-" + id ) . start ( ) ; ... | Asynchronous call that begins execution of the task and returns immediately . |
27,938 | public void addValue ( double value ) { if ( dataSetSize == dataSet . length ) { int newLength = ( int ) ( GROWTH_RATE * dataSetSize ) ; double [ ] newDataSet = new double [ newLength ] ; System . arraycopy ( dataSet , 0 , newDataSet , 0 , dataSetSize ) ; dataSet = newDataSet ; } dataSet [ dataSetSize ] = value ; updat... | Adds a single value to the data set and updates any statistics that are calculated cumulatively . |
27,939 | public final double getMedian ( ) { assertNotEmpty ( ) ; double [ ] dataCopy = new double [ getSize ( ) ] ; System . arraycopy ( dataSet , 0 , dataCopy , 0 , dataCopy . length ) ; Arrays . sort ( dataCopy ) ; int midPoint = dataCopy . length / 2 ; if ( dataCopy . length % 2 != 0 ) { return dataCopy [ midPoint ] ; } els... | Determines the median value of the data set . |
27,940 | private double sumSquaredDiffs ( ) { double mean = getArithmeticMean ( ) ; double squaredDiffs = 0 ; for ( int i = 0 ; i < getSize ( ) ; i ++ ) { double diff = mean - dataSet [ i ] ; squaredDiffs += ( diff * diff ) ; } return squaredDiffs ; } | Helper method for variance calculations . |
27,941 | public boolean getBit ( int index ) { assertValidIndex ( index ) ; int word = index / WORD_LENGTH ; int offset = index % WORD_LENGTH ; return ( data [ word ] & ( 1 << offset ) ) != 0 ; } | Returns the bit at the specified index . |
27,942 | public void setBit ( int index , boolean set ) { assertValidIndex ( index ) ; int word = index / WORD_LENGTH ; int offset = index % WORD_LENGTH ; if ( set ) { data [ word ] |= ( 1 << offset ) ; } else { data [ word ] &= ~ ( 1 << offset ) ; } } | Sets the bit at the specified index . |
27,943 | public void flipBit ( int index ) { assertValidIndex ( index ) ; int word = index / WORD_LENGTH ; int offset = index % WORD_LENGTH ; data [ word ] ^= ( 1 << offset ) ; } | Inverts the value of the bit at the specified index . |
27,944 | public void swapSubstring ( BitString other , int start , int length ) { assertValidIndex ( start ) ; other . assertValidIndex ( start ) ; int word = start / WORD_LENGTH ; int partialWordSize = ( WORD_LENGTH - start ) % WORD_LENGTH ; if ( partialWordSize > 0 ) { swapBits ( other , word , 0xFFFFFFFF << ( WORD_LENGTH - p... | An efficient method for exchanging data between two bit strings . Both bit strings must be long enough that they contain the full length of the specified substring . |
27,945 | public int compareTo ( Rational other ) { if ( denominator == other . getDenominator ( ) ) { return ( ( Long ) numerator ) . compareTo ( other . getNumerator ( ) ) ; } else { Long adjustedNumerator = numerator * other . getDenominator ( ) ; Long otherAdjustedNumerator = other . getNumerator ( ) * denominator ; return a... | Compares this value with the specified object for order . Returns a negative integer zero or a positive integer as this value is less than equal to or greater than the specified value . |
27,946 | public static void generateOutputFile ( Random rng , File outputFile ) throws IOException { DataOutputStream dataOutput = null ; try { dataOutput = new DataOutputStream ( new BufferedOutputStream ( new FileOutputStream ( outputFile ) ) ) ; for ( int i = 0 ; i < INT_COUNT ; i ++ ) { dataOutput . writeInt ( rng . nextInt... | Generates a file of random data in a format suitable for the DIEHARD test . DIEHARD requires 3 million 32 - bit integers . |
27,947 | public static long raiseToPower ( int value , int power ) { if ( power < 0 ) { throw new IllegalArgumentException ( "This method does not support negative powers." ) ; } long result = 1 ; for ( int i = 0 ; i < power ; i ++ ) { result *= value ; } return result ; } | Calculate the first argument raised to the power of the second . This method only supports non - negative powers . |
27,948 | public static int restrictRange ( int value , int min , int max ) { return Math . min ( ( Math . max ( value , min ) ) , max ) ; } | If the specified value is not greater than or equal to the specified minimum and less than or equal to the specified maximum adjust it so that it is . |
27,949 | protected static Map < Double , Double > doQuantization ( double max , double min , double [ ] values ) { double range = max - min ; int noIntervals = 20 ; double intervalSize = range / noIntervals ; int [ ] intervals = new int [ noIntervals ] ; for ( double value : values ) { int interval = Math . min ( noIntervals - ... | Convert the continuous values into discrete values by chopping up the distribution into several equally - sized intervals . |
27,950 | public final void reset ( ) { for ( int i = 0 ; i < combinationIndices . length ; i ++ ) { combinationIndices [ i ] = i ; } remainingCombinations = totalCombinations ; } | Reset the combination generator . |
27,951 | @ SuppressWarnings ( "unchecked" ) public T [ ] nextCombinationAsArray ( ) { T [ ] combination = ( T [ ] ) Array . newInstance ( elements . getClass ( ) . getComponentType ( ) , combinationIndices . length ) ; return nextCombinationAsArray ( combination ) ; } | Generate the next combination and return an array containing the appropriate elements . |
27,952 | public void setValue ( T value ) { try { lock . writeLock ( ) . lock ( ) ; this . value = value ; } finally { lock . writeLock ( ) . unlock ( ) ; } } | Change the value that is returned by this generator . |
27,953 | public static String urlEncode ( String path ) throws URISyntaxException { if ( isNullOrEmpty ( path ) ) return path ; return UrlEscapers . urlFragmentEscaper ( ) . escape ( path ) ; } | used for encoding url path segment |
27,954 | public static String encode ( String value ) throws UnsupportedEncodingException { if ( isNullOrEmpty ( value ) ) return value ; return URLEncoder . encode ( value , URL_ENCODING ) ; } | used for encoding queries or form data |
27,955 | public static HttpResponse getResponse ( String urls , HttpRequest request , HttpMethod method , int connectTimeoutMillis , int readTimeoutMillis ) throws IOException { OutputStream out = null ; InputStream content = null ; HttpResponse response = null ; HttpURLConnection httpConn = request . getHttpConnection ( urls ,... | Get http response |
27,956 | public void refreshCredentials ( ) { if ( this . credsProvider == null ) return ; try { AlibabaCloudCredentials creds = this . credsProvider . getCredentials ( ) ; this . accessKeyID = creds . getAccessKeyId ( ) ; this . accessKeySecret = creds . getAccessKeySecret ( ) ; if ( creds instanceof BasicSessionCredentials ) ... | refresh credentials if CredentialProvider set |
27,957 | public void addExtraInfo ( String key , Object value ) { Map < String , Object > infoMap = ( HashMap < String , Object > ) getMapFromJSON ( extraInfo ) ; infoMap . put ( key , value ) ; extraInfo = getJSONFromMap ( infoMap ) ; } | Add key value pair to extra info |
27,958 | private Map < String , Object > getMapFromJSON ( String json ) { Map < String , Object > propMap = new HashMap < String , Object > ( ) ; ObjectMapper mapper = new ObjectMapper ( ) ; if ( json == null || json . length ( ) == 0 ) { json = "{}" ; } try { propMap = mapper . readValue ( json , new TypeReference < HashMap < ... | Turn json string into map |
27,959 | private String getJSONFromMap ( Map < String , Object > propMap ) { try { return new JSONObject ( propMap ) . toString ( ) ; } catch ( Exception e ) { return "{}" ; } } | Turn map into string |
27,960 | public boolean preHandle ( HttpServletRequest request , HttpServletResponse response , Object handler ) throws Exception { String queryString = request . getQueryString ( ) == null ? "" : request . getQueryString ( ) ; if ( ConfigurationService . getInstance ( ) . isValid ( ) || request . getServletPath ( ) . startsWit... | This will check to see if certain configuration values exist from the ConfigurationService If not then it redirects to the configuration screen |
27,961 | @ RequestMapping ( value = "api/edit/server" , method = RequestMethod . POST ) public ServerRedirect addRedirectToProfile ( Model model , @ RequestParam ( value = "profileId" , required = false ) Integer profileId , @ RequestParam ( value = "profileIdentifier" , required = false ) String profileIdentifier , @ RequestPa... | Adds a redirect URL to the specified profile ID |
27,962 | @ RequestMapping ( value = "api/edit/server" , method = RequestMethod . GET ) public HashMap < String , Object > getjqRedirects ( Model model , @ RequestParam ( value = "profileId" , required = false ) Integer profileId , @ RequestParam ( value = "clientUUID" , required = true ) String clientUUID , @ RequestParam ( val... | Redirect URL to the specified profile ID |
27,963 | @ RequestMapping ( value = "api/servergroup" , method = RequestMethod . GET ) public HashMap < String , Object > getServerGroups ( Model model , @ RequestParam ( value = "profileId" , required = false ) Integer profileId , @ RequestParam ( value = "search" , required = false ) String search , @ RequestParam ( value = "... | Obtains the collection of server groups defined for a profile |
27,964 | @ RequestMapping ( value = "api/servergroup" , method = RequestMethod . POST ) public ServerGroup createServerGroup ( Model model , @ RequestParam ( value = "name" ) String name , @ RequestParam ( value = "profileId" , required = false ) Integer profileId , @ RequestParam ( value = "profileIdentifier" , required = fals... | Create a new server group for a profile |
27,965 | @ RequestMapping ( value = "/cert" , method = { RequestMethod . GET , RequestMethod . HEAD } ) public String certPage ( ) throws Exception { return "cert" ; } | Returns a simple web page where certs can be downloaded . This is meant for mobile device setup . |
27,966 | public static Map < String , String [ ] > mapUrlEncodedParameters ( byte [ ] dataArray ) throws Exception { Map < String , String [ ] > mapPostParameters = new HashMap < String , String [ ] > ( ) ; try { ByteArrayOutputStream byteout = new ByteArrayOutputStream ( ) ; for ( int x = 0 ; x < dataArray . length ; x ++ ) { ... | Obtain collection of Parameters from request |
27,967 | public static String getURL ( String sourceURI ) { String retval = sourceURI ; int qPos = sourceURI . indexOf ( "?" ) ; if ( qPos != - 1 ) { retval = retval . substring ( 0 , qPos ) ; } return retval ; } | Retrieve URL without parameters |
27,968 | public static String getHeaders ( HttpMethod method ) { String headerString = "" ; Header [ ] headers = method . getRequestHeaders ( ) ; for ( Header header : headers ) { String name = header . getName ( ) ; if ( name . equals ( Constants . ODO_PROXY_HEADER ) ) { continue ; } if ( headerString . length ( ) != 0 ) { hea... | Obtain newline - delimited headers from method |
27,969 | public static String getHeaders ( HttpServletRequest request ) { String headerString = "" ; Enumeration < String > headerNames = request . getHeaderNames ( ) ; while ( headerNames . hasMoreElements ( ) ) { String name = headerNames . nextElement ( ) ; if ( name . equals ( Constants . ODO_PROXY_HEADER ) ) { continue ; }... | Obtain newline - delimited headers from request |
27,970 | public static String getHeaders ( HttpServletResponse response ) { String headerString = "" ; Collection < String > headerNames = response . getHeaderNames ( ) ; for ( String headerName : headerNames ) { for ( String headerValue : response . getHeaders ( headerName ) ) { if ( headerString . length ( ) != 0 ) { headerSt... | Obtain newline - delimited headers from response |
27,971 | public static HashMap < String , String > getParameters ( String query ) { HashMap < String , String > params = new HashMap < String , String > ( ) ; if ( query == null || query . length ( ) == 0 ) { return params ; } String [ ] splitQuery = query . split ( "&" ) ; for ( String splitItem : splitQuery ) { String [ ] ite... | Obtain parameters from query |
27,972 | public List < Method > getMethodsFromGroupIds ( int [ ] groupIds , String [ ] filters ) throws Exception { ArrayList < Method > methods = new ArrayList < Method > ( ) ; for ( int groupId : groupIds ) { methods . addAll ( getMethodsFromGroupId ( groupId , filters ) ) ; } return methods ; } | Return all methods for a list of groupIds |
27,973 | public void updateRepeatNumber ( int newNum , int path_id , String client_uuid ) throws Exception { updateRequestResponseTables ( "repeat_number" , newNum , getProfileIdFromPathID ( path_id ) , client_uuid , path_id ) ; } | Update the repeat number for a client path |
27,974 | public void disableAll ( int profileId , String client_uuid ) { PreparedStatement statement = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "DELETE FROM " + Constants . DB_TABLE_ENABLED_OVERRIDE + " WHERE " + Constants . CLIENT_PROFILE_ID + " =... | Delete all enabled overrides for a client |
27,975 | public void removePathnameFromProfile ( int path_id , int profileId ) { PreparedStatement statement = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "DELETE FROM " + Constants . DB_TABLE_ENABLED_OVERRIDE + " WHERE " + Constants . ENABLED_OVERRID... | Remove a path from a profile |
27,976 | public List < Method > getMethodsFromGroupId ( int groupId , String [ ] filters ) throws Exception { ArrayList < Method > methods = new ArrayList < Method > ( ) ; PreparedStatement statement = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection... | Returns all methods for a specific group |
27,977 | public void enableCustomResponse ( String custom , int path_id , String client_uuid ) throws Exception { updateRequestResponseTables ( "custom_response" , custom , getProfileIdFromPathID ( path_id ) , client_uuid , path_id ) ; } | Enable a custom response |
27,978 | public static void updatePathTable ( String columnName , Object newData , int path_id ) { PreparedStatement statement = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "UPDATE " + Constants . DB_TABLE_PATH + " SET " + columnName + " = ?" + " WHER... | Updates a path table value for column columnName |
27,979 | public void removeCustomOverride ( int path_id , String client_uuid ) throws Exception { updateRequestResponseTables ( "custom_response" , "" , getProfileIdFromPathID ( path_id ) , client_uuid , path_id ) ; } | Remove custom overrides |
27,980 | public static int getProfileIdFromPathID ( int path_id ) throws Exception { return ( Integer ) SQLService . getInstance ( ) . getFromTable ( Constants . GENERIC_PROFILE_ID , Constants . GENERIC_ID , path_id , Constants . DB_TABLE_PATH ) ; } | Return the profileId for a path |
27,981 | public List < Group > findAllGroups ( ) { ArrayList < Group > allGroups = new ArrayList < Group > ( ) ; PreparedStatement queryStatement = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { queryStatement = sqlConnection . prepareStatement ( "SELECT * FROM " + Constant... | Obtain all groups |
27,982 | public int addPathnameToProfile ( int id , String pathname , String actualPath ) throws Exception { int pathOrder = getPathOrder ( id ) . size ( ) + 1 ; int pathId = - 1 ; PreparedStatement statement = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlC... | Add a path to a profile returns the id |
27,983 | public void addPathToRequestResponseTable ( int profileId , String clientUUID , int pathId ) throws Exception { PreparedStatement statement = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "INSERT INTO " + Constants . DB_TABLE_REQUEST_RESPONSE +... | Adds a path to the request response table with the specified values |
27,984 | public List < Integer > getPathOrder ( int profileId ) { ArrayList < Integer > pathOrder = new ArrayList < Integer > ( ) ; PreparedStatement queryStatement = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { queryStatement = sqlConnection . prepareStatement ( "SELECT ... | Return collection of path Ids in priority order |
27,985 | public void setGroupsForPath ( Integer [ ] groups , int pathId ) { String newGroups = Arrays . toString ( groups ) ; newGroups = newGroups . substring ( 1 , newGroups . length ( ) - 1 ) . replaceAll ( "\\s" , "" ) ; logger . info ( "adding groups={}, to pathId={}" , newGroups , pathId ) ; EditService . updatePathTable ... | Set the groups assigned to a path |
27,986 | public static boolean intArrayContains ( int [ ] array , int numToCheck ) { for ( int i = 0 ; i < array . length ; i ++ ) { if ( array [ i ] == numToCheck ) { return true ; } } return false ; } | a simple contains helper method checks if array contains a numToCheck |
27,987 | public Integer getGroupIdFromName ( String groupName ) { return ( Integer ) sqlService . getFromTable ( Constants . GENERIC_ID , Constants . GROUPS_GROUP_NAME , groupName , Constants . DB_TABLE_GROUPS ) ; } | given the groupName it returns the groupId |
27,988 | public void createOverride ( int groupId , String methodName , String className ) throws Exception { for ( Method method : EditService . getInstance ( ) . getMethodsFromGroupId ( groupId , null ) ) { if ( method . getMethodName ( ) . equals ( methodName ) && method . getClassName ( ) . equals ( className ) ) { return ;... | given the groupId and 2 string arrays adds the name - responses pair to the table_override |
27,989 | public String getGroupNameFromId ( int groupId ) { return ( String ) sqlService . getFromTable ( Constants . GROUPS_GROUP_NAME , Constants . GENERIC_ID , groupId , Constants . DB_TABLE_GROUPS ) ; } | given the groupId returns the groupName |
27,990 | public void updateGroupName ( String newGroupName , int id ) { PreparedStatement statement = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "UPDATE " + Constants . DB_TABLE_GROUPS + " SET " + Constants . GROUPS_GROUP_NAME + " = ? " + " WHERE " +... | updates the groupname in the table given the id |
27,991 | public void removeGroup ( int groupId ) { PreparedStatement statement = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "DELETE FROM " + Constants . DB_TABLE_GROUPS + " WHERE " + Constants . GENERIC_ID + " = ?" ) ; statement . setInt ( 1 , groupI... | Remove the group and all references to it |
27,992 | private void removeGroupIdFromTablePaths ( int groupIdToRemove ) { PreparedStatement queryStatement = null ; PreparedStatement statement = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { queryStatement = sqlConnection . prepareStatement ( "SELECT * FROM " + Constant... | Remove all references to a groupId |
27,993 | public void removePath ( int pathId ) { PreparedStatement statement = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "DELETE FROM " + Constants . DB_TABLE_ENABLED_OVERRIDE + " WHERE " + Constants . ENABLED_OVERRIDES_PATH_ID + " = ?" ) ; statemen... | Remove a path |
27,994 | public com . groupon . odo . proxylib . models . Method getMethodForOverrideId ( int overrideId ) { com . groupon . odo . proxylib . models . Method method = null ; if ( overrideId < 0 ) { method = new com . groupon . odo . proxylib . models . Method ( ) ; method . setId ( overrideId ) ; if ( method . getId ( ) == Cons... | Gets a method based on data in the override_db table |
27,995 | public void updatePathOrder ( int profileId , int [ ] pathOrder ) { for ( int i = 0 ; i < pathOrder . length ; i ++ ) { EditService . updatePathTable ( Constants . PATH_PROFILE_PATH_ORDER , ( i + 1 ) , pathOrder [ i ] ) ; } } | Updates the path_order column in the table loops though the pathOrder array and changes the value to the loop index + 1 for the specified pathId |
27,996 | public int getPathId ( String pathName , int profileId ) { PreparedStatement queryStatement = null ; ResultSet results = null ; int pathId = - 1 ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { queryStatement = sqlConnection . prepareStatement ( "SELECT " + Constants . GENERIC_ID + " FROM " + Const... | Get path ID for a given profileId and pathName |
27,997 | private String getPathSelectString ( ) { String queryString = "SELECT " + Constants . DB_TABLE_REQUEST_RESPONSE + "." + Constants . GENERIC_CLIENT_UUID + "," + Constants . DB_TABLE_PATH + "." + Constants . GENERIC_ID + "," + Constants . PATH_PROFILE_PATHNAME + "," + Constants . PATH_PROFILE_ACTUAL_PATH + "," + Constant... | Generate a path select string |
27,998 | private EndpointOverride getEndpointOverrideFromResultSet ( ResultSet results ) throws Exception { EndpointOverride endpoint = new EndpointOverride ( ) ; endpoint . setPathId ( results . getInt ( Constants . GENERIC_ID ) ) ; endpoint . setPath ( results . getString ( Constants . PATH_PROFILE_ACTUAL_PATH ) ) ; endpoint ... | Turn a resultset into EndpointOverride |
27,999 | public EndpointOverride getPath ( int pathId , String clientUUID , String [ ] filters ) throws Exception { EndpointOverride endpoint = null ; PreparedStatement statement = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { String queryString = this . getPathSelectStrin... | Returns information for a specific path id |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.