idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
18,500
public static MozuUrl addAttributeVocabularyValueUrl ( String attributeFQN , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/VocabularyValues?responseFields={responseFields}" ) ; formatter . formatUrl ( "attributeFQN" , attributeFQN ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for AddAttributeVocabularyValue
18,501
public static MozuUrl updateAttributeVocabularyValueUrl ( String attributeFQN , String responseFields , String value ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/VocabularyValues/{value}?responseFields={responseFields}" ) ; formatter . formatUrl ( "attributeFQN" , attributeFQN ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "value" , value ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for UpdateAttributeVocabularyValue
18,502
public static MozuUrl deleteAttributeVocabularyValueLocalizedContentUrl ( String attributeFQN , String localeCode , String value ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/VocabularyValues/{value}/LocalizedContent/{localeCode}" ) ; formatter . formatUrl ( "attributeFQN" , attributeFQN ) ; formatter . formatUrl ( "localeCode" , localeCode ) ; formatter . formatUrl ( "value" , value ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for DeleteAttributeVocabularyValueLocalizedContent
18,503
public static MozuUrl updateCheckoutAttributeUrl ( String checkoutId , Boolean removeMissing ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/checkouts/{checkoutId}/attributes?removeMissing={removeMissing}" ) ; formatter . formatUrl ( "checkoutId" , checkoutId ) ; formatter . formatUrl ( "removeMissing" , removeMissing ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for UpdateCheckoutAttribute
18,504
public static MozuUrl createDeveloperUserAuthTicketUrl ( Integer developerAccountId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/developer/authtickets/?developerAccountId={developerAccountId}&responseFields={responseFields}" ) ; formatter . formatUrl ( "developerAccountId" , developerAccountId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . HOME_POD ) ; }
Get Resource Url for CreateDeveloperUserAuthTicket
18,505
@ RequestMapping ( value = "/tenants" , method = RequestMethod . GET ) public String getTenants ( @ RequestParam ( "tenantId" ) Integer tenantId , Locale locale , ModelMap modelMap , Model model ) { AuthenticationProfile authenticationProfile = ( AuthenticationProfile ) modelMap . get ( "tenantAuthorization" ) ; if ( authenticationProfile == null ) { setupHomePage ( locale , model ) ; return "home" ; } if ( tenantId == null ) { tenantId = authenticationProfile . getActiveScope ( ) . getId ( ) ; } if ( tenantId != null && ! tenantId . equals ( authenticationProfile . getActiveScope ( ) . getId ( ) ) ) { authenticationProfile = UserAuthenticator . refreshUserAuthTicket ( authenticationProfile . getAuthTicket ( ) , tenantId ) ; model . addAttribute ( "tenantAuthorization" , authenticationProfile ) ; } List < Scope > tenants = authenticationProfile . getAuthorizedScopes ( ) ; if ( tenants == null ) { tenants = new ArrayList < Scope > ( ) ; tenants . add ( authenticationProfile . getActiveScope ( ) ) ; } model . addAttribute ( "user" , authenticationProfile . getUserProfile ( ) ) ; model . addAttribute ( "availableTenants" , tenants ) ; model . addAttribute ( "tenantId" , tenantId ) ; List < Site > sites = null ; if ( tenants != null && tenants . size ( ) > 0 ) { sites = getAvailableTenantSites ( tenantId ) ; } else { sites = new ArrayList < Site > ( ) ; } model . addAttribute ( "sites" , sites ) ; return "tenants" ; }
This method is used when the application and user have been authorized
18,506
public static MozuUrl getTenantScopesForUserUrl ( String responseFields , String userId ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/adminuser/accounts/{userId}/tenants?responseFields={responseFields}" ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "userId" , userId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . HOME_POD ) ; }
Get Resource Url for GetTenantScopesForUser
18,507
public static MozuUrl getConfigurationUrl ( String carrierId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/shipping/admin/carriers/{carrierId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "carrierId" , carrierId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetConfiguration
18,508
public static MozuUrl deleteConfigurationUrl ( String carrierId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/shipping/admin/carriers/{carrierId}" ) ; formatter . formatUrl ( "carrierId" , carrierId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for DeleteConfiguration
18,509
public static MozuUrl getPackageUrl ( String applicationKey , Boolean includeChildren , String responseFields , Boolean skipDevAccountCheck ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/appdev/apppackages/{applicationKey}/?includeChildren={includeChildren}&skipDevAccountCheck={skipDevAccountCheck}&responseFields={responseFields}" ) ; formatter . formatUrl ( "applicationKey" , applicationKey ) ; formatter . formatUrl ( "includeChildren" , includeChildren ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "skipDevAccountCheck" , skipDevAccountCheck ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetPackage
18,510
public static MozuUrl getApplicationSummaryChildrenUrl ( String appId ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/appdev/apppackages/apps/{appId}/" ) ; formatter . formatUrl ( "appId" , appId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetApplicationSummaryChildren
18,511
public static MozuUrl clonePackageUrl ( String applicationKey , String packageName , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/appdev/apppackages/{applicationKey}/clone/{packageName}?responseFields={responseFields}" ) ; formatter . formatUrl ( "applicationKey" , applicationKey ) ; formatter . formatUrl ( "packageName" , packageName ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for ClonePackage
18,512
public static MozuUrl getAppVersionsUrl ( String nsAndAppId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/developer/applications/versions/{nsAndAppId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "nsAndAppId" , nsAndAppId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . HOME_POD ) ; }
Get Resource Url for GetAppVersions
18,513
public static MozuUrl getPackageFileMetadataUrl ( String applicationKey , String filepath , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/developer/packages/{applicationKey}/filemetadata/{filepath}?responseFields={responseFields}" ) ; formatter . formatUrl ( "applicationKey" , applicationKey ) ; formatter . formatUrl ( "filepath" , filepath ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . HOME_POD ) ; }
Get Resource Url for GetPackageFileMetadata
18,514
public static MozuUrl upsertPackageFileUrl ( String applicationKey , String filepath , String lastModifiedTime , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/developer/packages/{applicationKey}/files/{filepath}?lastModifiedTime={lastModifiedTime}&responseFields={responseFields}" ) ; formatter . formatUrl ( "applicationKey" , applicationKey ) ; formatter . formatUrl ( "filepath" , filepath ) ; formatter . formatUrl ( "lastModifiedTime" , lastModifiedTime ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . HOME_POD ) ; }
Get Resource Url for UpsertPackageFile
18,515
public static MozuUrl renamePackageFileUrl ( String applicationKey , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/developer/packages/{applicationKey}/files_rename?responseFields={responseFields}" ) ; formatter . formatUrl ( "applicationKey" , applicationKey ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . HOME_POD ) ; }
Get Resource Url for RenamePackageFile
18,516
public static MozuUrl deletePackageFileUrl ( String applicationKey , String filepath ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/developer/packages/{applicationKey}/files/{filepath}" ) ; formatter . formatUrl ( "applicationKey" , applicationKey ) ; formatter . formatUrl ( "filepath" , filepath ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . HOME_POD ) ; }
Get Resource Url for DeletePackageFile
18,517
public static ScoreFunction illumina ( ) { return new ScoreFunction ( ) { public double evaluate ( final double relativePosition ) { if ( relativePosition < 0.05d ) { return 14400.0d * ( relativePosition * relativePosition ) ; } else if ( relativePosition < 0.8d ) { return 36.0d ; } else { return 22600.0d * Math . pow ( relativePosition - 1.0d , 4.0d ) ; } } } ; }
Illumina positional score function .
18,518
public static MozuUrl getFacetUrl ( Integer facetId , String responseFields , Boolean validate ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/facets/{facetId}?validate={validate}&responseFields={responseFields}" ) ; formatter . formatUrl ( "facetId" , facetId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "validate" , validate ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetFacet
18,519
public static MozuUrl getFacetCategoryListUrl ( Integer categoryId , Boolean includeAvailable , String responseFields , Boolean validate ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/facets/category/{categoryId}?includeAvailable={includeAvailable}&validate={validate}&responseFields={responseFields}" ) ; formatter . formatUrl ( "categoryId" , categoryId ) ; formatter . formatUrl ( "includeAvailable" , includeAvailable ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "validate" , validate ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetFacetCategoryList
18,520
public static MozuUrl updateFacetUrl ( Integer facetId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/facets/{facetId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "facetId" , facetId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for UpdateFacet
18,521
public static MozuUrl deleteFacetByIdUrl ( Integer facetId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/facets/{facetId}" ) ; formatter . formatUrl ( "facetId" , facetId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for DeleteFacetById
18,522
public Interval < C > intersect ( final Interval < C > that ) { if ( this == MAGIC || that == NULL ) { return that ; } if ( this == NULL ) { return NULL ; } if ( that == MAGIC ) { return new Interval ( this . dimension , this . range ) ; } if ( this . dimension == that . dimension ) { if ( this . isConnected ( that ) ) { return new Interval ( this . dimension , this . range . intersection ( that . range ) ) ; } return new Interval ( this . dimension ) ; } return NULL ; }
Find the intersection of two intervals .
18,523
public Interval < C > coalesce ( final Interval < C > that ) { if ( this . overlaps ( that ) ) { return new Interval ( this . dimension , this . range . span ( that . range ) ) ; } return NULL ; }
Find the coalesced result of two overlapping intervals .
18,524
public boolean isConnected ( final Interval < C > that ) { if ( this . hasNone ( ) || that . hasNone ( ) ) { return false ; } return this . range . isConnected ( that . range ) ; }
Test if two intervals are connected
18,525
public Difference < C > minus ( final Interval < C > that ) { return new Difference ( this . intersect ( that . ahead ( ) ) , this . intersect ( that . behind ( ) ) ) ; }
Experimental method to find the difference between two intervals .
18,526
public Interval < C > ahead ( ) { if ( this . hasNone ( ) ) { return new Interval ( this . dimension , Range . all ( ) ) ; } if ( this . range . equals ( Range . all ( ) ) ) { return new Interval ( this . dimension ) ; } return new Interval ( this . dimension , Range . downTo ( this . range . upperEndpoint ( ) , reverse ( this . range . upperBoundType ( ) ) ) ) ; }
Find the interval that extends ahead of this one .
18,527
public Interval < C > behind ( ) { if ( this . hasNone ( ) ) { return new Interval ( this . dimension , Range . all ( ) ) ; } if ( this . range . equals ( Range . all ( ) ) ) { return new Interval ( this . dimension ) ; } return new Interval ( this . dimension , Range . upTo ( this . range . lowerEndpoint ( ) , reverse ( this . range . lowerBoundType ( ) ) ) ) ; }
Find the interval that extends behind this one .
18,528
public Interval < C > gap ( final Interval < C > that ) { if ( this . before ( that ) ) { return this . ahead ( ) . intersect ( that . behind ( ) ) ; } if ( this . after ( that ) ) { return this . behind ( ) . intersect ( that . ahead ( ) ) ; } return NULL ; }
Find the gap between two intervals .
18,529
public boolean before ( final Interval < C > that ) { if ( this . hasNone ( ) || that . hasNone ( ) ) { return false ; } return this . dimension == that . dimension && this . range . upperEndpoint ( ) . compareTo ( that . range . lowerEndpoint ( ) ) < 0 ; }
Test if an interval precedes another .
18,530
public boolean after ( final Interval < C > that ) { if ( this . hasNone ( ) || that . hasNone ( ) ) { return false ; } return that . before ( this ) ; }
Test if an interval is after another .
18,531
public boolean between ( final Interval < C > that , final Interval < C > other ) { checkNotNull ( this . range , that . range ) ; checkNotNull ( other . range ) ; return this . after ( that ) && this . before ( other ) ; }
Test if an interval is between two others .
18,532
public boolean then ( final Interval < C > that ) { checkNotNull ( this . range , that . range ) ; return this . intersect ( that ) . equals ( this ) ; }
Test if an interval implies another .
18,533
public boolean ends ( final Interval < C > that ) { checkNotNull ( this . range , that . range ) ; return this . dimension == that . dimension && this . range . upperEndpoint ( ) . compareTo ( that . range . upperEndpoint ( ) ) == 0 && this . range . lowerEndpoint ( ) . compareTo ( that . range . lowerEndpoint ( ) ) > 0 ; }
Test if an interval ends another .
18,534
public static < C extends Comparable < ? > > List < Poset < C > > singletons ( final Collection < ? extends C > collection ) { List < Poset < C > > singletons = new ArrayList ( ) ; Poset previous = NULL ; for ( C element : collection ) { List < C > set = new ArrayList < > ( ) ; set . add ( element ) ; Poset poset = new Poset ( set ) ; if ( previous != NULL && poset . isComparableTo ( previous ) ) { throw new IllegalArgumentException ( "singletons must be disjoint" ) ; } singletons . add ( poset ) ; previous = poset ; } return singletons ; }
Calculate partially ordered singletons from a totally - ordered collection .
18,535
public static void validateHtml ( final File validationResultDir , final Configuration props , final File file ) throws IOException { Preconditions . checkArgument ( StringUtils . isNotBlank ( props . get ( WebConstants . W3C_MARKUP_VALIDATION_URL ) ) ) ; InputStream is = null ; BufferedReader br = null ; InputStream fis = null ; try { URL url = new URL ( props . get ( WebConstants . W3C_MARKUP_VALIDATION_URL ) ) ; URLConnection uc = url . openConnection ( ) ; MultipartPostRequest request = new MultipartPostRequest ( uc ) ; fis = new FileInputStream ( file ) ; request . setParameter ( "uploaded_file" , file . getPath ( ) , fis ) ; is = request . post ( ) ; String status = uc . getHeaderField ( STATUS ) ; int errors = Integer . parseInt ( uc . getHeaderField ( ERRORS ) ) ; LOG . info ( "Page " + file . getName ( ) + ": Number of HTML validation errors=" + errors ) ; int warnings = Integer . parseInt ( uc . getHeaderField ( WARNINGS ) ) ; LOG . info ( "Page " + file . getName ( ) + ": Number of HTML validation warnings=" + warnings ) ; String level = props . get ( WebConstants . W3C_MARKUP_VALIDATION_LEVEL , "ERROR" ) ; boolean validate = false ; if ( StringUtils . equalsIgnoreCase ( level , "WARNING" ) && ( warnings > 0 || errors > 0 ) ) { validate = true ; } else if ( StringUtils . equalsIgnoreCase ( level , "ERROR" ) && errors > 0 ) { validate = true ; } else if ( StringUtils . equalsIgnoreCase ( "Invalid" , status ) ) { validate = true ; } if ( validate ) { br = new BufferedReader ( new InputStreamReader ( is ) ) ; String line = null ; StringBuffer sb = new StringBuffer ( ) ; while ( ( line = br . readLine ( ) ) != null ) { sb . append ( line ) ; sb . append ( '\n' ) ; } PrintWriter writer = null ; String fileName = file . getName ( ) . substring ( 0 , file . getName ( ) . length ( ) - 5 ) + "_validation_result.html" ; FileUtils . forceMkdir ( validationResultDir ) ; File validationResultFile = new File ( validationResultDir , fileName ) ; try { writer = new PrintWriter ( validationResultFile , "UTF-8" ) ; writer . write ( sb . toString ( ) ) ; LOG . info ( "Validation result saved in file " + validationResultFile . getName ( ) ) ; } catch ( IOException ex ) { LOG . error ( "Could not write HTML file " + validationResultFile . getName ( ) + "to directory" , ex ) ; } finally { IOUtils . closeQuietly ( writer ) ; } } } finally { IOUtils . closeQuietly ( br ) ; IOUtils . closeQuietly ( fis ) ; } }
Validates an HTML file against the W3C markup validation service .
18,536
static File writeSequenceToTempFile ( final Sequence sequence ) throws IOException { File tmp = File . createTempFile ( sequence . getName ( ) + "-" , ".fa" ) ; try ( FileOutputStream outputStream = new FileOutputStream ( tmp ) ) { SeqIOTools . writeFasta ( outputStream , sequence ) ; } return tmp ; }
Write the specified sequence to a temporary file in FASTA format .
18,537
public static Iterable < GenewiseExon > genewiseExons ( final File aminoAcidHmm2File , final File genomicDnaFastaFile ) throws IOException { checkNotNull ( aminoAcidHmm2File ) ; checkNotNull ( genomicDnaFastaFile ) ; File genewiseResult = File . createTempFile ( "genewise" , ".txt" ) ; ProcessBuilder genewise = new ProcessBuilder ( "genewise" , "-hmmer" , "-tfor" , "-genes" , "-nosplice_gtag" , aminoAcidHmm2File . getPath ( ) , genomicDnaFastaFile . getPath ( ) ) ; genewise . redirectErrorStream ( true ) ; genewise . redirectOutput ( ProcessBuilder . Redirect . to ( genewiseResult ) ) ; Process genewiseProcess = genewise . start ( ) ; try { genewiseProcess . waitFor ( ) ; } catch ( InterruptedException e ) { } int lineNumber = 0 ; BufferedReader reader = null ; List < GenewiseExon > exons = Lists . newLinkedList ( ) ; try { reader = new BufferedReader ( new FileReader ( genewiseResult ) ) ; while ( reader . ready ( ) ) { String line = reader . readLine ( ) ; if ( line == null ) { break ; } if ( line . startsWith ( " Exon" ) ) { List < String > tokens = SPLITTER . splitToList ( line ) ; if ( tokens . size ( ) < 5 ) { throw new IOException ( "invalid genewise genes format at line number " + lineNumber + ", line " + line ) ; } try { long start = Long . parseLong ( tokens . get ( 1 ) ) ; long end = Long . parseLong ( tokens . get ( 2 ) ) ; if ( start > end ) { throw new IOException ( "invalid genewise exon at line number " + lineNumber + ", start > end" ) ; } int phase = Integer . parseInt ( tokens . get ( 4 ) ) ; exons . add ( new GenewiseExon ( start , end , phase ) ) ; } catch ( NumberFormatException e ) { throw new IOException ( "invalid genewise exon at line number " + lineNumber + ", caught " + e . getMessage ( ) ) ; } } lineNumber ++ ; } } finally { try { reader . close ( ) ; } catch ( Exception e ) { } try { genewiseResult . delete ( ) ; } catch ( Exception e ) { } } return ImmutableList . copyOf ( exons ) ; }
Return the exons predicted from the alignment of the specified amino acid HMM file in HMMER2 format against the specified genomic DNA sequence file in FASTA format .
18,538
public Latitude parseLatitude ( final String latitudeString ) throws ParserException { try { final Latitude latitude = new Latitude ( parseAngle ( latitudeString ) ) ; return latitude ; } catch ( final RuntimeException e ) { throw new ParserException ( "Cannot parse latitude: " + latitudeString ) ; } }
Parses a string representation of the latitude .
18,539
public Longitude parseLongitude ( final String longitudeString ) throws ParserException { try { final Longitude longitude = new Longitude ( parseAngle ( longitudeString ) ) ; return longitude ; } catch ( final RuntimeException e ) { throw new ParserException ( "Cannot parse longitude: " + longitudeString ) ; } }
Parses a string representation of the longitude .
18,540
public File createDumpFile ( final File dir , final String extension , final String urlString , final String additionalInfo ) { URI uri = URI . create ( urlString ) ; String path = uri . getPath ( ) ; if ( path == null ) { log . warn ( "Cannot create dump file for URI: " + uri ) ; return null ; } String name = PATTERN_FIRST_LAST_SLASH . matcher ( path ) . replaceAll ( "$1" ) ; name = PATTERN_ILLEGAL_CHARS . matcher ( name ) . replaceAll ( "_" ) ; Key key = Key . get ( dir . getPath ( ) , extension ) ; MutableInt counter = countersMap . get ( key ) ; if ( counter == null ) { counter = new MutableInt ( ) ; countersMap . put ( key , counter ) ; } int counterValue = counter . intValue ( ) ; counter . increment ( ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( String . format ( "%04d" , counterValue ) ) ; sb . append ( '_' ) ; sb . append ( name ) ; if ( StringUtils . isNotBlank ( additionalInfo ) ) { sb . append ( "_" ) ; sb . append ( additionalInfo ) ; } sb . append ( "." ) ; sb . append ( extension ) ; return new File ( dir , sb . toString ( ) ) ; }
Computes the best file to save the response to the current page .
18,541
public static MozuUrl getReturnItemUrl ( String responseFields , String returnId , String returnItemId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/returns/{returnId}/items/{returnItemId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "returnId" , returnId ) ; formatter . formatUrl ( "returnItemId" , returnItemId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetReturnItem
18,542
public static MozuUrl getAvailablePaymentActionsForReturnUrl ( String paymentId , String returnId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/returns/{returnId}/payments/{paymentId}/actions" ) ; formatter . formatUrl ( "paymentId" , paymentId ) ; formatter . formatUrl ( "returnId" , returnId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetAvailablePaymentActionsForReturn
18,543
public static MozuUrl resendReturnEmailUrl ( ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/returns/email/resend" ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for ResendReturnEmail
18,544
public static MozuUrl deleteOrderItemUrl ( String returnId , String returnItemId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/returns/{orderId}/items/{orderItemId}?updatemode={updateMode}&version={version}" ) ; formatter . formatUrl ( "returnId" , returnId ) ; formatter . formatUrl ( "returnItemId" , returnItemId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for DeleteOrderItem
18,545
public void setAddress ( final String address ) { Preconditions . checkArgument ( StringUtils . startsWith ( this . address , accountId + "+" ) , "Mail address can only be changed when subaddressing is active" ) ; Preconditions . checkArgument ( StringUtils . startsWith ( address , accountId ) , "New mail address %s does not start with accountId=%s" , address , accountId ) ; log . info ( "Changing mail address from {} to {}" , this . address , address ) ; this . address = address ; }
Allows to set a new mail address . This is only possible when mail subaddressing is active and the new mail address belongs to the defined mail accountId .
18,546
public static MozuUrl getSynonymDefinitionCollectionUrl ( String localeCode , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/search/synonym-definitions/{localeCode}?responseFields={responseFields}" ) ; formatter . formatUrl ( "localeCode" , localeCode ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetSynonymDefinitionCollection
18,547
public static MozuUrl updateSearchTuningRuleUrl ( String responseFields , String searchTuningRuleCode ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/search/searchtuningrules/{searchTuningRuleCode}?responseFields={responseFields}" ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "searchTuningRuleCode" , searchTuningRuleCode ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for UpdateSearchTuningRule
18,548
public static MozuUrl updateSynonymDefinitionUrl ( String responseFields , Integer synonymId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/search/synonyms/{synonymId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "synonymId" , synonymId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for UpdateSynonymDefinition
18,549
public static MozuUrl deleteSearchTuningRuleUrl ( String searchTuningRuleCode ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/search/searchtuningrules/{searchTuningRuleCode}" ) ; formatter . formatUrl ( "searchTuningRuleCode" , searchTuningRuleCode ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for DeleteSearchTuningRule
18,550
public static MozuUrl deleteSynonymDefinitionUrl ( Integer synonymId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/search/synonyms/{synonymId}" ) ; formatter . formatUrl ( "synonymId" , synonymId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for DeleteSynonymDefinition
18,551
public ApplicationContext getApplicationContext ( final JobExecutionContext context ) throws JobExecutionException { SchedulerContext schedulerContext ; try { final Scheduler scheduler = context . getScheduler ( ) ; schedulerContext = scheduler . getContext ( ) ; } catch ( SchedulerException e ) { logger . error ( "Unable to retrieve the scheduler context, cause : " , e ) ; throw new JobExecutionException ( e ) ; } final ApplicationContext applicationContext = ( ApplicationContext ) schedulerContext . get ( APPLICATION_CONTEXT_BEAN_NAME ) ; return applicationContext ; }
Retrieves the spring application context from the job execution context .
18,552
public QuartzExceptionHandler getQuartzExceptionHandler ( final JobExecutionContext context ) { QuartzExceptionHandler exceptionHandler = null ; try { final ApplicationContext applicationContext = getApplicationContext ( context ) ; exceptionHandler = ( QuartzExceptionHandler ) applicationContext . getBean ( QUARTZ_EXCEPTION_HANDLER_BEAN_NAME ) ; } catch ( JobExecutionException e ) { logger . error ( "An error occurs getting the Quartz exception Handler" , e ) ; } return exceptionHandler ; }
Retrieve the quartz exception handler bean .
18,553
public void buildAllStatistics ( ) { for ( Map < String , ? > map : daoService . getAppsAndCountsToTreat ( ) ) { final Application application = ( Application ) map . get ( Sms . PROP_APP ) ; final Account account = ( Account ) map . get ( Sms . PROP_ACC ) ; final Date olderSmsDate = daoService . getDateOfOlderSmsByApplicationAndAccount ( application , account ) ; if ( olderSmsDate != null ) { for ( Date monthToComputeStats : getListOfMarkerDateForNonComputedStats ( application , account , olderSmsDate ) ) { buildStatisticForAMonth ( application , account , monthToComputeStats ) ; } } } }
Build all non already computed statistic whatever the application account or date .
18,554
private void buildStatisticForAMonth ( Application application , Account account , Date month ) { buildStatistics ( application , account , getFirstDayOfMonth ( month ) , getLastDayOfMonth ( month ) , getMarkerDateOfMonth ( month ) ) ; }
Create stats in DB for the specified application and account for the month .
18,555
private Date getLastDayOfMonth ( final Date date ) { final Calendar calendar = toGregorianCalendar ( date ) ; calendar . set ( Calendar . DAY_OF_MONTH , calendar . getActualMaximum ( Calendar . DAY_OF_MONTH ) ) ; calendar . set ( Calendar . HOUR_OF_DAY , 23 ) ; calendar . set ( Calendar . MINUTE , 59 ) ; calendar . set ( Calendar . SECOND , 59 ) ; calendar . set ( Calendar . MILLISECOND , 999 ) ; return calendar . getTime ( ) ; }
Return the last day of month at 23h59 .
18,556
private List < Date > getListOfMarkerDateBetWeenTwoDates ( final Date startDate , final Date endDate ) { final List < Date > listOfMarkerDate = new LinkedList < > ( ) ; final Calendar startDateAsCal = toGregorianCalendar ( startDate ) ; final Calendar endDateAsCal = toGregorianCalendar ( endDate ) ; while ( startDateAsCal . before ( endDateAsCal ) ) { listOfMarkerDate . add ( getMarkerDateOfMonth ( startDateAsCal . getTime ( ) ) ) ; startDateAsCal . add ( Calendar . MONTH , 1 ) ; } return listOfMarkerDate ; }
Return the list of all potential marker date between two dates .
18,557
public EventHandlerStatus dispatchEvent ( HttpServletRequest httpRequest ) { ApiContext apiContext = new MozuApiContext ( httpRequest ) ; Event event = null ; try { String body = IOUtils . toString ( httpRequest . getInputStream ( ) ) ; logger . debug ( "Event body: " + body ) ; event = mapper . readValue ( body , Event . class ) ; logger . info ( "Dispatching Event. Correlation ID: " + event . getCorrelationId ( ) ) ; if ( ! Crypto . isRequestValid ( apiContext , body ) ) { StringBuilder msg = new StringBuilder ( "Event is not authorized." ) ; logger . warn ( msg . toString ( ) ) ; return ( new EventHandlerStatus ( msg . toString ( ) , HttpServletResponse . SC_UNAUTHORIZED ) ) ; } } catch ( IOException exception ) { StringBuilder msg = new StringBuilder ( "Unable to read event: " ) . append ( exception . getMessage ( ) ) ; logger . error ( msg . toString ( ) ) ; return ( new EventHandlerStatus ( msg . toString ( ) , HttpServletResponse . SC_INTERNAL_SERVER_ERROR ) ) ; } try { invokeHandler ( event , apiContext ) ; } catch ( Exception exception ) { StringBuilder msg = new StringBuilder ( "Unable to process event with correlation id " ) . append ( event . getCorrelationId ( ) ) . append ( ". Message: " ) . append ( exception . getMessage ( ) ) ; logger . error ( msg . toString ( ) ) ; return ( new EventHandlerStatus ( msg . toString ( ) , HttpServletResponse . SC_INTERNAL_SERVER_ERROR ) ) ; } return ( new EventHandlerStatus ( null , HttpServletResponse . SC_OK ) ) ; }
Takes the event notification message parses it and dispatches the event to the registered handler for the event category and type .
18,558
protected void invokeHandler ( Event event , ApiContext apiContext ) throws ClassNotFoundException , NoSuchMethodException , SecurityException , IllegalAccessException , IllegalArgumentException , InvocationTargetException , InstantiationException { String topic [ ] = event . getTopic ( ) . split ( "\\." ) ; String eventCategory = topic [ 0 ] . substring ( 0 , 1 ) . toUpperCase ( ) + topic [ 0 ] . substring ( 1 ) ; String eventAction = topic [ 1 ] ; Object handler = EventManager . getInstance ( ) . getRegisteredClassHandlers ( eventCategory ) ; if ( handler != null ) { String methodName = eventAction ; String className = handler . getClass ( ) . getName ( ) ; try { Method m ; m = handler . getClass ( ) . getMethod ( methodName , ApiContext . class , Event . class ) ; m . invoke ( handler , apiContext , event ) ; } catch ( NoSuchMethodException e ) { logger . warn ( "No " + eventAction + " method on class " + className ) ; throw e ; } catch ( SecurityException e ) { logger . warn ( "Security exception: " + e . getMessage ( ) ) ; throw e ; } catch ( IllegalAccessException e ) { logger . warn ( "Illegal access for method " + eventAction + " on class " + className ) ; throw e ; } catch ( IllegalArgumentException e ) { logger . warn ( "Illegal argument exception for method " + eventAction + " on class " + className ) ; throw e ; } catch ( InvocationTargetException e ) { logger . warn ( "Invocation target exception for method " + eventAction + " on class " + className ) ; throw e ; } } }
Dispatch the event to the handler registered for the category . The method corresponding to the event type is invoked .
18,559
protected final Vertex supremum ( final E proposed , Vertex generator ) { boolean max = true ; while ( max ) { max = false ; for ( Edge edge : generator . getEdges ( Direction . BOTH ) ) { Vertex target = edge . getVertex ( Direction . OUT ) ; if ( filter ( target , generator ) ) { continue ; } if ( filter ( target , proposed ) ) { generator = target ; max = true ; break ; } } } return generator ; }
Find the supremum or least upper bound .
18,560
public final boolean containsAll ( final Collection < ? extends E > collection ) { for ( E element : collection ) { if ( ! this . contains ( element ) ) { return false ; } } return true ; }
Test if the lattice contains all elements of the given collection .
18,561
protected final Vertex addIntent ( final E proposed , Vertex generator ) { generator = supremum ( proposed , generator ) ; if ( filter ( generator , proposed ) && filter ( proposed , generator ) ) { return generator ; } List parents = new ArrayList < > ( ) ; for ( Edge edge : generator . getEdges ( Direction . BOTH ) ) { Vertex target = edge . getVertex ( Direction . OUT ) ; if ( filter ( target , generator ) ) { continue ; } Vertex candidate = target ; if ( ! filter ( target , proposed ) && ! filter ( proposed , target ) ) { E targetElement = target . getProperty ( LABEL ) ; E intersect = ( E ) targetElement . intersect ( proposed ) ; candidate = addIntent ( intersect , candidate ) ; } boolean add = true ; List doomed = new ArrayList < > ( ) ; for ( java . util . Iterator it = parents . iterator ( ) ; it . hasNext ( ) ; ) { Vertex parent = ( Vertex ) it . next ( ) ; if ( filter ( parent , candidate ) ) { add = false ; break ; } else if ( filter ( candidate , parent ) ) { doomed . add ( parent ) ; } } for ( java . util . Iterator it = doomed . iterator ( ) ; it . hasNext ( ) ; ) { Vertex vertex = ( Vertex ) it . next ( ) ; parents . remove ( vertex ) ; } if ( add ) { parents . add ( candidate ) ; } } E generatorLabel = generator . getProperty ( LABEL ) ; Vertex child = insert ( ( E ) proposed . union ( generatorLabel ) ) ; addUndirectedEdge ( generator , child , "" ) ; bottom = filter ( bottom , proposed ) ? child : bottom ; for ( java . util . Iterator it = parents . iterator ( ) ; it . hasNext ( ) ; ) { Vertex parent = ( Vertex ) it . next ( ) ; if ( ! parent . equals ( generator ) ) { removeUndirectedEdge ( parent , generator ) ; addUndirectedEdge ( parent , child , "" ) ; } } return child ; }
Add a new element dynamically to the lattice .
18,562
public static MozuUrl updateOrderAttributesUrl ( String orderId , Boolean removeMissing ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/orders/{orderId}/attributes?removeMissing={removeMissing}" ) ; formatter . formatUrl ( "orderId" , orderId ) ; formatter . formatUrl ( "removeMissing" , removeMissing ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for UpdateOrderAttributes
18,563
public static MozuUrl updateUrl ( String cardId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/payments/commerce/payments/cards/{cardId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "cardId" , cardId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . PCI_POD ) ; }
Get Resource Url for Update
18,564
public static MozuUrl deleteUrl ( String cardId ) { UrlFormatter formatter = new UrlFormatter ( "/payments/commerce/payments/cards/{cardId}" ) ; formatter . formatUrl ( "cardId" , cardId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . PCI_POD ) ; }
Get Resource Url for Delete
18,565
public static MozuUrl getPropertyTypesUrl ( Integer pageSize , String responseFields , Integer startIndex ) { UrlFormatter formatter = new UrlFormatter ( "/api/content/propertytypes/?pageSize={pageSize}&startIndex={startIndex}&responseFields={responseFields}" ) ; formatter . formatUrl ( "pageSize" , pageSize ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "startIndex" , startIndex ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetPropertyTypes
18,566
public static MozuUrl getPropertyTypeUrl ( String propertyTypeName , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/content/propertytypes/{propertyTypeName}?responseFields={responseFields}" ) ; formatter . formatUrl ( "propertyTypeName" , propertyTypeName ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetPropertyType
18,567
public static MozuUrl deletePropertyTypeUrl ( String propertyTypeName ) { UrlFormatter formatter = new UrlFormatter ( "/api/content/propertytypes/{propertyTypeName}" ) ; formatter . formatUrl ( "propertyTypeName" , propertyTypeName ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for DeletePropertyType
18,568
public static MozuUrl storeCredentialsUrl ( ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/extensions/credentialStore/" ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for StoreCredentials
18,569
public static MozuUrl getQuoteItemsByQuoteNameUrl ( Integer customerAccountId , String filter , Integer pageSize , String quoteName , String responseFields , String sortBy , Integer startIndex ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/quotes/customers/{customerAccountId}/{quoteName}/items?startIndex={startIndex}&pageSize={pageSize}&sortBy={sortBy}&filter={filter}&responseFields={responseFields}" ) ; formatter . formatUrl ( "customerAccountId" , customerAccountId ) ; formatter . formatUrl ( "filter" , filter ) ; formatter . formatUrl ( "pageSize" , pageSize ) ; formatter . formatUrl ( "quoteName" , quoteName ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "sortBy" , sortBy ) ; formatter . formatUrl ( "startIndex" , startIndex ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetQuoteItemsByQuoteName
18,570
public static MozuUrl addItemToQuoteUrl ( String quoteId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/quotes/{quoteId}/items?responseFields={responseFields}" ) ; formatter . formatUrl ( "quoteId" , quoteId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for AddItemToQuote
18,571
public static MozuUrl updateQuoteItemUrl ( String quoteId , String quoteItemId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/quotes/{quoteId}/items/{quoteItemId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "quoteId" , quoteId ) ; formatter . formatUrl ( "quoteItemId" , quoteItemId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for UpdateQuoteItem
18,572
public static MozuUrl deleteQuoteItemUrl ( String quoteId , String quoteItemId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/quotes/{quoteId}/items/{quoteItemId}" ) ; formatter . formatUrl ( "quoteId" , quoteId ) ; formatter . formatUrl ( "quoteItemId" , quoteItemId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for DeleteQuoteItem
18,573
void signRequest ( final RSAPublicKey rsaPublicKey , final byte [ ] data ) throws IOException { final String keyType = Rsa . RSA_LABEL ; final byte [ ] publicExponent = rsaPublicKey . getPublicExponent ( ) . toByteArray ( ) ; final byte [ ] modulus = rsaPublicKey . getModulus ( ) . toByteArray ( ) ; final int publicKeyLength = 4 + keyType . length ( ) + 4 + publicExponent . length + 4 + modulus . length ; final ByteBuffer buff = ByteBuffer . allocate ( INT_BYTES + 1 + INT_BYTES + publicKeyLength + INT_BYTES + data . length + 4 ) ; buff . putInt ( publicKeyLength + data . length + 13 ) ; buff . put ( ( byte ) SSH2_AGENTC_SIGN_REQUEST ) ; buff . putInt ( publicKeyLength ) ; buff . putInt ( keyType . length ( ) ) ; for ( final byte b : keyType . getBytes ( ) ) { buff . put ( b ) ; } buff . putInt ( publicExponent . length ) ; buff . put ( publicExponent ) ; buff . putInt ( modulus . length ) ; buff . put ( modulus ) ; buff . putInt ( data . length ) ; buff . put ( data ) ; buff . put ( new byte [ ] { 0 , 0 , 0 , 0 } ) ; out . write ( buff . array ( ) ) ; out . flush ( ) ; log . debug ( "Sent SSH2_AGENTC_SIGN_REQUEST message to ssh-agent." ) ; }
Send a SSH2_AGENTC_SIGN_REQUEST message to ssh - agent .
18,574
public static MozuUrl splitItemUrl ( String checkoutId , String itemId , Integer quantity , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/checkouts/{checkoutId}/items/{itemId}/split?quantity={quantity}&responseFields={responseFields}" ) ; formatter . formatUrl ( "checkoutId" , checkoutId ) ; formatter . formatUrl ( "itemId" , itemId ) ; formatter . formatUrl ( "quantity" , quantity ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for SplitItem
18,575
public static MozuUrl updateItemDestinationUrl ( String checkoutId , String destinationId , String itemId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/checkouts/{checkoutId}/items/{itemId}/destination/{destinationId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "checkoutId" , checkoutId ) ; formatter . formatUrl ( "destinationId" , destinationId ) ; formatter . formatUrl ( "itemId" , itemId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for UpdateItemDestination
18,576
public static MozuUrl deleteCheckoutItemUrl ( String checkoutId , String itemId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/checkouts/{checkoutId}/items/{itemId}" ) ; formatter . formatUrl ( "checkoutId" , checkoutId ) ; formatter . formatUrl ( "itemId" , itemId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for DeleteCheckoutItem
18,577
public static MozuUrl getViewEntityContainerUrl ( String entityId , String entityListFullName , String responseFields , String viewName ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/entitylists/{entityListFullName}/views/{viewName}/entityContainers/{entityId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "entityId" , entityId ) ; formatter . formatUrl ( "entityListFullName" , entityListFullName ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "viewName" , viewName ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetViewEntityContainer
18,578
public static MozuUrl getViewEntityContainersUrl ( String entityListFullName , String filter , Integer pageSize , String responseFields , Integer startIndex , String viewName ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/entitylists/{entityListFullName}/views/{viewName}/entityContainers?pageSize={pageSize}&startIndex={startIndex}&filter={filter}&responseFields={responseFields}" ) ; formatter . formatUrl ( "entityListFullName" , entityListFullName ) ; formatter . formatUrl ( "filter" , filter ) ; formatter . formatUrl ( "pageSize" , pageSize ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "startIndex" , startIndex ) ; formatter . formatUrl ( "viewName" , viewName ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetViewEntityContainers
18,579
public static MozuUrl getEntityListViewUrl ( String entityListFullName , String responseFields , String viewName ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/entitylists/{entityListFullName}/views/{viewName}?responseFields={responseFields}" ) ; formatter . formatUrl ( "entityListFullName" , entityListFullName ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "viewName" , viewName ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetEntityListView
18,580
public static MozuUrl getEntityListViewsUrl ( String entityListFullName , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/entitylists/{entityListFullName}/views?responseFields={responseFields}" ) ; formatter . formatUrl ( "entityListFullName" , entityListFullName ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetEntityListViews
18,581
public static MozuUrl deleteEntityListViewUrl ( String entityListFullName , String viewName ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/entitylists/{entityListFullName}/views/{viewName}" ) ; formatter . formatUrl ( "entityListFullName" , entityListFullName ) ; formatter . formatUrl ( "viewName" , viewName ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for DeleteEntityListView
18,582
public static MozuUrl getWishlistItemUrl ( String responseFields , String wishlistId , String wishlistItemId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/wishlists/{wishlistId}/items/{wishlistItemId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "wishlistId" , wishlistId ) ; formatter . formatUrl ( "wishlistItemId" , wishlistItemId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetWishlistItem
18,583
public static MozuUrl getWishlistItemsByWishlistNameUrl ( Integer customerAccountId , String filter , Integer pageSize , String responseFields , String sortBy , Integer startIndex , String wishlistName ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/wishlists/customers/{customerAccountId}/{wishlistName}/items?startIndex={startIndex}&pageSize={pageSize}&sortBy={sortBy}&filter={filter}&responseFields={responseFields}" ) ; formatter . formatUrl ( "customerAccountId" , customerAccountId ) ; formatter . formatUrl ( "filter" , filter ) ; formatter . formatUrl ( "pageSize" , pageSize ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "sortBy" , sortBy ) ; formatter . formatUrl ( "startIndex" , startIndex ) ; formatter . formatUrl ( "wishlistName" , wishlistName ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetWishlistItemsByWishlistName
18,584
public static MozuUrl updateWishlistItemQuantityUrl ( Integer quantity , String responseFields , String wishlistId , String wishlistItemId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/wishlists/{wishlistId}/items/{wishlistItemId}/{quantity}?responseFields={responseFields}" ) ; formatter . formatUrl ( "quantity" , quantity ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "wishlistId" , wishlistId ) ; formatter . formatUrl ( "wishlistItemId" , wishlistItemId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for UpdateWishlistItemQuantity
18,585
public static MozuUrl removeAllWishlistItemsUrl ( String wishlistId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/wishlists/{wishlistId}/items" ) ; formatter . formatUrl ( "wishlistId" , wishlistId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for RemoveAllWishlistItems
18,586
public static MozuUrl deleteWishlistItemUrl ( String wishlistId , String wishlistItemId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/wishlists/{wishlistId}/items/{wishlistItemId}" ) ; formatter . formatUrl ( "wishlistId" , wishlistId ) ; formatter . formatUrl ( "wishlistItemId" , wishlistItemId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for DeleteWishlistItem
18,587
public static MozuUrl getCreditUrl ( String code , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/customer/credits/{code}?responseFields={responseFields}" ) ; formatter . formatUrl ( "code" , code ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetCredit
18,588
public static MozuUrl resendCreditCreatedEmailUrl ( String code , String userId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/customer/credits/{code}/Resend-Email?userId={userId}" ) ; formatter . formatUrl ( "code" , code ) ; formatter . formatUrl ( "userId" , userId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for ResendCreditCreatedEmail
18,589
public static void main ( final String [ ] args ) { SLF4JBridgeHandler . install ( ) ; boolean exitWithError = true ; StopWatch stopWatch = new StopWatch ( ) ; try { RESULT_LOG . info ( "jFunk started" ) ; stopWatch . start ( ) ; int threadCount = 1 ; boolean parallel = false ; Properties scriptProperties = new Properties ( ) ; List < File > scripts = Lists . newArrayList ( ) ; for ( String arg : args ) { if ( arg . startsWith ( "-threadcount" ) ) { String [ ] split = arg . split ( "=" ) ; Preconditions . checkArgument ( split . length == 2 , "The number of threads must be specified as follows: -threadcount=<value>" ) ; threadCount = Integer . parseInt ( split [ 1 ] ) ; RESULT_LOG . info ( "Using " + threadCount + ( threadCount == 1 ? " thread" : " threads" ) ) ; } else if ( arg . startsWith ( "-S" ) ) { arg = arg . substring ( 2 ) ; String [ ] split = arg . split ( "=" ) ; Preconditions . checkArgument ( split . length == 2 , "Script parameters must be given in the form -S<name>=<value>" ) ; scriptProperties . setProperty ( split [ 0 ] , normalizeScriptParameterValue ( split [ 1 ] ) ) ; RESULT_LOG . info ( "Using script parameter " + split [ 0 ] + " with value " + split [ 1 ] ) ; } else if ( arg . equals ( "-parallel" ) ) { parallel = true ; RESULT_LOG . info ( "Using parallel mode" ) ; } else { scripts . add ( new File ( arg ) ) ; } } if ( scripts . isEmpty ( ) ) { scripts . addAll ( requestScriptsViaGui ( ) ) ; if ( scripts . isEmpty ( ) ) { RESULT_LOG . info ( "Execution finished (took " + stopWatch + " H:mm:ss.SSS)" ) ; System . exit ( 0 ) ; } } String propsFileName = System . getProperty ( "jfunk.props.file" , "jfunk.properties" ) ; Module module = ModulesLoader . loadModulesFromProperties ( new JFunkDefaultModule ( ) , propsFileName ) ; Injector injector = Guice . createInjector ( module ) ; JFunkFactory factory = injector . getInstance ( JFunkFactory . class ) ; JFunkBase jFunk = factory . create ( threadCount , parallel , scripts , scriptProperties ) ; jFunk . execute ( ) ; exitWithError = false ; } catch ( JFunkExecutionException ex ) { } catch ( Exception ex ) { Logger . getLogger ( JFunk . class ) . error ( "jFunk terminated unexpectedly." , ex ) ; } finally { stopWatch . stop ( ) ; RESULT_LOG . info ( "Execution finished (took " + stopWatch + " H:mm:ss.SSS)" ) ; } System . exit ( exitWithError ? - 1 : 0 ) ; }
Starts jFunk .
18,590
public Element findElementById ( final Element element ) { Attribute a = element . getAttribute ( idAttributeName ) ; if ( a == null ) { return null ; } return findElementById ( a . getValue ( ) ) ; }
Searches the attribute id in the given element first and using this element searches for the element with the attribute id and the value of this element .
18,591
public Element findElementById ( final String id ) { Element element = cache . get ( id ) ; if ( element == null ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Search for element with ID {}" , id ) ; } Element root = document . getRootElement ( ) ; element = search ( root , elementName , idAttributeName , id ) ; if ( element != null ) { cache . put ( id , element ) ; } } return element ; }
Searches first in the cache for the given id . If it is found the element saved there will be returned . If it is not found the search - starting at the RootElement - will continue until the first element in the tree hierarchy is found which 1 . has the attribute id and 2 . whose id attribute has the value of the parameter s id . Once found it will be saved in the cache .
18,592
public static Element search ( final Element root , final String elementName , final String idAttributeName , final String id ) { Element element = null ; @ SuppressWarnings ( "unchecked" ) List < Element > children = root . getChildren ( ) ; for ( Element e : children ) { if ( elementName == null || e . getName ( ) . equals ( elementName ) ) { Attribute a = e . getAttribute ( idAttributeName ) ; if ( a != null && id . equals ( a . getValue ( ) ) ) { element = e ; } else { element = search ( e , elementName , idAttributeName , id ) ; } } if ( element != null ) { break ; } } return element ; }
Searches the ElementBaum starting with the given element for the ChildElement with the respective attribute value
18,593
public static Element getChild ( final String name , final Element root ) { @ SuppressWarnings ( "unchecked" ) List < Element > allChildren = root . getChildren ( ) ; for ( Element child : allChildren ) { if ( child . getName ( ) . equals ( name ) ) { return child ; } } return null ; }
Searches for the Child with the given name ignoring namespaces
18,594
public static MozuUrl getVisitUrl ( String responseFields , String visitId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/customer/visits/{visitId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "visitId" , visitId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetVisit
18,595
public boolean executeScript ( final File script , final Properties scriptProperties ) { checkState ( script . exists ( ) , "Script file does not exist: %s" , script ) ; checkState ( script . canRead ( ) , "Script file is not readable: %s" , script ) ; Reader reader = null ; boolean success = false ; Throwable throwable = null ; scriptScope . enterScope ( ) ; ScriptContext ctx = scriptContextProvider . get ( ) ; try { reader = Files . newReader ( script , charset ) ; ScriptEngine scriptEngine = new ScriptEngineManager ( ) . getEngineByExtension ( "groovy" ) ; ctx . setScript ( script ) ; ctx . load ( JFunkConstants . SCRIPT_PROPERTIES , false ) ; ctx . registerReporter ( new SimpleReporter ( ) ) ; initGroovyCommands ( scriptEngine , ctx ) ; initScriptProperties ( scriptEngine , scriptProperties ) ; ScriptMetaData scriptMetaData = scriptMetaDataProvider . get ( ) ; scriptMetaData . setScriptName ( script . getPath ( ) ) ; Date startDate = new Date ( ) ; scriptMetaData . setStartDate ( startDate ) ; ctx . set ( JFunkConstants . SCRIPT_START_MILLIS , String . valueOf ( startDate . getTime ( ) ) ) ; eventBus . post ( scriptEngine ) ; eventBus . post ( new BeforeScriptEvent ( script . getAbsolutePath ( ) ) ) ; scriptEngine . eval ( reader ) ; success = true ; } catch ( IOException ex ) { throwable = ex ; log . error ( "Error loading script: " + script , ex ) ; } catch ( ScriptException ex ) { throwable = ex ; Throwable th = ex ; while ( ! ( th instanceof ModuleExecutionException ) ) { if ( th == null ) { log . error ( "Error executing script: " + script , ex ) ; success = false ; break ; } th = th . getCause ( ) ; } } finally { try { ScriptMetaData scriptMetaData = scriptMetaDataProvider . get ( ) ; Date endDate = new Date ( ) ; scriptMetaData . setEndDate ( endDate ) ; ctx . set ( JFunkConstants . SCRIPT_END_MILLIS , String . valueOf ( endDate . getTime ( ) ) ) ; scriptMetaData . setThrowable ( throwable ) ; eventBus . post ( new AfterScriptEvent ( script . getAbsolutePath ( ) , success ) ) ; } finally { scriptScope . exitScope ( ) ; closeQuietly ( reader ) ; } } return success ; }
Executes the specified Groovy script .
18,596
public void exitScope ( ) { Map < Key < ? > , Object > scopeMap = checkNotNull ( getScopeMapForCurrentThread ( ) , "No scope map found for the current thread. Forgot to call enterScope()?" ) ; performDisposal ( scopeMap ) ; nonInheritableScopeCache . remove ( ) ; inheritableScopeCache . remove ( ) ; log . debug ( "Exited scope." ) ; }
Exits the scope context for the current thread . Call this method after a thread is done in order to avoid memory leaks and to enable the thread to enter a new scope context again .
18,597
public static MozuUrl getLocationsInUsageTypeUrl ( String filter , Boolean includeAttributeDefinition , String locationUsageType , Integer pageSize , String responseFields , String sortBy , Integer startIndex ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/storefront/locationUsageTypes/{locationUsageType}/locations?startIndex={startIndex}&pageSize={pageSize}&sortBy={sortBy}&filter={filter}&includeAttributeDefinition={includeAttributeDefinition}&responseFields={responseFields}" ) ; formatter . formatUrl ( "filter" , filter ) ; formatter . formatUrl ( "includeAttributeDefinition" , includeAttributeDefinition ) ; formatter . formatUrl ( "locationUsageType" , locationUsageType ) ; formatter . formatUrl ( "pageSize" , pageSize ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "sortBy" , sortBy ) ; formatter . formatUrl ( "startIndex" , startIndex ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetLocationsInUsageType
18,598
public static MozuUrl getDirectShipLocationUrl ( Boolean includeAttributeDefinition , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/storefront/locationUsageTypes/DS/location?includeAttributeDefinition={includeAttributeDefinition}&responseFields={responseFields}" ) ; formatter . formatUrl ( "includeAttributeDefinition" , includeAttributeDefinition ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetDirectShipLocation
18,599
public static MozuUrl getInStorePickupLocationUrl ( Boolean includeAttributeDefinition , String locationCode , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/storefront/locationUsageTypes/SP/locations/{locationCode}?includeAttributeDefinition={includeAttributeDefinition}&responseFields={responseFields}" ) ; formatter . formatUrl ( "includeAttributeDefinition" , includeAttributeDefinition ) ; formatter . formatUrl ( "locationCode" , locationCode ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetInStorePickupLocation