idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
142,200 | public static VcfHeader header ( final InputStream inputStream ) throws IOException { checkNotNull ( inputStream ) ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ) { return header ( reader ) ; } } | Read the VCF header from the specified input stream . | 56 | 11 |
142,201 | public static Iterable < VcfSample > samples ( final File file ) throws IOException { checkNotNull ( file ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( file ) ) ) { return samples ( reader ) ; } } | Read zero or more VCF samples from the specified file . | 55 | 12 |
142,202 | public static Iterable < VcfSample > samples ( final URL url ) throws IOException { checkNotNull ( url ) ; try ( BufferedReader reader = Resources . asCharSource ( url , Charsets . UTF_8 ) . openBufferedStream ( ) ) { return samples ( reader ) ; } } | Read zero or more VCF samples from the specified URL . | 66 | 12 |
142,203 | public static Iterable < VcfSample > samples ( final InputStream inputStream ) throws IOException { checkNotNull ( inputStream ) ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ) { return samples ( reader ) ; } } | Read zero or more VCF samples from the specified input stream . | 60 | 13 |
142,204 | public static Iterable < VcfRecord > records ( final File file ) throws IOException { checkNotNull ( file ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( file ) ) ) { return records ( reader ) ; } } | Read zero or more VCF records from the specified file . | 55 | 12 |
142,205 | public static Iterable < VcfRecord > records ( final URL url ) throws IOException { checkNotNull ( url ) ; try ( BufferedReader reader = Resources . asCharSource ( url , Charsets . UTF_8 ) . openBufferedStream ( ) ) { return records ( reader ) ; } } | Read zero or more VCF records from the specified URL . | 66 | 12 |
142,206 | public static Iterable < VcfRecord > records ( final InputStream inputStream ) throws IOException { checkNotNull ( inputStream ) ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ) { return records ( reader ) ; } } | Read zero or more VCF records from the specified input stream . | 60 | 13 |
142,207 | private void cleanUp ( final DataSet ds ) { Set < String > indexedKeys = Sets . newHashSet ( ) ; for ( String key : ds . getDataView ( ) . keySet ( ) ) { // Search for indexed entries if ( key . contains ( "#" ) ) { // Remember key (without index) indexedKeys . add ( key . substring ( 0 , key . indexOf ( "#" ) ) ) ; } } // Remove all indexes for ( String indexedKey : indexedKeys ) { ds . removeValue ( indexedKey ) ; } } | Check DataSet for indexed entries and remove all keys without index if indexed entries with the same name exist . | 121 | 21 |
142,208 | public static MozuUrl getChildCategoriesUrl ( Integer categoryId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/categories/{categoryId}/children?responseFields={responseFields}" ) ; formatter . formatUrl ( "categoryId" , categoryId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for GetChildCategories | 128 | 9 |
142,209 | public static MozuUrl addCategoryUrl ( Boolean incrementSequence , String responseFields , Boolean useProvidedId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/categories/?incrementSequence={incrementSequence}&useProvidedId={useProvidedId}&responseFields={responseFields}" ) ; formatter . formatUrl ( "incrementSequence" , incrementSequence ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "useProvidedId" , useProvidedId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for AddCategory | 170 | 7 |
142,210 | public static MozuUrl addProductsToCategoryUrl ( Integer categoryId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/categories/{categoryId}/add-products" ) ; formatter . formatUrl ( "categoryId" , categoryId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for AddProductsToCategory | 100 | 9 |
142,211 | public static MozuUrl updateCategoryUrl ( Boolean cascadeVisibility , Integer categoryId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/categories/{categoryId}?cascadeVisibility={cascadeVisibility}&responseFields={responseFields}" ) ; formatter . formatUrl ( "cascadeVisibility" , cascadeVisibility ) ; formatter . formatUrl ( "categoryId" , categoryId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for UpdateCategory | 158 | 7 |
142,212 | public static MozuUrl deleteCategoryByIdUrl ( Boolean cascadeDelete , Integer categoryId , Boolean forceDelete , Boolean reassignToParent ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/categories/{categoryId}/?cascadeDelete={cascadeDelete}&forceDelete={forceDelete}&reassignToParent={reassignToParent}" ) ; formatter . formatUrl ( "cascadeDelete" , cascadeDelete ) ; formatter . formatUrl ( "categoryId" , categoryId ) ; formatter . formatUrl ( "forceDelete" , forceDelete ) ; formatter . formatUrl ( "reassignToParent" , reassignToParent ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for DeleteCategoryById | 188 | 8 |
142,213 | public static MozuUrl getDeliveryAttemptSummaryUrl ( Integer processId , String responseFields , String subscriptionId ) { UrlFormatter formatter = new UrlFormatter ( "/api/event/push/subscriptions/{subscriptionId}/deliveryattempts/{id}?responseFields={responseFields}" ) ; formatter . formatUrl ( "processId" , processId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "subscriptionId" , subscriptionId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for GetDeliveryAttemptSummary | 155 | 9 |
142,214 | public static void write ( final Hml data , final Writer writer ) throws IOException { checkNotNull ( data ) ; checkNotNull ( writer ) ; try { JAXBContext context = JAXBContext . newInstance ( Hml . class ) ; Marshaller marshaller = context . createMarshaller ( ) ; SchemaFactory schemaFactory = SchemaFactory . newInstance ( XMLConstants . W3C_XML_SCHEMA_NS_URI ) ; URL schemaURL = HmlReader . class . getResource ( "/org/nmdp/ngs/hml/xsd/hml-1.0.1.xsd" ) ; Schema schema = schemaFactory . newSchema ( schemaURL ) ; marshaller . setSchema ( schema ) ; marshaller . setProperty ( Marshaller . JAXB_FORMATTED_OUTPUT , true ) ; marshaller . marshal ( data , writer ) ; } catch ( JAXBException | SAXException e ) { e . printStackTrace ( ) ; throw new IOException ( "could not marshal HML" , e ) ; } } | Write the specified HML to the specified writer . | 252 | 10 |
142,215 | public static void write ( final Hml data , final File file ) throws IOException { checkNotNull ( data ) ; checkNotNull ( file ) ; try ( BufferedWriter writer = new BufferedWriter ( new FileWriter ( file ) ) ) { write ( data , writer ) ; } } | Write the specified HML to the specified file . | 62 | 10 |
142,216 | public static void write ( final Hml data , final OutputStream outputStream ) throws IOException { checkNotNull ( data ) ; checkNotNull ( outputStream ) ; try ( BufferedWriter writer = new BufferedWriter ( new OutputStreamWriter ( outputStream ) ) ) { write ( data , writer ) ; } } | Write the specified HML to the specified output stream . | 67 | 11 |
142,217 | public static MozuUrl getCurrencyExchangeRateUrl ( String currencyCode , String responseFields , String toCurrencyCode ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/currency/{currencyCode}/exchangerates/{toCurrencyCode}?responseFields={responseFields}" ) ; formatter . formatUrl ( "currencyCode" , currencyCode ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "toCurrencyCode" , toCurrencyCode ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for GetCurrencyExchangeRate | 164 | 11 |
142,218 | public static MozuUrl updateCurrencyLocalizationUrl ( String currencyCode , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/currency/{currencyCode}?responseFields={responseFields}" ) ; formatter . formatUrl ( "currencyCode" , currencyCode ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for UpdateCurrencyLocalization | 126 | 10 |
142,219 | public static MozuUrl deleteCurrencyLocalizationUrl ( String currencyCode ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/currency/{currencyCode}" ) ; formatter . formatUrl ( "currencyCode" , currencyCode ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for DeleteCurrencyLocalization | 95 | 10 |
142,220 | public static MozuUrl deleteCurrencyExchangeRateUrl ( String currencyCode , String toCurrencyCode ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/currency/{currencyCode}/exchangerates/{toCurrencyCode}" ) ; formatter . formatUrl ( "currencyCode" , currencyCode ) ; formatter . formatUrl ( "toCurrencyCode" , toCurrencyCode ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for DeleteCurrencyExchangeRate | 133 | 11 |
142,221 | public MailAccount reserveMailAccount ( final String accountReservationKey , final String pool ) { if ( pool == null && emailAddressPools . keySet ( ) . size ( ) > 1 ) { throw new IllegalStateException ( "No pool specified but multiple pools available." ) ; } String poolKey = pool == null ? defaultPool : pool ; List < MailAccount > addressPool = newArrayList ( emailAddressPools . get ( poolKey ) ) ; Collections . shuffle ( addressPool , random . getRandom ( ) ) ; return reserveAvailableMailAccount ( accountReservationKey , addressPool ) ; } | Reserves an available mail account from the specified pool under the specified reservation key . The method blocks until an account is available . | 128 | 25 |
142,222 | public MailAccount lookupUsedMailAccountForCurrentThread ( final String accountReservationKey ) { lock . lock ( ) ; try { Map < MailAccount , ThreadReservationKeyWrapper > usedAccountsForThread = filterValues ( usedAccounts , new CurrentThreadWrapperPredicate ( ) ) ; if ( ! usedAccountsForThread . isEmpty ( ) ) { for ( Entry < MailAccount , ThreadReservationKeyWrapper > entry : usedAccountsForThread . entrySet ( ) ) { if ( entry . getValue ( ) . accountReservationKey . equals ( accountReservationKey ) ) { return entry . getKey ( ) ; } } } return null ; } finally { lock . unlock ( ) ; } } | Looks up the mail account that is reserved for the current thread under the specified key . | 154 | 17 |
142,223 | public Set < MailAccount > getReservedMailAccountsForCurrentThread ( ) { lock . lock ( ) ; try { Map < MailAccount , ThreadReservationKeyWrapper > accountsForThread = filterValues ( usedAccounts , new CurrentThreadWrapperPredicate ( ) ) ; return ImmutableSet . copyOf ( accountsForThread . keySet ( ) ) ; } finally { lock . unlock ( ) ; } } | Gets the set of reserved mail accounts for the current thread . | 89 | 13 |
142,224 | public Set < String > getRegisteredAccountReservationKeysForCurrentThread ( ) { lock . lock ( ) ; try { Map < MailAccount , String > accountsForThread = transformValues ( filterValues ( usedAccounts , new CurrentThreadWrapperPredicate ( ) ) , new Function < ThreadReservationKeyWrapper , String > ( ) { @ Override public String apply ( final ThreadReservationKeyWrapper input ) { return input . accountReservationKey ; } } ) ; return ImmutableSet . copyOf ( accountsForThread . values ( ) ) ; } finally { lock . unlock ( ) ; } } | Gets the set of reservation key under which accounts are reserved for the current thread . | 129 | 17 |
142,225 | public void releaseAllMailAccountsForThread ( ) { log . info ( "Releasing all mail accounts for the current thread..." ) ; lock . lock ( ) ; try { for ( Iterator < Entry < MailAccount , ThreadReservationKeyWrapper > > it = usedAccounts . entrySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { ThreadReservationKeyWrapper wrapper = it . next ( ) . getValue ( ) ; if ( wrapper . thread == Thread . currentThread ( ) ) { it . remove ( ) ; } } condition . signalAll ( ) ; } finally { lock . unlock ( ) ; } } | Releases all reserved mail accounts for the current thread so they can be reused by other threads . Threads blocking on an attempt to reserved an account are notified . | 138 | 32 |
142,226 | public void releaseMailAccountForThread ( final MailAccount account ) { log . info ( "Releasing mail account for the current thread: {}" , account ) ; lock . lock ( ) ; try { ThreadReservationKeyWrapper wrapper = usedAccounts . get ( account ) ; if ( wrapper != null ) { if ( wrapper . thread == Thread . currentThread ( ) ) { log . debug ( "Releasing mail account: {}" , account ) ; usedAccounts . remove ( account ) ; condition . signalAll ( ) ; } else { log . warn ( "Cannot release a mail account reserved by a different thread: {}" , account ) ; } } } finally { lock . unlock ( ) ; } } | Releases the specified mail account for the current thread so it can be reused by another threads . Threads blocking on an attempt to reserved an account are notified . | 151 | 32 |
142,227 | public void releaseMailAccountForThread ( final String accountReservationKey ) { lock . lock ( ) ; try { MailAccount mailAccount = lookupUsedMailAccountForCurrentThread ( accountReservationKey ) ; releaseMailAccountForThread ( mailAccount ) ; } finally { lock . unlock ( ) ; } } | Releases the mail account reserved under the specified reservation key for the current thread so it can be reused by another threads . Threads blocking on an attempt to reserved an account are notified . | 64 | 37 |
142,228 | public static MozuUrl addProductSortDefinitionUrl ( String responseFields , Boolean useProvidedId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/productsortdefinitions/?useProvidedId={useProvidedId}&responseFields={responseFields}" ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "useProvidedId" , useProvidedId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for AddProductSortDefinition | 140 | 9 |
142,229 | public static MozuUrl updateProductSortDefinitionUrl ( Integer productSortDefinitionId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/productsortdefinitions/{productSortDefinitionId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "productSortDefinitionId" , productSortDefinitionId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for UpdateProductSortDefinition | 136 | 9 |
142,230 | public static MozuUrl deleteProductSortDefinitionUrl ( Integer productSortDefinitionId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/productsortdefinitions/{productSortDefinitionId}" ) ; formatter . formatUrl ( "productSortDefinitionId" , productSortDefinitionId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for DeleteProductSortDefinition | 105 | 9 |
142,231 | @ Override public boolean hasNextCase ( ) { for ( ConstraintWrap wrap : summands ) { if ( wrap . constraint . hasNextCase ( ) ) { return true ; } } return false ; } | Returns true if one of the sub - constraints still contains mandatory cases | 46 | 13 |
142,232 | public synchronized void registerHandler ( Object handler ) { boolean validClass = false ; if ( handler == null ) { throw new IllegalArgumentException ( "Null handler class" ) ; } // Get the implemented interfaces. This gets only the // directly implemented interfaces Class < ? > clazz = handler . getClass ( ) ; Class < ? > interfaces [ ] = clazz . getInterfaces ( ) ; for ( int i = 0 ; i < interfaces . length ; i ++ ) { String iName = interfaces [ i ] . getSimpleName ( ) ; // verify the interface is for an event interface if ( iName . contains ( EVENT_INTERFACE_SUFFIX ) ) { validClass = true ; String eventCategory = iName . substring ( 0 , iName . indexOf ( EVENT_INTERFACE_SUFFIX ) ) . toLowerCase ( ) ; // see if a handler has been registered for the interface type if ( eventHandlers . get ( eventCategory ) == null ) { eventHandlers . put ( eventCategory , handler ) ; } else { throw new ApiException ( "Handler already registered for event type " + iName ) ; } } } if ( ! validClass ) { throw new ApiException ( "Class is invalid, it does not implement any event interfaces: " + clazz . getName ( ) ) ; } } | Register an event handler . The registration looks at the interfaces that the handler implements . An entry is created in the event handler map for each event interface that is implemented . | 285 | 33 |
142,233 | public void merge ( OrderedIntDoubleMapping updates , DoubleDoubleFunction func ) { int [ ] updateIndices = updates . getIndices ( ) ; double [ ] updateValues = updates . getValues ( ) ; int newNumMappings = numMappings + updates . getNumMappings ( ) ; int newCapacity = Math . max ( ( int ) ( 1.2 * newNumMappings ) , newNumMappings + 1 ) ; int [ ] newIndices = new int [ newCapacity ] ; double [ ] newValues = new double [ newCapacity ] ; int k = 0 ; int i = 0 , j = 0 ; for ( ; i < numMappings && j < updates . getNumMappings ( ) ; ++ k ) { if ( indices [ i ] < updateIndices [ j ] ) { newIndices [ k ] = indices [ i ] ; newValues [ k ] = func . apply ( values [ i ] , 0 ) ; ++ i ; } else if ( indices [ i ] > updateIndices [ j ] ) { newIndices [ k ] = updateIndices [ j ] ; newValues [ k ] = func . apply ( 0 , updateValues [ j ] ) ; ++ j ; } else { newIndices [ k ] = updateIndices [ j ] ; newValues [ k ] = func . apply ( values [ i ] , updateValues [ j ] ) ; ++ i ; ++ j ; } } if ( i < numMappings ) { int delta = numMappings - i ; System . arraycopy ( indices , i , newIndices , k , delta ) ; System . arraycopy ( values , i , newValues , k , delta ) ; k += delta ; } if ( j < updates . getNumMappings ( ) ) { int delta = updates . getNumMappings ( ) - j ; System . arraycopy ( updateIndices , j , newIndices , k , delta ) ; System . arraycopy ( updateValues , j , newValues , k , delta ) ; k += delta ; } indices = newIndices ; values = newValues ; numMappings = k ; } | Merges the updates in linear time by allocating new arrays and iterating through the existing indices and values and the updates indices and values at the same time while selecting the minimum index to set at each step . | 458 | 42 |
142,234 | public Field createField ( final MathRandom random , final Element element , final String characterSetId ) { Field field = null ; Element fieldElement = null ; Element fieldRefElement = element . getChild ( XMLTags . FIELD_REF ) ; if ( fieldRefElement != null ) { fieldElement = getElementFinder ( element ) . findElementById ( fieldRefElement ) ; } else { fieldElement = element . getChild ( XMLTags . FIELD ) ; } checkState ( fieldElement != null , "Could not find a Field tag or FieldRef tag" ) ; Class < ? extends Field > classObject = null ; try { classObject = getClassObject ( fieldElement ) ; Constructor < ? extends Field > constructor = classObject . getConstructor ( new Class [ ] { MathRandom . class , Element . class , String . class } ) ; field = constructor . newInstance ( new Object [ ] { random , fieldElement , characterSetId } ) ; } catch ( Exception e ) { throw new IllegalStateException ( "Could not initialise object of class " + classObject , e ) ; } return field ; } | Searches for the Field Child tag in the specified element or takes the Field_Ref Tag and generates a new field instance based on the tag data . So this method has to be called with an element as parameter that contains a field or a field_ref element respectively . | 238 | 55 |
142,235 | private Class < ? extends Field > getClassObject ( final Element element ) { String className = element . getAttributeValue ( XMLTags . CLASS ) ; Class < ? extends Field > classObject = null ; try { className = className . indexOf ( ' ' ) > 0 ? className : getClass ( ) . getPackage ( ) . getName ( ) + ' ' + className ; classObject = Class . forName ( className ) . asSubclass ( Field . class ) ; } catch ( ClassNotFoundException e ) { throw new IllegalStateException ( "could not get class " + className , e ) ; } return classObject ; } | This method returns the class object from which a new instance shall be generated . To achieve this the class attribute of the passed element is taken to determine the class name . | 140 | 33 |
142,236 | public static PointLocation parsePointLocation ( final String representation ) throws ParserException { if ( StringUtils . isBlank ( representation ) ) { throw new ParserException ( "No point location value provided" ) ; } if ( ! StringUtils . endsWith ( representation , "/" ) ) { throw new ParserException ( "Point location value must be terminated with /" ) ; } final PointLocationParser parser = new PointLocationParser ( ) ; final CoordinateParser coordinateParser = new CoordinateParser ( ) ; // Split by group final List < String > tokens = parser . split ( representation ) ; if ( tokens . size ( ) != 4 ) { throw new ParserException ( "Cannot parse " + representation ) ; } final Latitude latitude = coordinateParser . parseLatitude ( tokens . get ( 0 ) ) ; final Longitude longitude = coordinateParser . parseLongitude ( tokens . get ( 1 ) ) ; final double altitude = NumberUtils . toDouble ( tokens . get ( 2 ) ) ; final String coordinateReferenceSystemIdentifier = StringUtils . trimToEmpty ( tokens . get ( 3 ) ) ; final PointLocation pointLocation = new PointLocation ( latitude , longitude , altitude , coordinateReferenceSystemIdentifier ) ; return pointLocation ; } | Parses a string representation of the point location . | 268 | 11 |
142,237 | public static MozuUrl getPropertyValueLocalizedContentsUrl ( String attributeFQN , String productCode , String value ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/products/{productCode}/Properties/{attributeFQN}/values/{value}/LocalizedContent" ) ; formatter . formatUrl ( "attributeFQN" , attributeFQN ) ; formatter . formatUrl ( "productCode" , productCode ) ; formatter . formatUrl ( "value" , value ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for GetPropertyValueLocalizedContents | 158 | 11 |
142,238 | public static MozuUrl deletePropertyUrl ( String attributeFQN , String productCode ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/products/{productCode}/Properties/{attributeFQN}" ) ; formatter . formatUrl ( "attributeFQN" , attributeFQN ) ; formatter . formatUrl ( "productCode" , productCode ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for DeleteProperty | 127 | 7 |
142,239 | public static MozuUrl getProductsUrl ( String cursorMark , String defaultSort , String filter , Integer pageSize , String responseFields , String responseOptions , String sortBy , Integer startIndex ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/storefront/products/?filter={filter}&startIndex={startIndex}&pageSize={pageSize}&sortBy={sortBy}&responseOptions={responseOptions}&cursorMark={cursorMark}&defaultSort={defaultSort}&responseFields={responseFields}" ) ; formatter . formatUrl ( "cursorMark" , cursorMark ) ; formatter . formatUrl ( "defaultSort" , defaultSort ) ; formatter . formatUrl ( "filter" , filter ) ; formatter . formatUrl ( "pageSize" , pageSize ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "responseOptions" , responseOptions ) ; formatter . formatUrl ( "sortBy" , sortBy ) ; formatter . formatUrl ( "startIndex" , startIndex ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for GetProducts | 280 | 7 |
142,240 | public static MozuUrl getProductInventoryUrl ( String locationCodes , String productCode , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/storefront/products/{productCode}/locationinventory?locationCodes={locationCodes}&responseFields={responseFields}" ) ; formatter . formatUrl ( "locationCodes" , locationCodes ) ; formatter . formatUrl ( "productCode" , productCode ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for GetProductInventory | 160 | 9 |
142,241 | public static MozuUrl getProductUrl ( Boolean acceptVariantProductCode , Boolean allowInactive , String productCode , String purchaseLocation , Integer quantity , String responseFields , Boolean skipInventoryCheck , Boolean supressOutOfStock404 , String variationProductCode , String variationProductCodeFilter ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/storefront/products/{productCode}?variationProductCode={variationProductCode}&allowInactive={allowInactive}&skipInventoryCheck={skipInventoryCheck}&supressOutOfStock404={supressOutOfStock404}&quantity={quantity}&acceptVariantProductCode={acceptVariantProductCode}&purchaseLocation={purchaseLocation}&variationProductCodeFilter={variationProductCodeFilter}&responseFields={responseFields}" ) ; formatter . formatUrl ( "acceptVariantProductCode" , acceptVariantProductCode ) ; formatter . formatUrl ( "allowInactive" , allowInactive ) ; formatter . formatUrl ( "productCode" , productCode ) ; formatter . formatUrl ( "purchaseLocation" , purchaseLocation ) ; formatter . formatUrl ( "quantity" , quantity ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "skipInventoryCheck" , skipInventoryCheck ) ; formatter . formatUrl ( "supressOutOfStock404" , supressOutOfStock404 ) ; formatter . formatUrl ( "variationProductCode" , variationProductCode ) ; formatter . formatUrl ( "variationProductCodeFilter" , variationProductCodeFilter ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for GetProduct | 404 | 7 |
142,242 | public static MozuUrl getProductForIndexingUrl ( DateTime lastModifiedDate , String productCode , Long productVersion , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/storefront/products/indexing/{productCode}?productVersion={productVersion}&lastModifiedDate={lastModifiedDate}&responseFields={responseFields}" ) ; formatter . formatUrl ( "lastModifiedDate" , lastModifiedDate ) ; formatter . formatUrl ( "productCode" , productCode ) ; formatter . formatUrl ( "productVersion" , productVersion ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for GetProductForIndexing | 193 | 10 |
142,243 | public static MozuUrl configuredProductUrl ( Boolean includeOptionDetails , String productCode , String purchaseLocation , Integer quantity , String responseFields , Boolean skipInventoryCheck , String variationProductCodeFilter ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/storefront/products/{productCode}/configure?includeOptionDetails={includeOptionDetails}&skipInventoryCheck={skipInventoryCheck}&quantity={quantity}&purchaseLocation={purchaseLocation}&variationProductCodeFilter={variationProductCodeFilter}&responseFields={responseFields}" ) ; formatter . formatUrl ( "includeOptionDetails" , includeOptionDetails ) ; formatter . formatUrl ( "productCode" , productCode ) ; formatter . formatUrl ( "purchaseLocation" , purchaseLocation ) ; formatter . formatUrl ( "quantity" , quantity ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "skipInventoryCheck" , skipInventoryCheck ) ; formatter . formatUrl ( "variationProductCodeFilter" , variationProductCodeFilter ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for ConfiguredProduct | 286 | 8 |
142,244 | public static MozuUrl validateProductUrl ( String productCode , String purchaseLocation , Integer quantity , String responseFields , Boolean skipDefaults , Boolean skipInventoryCheck ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/storefront/products/{productCode}/validate?skipInventoryCheck={skipInventoryCheck}&quantity={quantity}&skipDefaults={skipDefaults}&purchaseLocation={purchaseLocation}&responseFields={responseFields}" ) ; formatter . formatUrl ( "productCode" , productCode ) ; formatter . formatUrl ( "purchaseLocation" , purchaseLocation ) ; formatter . formatUrl ( "quantity" , quantity ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "skipDefaults" , skipDefaults ) ; formatter . formatUrl ( "skipInventoryCheck" , skipInventoryCheck ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for ValidateProduct | 247 | 8 |
142,245 | public static MozuUrl validateDiscountsUrl ( Boolean allowInactive , Integer customerAccountId , String productCode , String responseFields , Boolean skipInventoryCheck , String variationProductCode ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/storefront/products/{productCode}/validateDiscounts?variationProductCode={variationProductCode}&customerAccountId={customerAccountId}&allowInactive={allowInactive}&skipInventoryCheck={skipInventoryCheck}&responseFields={responseFields}" ) ; formatter . formatUrl ( "allowInactive" , allowInactive ) ; formatter . formatUrl ( "customerAccountId" , customerAccountId ) ; formatter . formatUrl ( "productCode" , productCode ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "skipInventoryCheck" , skipInventoryCheck ) ; formatter . formatUrl ( "variationProductCode" , variationProductCode ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for ValidateDiscounts | 267 | 10 |
142,246 | public static MozuUrl getLocationInventoryUrl ( String locationCode , String productCode , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/locationinventory/{locationCode}/{productCode}?responseFields={responseFields}" ) ; formatter . formatUrl ( "locationCode" , locationCode ) ; formatter . formatUrl ( "productCode" , productCode ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for GetLocationInventory | 150 | 9 |
142,247 | public static MozuUrl addLocationInventoryUrl ( String locationCode , Boolean performUpserts ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/locationinventory/{locationCode}?performUpserts={performUpserts}" ) ; formatter . formatUrl ( "locationCode" , locationCode ) ; formatter . formatUrl ( "performUpserts" , performUpserts ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for AddLocationInventory | 139 | 9 |
142,248 | public static MozuUrl deleteLocationInventoryUrl ( String locationCode , String productCode ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/locationinventory/{locationCode}/{productCode}" ) ; formatter . formatUrl ( "locationCode" , locationCode ) ; formatter . formatUrl ( "productCode" , productCode ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for DeleteLocationInventory | 119 | 9 |
142,249 | public static MozuUrl getOrderNotesUrl ( String orderId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/orders/{orderId}/notes" ) ; formatter . formatUrl ( "orderId" , orderId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for GetOrderNotes | 91 | 8 |
142,250 | public static MozuUrl getOrderNoteUrl ( String noteId , String orderId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/orders/{orderId}/notes/{noteId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "noteId" , noteId ) ; formatter . formatUrl ( "orderId" , orderId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for GetOrderNote | 145 | 8 |
142,251 | public static MozuUrl deleteOrderNoteUrl ( String noteId , String orderId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/orders/{orderId}/notes/{noteId}" ) ; formatter . formatUrl ( "noteId" , noteId ) ; formatter . formatUrl ( "orderId" , orderId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for DeleteOrderNote | 114 | 8 |
142,252 | @ Override public Set < String > getContainedIds ( ) { Set < String > s = super . getContainedIds ( ) ; s . addAll ( constraint . getContainedIds ( ) ) ; return s ; } | Returns the set of constained ids . This Set contains all ids of the embedded constraint plus its own if this is set . | 52 | 27 |
142,253 | private void purgeSmsOlderThan ( final Date date ) { logger . debug ( "Starting purge of SMS table with parameter : \n" + " - date : " + date ) ; final int nbSmsDeleted = daoService . deleteSmsOlderThan ( date ) ; logger . debug ( "End purge of SMS table, result : \n" + " - number of sms deleted : " + nbSmsDeleted ) ; } | Purge the Sms in db with date older than the specified date . | 101 | 15 |
142,254 | public static MozuUrl updateExtendedPropertyUrl ( String key , String responseFields , Boolean upsert ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/carts/current/extendedproperties/{key}?upsert={upsert}&responseFields={responseFields}" ) ; formatter . formatUrl ( "key" , key ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "upsert" , upsert ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for UpdateExtendedProperty | 149 | 9 |
142,255 | public static MozuUrl updateExtendedPropertiesUrl ( Boolean upsert ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/carts/current/extendedproperties?upsert={upsert}" ) ; formatter . formatUrl ( "upsert" , upsert ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for UpdateExtendedProperties | 99 | 10 |
142,256 | public static MozuUrl deleteExtendedPropertiesUrl ( ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/carts/current/extendedproperties" ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for DeleteExtendedProperties | 75 | 10 |
142,257 | @ Override protected String initValuesImpl ( final FieldCase ca ) { if ( ca == FieldCase . NULL || ca == FieldCase . BLANK ) { return null ; } String s = super . initValuesImpl ( ca ) ; int counter = 10000 ; while ( set . contains ( s ) && counter > 0 ) { s = super . initValuesImpl ( ca ) ; counter -- ; } if ( counter == 0 ) { throw new IllegalStateException ( "Could not generate unique value" ) ; } set . add ( s ) ; return s ; } | Calls initValuesImpl on the super class . If the returned value is already in the list of values initValuesImpl is called again . This happens up to 10000 times . If a new value is found it is stored in the set . | 117 | 48 |
142,258 | @ Override public int getMaxLength ( ) { int max = - 1 ; for ( Constraint c : constraints ) { int cM = c . getMaxLength ( ) ; if ( max < cM ) { max = cM ; } } return max ; } | Returns the maximum of all embedded constraints . | 58 | 8 |
142,259 | @ Override public String initValues ( final FieldCase ca ) { if ( ca != null ) { /* * If a FieldCase is given all fields will be generated anew, independent of the case * combination. */ for ( Constraint c : constraints ) { c . resetValues ( ) ; } } for ( Constraint c : constraints ) { c . initValues ( ca ) ; } return null ; } | Initializes all subconstraints . | 86 | 8 |
142,260 | @ Override public void resetValues ( ) { int length = constraints . size ( ) ; for ( int i = length - 1 ; i >= 0 ; i -- ) { Constraint c = constraints . get ( i ) ; c . resetValues ( ) ; if ( dependent && c . hasNextCase ( ) ) { // reset all constraints below // only if the constraint above still has a case to be processed for ( int j = i + 1 ; j < length ; j ++ ) { constraints . get ( j ) . resetCase ( ) ; } break ; } } } | Resets the values of the sub - constraints . To achieve this the list of sub - constraints is passed backwards . If all sub - constraints are independent of each other simply all sub - constraints will be reset . However if they are dependent the case of all constraints in the list below the first constraint which still has to process a test case will be reset and the run will be canceled . This way all the cases of the last sub - constraints will be run first . Then the next case will be called in the penultimate sub - constraint . Again all cases of the last one will be run etc . | 121 | 120 |
142,261 | public char [ ] getCharacters ( final int size , final int bad ) { if ( size == 0 ) { return new char [ 0 ] ; } char [ ] chars = new char [ size ] ; for ( int i = 0 ; i < chars . length ; i ++ ) { chars [ i ] = field . getAllowedCharacter ( ) ; } // remove leading blanks for ( int i = 0 ; i < 10 && Character . isSpaceChar ( chars [ 0 ] ) ; i ++ ) { chars [ 0 ] = field . getAllowedCharacter ( ) ; } // remove trailing blanks for ( int i = 0 ; i < 10 && Character . isSpaceChar ( chars [ chars . length - 1 ] ) ; i ++ ) { chars [ chars . length - 1 ] = field . getAllowedCharacter ( ) ; } int toBeReplaced = bad ; if ( - 2 == bad ) { if ( ! canBad ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "This node does not allow negative characters, " + "but as all characters shall be negative no character is returned" ) ; } return new char [ 0 ] ; } toBeReplaced = chars . length ; } else if ( - 1 == bad ) { // 1 - (all -1) characters are replaced toBeReplaced = 1 + rnd . getInt ( chars . length - 2 ) ; } if ( toBeReplaced > 0 ) { // create a random index list List < Integer > l = new ArrayList < Integer > ( chars . length ) ; for ( int i = 0 ; i < chars . length ; i ++ ) { l . add ( i ) ; } Collections . shuffle ( l ) ; for ( int i = 0 ; i < toBeReplaced ; i ++ ) { int index = l . remove ( 0 ) ; Character currentBad = field . getForbiddenCharacter ( ) ; if ( currentBad == null ) { log . warn ( "This node does not allow negative characters" ) ; break ; } // The first and the last character as a forbidden character is not a space! // this would usually shorten the length if ( index == 0 || index == chars . length - 1 ) { int counter = 0 ; while ( counter < 100 && Character . isSpaceChar ( currentBad ) ) { currentBad = field . getForbiddenCharacter ( ) ; counter ++ ; } if ( counter == 100 ) { log . warn ( "Space is the only possible forbidden character for this node, no replacement!" ) ; break ; } } if ( log . isDebugEnabled ( ) ) { log . debug ( "Replace Character " + Character . toString ( chars [ index ] ) + " with " + Character . toString ( currentBad ) ) ; } chars [ index ] = currentBad ; } } return chars ; } | Returns size characters in an array . If bad is set to true at least half of all the characters will be set to a forbidden character . | 604 | 28 |
142,262 | public static MozuUrl getThirdPartyPaymentWorkflowWithValuesUrl ( String fullyQualifiedName , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/settings/checkout/paymentsettings/thirdpartyworkflow/{fullyQualifiedName}?responseFields={responseFields}" ) ; formatter . formatUrl ( "fullyQualifiedName" , fullyQualifiedName ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for GetThirdPartyPaymentWorkflowWithValues | 145 | 14 |
142,263 | public static MozuUrl getThirdPartyPaymentWorkflowsUrl ( ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/settings/checkout/paymentsettings/thirdpartyworkflows" ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for GetThirdPartyPaymentWorkflows | 82 | 12 |
142,264 | public static MozuUrl addThirdPartyPaymentWorkflowUrl ( ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/settings/checkout/paymentsettings/thirdpartyworkflows" ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for AddThirdPartyPaymentWorkflow | 82 | 12 |
142,265 | public static MozuUrl deleteThirdPartyPaymentWorkflowUrl ( String fullyQualifiedName ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/settings/checkout/paymentsettings/thirdpartyworkflows/{fullyQualifiedName}" ) ; formatter . formatUrl ( "fullyQualifiedName" , fullyQualifiedName ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for DeleteThirdPartyPaymentWorkflow | 112 | 12 |
142,266 | public static MozuUrl getAvailableDigitalPackageFulfillmentActionsUrl ( String digitalPackageId , String orderId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/orders/{orderId}/digitalpackages/{digitalPackageId}/actions" ) ; formatter . formatUrl ( "digitalPackageId" , digitalPackageId ) ; formatter . formatUrl ( "orderId" , orderId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for GetAvailableDigitalPackageFulfillmentActions | 129 | 15 |
142,267 | public static MozuUrl getDigitalPackageUrl ( String digitalPackageId , String orderId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/orders/{orderId}/digitalpackages/{digitalPackageId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "digitalPackageId" , digitalPackageId ) ; formatter . formatUrl ( "orderId" , orderId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for GetDigitalPackage | 150 | 8 |
142,268 | @ Cmd public Reporter registerReporter ( final Reporter reporter ) { injector . injectMembers ( reporter ) ; reporters . add ( reporter ) ; return reporter ; } | Registers a reporter . | 34 | 5 |
142,269 | @ Cmd public File chooseFile ( final String fileKey ) { log . debug ( "Opening file chooser dialog" ) ; JFileChooser fileChooser = new JFileChooser ( System . getProperty ( JFunkConstants . USER_DIR ) ) ; fileChooser . setFileSelectionMode ( JFileChooser . FILES_AND_DIRECTORIES ) ; fileChooser . setPreferredSize ( new Dimension ( 600 , 326 ) ) ; int fileChooserResult = fileChooser . showOpenDialog ( null ) ; if ( fileChooserResult == JFileChooser . APPROVE_OPTION ) { File file = fileChooser . getSelectedFile ( ) ; String filename = file . toString ( ) ; log . info ( "Assigning file path '{}' to property '{}'" , filename , fileKey ) ; config . put ( fileKey , filename ) ; return file ; } log . error ( "No file or directory was chosen, execution will abort" ) ; throw new IllegalArgumentException ( "No file or directory was chosen" ) ; } | Opens a file chooser dialog which can then be used to choose a file or directory and assign the path of the chosen object to a variable . The name of the variable must be passed as a parameter . | 240 | 42 |
142,270 | @ Cmd public String chooseRandom ( final String propertyKey , final List < String > randomValues ) { Randomizable < String > choice = new RandomCollection <> ( random , randomValues ) ; String currentValue = choice . get ( ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Chosen value: " + currentValue ) ; } currentValue = resolveProperty ( currentValue ) ; config . put ( propertyKey , currentValue ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "... value for '{}' was set to {}" , propertyKey , currentValue ) ; } return currentValue ; } | Randomly selects an item from a list of Strings . List items may contain placeholder tokens . The result is stored in the configuration under the specified key and also returned by this method . | 140 | 37 |
142,271 | @ Cmd public void module ( final String moduleName , final Map < ? , ? > attributes , final Closure < Void > closure ) { moduleBuilderProvider . get ( ) . invokeMethod ( "module" , newArrayList ( moduleName , attributes , closure ) ) ; } | Creates and runs a dynamic script module . | 59 | 9 |
142,272 | @ Cmd public void onError ( final Closure < Void > closure ) { int errorCount = errors . size ( ) ; if ( errorCount > 0 ) { log . info ( errorCount + " error" + ( errorCount == 1 ? "" : "s" ) + " in list --> executing block" ) ; closure . call ( ) ; log . info ( "Finished OnError block" ) ; } else { log . info ( "No errors in list --> skipping block" ) ; } } | Executes the specified closure if at least one exception had previously been recorded in the currently executing script . | 107 | 20 |
142,273 | @ Cmd public void optional ( final Closure < Void > closure ) { log . info ( "Executing optional block ..." ) ; try { closure . call ( ) ; } catch ( final Exception ex ) { log . error ( "Exception executing optional block: " + ex . getMessage ( ) , ex ) ; errors . add ( ex ) ; } catch ( AssertionError err ) { log . error ( "Assertion failed executing optional block: " + err . getMessage ( ) , err ) ; errors . add ( err ) ; } log . info ( "... finished execution of optional block" ) ; } | Runs the specified closure catching any exception that might occur during execution . | 130 | 14 |
142,274 | @ Cmd public void processCsvFile ( final String csvFile , final String delimiter , final char quoteChar , final Charset charset , final Closure < Void > closure ) { File f = new File ( csvFile ) ; try { config . extractFromArchive ( f , true ) ; checkState ( f . exists ( ) , "CSV file not found: " + f ) ; Reader reader = Files . newReader ( f , charset == null ? defaultCharset : charset ) ; csvDataProcessor . processFile ( reader , delimiter , quoteChar , closure ) ; } catch ( IOException ex ) { throw new IllegalStateException ( "Error reading CSV file: " + f , ex ) ; } } | Processes a CSV file . | 161 | 6 |
142,275 | @ Cmd public String prompt ( final String configKey , final String message ) { System . out . print ( resolveProperty ( message ) + " " ) ; //NOSONAR BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String value = StringUtils . trim ( in . readLine ( ) ) ; config . put ( configKey , value ) ; return value ; // Stream nicht schliessen } catch ( IOException ex ) { throw new IllegalStateException ( ex ) ; } } | Prompts for closure - line input . the input is stored in the configuration under the specified key . | 117 | 21 |
142,276 | public Rectangle intersection ( Rectangle other ) { int left = Math . max ( this . left , other . left ) ; int top = Math . max ( this . top , other . top ) ; int right = Math . min ( this . right , other . right ) ; int bottom = Math . min ( this . bottom , other . bottom ) ; if ( right >= left && bottom >= top ) { int height = bottom - top ; int width = right - left ; return new Rectangle ( top , left , bottom , right , width , height ) ; } else { return null ; } } | Returns the intersection with the other rectangle or null if the two rectangles do not intersect . | 125 | 18 |
142,277 | public static MozuUrl deleteChannelUrl ( String code ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/channels/{code}" ) ; formatter . formatUrl ( "code" , code ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for DeleteChannel | 84 | 7 |
142,278 | public static String getMemoryInfo ( final Unit unit ) { final long [ ] memory = getMemoryInfo ( ) ; for ( final Type type : Type . values ( ) ) { memory [ type . ordinal ( ) ] /= unit . getDenominator ( ) ; } final StringBuilder sb = new StringBuilder ( 100 ) ; sb . append ( "Memory (free/total/max): " ) ; sb . append ( memory [ Type . FREE . ordinal ( ) ] ) ; sb . append ( unit . getUnitString ( ) ) ; sb . append ( "/" ) ; sb . append ( memory [ Type . TOTAL . ordinal ( ) ] ) ; sb . append ( unit . getUnitString ( ) ) ; sb . append ( "/" ) ; sb . append ( memory [ Type . MAX . ordinal ( ) ] ) ; sb . append ( unit . getUnitString ( ) ) ; return sb . toString ( ) ; } | Get information about the current memory status of the JVM . | 212 | 12 |
142,279 | public static MozuUrl transformDocumentContentUrl ( String crop , String documentId , String documentListName , Integer height , Integer max , Integer maxHeight , Integer maxWidth , Integer quality , Integer width ) { UrlFormatter formatter = new UrlFormatter ( "/api/content/documentlists/{documentListName}/documents/{documentId}/transform?width={width}&height={height}&maxWidth={maxWidth}&maxHeight={maxHeight}&crop={crop}&quality={quality}" ) ; formatter . formatUrl ( "crop" , crop ) ; formatter . formatUrl ( "documentId" , documentId ) ; formatter . formatUrl ( "documentListName" , documentListName ) ; formatter . formatUrl ( "height" , height ) ; formatter . formatUrl ( "max" , max ) ; formatter . formatUrl ( "maxHeight" , maxHeight ) ; formatter . formatUrl ( "maxWidth" , maxWidth ) ; formatter . formatUrl ( "quality" , quality ) ; formatter . formatUrl ( "width" , width ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for TransformDocumentContent | 274 | 8 |
142,280 | public static MozuUrl getDocumentUrl ( String documentId , String documentListName , Boolean includeInactive , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/content/documentlists/{documentListName}/documents/{documentId}?includeInactive={includeInactive}&responseFields={responseFields}" ) ; formatter . formatUrl ( "documentId" , documentId ) ; formatter . formatUrl ( "documentListName" , documentListName ) ; formatter . formatUrl ( "includeInactive" , includeInactive ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for GetDocument | 181 | 7 |
142,281 | public static MozuUrl updateDocumentUrl ( String documentId , String documentListName , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/content/documentlists/{documentListName}/documents/{documentId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "documentId" , documentId ) ; formatter . formatUrl ( "documentListName" , documentListName ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for UpdateDocument | 150 | 7 |
142,282 | public static MozuUrl deleteDocumentUrl ( String documentId , String documentListName ) { UrlFormatter formatter = new UrlFormatter ( "/api/content/documentlists/{documentListName}/documents/{documentId}" ) ; formatter . formatUrl ( "documentId" , documentId ) ; formatter . formatUrl ( "documentListName" , documentListName ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for DeleteDocument | 119 | 7 |
142,283 | public static MozuUrl deleteCouponUrl ( String couponCode , String couponSetCode ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/couponsets/{couponSetCode}/couponcodes/{couponCode}" ) ; formatter . formatUrl ( "couponCode" , couponCode ) ; formatter . formatUrl ( "couponSetCode" , couponSetCode ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for DeleteCoupon | 138 | 9 |
142,284 | public static String about ( ) { final StringBuffer about = new StringBuffer ( ) ; about . append ( getProductName ( ) ) . append ( " " ) . append ( getVersion ( ) ) . append ( "\n" ) . append ( "\u00A9 2007-2014 Sualeh Fatehi" ) ; //$NON-NLS-2$ return new String ( about ) ; } | Information about this product . | 86 | 5 |
142,285 | public static HighScoringPair valueOf ( final String value ) { checkNotNull ( value ) ; List < String > tokens = Splitter . on ( "\t" ) . trimResults ( ) . splitToList ( value ) ; if ( tokens . size ( ) != 12 ) { throw new IllegalArgumentException ( "value must have twelve fields" ) ; } String source = tokens . get ( 0 ) . trim ( ) ; String target = tokens . get ( 1 ) . trim ( ) ; double percentIdentity = Double . parseDouble ( tokens . get ( 2 ) . trim ( ) ) ; long alignmentLength = Long . parseLong ( tokens . get ( 3 ) . trim ( ) ) ; int mismatches = Integer . parseInt ( tokens . get ( 4 ) . trim ( ) ) ; int gapOpens = Integer . parseInt ( tokens . get ( 5 ) . trim ( ) ) ; long sourceStart = Long . parseLong ( tokens . get ( 6 ) . trim ( ) ) ; long sourceEnd = Long . parseLong ( tokens . get ( 7 ) . trim ( ) ) ; long targetStart = Long . parseLong ( tokens . get ( 8 ) . trim ( ) ) ; long targetEnd = Long . parseLong ( tokens . get ( 9 ) . trim ( ) ) ; double evalue = Double . parseDouble ( tokens . get ( 10 ) . trim ( ) ) ; double bitScore = Double . parseDouble ( tokens . get ( 11 ) . trim ( ) ) ; return new HighScoringPair ( source , target , percentIdentity , alignmentLength , mismatches , gapOpens , sourceStart , sourceEnd , targetStart , targetEnd , evalue , bitScore ) ; } | Return a new high scoring pair parsed from the specified value . | 364 | 12 |
142,286 | @ Override public void exitScope ( ) { Map < Key < ? > , Object > scopeMap = scopeStackCache . get ( ) . peek ( ) ; performDisposal ( scopeMap ) ; scopeStackCache . get ( ) . pop ( ) ; log . debug ( "Exited scope." ) ; } | Exists the scope context of the current thread by popping the context s map off the internal stack . | 66 | 20 |
142,287 | public static MozuUrl removeAllMessagesUrl ( ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/carts/current/messages" ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for RemoveAllMessages | 73 | 9 |
142,288 | public static MozuUrl removeMessageUrl ( String messageId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/carts/current/messages/{messageId}" ) ; formatter . formatUrl ( "messageId" , messageId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for RemoveMessage | 93 | 7 |
142,289 | @ Override public E get ( ) { if ( originalElements . isEmpty ( ) ) { return null ; } if ( ! priorityElements . isEmpty ( ) ) { return priorityElements . remove ( 0 ) ; } if ( currentElements . size ( ) <= originalElements . size ( ) ) { currentElements . addAll ( originalElements ) ; } int index = random . getInt ( currentElements . size ( ) - 1 ) ; return currentElements . remove ( index ) ; } | Returns the next random element . | 111 | 6 |
142,290 | @ Override public void reset ( ) { this . priorityElements = Lists . newArrayList ( originalElements ) ; Collections . shuffle ( priorityElements ) ; this . currentElements = Lists . newArrayListWithExpectedSize ( 2 * originalElements . size ( ) ) ; this . currentElements . addAll ( originalElements ) ; } | Resets this object so it behaves like a newly constructed instance . | 77 | 13 |
142,291 | public static MozuUrl getWishlistByNameUrl ( Integer customerAccountId , String responseFields , String wishlistName ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/wishlists/customers/{customerAccountId}/{wishlistName}?responseFields={responseFields}" ) ; formatter . formatUrl ( "customerAccountId" , customerAccountId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "wishlistName" , wishlistName ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for GetWishlistByName | 163 | 11 |
142,292 | public static MozuUrl updateWishlistUrl ( String responseFields , String wishlistId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/wishlists/{wishlistId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "wishlistId" , wishlistId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for UpdateWishlist | 128 | 9 |
142,293 | public static MozuUrl getApplicationUrl ( String appId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/applications/{appId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "appId" , appId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for GetApplication | 120 | 7 |
142,294 | public double [ ] getColumn ( int col ) { double [ ] column = new double [ numRows ] ; int offset = translate ( 0 , col , numRows ) ; for ( int i = 0 ; i < column . length ; i ++ ) { column [ i ] = matrix [ offset + i ] ; } return column ; } | Gets a whole column of the matrix as a double array . | 72 | 13 |
142,295 | public double [ ] getRow ( int row ) { double [ ] rowArray = new double [ getColumnCount ( ) ] ; for ( int i = 0 ; i < getColumnCount ( ) ; i ++ ) { rowArray [ i ] = get ( row , i ) ; } return rowArray ; } | Get a single row of the matrix as a double array . | 65 | 12 |
142,296 | public void setRow ( int row , double [ ] value ) { for ( int i = 0 ; i < value . length ; i ++ ) { this . matrix [ translate ( row , i , numRows ) ] = value [ i ] ; } } | Sets the row to a given double array . | 54 | 10 |
142,297 | public void setColumn ( int col , double [ ] values ) { int offset = translate ( 0 , col , numRows ) ; System . arraycopy ( values , 0 , matrix , offset , values . length ) ; } | Sets the column to a given double array . | 47 | 10 |
142,298 | public static MozuUrl getCartUrl ( String cartId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/carts/{cartId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "cartId" , cartId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for GetCart | 119 | 7 |
142,299 | public static MozuUrl getUserCartSummaryUrl ( String responseFields , String userId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/carts/user/{userId}/summary?responseFields={responseFields}" ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "userId" , userId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; } | Get Resource Url for GetUserCartSummary | 125 | 9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.