idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
151,600
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
151,601
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 .
151,602
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 .
151,603
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 .
151,604
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 .
151,605
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 .
151,606
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
151,607
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
151,608
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 .
151,609
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 .
151,610
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 .
151,611
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 .
151,612
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 .
151,613
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 .
151,614
@ 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
151,615
@ 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 .
151,616
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
151,617
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 .
151,618
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 .
151,619
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 .
151,620
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 .
151,621
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 .
151,622
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 .
151,623
public final void reset ( ) { for ( int i = 0 ; i < permutationIndices . length ; i ++ ) { permutationIndices [ i ] = i ; } remainingPermutations = totalPermutations ; }
Resets the generator state .
151,624
@ 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 .
151,625
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 .
151,626
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 .
151,627
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 .
151,628
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 .
151,629
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 .
151,630
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 .
151,631
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 .
151,632
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 .
151,633
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 .
151,634
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 .
151,635
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 .
151,636
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 .
151,637
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 .
151,638
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 .
151,639
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 .
151,640
public final void reset ( ) { for ( int i = 0 ; i < combinationIndices . length ; i ++ ) { combinationIndices [ i ] = i ; } remainingCombinations = totalCombinations ; }
Reset the combination generator .
151,641
@ 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 .
151,642
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 .
151,643
public static String urlEncode ( String path ) throws URISyntaxException { if ( isNullOrEmpty ( path ) ) return path ; return UrlEscapers . urlFragmentEscaper ( ) . escape ( path ) ; }
used for encoding url path segment
151,644
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
151,645
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
151,646
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
151,647
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
151,648
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
151,649
private String getJSONFromMap ( Map < String , Object > propMap ) { try { return new JSONObject ( propMap ) . toString ( ) ; } catch ( Exception e ) { return "{}" ; } }
Turn map into string
151,650
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
151,651
@ 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
151,652
@ 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
151,653
@ 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
151,654
@ 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
151,655
@ 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 .
151,656
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
151,657
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
151,658
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
151,659
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
151,660
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
151,661
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
151,662
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
151,663
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
151,664
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
151,665
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
151,666
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
151,667
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
151,668
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
151,669
public void removeCustomOverride ( int path_id , String client_uuid ) throws Exception { updateRequestResponseTables ( "custom_response" , "" , getProfileIdFromPathID ( path_id ) , client_uuid , path_id ) ; }
Remove custom overrides
151,670
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
151,671
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
151,672
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
151,673
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
151,674
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
151,675
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
151,676
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
151,677
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
151,678
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
151,679
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
151,680
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
151,681
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
151,682
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
151,683
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
151,684
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
151,685
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
151,686
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
151,687
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
151,688
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
151,689
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
151,690
public void setName ( int pathId , String pathName ) { PreparedStatement statement = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "UPDATE " + Constants . DB_TABLE_PATH + " SET " + Constants . PATH_PROFILE_PATHNAME + " = ?" + " WHERE " + Consta...
Sets the path name for this ID
151,691
public void setPath ( int pathId , String path ) { PreparedStatement statement = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "UPDATE " + Constants . DB_TABLE_PATH + " SET " + Constants . PATH_PROFILE_ACTUAL_PATH + " = ? " + " WHERE " + Consta...
Sets the actual path for this ID
151,692
public void setBodyFilter ( int pathId , String bodyFilter ) { PreparedStatement statement = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "UPDATE " + Constants . DB_TABLE_PATH + " SET " + Constants . PATH_PROFILE_BODY_FILTER + " = ? " + " WHER...
Sets the body filter for this ID
151,693
public void setContentType ( int pathId , String contentType ) { PreparedStatement statement = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "UPDATE " + Constants . DB_TABLE_PATH + " SET " + Constants . PATH_PROFILE_CONTENT_TYPE + " = ? " + " W...
Sets the content type for this ID
151,694
public void setRequestType ( int pathId , Integer requestType ) { if ( requestType == null ) { requestType = Constants . REQUEST_TYPE_GET ; } PreparedStatement statement = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "UPDATE " + Constants . DB...
Sets the request type for this ID . Defaults to GET
151,695
public void setGlobal ( int pathId , Boolean global ) { PreparedStatement statement = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "UPDATE " + Constants . DB_TABLE_PATH + " SET " + Constants . PATH_PROFILE_GLOBAL + " = ? " + " WHERE " + Consta...
Sets the global setting for this ID
151,696
public List < EndpointOverride > getPaths ( int profileId , String clientUUID , String [ ] filters ) throws Exception { ArrayList < EndpointOverride > properties = new ArrayList < EndpointOverride > ( ) ; PreparedStatement statement = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getCo...
Returns an array of all endpoints
151,697
public void setCustomRequest ( int pathId , String customRequest , String clientUUID ) { PreparedStatement statement = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { int profileId = EditService . getProfileIdFromPathID ( pathId ) ; statement = sqlConnection . prepareStatement ( "UPDATE " + C...
Set the value for a custom request
151,698
public void clearResponseSettings ( int pathId , String clientUUID ) throws Exception { logger . info ( "clearing response settings" ) ; this . setResponseEnabled ( pathId , false , clientUUID ) ; OverrideService . getInstance ( ) . disableAllOverrides ( pathId , clientUUID , Constants . OVERRIDE_TYPE_RESPONSE ) ; Edit...
Clear all overrides reset repeat counts for a response path
151,699
public void clearRequestSettings ( int pathId , String clientUUID ) throws Exception { this . setRequestEnabled ( pathId , false , clientUUID ) ; OverrideService . getInstance ( ) . disableAllOverrides ( pathId , clientUUID , Constants . OVERRIDE_TYPE_REQUEST ) ; EditService . getInstance ( ) . updateRepeatNumber ( Con...
Clear all overrides reset repeat counts for a request path