idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
18,900
public static < C extends Comparable > Ordering < Range < C > > orderingByLowerEndpoint ( ) { return new Ordering < Range < C > > ( ) { public int compare ( final Range < C > left , final Range < C > right ) { return ComparisonChain . start ( ) . compare ( left . hasLowerBound ( ) , right . hasLowerBound ( ) ) . compare ( left . lowerEndpoint ( ) , right . lowerEndpoint ( ) ) . result ( ) ; } } ; }
Return an ordering by lower endpoint over ranges .
18,901
public static < C extends Comparable > Ordering < Range < C > > reverseOrderingByLowerEndpoint ( ) { Ordering < Range < C > > orderingByLowerEndpoint = orderingByLowerEndpoint ( ) ; return orderingByLowerEndpoint . reverse ( ) ; }
Return a reverse ordering by lower endpoint over ranges .
18,902
public static < C extends Comparable > Ordering < Range < C > > orderingByUpperEndpoint ( ) { return new Ordering < Range < C > > ( ) { public int compare ( final Range < C > left , final Range < C > right ) { return ComparisonChain . start ( ) . compare ( left . hasUpperBound ( ) , right . hasUpperBound ( ) ) . compare ( left . upperEndpoint ( ) , right . upperEndpoint ( ) ) . result ( ) ; } } ; }
Return an ordering by upper endpoint over ranges .
18,903
public static < C extends Comparable > Ordering < Range < C > > reverseOrderingByUpperEndpoint ( ) { Ordering < Range < C > > orderingByUpperEndpoint = orderingByUpperEndpoint ( ) ; return orderingByUpperEndpoint . reverse ( ) ; }
Return a reverse ordering by upper endpoint over ranges .
18,904
public static MozuUrl getCurrencyExchangeRatesUrl ( ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/storefront/currencies/exchangerates" ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetCurrencyExchangeRates
18,905
public void extractFromArchive ( final File targetFile , final boolean forceOverwrite ) throws IOException { if ( zipArchive != null ) { ZipEntry entry = zipArchive . getEntry ( targetFile . getName ( ) ) ; if ( entry != null ) { if ( ! targetFile . exists ( ) ) { try { targetFile . createNewFile ( ) ; } catch ( IOException ex ) { throw new JFunkException ( "Error creating file: " + targetFile , ex ) ; } } else if ( ! forceOverwrite ) { return ; } logger . info ( "Loading file '{}' from zip archive..." , targetFile ) ; OutputStream out = null ; InputStream in = null ; try { out = new FileOutputStream ( targetFile ) ; in = zipArchive . getInputStream ( entry ) ; IOUtils . copy ( in , out ) ; } finally { IOUtils . closeQuietly ( in ) ; IOUtils . closeQuietly ( out ) ; } } else { logger . error ( "Could not find file '{}' in zip archive" , targetFile ) ; } } }
Extracts the specified file from this configuration s zip file if applicable .
18,906
public static MozuUrl getDestinationUrl ( String checkoutId , String destinationId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/checkouts/{checkoutId}/destinations/{destinationId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "checkoutId" , checkoutId ) ; formatter . formatUrl ( "destinationId" , destinationId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetDestination
18,907
public static MozuUrl addDestinationUrl ( String checkoutId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/checkouts/{checkoutId}/destinations?responseFields={responseFields}" ) ; formatter . formatUrl ( "checkoutId" , checkoutId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for AddDestination
18,908
public static MozuUrl removeDestinationUrl ( String checkoutId , String destinationId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/checkouts/{checkoutId}/destinations/{destinationId}" ) ; formatter . formatUrl ( "checkoutId" , checkoutId ) ; formatter . formatUrl ( "destinationId" , destinationId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for RemoveDestination
18,909
public static Iterable < VcfSample > samples ( final Readable readable ) throws IOException { checkNotNull ( readable ) ; ParseListener parseListener = new ParseListener ( ) ; VcfParser . parse ( readable , parseListener ) ; return parseListener . getSamples ( ) . values ( ) ; }
Read zero or more VCF samples from the specified readable .
18,910
private String chooseAlternations ( final String expression ) { StrBuilder sb = new StrBuilder ( expression ) ; int i = 0 ; while ( UNESCAPED_PIPE_PATTERN . matcher ( sb . toString ( ) ) . find ( ) ) { for ( ; i < sb . length ( ) ; ++ i ) { if ( sb . charAt ( i ) == '|' ) { if ( sb . charAt ( i - 1 ) == '\\' ) { continue ; } int start = i ; for ( int closingCount = 0 ; start >= 0 ; -- start ) { char c = sb . charAt ( start ) ; if ( c == '(' ) { if ( closingCount == 0 ) { break ; } -- closingCount ; } else if ( c == ')' ) { ++ closingCount ; } } if ( start >= 0 ) { int end = i ; for ( int openingCount = 0 ; end < sb . length ( ) ; ++ end ) { char c = sb . charAt ( end ) ; if ( c == '(' ) { ++ openingCount ; } else if ( c == ')' ) { if ( openingCount == 0 ) { break ; } -- openingCount ; } } String alternative = random . getBoolean ( ) ? sb . substring ( start + 1 , i ) : sb . substring ( i + 1 , end ) ; sb . replace ( start , end + 1 , alternative ) ; i = start + alternative . length ( ) ; break ; } String alternative = random . getBoolean ( ) ? sb . substring ( 0 , i ) : sb . substring ( i + 1 ) ; sb . replace ( 0 , sb . length ( ) + 1 , alternative ) ; break ; } } } return sb . toString ( ) ; }
Resolves alternations by randomly choosing one at a time and adapting the pattern accordingly
18,911
public String negateString ( final String input , int bad ) { int length = input . length ( ) ; Range [ ] ranges = getRanges ( ) ; int [ ] lengths = new int [ ranges . length ] ; for ( int i = 0 ; i < lengths . length ; i ++ ) { Range r = ranges [ i ] ; lengths [ i ] = r . getMin ( ) ; length -= r . getMin ( ) ; } int i = 0 ; while ( length > 0 && i < 1000 ) { int index = i % lengths . length ; Range r = ranges [ index ] ; if ( lengths [ index ] < r . getMax ( ) ) { lengths [ index ] += 1 ; length -- ; } i ++ ; } String replaceString = generate ( lengths , - 2 ) ; if ( replaceString . length ( ) == 0 ) { log . warn ( "No negative characters possible in this expression. All characters are allowed." ) ; return input ; } List < Integer > l = new ArrayList < Integer > ( input . length ( ) ) ; for ( i = 0 ; i < input . length ( ) ; i ++ ) { l . add ( i ) ; } if ( bad == - 2 ) { bad = input . length ( ) ; } else if ( bad == - 1 ) { bad = 1 + random . getInt ( input . length ( ) - 1 ) ; } Collections . shuffle ( l ) ; StringBuffer base = new StringBuffer ( input ) ; int j = 0 ; for ( i = 0 ; i < bad ; i ++ ) { int index = l . remove ( 0 ) ; char replaceChar = ' ' ; if ( index < replaceString . length ( ) ) { replaceChar = replaceString . charAt ( index ) ; } while ( ( index == 0 || index >= replaceString . length ( ) || index == input . length ( ) - 1 ) && Character . isSpaceChar ( replaceChar ) ) { replaceChar = replaceString . charAt ( j ) ; j = ( j + 1 ) % replaceString . length ( ) ; } base . setCharAt ( index , replaceChar ) ; } if ( log . isDebugEnabled ( ) ) { log . debug ( "False characters in string; " + input + " became " + base ) ; } return base . toString ( ) ; }
Replaces randomly selected characters in the given string with forbidden characters according to the given expression .
18,912
public Range [ ] getRanges ( ) { Range [ ] ranges = new Range [ nodes . size ( ) ] ; for ( int i = 0 ; i < ranges . length ; i ++ ) { ranges [ i ] = nodes . get ( i ) . getRange ( ) ; } return ranges ; }
As the regular expression was distributed in separate node every node has its own range . This method returns an array containing all range objects .
18,913
public String generate ( final int [ ] nodeSizes , final int bad ) { buf . setLength ( 0 ) ; for ( int i = 0 ; i < nodes . size ( ) && i < nodeSizes . length ; i ++ ) { buf . append ( nodes . get ( i ) . getCharacters ( nodeSizes [ i ] , bad ) ) ; } String value = buf . toString ( ) ; buf . setLength ( 0 ) ; return value ; }
Generates a string containing subject to the parameter value only allowed or one half of forbidden characters .
18,914
public String generate ( final int bad ) { int [ ] sizes = new int [ nodes . size ( ) ] ; for ( int i = 0 ; i < sizes . length ; i ++ ) { Range r = nodes . get ( i ) . getRange ( ) ; sizes [ i ] = r . getMin ( ) + r . getRange ( ) / 2 ; } return generate ( sizes , bad ) ; }
Returns a string whose length is always exactly in the middle of the allowed range
18,915
public String generate ( int total , final int bad ) { if ( total < 0 ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Character string cannot have a negative length!" ) ; } total = 0 ; } Range [ ] ranges = getRanges ( ) ; int [ ] lengths = new int [ ranges . length ] ; int length = 0 ; for ( int i = 0 ; i < ranges . length ; i ++ ) { lengths [ i ] = ranges [ i ] . getMin ( ) ; length += lengths [ i ] ; } int index = 0 ; boolean increase = length < total ; if ( increase ) { boolean maxedOut = total > getRange ( ) . getMax ( ) ; while ( length < total ) { if ( ( maxedOut || ranges [ index ] . getMax ( ) > lengths [ index ] ) && choice . get ( ) ) { lengths [ index ] ++ ; length ++ ; } index = ( index + 1 ) % lengths . length ; } } else { boolean minOut = total < getRange ( ) . getMin ( ) ; while ( length > total ) { if ( ( minOut || ranges [ index ] . getMin ( ) > lengths [ index ] ) && lengths [ index ] > 0 && choice . get ( ) ) { lengths [ index ] -- ; length -- ; } index = ( index + 1 ) % lengths . length ; } } return generate ( lengths , bad ) ; }
Generates a string with the given length . Thereby the mandatory length will be reached first and then the separate areas are filled with the remaining characters randlomly .
18,916
private static int intFromSubArray ( final byte [ ] bytes , final int from , final int to ) { final byte [ ] subBytes = Arrays . copyOfRange ( bytes , from , to ) ; final ByteBuffer wrap = ByteBuffer . wrap ( subBytes ) ; return wrap . getInt ( ) ; }
Take a slice of an array of bytes and interpret it as an int .
18,917
void startArchiving ( ) { if ( isArchivingDisabled ( ) ) { return ; } String archiveName = configuration . get ( JFunkConstants . ARCHIVE_FILE ) ; if ( StringUtils . isBlank ( archiveName ) ) { archiveName = String . format ( DIR_PATTERN , moduleMetaData . getModuleName ( ) , Thread . currentThread ( ) . getName ( ) , FORMAT . format ( moduleMetaData . getStartDate ( ) ) ) ; } moduleArchiveDir = new File ( archiveDir , archiveName ) ; if ( moduleArchiveDir . exists ( ) ) { log . warn ( "Archive directory already exists: {}" , moduleArchiveDir ) ; } else { moduleArchiveDir . mkdirs ( ) ; } addModuleAppender ( ) ; log . info ( "Started archiving: (module={}, moduleArchiveDir={})" , moduleMetaData . getModuleName ( ) , moduleArchiveDir ) ; }
Starts archiving of the specified module if archiving is enabled .
18,918
public String initValuesImpl ( final FieldCase ca ) { if ( ca == FieldCase . NULL || ca == FieldCase . BLANK ) { return null ; } if ( ca != null || last && constraint . hasNextCase ( ) || generator . isIgnoreOptionalConstraints ( ) ) { return constraint . initValues ( ca ) ; } if ( choice . isNext ( ) ) { last = true ; return constraint . initValues ( null ) ; } last = false ; constraint . initValues ( FieldCase . NULL ) ; return null ; }
Returns either null or a value . If null is returned the embedded constraint is initialized with FieldCase . NULL . If a value is returned the embedded constraint is initialized with the FieldCase whose value is returned . If the latest value was not not null the next value will be generated if in the case that the embedded constraint still has an mandatory case . This also applies if all optional constraints have been turned of globally using the property IGNORE_CONSTRAINT_OPTIONAL . Otherwise no value will be generated in 50% of the cases or the values of the embedded constraints are returned .
18,919
public static String spacesOptional ( final String input ) { String output ; output = input . replaceAll ( "\\s" , "\\\\s?" ) ; return output ; }
Replaces a space with the regular expression \\ s?
18,920
public static MozuUrl getDiscountSettingsUrl ( Integer catalogId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/discountsettings/{catalogId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "catalogId" , catalogId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetDiscountSettings
18,921
public static Hml read ( final File file ) throws IOException { checkNotNull ( file ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( file ) ) ) { return read ( reader ) ; } }
Read HML from the specified file .
18,922
byte [ ] readSignResponse ( ) throws IOException { final byte [ ] headerBytes = readBytes ( 9 , "SSH2_AGENT_SIGN_RESPONSE" ) ; log . debug ( "Received SSH2_AGENT_SIGN_RESPONSE message from ssh-agent." ) ; final SignResponseHeaders headers = SignResponseHeaders . from ( headerBytes ) ; final byte [ ] bytes = readBytes ( headers . getLength ( ) - 5 ) ; final ByteIterator iterator = new ByteIterator ( bytes ) ; final byte [ ] responseType = iterator . next ( ) ; final String signatureFormatId = new String ( responseType ) ; if ( ! signatureFormatId . equals ( Rsa . RSA_LABEL ) ) { throw new RuntimeException ( "I unexpectedly got a non-Rsa signature format ID in the " + "SSH2_AGENT_SIGN_RESPONSE's signature blob." ) ; } return iterator . next ( ) ; }
Return an array of bytes from the ssh - agent representing data signed by a private SSH key .
18,923
public static MozuUrl getTaxableTerritoriesUrl ( ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/settings/general/taxableterritories" ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetTaxableTerritories
18,924
public static MozuUrl updateTaxableTerritoriesUrl ( ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/settings/general/taxableterritories" ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for UpdateTaxableTerritories
18,925
public static Iterable < VcfRecord > records ( final Readable readable ) throws IOException { checkNotNull ( readable ) ; ParseListener parseListener = new ParseListener ( ) ; VcfParser . parse ( readable , parseListener ) ; return parseListener . getRecords ( ) ; }
Read zero or more VCF records from the specified readable .
18,926
public Constraint createModel ( final MathRandom random , final Element element ) { if ( element == null ) { return null ; } Class < ? extends Constraint > classObject = null ; Constraint object = null ; try { classObject = getClassObject ( element ) ; Constructor < ? extends Constraint > constructor = getConstructor ( classObject ) ; object = getObject ( random , element , constructor ) ; } catch ( InvocationTargetException ex ) { throw new JFunkException ( "Could not initialise object of class " + classObject , ex . getCause ( ) ) ; } catch ( Exception ex ) { throw new JFunkException ( "Could not initialise object of class " + classObject , ex ) ; } putToCache ( element , object ) ; return object ; }
Generates an instance based on the data in the given object . The object s class will be determined by the class attribute of the element . IF the element contains an id attribute the generated instance is stored in a map using this id as key .
18,927
public Constraint getModel ( final Element element ) throws IdNotFoundException { Attribute attr = element . getAttribute ( XMLTags . ID ) ; if ( attr == null ) { throw new IdNotFoundException ( null ) ; } Constraint c = null ; final String id = attr . getValue ( ) ; try { c = getModel ( id ) ; } catch ( IdNotFoundException e ) { LOG . debug ( "DummyConstraint fuer id " + id ) ; } if ( c == null ) { c = new DummyConstraint ( ) ; putToCache ( id , c ) ; } return c ; }
Returns the constraint to the associated id attribute value of the passed element . To achieve this the id attribute of the passed element is searched first . If there is none an IdNotFoundException will be thrown . Then the constraint stored under the respective key is returned from the internal table . If this constraint is not found a wrapper is written to the table at the requested key . This way the sequence of the constraints in the XML file does not determine the cross - references by id . The wrapper will be replaced if a constraint already represented by the wrapper in the table is generated later on .
18,928
public Constraint getModel ( final String id ) throws IdNotFoundException { Constraint e = map . get ( id ) ; if ( e == null ) { throw new IdNotFoundException ( id ) ; } return e ; }
Returns the object in the map with the key id
18,929
private Class < ? extends Constraint > getClassObject ( final Element element ) throws ClassNotFoundException { String className = element . getAttributeValue ( XMLTags . CLASS ) ; className = className . indexOf ( '.' ) > 0 ? className : getClass ( ) . getPackage ( ) . getName ( ) + '.' + className ; return Class . forName ( className ) . asSubclass ( Constraint . class ) ; }
This method returns the class object of which a new instance shall be generated . To achieve this the class attribute of the passed element will be used to determine the class name
18,930
private Constructor < ? extends Constraint > getConstructor ( final Class < ? extends Constraint > classObject ) throws NoSuchMethodException { return classObject . getConstructor ( new Class [ ] { MathRandom . class , Element . class , Generator . class } ) ; }
Searches for the matching constraint constructor with the parameter types MathRandom Element and Generator .
18,931
private Constraint getObject ( final MathRandom random , final Element element , final Constructor < ? extends Constraint > constructor ) throws IllegalArgumentException , InstantiationException , IllegalAccessException , InvocationTargetException { LOG . debug ( "Creating constraint: " + element . getAttributes ( ) ) ; Constraint instance = constructor . newInstance ( new Object [ ] { random , element , generator } ) ; injector . injectMembers ( instance ) ; return instance ; }
Generates a new constraint instance using the given constructor the element and the generateor callback as parameters .
18,932
private void putToCache ( final Element element , final Constraint object ) { String id = element . getAttributeValue ( XMLTags . ID ) ; if ( id != null && id . length ( ) > 0 ) { Constraint old = putToCache ( id , object ) ; if ( old != null ) { LOG . warn ( "The id=" + id + " for object of type=" + old . getClass ( ) . getName ( ) + " was already found. Please make sure this is ok and no mistake." ) ; } } }
If the element has an attribute with name id this attribute s value will be used as key to store the just generated object in a map . The object can in this case also be retrieved using this id .
18,933
private Constraint putToCache ( final String id , final Constraint object ) { Constraint c = this . map . put ( id , object ) ; if ( c instanceof DummyConstraint ) { ( ( DummyConstraint ) c ) . constraint = object ; return null ; } return c ; }
Puts the given constraint object into the cache using the key id . If an existing DummyConstraint object is found in the table the reference will be set to the constraint and the constraint will not be put into the table .
18,934
public static Analysis readAnalysis ( final Reader reader ) throws IOException { checkNotNull ( reader ) ; try { JAXBContext context = JAXBContext . newInstance ( Analysis . class ) ; Unmarshaller unmarshaller = context . createUnmarshaller ( ) ; SchemaFactory schemaFactory = SchemaFactory . newInstance ( XMLConstants . W3C_XML_SCHEMA_NS_URI ) ; URL commonSchemaURL = SraReader . class . getResource ( "/org/nmdp/ngs/sra/xsd/SRA.common.xsd" ) ; URL analysisSchemaURL = SraReader . class . getResource ( "/org/nmdp/ngs/sra/xsd/SRA.analysis.xsd" ) ; Schema schema = schemaFactory . newSchema ( new StreamSource [ ] { new StreamSource ( commonSchemaURL . toString ( ) ) , new StreamSource ( analysisSchemaURL . toString ( ) ) } ) ; unmarshaller . setSchema ( schema ) ; return ( Analysis ) unmarshaller . unmarshal ( reader ) ; } catch ( JAXBException | SAXException e ) { throw new IOException ( "could not unmarshal Analysis" , e ) ; } }
Read an analysis from the specified reader .
18,935
public static Analysis readAnalysis ( final File file ) throws IOException { checkNotNull ( file ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( file ) ) ) { return readAnalysis ( reader ) ; } }
Read an analysis from the specified file .
18,936
public static Analysis readAnalysis ( final URL url ) throws IOException { checkNotNull ( url ) ; try ( BufferedReader reader = Resources . asCharSource ( url , Charsets . UTF_8 ) . openBufferedStream ( ) ) { return readAnalysis ( reader ) ; } }
Read an analysis from the specified URL .
18,937
public static Analysis readAnalysis ( final InputStream inputStream ) throws IOException { checkNotNull ( inputStream ) ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ) { return readAnalysis ( reader ) ; } }
Read an analysis from the specified input stream .
18,938
public static Experiment readExperiment ( final File file ) throws IOException { checkNotNull ( file ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( file ) ) ) { return readExperiment ( reader ) ; } }
Read an experiment from the specified file .
18,939
public static Experiment readExperiment ( final URL url ) throws IOException { checkNotNull ( url ) ; try ( BufferedReader reader = Resources . asCharSource ( url , Charsets . UTF_8 ) . openBufferedStream ( ) ) { return readExperiment ( reader ) ; } }
Read an experiment from the specified URL .
18,940
public static Experiment readExperiment ( final InputStream inputStream ) throws IOException { checkNotNull ( inputStream ) ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ) { return readExperiment ( reader ) ; } }
Read an experiment from the specified input stream .
18,941
public static RunSet readRunSet ( final File file ) throws IOException { checkNotNull ( file ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( file ) ) ) { return readRunSet ( reader ) ; } }
Read a run set from the specified file .
18,942
public static RunSet readRunSet ( final URL url ) throws IOException { checkNotNull ( url ) ; try ( BufferedReader reader = Resources . asCharSource ( url , Charsets . UTF_8 ) . openBufferedStream ( ) ) { return readRunSet ( reader ) ; } }
Read a run set from the specified URL .
18,943
public static RunSet readRunSet ( final InputStream inputStream ) throws IOException { checkNotNull ( inputStream ) ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ) { return readRunSet ( reader ) ; } }
Read a run set from the specified input stream .
18,944
public static Sample readSample ( final File file ) throws IOException { checkNotNull ( file ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( file ) ) ) { return readSample ( reader ) ; } }
Read a sample from the specified file .
18,945
public static Sample readSample ( final URL url ) throws IOException { checkNotNull ( url ) ; try ( BufferedReader reader = Resources . asCharSource ( url , Charsets . UTF_8 ) . openBufferedStream ( ) ) { return readSample ( reader ) ; } }
Read a sample from the specified URL .
18,946
public static Sample readSample ( final InputStream inputStream ) throws IOException { checkNotNull ( inputStream ) ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ) { return readSample ( reader ) ; } }
Read a sample from the specified input stream .
18,947
public static Study readStudy ( final File file ) throws IOException { checkNotNull ( file ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( file ) ) ) { return readStudy ( reader ) ; } }
Read a study from the specified file .
18,948
public static Study readStudy ( final URL url ) throws IOException { checkNotNull ( url ) ; try ( BufferedReader reader = Resources . asCharSource ( url , Charsets . UTF_8 ) . openBufferedStream ( ) ) { return readStudy ( reader ) ; } }
Read a study from the specified URL .
18,949
public static Study readStudy ( final InputStream inputStream ) throws IOException { checkNotNull ( inputStream ) ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ) { return readStudy ( reader ) ; } }
Read a study from the specified input stream .
18,950
public static Submission readSubmission ( final File file ) throws IOException { checkNotNull ( file ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( file ) ) ) { return readSubmission ( reader ) ; } }
Read a submission from the specified file .
18,951
public static Submission readSubmission ( final URL url ) throws IOException { checkNotNull ( url ) ; try ( BufferedReader reader = Resources . asCharSource ( url , Charsets . UTF_8 ) . openBufferedStream ( ) ) { return readSubmission ( reader ) ; } }
Read a submission from the specified URL .
18,952
public static Submission readSubmission ( final InputStream inputStream ) throws IOException { checkNotNull ( inputStream ) ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ) { return readSubmission ( reader ) ; } }
Read a submission from the specified input stream .
18,953
protected < T > T getScopedObject ( final Key < T > key , final Provider < T > unscoped , final Map < Key < ? > , Object > scopeMap ) { @ SuppressWarnings ( "unchecked" ) T value = ( T ) scopeMap . get ( key ) ; if ( value == null ) { value = unscoped . get ( ) ; scopeMap . put ( key , value ) ; } return value ; }
If already present gets the object for the specified key from the scope map . Otherwise it is retrieved from the unscoped provider and stored in the scope map .
18,954
public static MozuUrl refreshUserAuthTicketUrl ( String refreshToken , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/customer/authtickets/refresh?refreshToken={refreshToken}&responseFields={responseFields}" ) ; formatter . formatUrl ( "refreshToken" , refreshToken ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for RefreshUserAuthTicket
18,955
public static MozuUrl createUserAuthTicketUrl ( String responseFields , Integer tenantId ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/adminuser/authtickets/tenants?tenantId={tenantId}&responseFields={responseFields}" ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "tenantId" , tenantId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . HOME_POD ) ; }
Get Resource Url for CreateUserAuthTicket
18,956
public static MozuUrl deleteUserAuthTicketUrl ( String refreshToken ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/adminuser/authtickets/?refreshToken={refreshToken}" ) ; formatter . formatUrl ( "refreshToken" , refreshToken ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . HOME_POD ) ; }
Get Resource Url for DeleteUserAuthTicket
18,957
public static Iterable < BedRecord > read ( final Readable readable ) throws IOException { checkNotNull ( readable ) ; Collect collect = new Collect ( ) ; stream ( readable , collect ) ; return collect . records ( ) ; }
Read zero or more BED records from the specified readable .
18,958
public static void stream ( final Readable readable , final BedListener listener ) throws IOException { checkNotNull ( readable ) ; checkNotNull ( listener ) ; BedLineProcessor lineProcessor = new BedLineProcessor ( listener ) ; CharStreams . readLines ( readable , lineProcessor ) ; }
Stream zero or more BED records from the specified readable .
18,959
public void copy ( final File source ) throws IOException { if ( ! source . exists ( ) ) { LOG . warn ( "File " + source + " cannot be copied as it does not exist" ) ; return ; } if ( equals ( source ) ) { LOG . info ( "Skipping copying of " + source + " as it matches the target" ) ; return ; } File target = isDirectory ( ) ? new File ( this , source . getName ( ) ) : this ; FileUtils . copyFile ( source , target ) ; }
Copies the specified file . If this object is a directory the file will be copied to this directory . If this object represents a file it will be overwritten with the specified file .
18,960
public void zip ( final File zipFile ) throws IOException { File [ ] files = listFiles ( ) ; if ( files . length == 0 ) { return ; } LOG . info ( "Creating zip file " + zipFile + " from directory " + this ) ; ZipOutputStream zipOut = null ; try { zipOut = new ZipOutputStream ( new FileOutputStream ( zipFile ) ) ; for ( File file : files ) { zip ( "" , file , zipOut ) ; } } finally { IOUtils . closeQuietly ( zipOut ) ; } }
Zips all included objects into the specified file .
18,961
public static Module loadModulesFromProperties ( final Module jFunkModule , final String propertiesFile ) throws ClassNotFoundException , InstantiationException , IllegalAccessException , IOException { final List < Module > modules = Lists . newArrayList ( ) ; LOG . debug ( "Using jfunk.props.file=" + propertiesFile ) ; Properties props = loadProperties ( propertiesFile ) ; for ( final Enumeration < ? > en = props . propertyNames ( ) ; en . hasMoreElements ( ) ; ) { String name = ( String ) en . nextElement ( ) ; if ( name . startsWith ( "module." ) ) { String className = props . getProperty ( name ) ; LOG . info ( "Loading " + name + "=" + className ) ; Class < ? extends Module > moduleClass = Class . forName ( className ) . asSubclass ( Module . class ) ; Module module = moduleClass . newInstance ( ) ; modules . add ( module ) ; } } return Modules . override ( jFunkModule ) . with ( modules ) ; }
Loads Guice modules whose class names are specified as properties . All properties starting with module . are considered to have a fully qualified class name representing a Guice module . The modules are combined and override thespecified jFunkModule .
18,962
public Range merge ( final Range otherRange ) { int newMin = Math . min ( otherRange . min , min ) ; int newMax = Math . max ( otherRange . max , max ) ; return new Range ( newMin , newMax ) ; }
Merges this range with the passed range . Returns a range object whose min and max values match the minimum or maximum of the two values respectively . So the range returned contains this and the passed range in any case .
18,963
public Range sumBoundaries ( final Range plus ) { int newMin = min + plus . min ; int newMax = max == RANGE_MAX || plus . max == RANGE_MAX ? RANGE_MAX : max + plus . max ; return new Range ( newMin , newMax ) ; }
Sums the boundaries of this range with the ones of the passed . So the returned range has this . min + plus . min as minimum and this . max + plus . max as maximum respectively .
18,964
public Range intersect ( final Range outerRange ) throws RangeException { if ( min > outerRange . max ) { throw new IllegalArgumentException ( "range maximum must be greater or equal than " + min ) ; } if ( max < outerRange . min ) { throw new IllegalArgumentException ( "range minimum must be less or equal than " + max ) ; } int newMin = Math . max ( min , outerRange . min ) ; int newMax = Math . min ( max , outerRange . max ) ; return new Range ( newMin , newMax ) ; }
Intersects this range with the one passed . This means that the returned rand contains the maximum of both minima as minimum and the minimum of the two maxima as maximum .
18,965
public List < Integer > listValues ( ) { ArrayList < Integer > list = new ArrayList < Integer > ( getRange ( ) ) ; for ( int i = getMin ( ) ; i <= getMax ( ) ; i ++ ) { list . add ( i ) ; } return list ; }
Returns a list of all allowed values within the range
18,966
public static MozuUrl getCartItemUrl ( String cartItemId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/carts/current/items/{cartItemId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "cartItemId" , cartItemId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetCartItem
18,967
public static MozuUrl addItemsToCartUrl ( Boolean throwErrorOnInvalidItems ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/carts/current/bulkitems?throwErrorOnInvalidItems={throwErrorOnInvalidItems}" ) ; formatter . formatUrl ( "throwErrorOnInvalidItems" , throwErrorOnInvalidItems ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for AddItemsToCart
18,968
public static MozuUrl updateCartItemQuantityUrl ( String cartItemId , Integer quantity , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/carts/current/items/{cartItemId}/{quantity}?responseFields={responseFields}" ) ; formatter . formatUrl ( "cartItemId" , cartItemId ) ; formatter . formatUrl ( "quantity" , quantity ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for UpdateCartItemQuantity
18,969
public static MozuUrl removeAllCartItemsUrl ( ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/carts/current/items" ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for RemoveAllCartItems
18,970
public static MozuUrl deleteCartItemUrl ( String cartItemId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/carts/current/items/{cartItemId}" ) ; formatter . formatUrl ( "cartItemId" , cartItemId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for DeleteCartItem
18,971
public static MozuUrl processDigitalWalletUrl ( String checkoutId , String digitalWalletType , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/checkouts/{checkoutId}/digitalWallet/{digitalWalletType}?responseFields={responseFields}" ) ; formatter . formatUrl ( "checkoutId" , checkoutId ) ; formatter . formatUrl ( "digitalWalletType" , digitalWalletType ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for ProcessDigitalWallet
18,972
public static VcfHeader header ( final Readable readable ) throws IOException { checkNotNull ( readable ) ; ParseListener parseListener = new ParseListener ( ) ; VcfParser . parse ( readable , parseListener ) ; return parseListener . getHeader ( ) ; }
Read the VCF header from the specified readable .
18,973
protected String initValuesImpl ( final FieldCase ca ) { if ( ca == FieldCase . NULL || ca == FieldCase . BLANK ) { return null ; } return field . getString ( control . getNext ( ca ) ) ; }
Returns a string whose length and character type reflect the passed FieldCase using the embedded field object . If FieldCase . NULL or FieldCase . BLANK is passed the method returns null .
18,974
public static MozuUrl validateTargetRuleUrl ( ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/targetrules/validate" ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for ValidateTargetRule
18,975
public static String formatLatitude ( final Latitude latitude , final PointLocationFormatType formatType ) throws FormatterException { if ( latitude == null ) { throw new FormatterException ( "No point location provided" ) ; } if ( formatType == null ) { throw new FormatterException ( "No format type provided" ) ; } final String formatted ; switch ( formatType ) { case HUMAN_LONG : formatted = latitude . toString ( ) ; break ; case HUMAN_MEDIUM : formatted = formatLatitudeHumanMedium ( latitude ) ; break ; case LONG : formatted = formatLatitudeLong ( latitude ) ; break ; case MEDIUM : formatted = formatLatitudeMedium ( latitude ) ; break ; case SHORT : formatted = formatLatitudeShort ( latitude ) ; break ; case DECIMAL : formatted = formatLatitudeWithDecimals ( latitude ) ; break ; default : throw new FormatterException ( "Unsupported format type" ) ; } return formatted ; }
Formats a latitude as an ISO 6709 string .
18,976
public static String formatLongitude ( final Longitude longitude , final PointLocationFormatType formatType ) throws FormatterException { if ( longitude == null ) { throw new FormatterException ( "No point location provided" ) ; } if ( formatType == null ) { throw new FormatterException ( "No format type provided" ) ; } final String formatted ; switch ( formatType ) { case HUMAN_LONG : formatted = longitude . toString ( ) ; break ; case HUMAN_MEDIUM : formatted = formatLongitudeHumanMedium ( longitude ) ; break ; case LONG : formatted = formatLongitudeLong ( longitude ) ; break ; case MEDIUM : formatted = formatLongitudeMedium ( longitude ) ; break ; case SHORT : formatted = formatLongitudeShort ( longitude ) ; break ; case DECIMAL : formatted = formatLongitudeWithDecimals ( longitude ) ; break ; default : throw new FormatterException ( "Unsupported format type" ) ; } return formatted ; }
Formats a longitude as an ISO 6709 string .
18,977
public static String formatPointLocation ( final PointLocation pointLocation , final PointLocationFormatType formatType ) throws FormatterException { if ( pointLocation == null ) { throw new FormatterException ( "No point location provided" ) ; } if ( formatType == null ) { throw new FormatterException ( "No format type provided" ) ; } final String formatted ; switch ( formatType ) { case HUMAN_LONG : formatted = pointLocation . toString ( ) ; break ; case HUMAN_MEDIUM : formatted = formatHumanMedium ( pointLocation ) ; break ; case HUMAN_SHORT : formatted = formatHumanShort ( pointLocation ) ; break ; case LONG : formatted = formatISO6709Long ( pointLocation ) ; break ; case MEDIUM : formatted = formatISO6709Medium ( pointLocation ) ; break ; case SHORT : formatted = formatISO6709Short ( pointLocation ) ; break ; case DECIMAL : formatted = formatISO6709WithDecimals ( pointLocation ) ; break ; default : throw new FormatterException ( "Unsupported format type" ) ; } return formatted ; }
Formats a point location as an ISO 6709 or human readable string .
18,978
private static String formatISO6709WithDecimals ( final PointLocation pointLocation ) { final Latitude latitude = pointLocation . getLatitude ( ) ; final Longitude longitude = pointLocation . getLongitude ( ) ; String string = formatLatitudeWithDecimals ( latitude ) + formatLongitudeWithDecimals ( longitude ) ; final double altitude = pointLocation . getAltitude ( ) ; string = string + formatAltitudeWithSign ( altitude ) ; final String crs = pointLocation . getCoordinateReferenceSystemIdentifier ( ) ; string = string + formatCoordinateReferenceSystemIdentifier ( crs ) ; return string + "/" ; }
Formats a point location as an ISO 6709 string using decimals .
18,979
private int [ ] sexagesimalSplit ( final double value ) { final double absValue = Math . abs ( value ) ; int units ; int minutes ; int seconds ; final int sign = value < 0 ? - 1 : 1 ; units = ( int ) Math . floor ( absValue ) ; seconds = ( int ) Math . round ( ( absValue - units ) * 3600D ) ; minutes = seconds / 60 ; if ( minutes == 60 ) { minutes = 0 ; units ++ ; } seconds = seconds % 60 ; units = units * sign ; minutes = minutes * sign ; seconds = seconds * sign ; return new int [ ] { units , minutes , seconds } ; }
Splits a double value into it s sexagesimal parts . Each part has the same sign as the provided value .
18,980
public static < N extends Number & Comparable < ? super N > > Point singleton ( final N value ) { checkNotNull ( value ) ; return Geometries . point ( value . doubleValue ( ) , 0.5d ) ; }
Create and return a new point geometry from the specified singleton value .
18,981
public static < N extends Number & Comparable < ? super N > > Rectangle range ( final Range < N > range ) { checkNotNull ( range ) ; if ( range . isEmpty ( ) ) { throw new IllegalArgumentException ( "range must not be empty" ) ; } if ( ! range . hasLowerBound ( ) || ! range . hasUpperBound ( ) ) { throw new IllegalArgumentException ( "range must have lower and upper bounds" ) ; } Number lowerEndpoint = range . lowerEndpoint ( ) ; BoundType lowerBoundType = range . lowerBoundType ( ) ; Number upperEndpoint = range . upperEndpoint ( ) ; BoundType upperBoundType = range . upperBoundType ( ) ; double x1 = lowerBoundType == BoundType . OPEN ? lowerEndpoint . doubleValue ( ) + 1.0d : lowerEndpoint . doubleValue ( ) ; double y1 = 0.0d ; double x2 = upperBoundType == BoundType . OPEN ? upperEndpoint . doubleValue ( ) - 1.0d : upperEndpoint . doubleValue ( ) ; double y2 = 1.0d ; return Geometries . rectangle ( x1 , y1 , x2 , y2 ) ; }
Create and return a new rectangle geometry from the specified range .
18,982
static boolean isLeft ( final Fastq fastq ) { checkNotNull ( fastq ) ; return LEFT . matcher ( fastq . getDescription ( ) ) . matches ( ) ; }
Return true if the specified fastq is the left or first read of a paired end read .
18,983
static boolean isRight ( final Fastq fastq ) { checkNotNull ( fastq ) ; return RIGHT . matcher ( fastq . getDescription ( ) ) . matches ( ) ; }
Return true if the specified fastq is the right or second read of a paired end read .
18,984
static String prefix ( final Fastq fastq ) { checkNotNull ( fastq ) ; Matcher m = PREFIX . matcher ( fastq . getDescription ( ) ) ; if ( ! m . matches ( ) ) { throw new PairedEndFastqReaderException ( "could not parse prefix from description " + fastq . getDescription ( ) ) ; } return m . group ( 1 ) ; }
Return the prefix of the paired end read name of the specified fastq .
18,985
public static GapPenalties create ( final int match , final int replace , final int insert , final int delete , final int extend ) { return new GapPenalties ( ( short ) match , ( short ) replace , ( short ) insert , ( short ) delete , ( short ) extend ) ; }
Create and return a new gap penalties with the specified penalties .
18,986
public static MozuUrl getAvailablePickupFulfillmentActionsUrl ( String orderId , String pickupId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/orders/{orderId}/pickups/{pickupId}/actions" ) ; formatter . formatUrl ( "orderId" , orderId ) ; formatter . formatUrl ( "pickupId" , pickupId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetAvailablePickupFulfillmentActions
18,987
public static MozuUrl getPickupUrl ( String orderId , String pickupId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/orders/{orderId}/pickups/{pickupId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "orderId" , orderId ) ; formatter . formatUrl ( "pickupId" , pickupId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetPickup
18,988
public void setParameter ( final String name , final String filename , final InputStream is ) throws IOException { boundary ( ) ; writeName ( name ) ; write ( "; filename=\"" ) ; write ( filename ) ; write ( '"' ) ; newline ( ) ; write ( "Content-Type: " ) ; String type = URLConnection . guessContentTypeFromName ( filename ) ; if ( type == null ) { type = "application/octet-stream" ; } writeln ( type ) ; newline ( ) ; pipe ( is , os ) ; newline ( ) ; }
Adds a file parameter to the request
18,989
public static MozuUrl getTransactionsUrl ( Integer accountId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/customer/accounts/{accountId}/transactions" ) ; formatter . formatUrl ( "accountId" , accountId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetTransactions
18,990
public static MozuUrl removeTransactionUrl ( Integer accountId , String transactionId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/customer/accounts/{accountId}/transactions/{transactionId}" ) ; formatter . formatUrl ( "accountId" , accountId ) ; formatter . formatUrl ( "transactionId" , transactionId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for RemoveTransaction
18,991
public void send ( final Message msg ) throws MailException { Transport transport = null ; try { if ( log . isDebugEnabled ( ) ) { log . debug ( "Sending mail message [subject={}, recipients={}]" , msg . getSubject ( ) , on ( ", " ) . join ( msg . getAllRecipients ( ) ) ) ; } transport = sessionProvider . get ( ) . getTransport ( ) ; transport . connect ( ) ; transport . sendMessage ( msg , msg . getAllRecipients ( ) ) ; } catch ( MessagingException ex ) { throw new MailException ( "Error sending mail message" , ex ) ; } finally { try { transport . close ( ) ; } catch ( MessagingException ex ) { log . error ( ex . getMessage ( ) , ex ) ; } } }
Sends the specified message .
18,992
public static MozuUrl getQuoteByNameUrl ( Integer customerAccountId , String quoteName , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/quotes/customers/{customerAccountId}/{quoteName}?responseFields={responseFields}" ) ; formatter . formatUrl ( "customerAccountId" , customerAccountId ) ; formatter . formatUrl ( "quoteName" , quoteName ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetQuoteByName
18,993
public static MozuUrl deleteQuoteUrl ( String quoteId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/quotes/{quoteId}" ) ; formatter . formatUrl ( "quoteId" , quoteId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for DeleteQuote
18,994
public static MozuUrl getDBValueUrl ( String dbEntryQuery , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/tenantdata/{dbEntryQuery}?responseFields={responseFields}" ) ; formatter . formatUrl ( "dbEntryQuery" , dbEntryQuery ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetDBValue
18,995
public static MozuUrl createDBValueUrl ( String dbEntryQuery ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/tenantdata/{dbEntryQuery}" ) ; formatter . formatUrl ( "dbEntryQuery" , dbEntryQuery ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for CreateDBValue
18,996
public static List < String > normalizeTagsForUpload ( List < String > list ) { if ( isNullOrEmpty ( list ) ) { return null ; } List < String > tmp = new ArrayList < String > ( ) ; for ( String s : list ) { if ( s . contains ( " " ) ) { tmp . add ( "\"" + s + "\"" ) ; } else { tmp . add ( s ) ; } } return tmp ; }
Normalize tags for uploads .
18,997
public static Integer memberTypeToMemberTypeId ( JinxConstants . MemberType memberType ) { if ( memberType == null ) { return null ; } Integer type ; switch ( memberType ) { case narwhal : type = 1 ; break ; case member : type = 2 ; break ; case moderator : type = 3 ; break ; case admin : type = 4 ; break ; default : type = null ; break ; } return type ; }
Convert a MemberType enum to the numeric Flickr member type id .
18,998
public static JinxConstants . MemberType typeIdToMemberType ( Integer typeId ) { if ( typeId == null ) { return null ; } JinxConstants . MemberType memberType ; switch ( typeId ) { case 1 : memberType = JinxConstants . MemberType . narwhal ; break ; case 2 : memberType = JinxConstants . MemberType . member ; break ; case 3 : memberType = JinxConstants . MemberType . moderator ; break ; case 4 : memberType = JinxConstants . MemberType . admin ; break ; default : memberType = null ; break ; } return memberType ; }
Convert a numeric Flickr member type id to a MemberType enum value .
18,999
public static Integer groupPrivacyEnumToPrivacyId ( JinxConstants . GroupPrivacy privacy ) { if ( privacy == null ) { return null ; } Integer id ; switch ( privacy ) { case group_private : id = 1 ; break ; case group_invite_only_public : id = 2 ; break ; case group_open_public : id = 3 ; break ; default : id = null ; break ; } return id ; }
Convert a GroupPrivacy enum value to the corresponding Flickr numeric identifier .