idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
4,500
public Account createAccount ( String email , String clientId , String clientSecret ) throws HelloSignException { HttpClient client = httpClient . withAuth ( auth ) . withPostField ( Account . ACCOUNT_EMAIL_ADDRESS , email ) ; if ( clientId != null && clientSecret != null ) { client = client . withPostField ( CLIENT_ID...
Creates a new HelloSign account and provides OAuth app credentials to automatically generate an OAuth token with the user Account response .
4,501
public OauthData getOauthData ( String code , String clientId , String secret , String state , boolean autoSetRequestToken ) throws HelloSignException { OauthData data = new OauthData ( httpClient . withAuth ( auth ) . withPostField ( OAUTH_STATE , state ) . withPostField ( OAUTH_CODE , code ) . withPostField ( CLIENT_...
Performs an OAuth request and returns the necessary data for authorizing an API application and will automatically set the access token and code for making authenticated requests with this client .
4,502
public OauthData refreshOauthData ( String refreshToken ) throws HelloSignException { OauthData data = new OauthData ( httpClient . withAuth ( auth ) . withPostField ( OAUTH_GRANT_TYPE , OAUTH_GRANT_TYPE_REFRESH_TOKEN ) . withPostField ( OAUTH_REFRESH_TOKEN , refreshToken ) . post ( OAUTH_TOKEN_URL ) . asJson ( ) ) ; i...
Refreshes the OauthData for this client with the provided refresh token .
4,503
public Team getTeam ( ) throws HelloSignException { return new Team ( httpClient . withAuth ( auth ) . get ( BASE_URI + TEAM_URI ) . asJson ( ) ) ; }
Retrieves the Team for the current user account .
4,504
public Team createTeam ( String teamName ) throws HelloSignException { return new Team ( httpClient . withAuth ( auth ) . withPostField ( Team . TEAM_NAME , teamName ) . post ( BASE_URI + TEAM_URI ) . asJson ( ) ) ; }
Creates a new team for the current user with the given name .
4,505
public boolean destroyTeam ( ) throws HelloSignException { return HttpURLConnection . HTTP_OK == httpClient . withAuth ( auth ) . post ( BASE_URI + TEAM_DESTROY_URI ) . asHttpCode ( ) ; }
Destroys the current user s team .
4,506
public Team inviteTeamMember ( String idOrEmail ) throws HelloSignException { String key = ( idOrEmail != null && idOrEmail . contains ( "@" ) ) ? Account . ACCOUNT_EMAIL_ADDRESS : Account . ACCOUNT_ID ; return new Team ( httpClient . withAuth ( auth ) . withPostField ( key , idOrEmail ) . post ( BASE_URI + TEAM_ADD_ME...
Adds the user to the current user s team .
4,507
public SignatureRequest getSignatureRequest ( String id ) throws HelloSignException { String url = BASE_URI + SIGNATURE_REQUEST_URI + "/" + id ; return new SignatureRequest ( httpClient . withAuth ( auth ) . get ( url ) . asJson ( ) ) ; }
Retrieves a Signature Request with the given ID .
4,508
public SignatureRequestList getSignatureRequests ( ) throws HelloSignException { return new SignatureRequestList ( httpClient . withAuth ( auth ) . get ( BASE_URI + SIGNATURE_REQUEST_LIST_URI ) . asJson ( ) ) ; }
Retrieves the current user s signature requests . The resulting object represents a paged query result . The page information can be retrieved on from the ListInfo object on the SignatureRequestList .
4,509
public SignatureRequestList getSignatureRequests ( int page ) throws HelloSignException { return new SignatureRequestList ( httpClient . withAuth ( auth ) . withGetParam ( AbstractResourceList . PAGE , Integer . toString ( page ) ) . get ( BASE_URI + SIGNATURE_REQUEST_LIST_URI ) . asJson ( ) ) ; }
Retrieves a specific page of the current user s signature requests .
4,510
public SignatureRequest sendSignatureRequest ( SignatureRequest req ) throws HelloSignException { if ( req . hasId ( ) ) { throw new HelloSignException ( "Sending an existing signature request is not supported" ) ; } return new SignatureRequest ( httpClient . withAuth ( auth ) . withPostFields ( req . getPostFields ( )...
Sends the provided signature request to HelloSign .
4,511
public SignatureRequest updateSignatureRequest ( String signatureRequestId , String signatureId , String newEmailAddress ) throws HelloSignException { String url = BASE_URI + SIGNATURE_REQUEST_UPDATE_URI + "/" + signatureRequestId ; return new SignatureRequest ( httpClient . withAuth ( auth ) . withPostField ( Signatur...
Update a signer s email address .
4,512
public TemplateList getTemplates ( ) throws HelloSignException { return new TemplateList ( httpClient . withAuth ( auth ) . get ( BASE_URI + TEMPLATE_LIST_URI ) . asJson ( ) ) ; }
Retrieves the templates for the current user account .
4,513
public TemplateList getTemplates ( int page ) throws HelloSignException { return new TemplateList ( httpClient . withAuth ( auth ) . withGetParam ( AbstractResourceList . PAGE , Integer . toString ( page ) ) . get ( BASE_URI + TEMPLATE_LIST_URI ) . asJson ( ) ) ; }
Retrieves a page of templates for the current user account .
4,514
public File getTemplateFile ( String templateId ) throws HelloSignException { String url = BASE_URI + TEMPLATE_FILE_URI + "/" + templateId ; String fileName = TEMPLATE_FILE_NAME + "." + TEMPLATE_FILE_EXT ; return httpClient . withAuth ( auth ) . get ( url ) . asFile ( fileName ) ; }
Retrieves the PDF file backing the Template specified by the provided Template ID .
4,515
public String getTemplateFileUrl ( String templateId ) throws HelloSignException { String fileUrl = null ; String url = BASE_URI + TEMPLATE_FILE_URI + "/" + templateId ; JSONObject response = httpClient . withAuth ( auth ) . withGetParam ( PARAM_GET_URL , "1" ) . get ( url ) . asJson ( ) ; if ( response . has ( "file_u...
Returns a signed URL that can be used to retrieve the file backing a template .
4,516
public Template getTemplate ( String templateId ) throws HelloSignException { String url = BASE_URI + TEMPLATE_URI + "/" + templateId ; return new Template ( httpClient . withAuth ( auth ) . get ( url ) . asJson ( ) ) ; }
Retrieves a specific Template based on the provided Template ID .
4,517
public Template addTemplateUser ( String templateId , String idOrEmail ) throws HelloSignException { String url = BASE_URI + TEMPLATE_ADD_USER_URI + "/" + templateId ; String key = ( idOrEmail != null && idOrEmail . contains ( "@" ) ) ? Account . ACCOUNT_EMAIL_ADDRESS : Account . ACCOUNT_ID ; return new Template ( http...
Adds the provided user to the template indicated by the provided template ID . The new user can be designated using their account ID or email address .
4,518
public boolean deleteTemplate ( String templateId ) throws HelloSignException { String url = BASE_URI + TEMPLATE_DELETE_URI + "/" + templateId ; return HttpURLConnection . HTTP_OK == httpClient . withAuth ( auth ) . post ( url ) . asHttpCode ( ) ; }
Delete the template designated by the template id
4,519
public String updateTemplateFiles ( String existingTemplateId , TemplateDraft newTemplate , String clientId ) throws HelloSignException { String url = BASE_URI + TEMPLATE_UPDATE_FILES_URI + "/" + existingTemplateId ; HttpClient client = httpClient . withAuth ( auth ) . withPostFields ( newTemplate . getPostFields ( ) )...
Replaces the backing documents for the given template with the given files .
4,520
public SignatureRequest sendTemplateSignatureRequest ( TemplateSignatureRequest req ) throws HelloSignException { return new SignatureRequest ( httpClient . withAuth ( auth ) . withPostFields ( req . getPostFields ( ) ) . post ( BASE_URI + TEMPLATE_SIGNATURE_REQUEST_URI ) . asJson ( ) ) ; }
Creates a new Signature Request based on the template provided .
4,521
public boolean cancelSignatureRequest ( String id ) throws HelloSignException { String url = BASE_URI + SIGNATURE_REQUEST_CANCEL_URI + "/" + id ; return HttpURLConnection . HTTP_OK == httpClient . withAuth ( auth ) . post ( url ) . asHttpCode ( ) ; }
Cancels an existing signature request . If it has been completed it will delete the signature request from your account .
4,522
public SignatureRequest requestEmailReminder ( String requestId , String email ) throws HelloSignException { String url = BASE_URI + SIGNATURE_REQUEST_REMIND_URI + "/" + requestId ; return new SignatureRequest ( httpClient . withAuth ( auth ) . withPostField ( Account . ACCOUNT_EMAIL_ADDRESS , email ) . post ( url ) . ...
Instructs HelloSign to email the given address with a reminder to sign the SignatureRequest referenced by the given request ID .
4,523
public File getFinalCopy ( String requestId ) throws HelloSignException { String url = BASE_URI + SIGNATURE_REQUEST_FINAL_COPY_URI + "/" + requestId ; String filename = FINAL_COPY_FILE_NAME + "." + FINAL_COPY_FILE_EXT ; return httpClient . withAuth ( auth ) . get ( url ) . asFile ( filename ) ; }
Retrieves the final PDF copy of a signature request if it exists .
4,524
public File getFiles ( String requestId , String format ) throws HelloSignException { if ( format == null || format . isEmpty ( ) ) { format = FILES_FILE_EXT ; } String url = BASE_URI + SIGNATURE_REQUEST_FILES_URI + "/" + requestId ; String fileName = FILES_FILE_NAME + "." + format ; return httpClient . withAuth ( auth...
Retrieves the file associated with a signature request .
4,525
public FileUrlResponse getFilesUrl ( String requestId ) throws HelloSignException { String url = BASE_URI + SIGNATURE_REQUEST_FILES_URI + "/" + requestId ; HttpClient httpClient = this . httpClient . withAuth ( auth ) . withGetParam ( PARAM_GET_URL , "1" ) . get ( url ) ; if ( httpClient . getLastResponseCode ( ) == 40...
Retrieves a URL for a file associated with a signature request .
4,526
public AbstractRequest createEmbeddedRequest ( EmbeddedRequest embeddedReq ) throws HelloSignException { String url = BASE_URI ; Class < ? > returnType = SignatureRequest . class ; AbstractRequest req = embeddedReq . getRequest ( ) ; if ( req instanceof TemplateSignatureRequest ) { url += SIGNATURE_REQUEST_EMBEDDED_TEM...
Creates a signature request that can be embedded within your website .
4,527
public EmbeddedResponse getEmbeddedSignUrl ( String signatureId ) throws HelloSignException { String url = BASE_URI + EMBEDDED_SIGN_URL_URI + "/" + signatureId ; return new EmbeddedResponse ( httpClient . withAuth ( auth ) . post ( url ) . asJson ( ) ) ; }
Retrieves the necessary information to build an embedded signature request .
4,528
public UnclaimedDraft createUnclaimedDraft ( UnclaimedDraft draft ) throws HelloSignException { String url = BASE_URI ; if ( draft . isForEmbeddedSigning ( ) ) { url += UNCLAIMED_DRAFT_CREATE_EMBEDDED_URI ; } else { url += UNCLAIMED_DRAFT_CREATE_URI ; } return new UnclaimedDraft ( httpClient . withAuth ( auth ) . withP...
Creates an unclaimed draft using the provided request draft object .
4,529
public TemplateDraft createEmbeddedTemplateDraft ( EmbeddedRequest req ) throws HelloSignException { return new TemplateDraft ( httpClient . withAuth ( auth ) . withPostFields ( req . getPostFields ( ) ) . post ( BASE_URI + TEMPLATE_CREATE_EMBEDDED_DRAFT_URI ) . asJson ( ) ) ; }
Creates a template draft that can be used for embedded template creation .
4,530
public ApiApp getApiApp ( String clientId ) throws HelloSignException { String url = BASE_URI + API_APP_URI + "/" + clientId ; return new ApiApp ( httpClient . withAuth ( auth ) . get ( url ) . asJson ( ) ) ; }
Retrieves the API app configuration for the given Client ID .
4,531
public ApiAppList getApiApps ( ) throws HelloSignException { return new ApiAppList ( httpClient . withAuth ( auth ) . get ( BASE_URI + API_APP_LIST_URI ) . asJson ( ) ) ; }
Retrieves a paged list of API apps for the authenticated account .
4,532
public ApiApp createApiApp ( ApiApp app ) throws HelloSignException { return new ApiApp ( httpClient . withAuth ( auth ) . withPostFields ( app . getPostFields ( ) ) . post ( BASE_URI + API_APP_URI ) . asJson ( ) ) ; }
Creates a new ApiApp using the properties set on the provided ApiApp .
4,533
public boolean deleteApiApp ( String clientId ) throws HelloSignException { String url = BASE_URI + API_APP_URI + "/" + clientId ; return HttpURLConnection . HTTP_NO_CONTENT == httpClient . withAuth ( auth ) . delete ( url ) . asHttpCode ( ) ; }
Attempts to delete the API app with the given client ID .
4,534
public ApiApp updateApiApp ( ApiApp app ) throws HelloSignException { if ( ! app . hasClientId ( ) ) { throw new HelloSignException ( "Cannot update an ApiApp without a client ID. Create one first!" ) ; } String url = BASE_URI + API_APP_URI + "/" + app . getClientId ( ) ; return new ApiApp ( httpClient . withAuth ( aut...
Updates the API app with the given ApiApp object properties .
4,535
public void setAccessToken ( String accessToken , String tokenType ) throws HelloSignException { auth . setAccessToken ( accessToken , tokenType ) ; }
Sets the access token for the OAuth user that this client will use to perform requests .
4,536
public void setFormFields ( List < FormField > formFields ) throws HelloSignException { clearList ( DOCUMENT_FORM_FIELDS ) ; for ( FormField formField : formFields ) { addFormField ( formField ) ; } }
Overwrites the form fields for this document . This is useful when manually migrating form fields from a template .
4,537
public void addFormField ( FormField formField ) throws HelloSignException { if ( ! has ( DOCUMENT_FORM_FIELDS ) ) { clearList ( DOCUMENT_FORM_FIELDS ) ; } addToList ( DOCUMENT_FORM_FIELDS , formField ) ; }
Adds the form field to this document .
4,538
protected Constructor < ? > getConstructor ( Class < ? > clazz , Class < ? > paramClass ) { for ( Constructor < ? > c : clazz . getConstructors ( ) ) { Class < ? > [ ] paramTypes = c . getParameterTypes ( ) ; if ( paramTypes . length != 1 ) { continue ; } if ( paramTypes [ 0 ] . equals ( paramClass ) ) { return c ; } }...
Returns the first constructor that has exactly one parameter of the provided paramClass type .
4,539
public void setCustomFieldValue ( String fieldNameOrApiId , String value ) { CustomField f = new CustomField ( ) ; f . setName ( fieldNameOrApiId ) ; f . setValue ( value ) ; customFields . add ( f ) ; }
Adds the value to fill in for a custom field with the given field name .
4,540
public Map < String , String > getCustomFields ( ) { Map < String , String > fields = new HashMap < String , String > ( ) ; for ( CustomField f : customFields ) { fields . put ( f . getName ( ) , f . getValue ( ) ) ; } return fields ; }
Returns the map of custom fields for the template . This is a map of String field names to String field values .
4,541
public void setCustomFields ( Map < String , String > fields ) { clearCustomFields ( ) ; for ( String key : fields . keySet ( ) ) { CustomField f = new CustomField ( ) ; f . setName ( key ) ; f . setValue ( fields . get ( key ) ) ; customFields . add ( f ) ; } }
Overwrites the current map of custom fields to the provided map . This is a map of String field names to String field values .
4,542
public String getTemplateId ( ) throws HelloSignException { List < String > templateIds = getTemplateIds ( ) ; if ( templateIds . size ( ) == 0 ) { return null ; } return templateIds . get ( 0 ) ; }
Get the template ID that will be used with this request .
4,543
public void addTemplateId ( String id , Integer index ) throws HelloSignException { List < String > currentList = getList ( String . class , TEMPLATE_IDS ) ; if ( index == null ) { index = currentList . size ( ) ; } else if ( index < 0 ) { throw new HelloSignException ( "index cannot be negative" ) ; } else if ( index ...
Add the template ID to be used at the specified index .
4,544
public void setAccessToken ( String accessToken , String tokenType ) throws HelloSignException { if ( accessToken == null ) { throw new HelloSignException ( "Access Token cannot be null" ) ; } if ( tokenType == null ) { throw new HelloSignException ( "Token Type cannot be null" ) ; } this . accessToken = new String ( a...
Sets the access token for the HelloSign client authentication .
4,545
public void authenticate ( HttpURLConnection httpConn , String url ) { String authorization = null ; if ( hasAccessToken ( ) && isOperationOauth ( url ) ) { logger . debug ( "Using OAuth token to authenticate" ) ; authorization = getAccessTokenType ( ) + " " + getAccessToken ( ) ; } else if ( hasApiKey ( ) ) { logger ....
Authorizes the HTTP connection using this instance s credentials .
4,546
public void setScopes ( Set < ApiAppOauthScopeType > scopes ) { if ( oauth == null ) { oauth = new ApiAppOauth ( ) ; } oauth . setScopes ( scopes ) ; }
Set this API app s OAuth scopes .
4,547
public void addScope ( ApiAppOauthScopeType scope ) { if ( oauth == null ) { oauth = new ApiAppOauth ( ) ; } oauth . addScope ( scope ) ; }
Add a scope to this API App s OAuth scope list . Duplicates will be ignored .
4,548
public Map < String , Serializable > getPostFields ( ) throws HelloSignException { Map < String , Serializable > fields = new HashMap < String , Serializable > ( ) ; try { if ( hasName ( ) ) { fields . put ( APIAPP_NAME , getName ( ) ) ; } if ( hasDomain ( ) ) { fields . put ( APIAPP_DOMAIN , getDomain ( ) ) ; } if ( h...
Internal method used to retrieve the necessary POST fields to submit the API app to HelloSign .
4,549
public void setPageBackgroundColor ( String color ) throws HelloSignException { if ( white_labeling_options == null ) { white_labeling_options = new WhiteLabelingOptions ( ) ; } white_labeling_options . setPageBackgroundColor ( color ) ; }
Set the signer page background color .
4,550
public void setHeaderBackgroundColor ( String color ) throws HelloSignException { if ( white_labeling_options == null ) { white_labeling_options = new WhiteLabelingOptions ( ) ; } white_labeling_options . setHeaderBackgroundColor ( color ) ; }
Set the signer page header background color .
4,551
public void setTextColor1 ( String color ) throws HelloSignException { if ( white_labeling_options == null ) { white_labeling_options = new WhiteLabelingOptions ( ) ; } white_labeling_options . setTextColor1 ( color ) ; }
Set the signer page text 1 color .
4,552
public void setTextColor2 ( String color ) throws HelloSignException { if ( white_labeling_options == null ) { white_labeling_options = new WhiteLabelingOptions ( ) ; } white_labeling_options . setTextColor2 ( color ) ; }
Set the signer page text 2 color .
4,553
public void setLinkColor ( String color ) throws HelloSignException { if ( white_labeling_options == null ) { white_labeling_options = new WhiteLabelingOptions ( ) ; } white_labeling_options . setLinkColor ( color ) ; }
Set the signer page link color .
4,554
public void setPrimaryButtonColor ( String color ) throws HelloSignException { if ( white_labeling_options == null ) { white_labeling_options = new WhiteLabelingOptions ( ) ; } white_labeling_options . setPrimaryButtonColor ( color ) ; }
Set the signer page primary button color .
4,555
public void setPrimaryButtonTextColor ( String color ) throws HelloSignException { if ( white_labeling_options == null ) { white_labeling_options = new WhiteLabelingOptions ( ) ; } white_labeling_options . setPrimaryButtonTextColor ( color ) ; }
Set the signer page primary button text color .
4,556
public void setPrimaryButtonHoverColor ( String color ) throws HelloSignException { if ( white_labeling_options == null ) { white_labeling_options = new WhiteLabelingOptions ( ) ; } white_labeling_options . setPrimaryButtonHoverColor ( color ) ; }
Set the signer page primary button hover color .
4,557
public void setPrimaryButtonTextHoverColor ( String color ) throws HelloSignException { if ( white_labeling_options == null ) { white_labeling_options = new WhiteLabelingOptions ( ) ; } white_labeling_options . setPrimaryButtonTextHoverColor ( color ) ; }
Set the signer page primary button text hover color .
4,558
public void setSecondaryButtonColor ( String color ) throws HelloSignException { if ( white_labeling_options == null ) { white_labeling_options = new WhiteLabelingOptions ( ) ; } white_labeling_options . setSecondaryButtonColor ( color ) ; }
Set the signer page secondary button color .
4,559
public void setSecondaryButtonTextColor ( String color ) throws HelloSignException { if ( white_labeling_options == null ) { white_labeling_options = new WhiteLabelingOptions ( ) ; } white_labeling_options . setSecondaryButtonTextColor ( color ) ; }
Set the signer page secondary button text color .
4,560
public void setSecondaryButtonHoverColor ( String color ) throws HelloSignException { if ( white_labeling_options == null ) { white_labeling_options = new WhiteLabelingOptions ( ) ; } white_labeling_options . setSecondaryButtonHoverColor ( color ) ; }
Set the signer page secondary button hover color .
4,561
public void setSecondaryButtonTextHoverColor ( String color ) throws HelloSignException { if ( white_labeling_options == null ) { white_labeling_options = new WhiteLabelingOptions ( ) ; } white_labeling_options . setSecondaryButtonTextHoverColor ( color ) ; }
Set the signer page secondary button text hover color .
4,562
public void addFile ( File file ) throws HelloSignException { if ( ! ( request instanceof SignatureRequest ) ) { throw new HelloSignException ( "Cannot add files to this unclaimed draft" ) ; } ( ( SignatureRequest ) request ) . addFile ( file ) ; }
Adds a file to the unclaimed draft .
4,563
public void recover ( ) throws JMSException { checkClosed ( ) ; List < SQSMessageIdentifier > unAckedMessages = acknowledger . getUnAckMessages ( ) ; acknowledger . forgetUnAckMessages ( ) ; Map < String , Set < String > > queueToGroupsMapping = getAffectedGroupsPerQueueUrl ( unAckedMessages ) ; for ( SQSMessageConsume...
Negative acknowledges all the messages on the session that is delivered but not acknowledged .
4,564
public Queue createQueue ( String queueName ) throws JMSException { checkClosed ( ) ; return new SQSQueueDestination ( queueName , amazonSQSClient . getQueueUrl ( queueName ) . getQueueUrl ( ) ) ; }
This does not create SQS Queue . This method is only to create JMS Queue Object . Make sure the queue exists corresponding to the queueName .
4,565
public void send ( Queue queue , Message message ) throws JMSException { if ( ! ( queue instanceof SQSQueueDestination ) ) { throw new InvalidDestinationException ( "Incompatible implementation of Queue. Please use SQSQueueDestination implementation." ) ; } checkIfDestinationAlreadySet ( ) ; sendInternal ( ( SQSQueueDe...
Sends a message to a queue .
4,566
Map < String , MessageAttributeValue > propertyToMessageAttribute ( SQSMessage message ) throws JMSException { Map < String , MessageAttributeValue > messageAttributes = new HashMap < String , MessageAttributeValue > ( ) ; Enumeration < String > propertyNames = message . getPropertyNames ( ) ; while ( propertyNames . h...
Not verified on the client side but SQS Attribute names must be valid letter or digit on the basic multilingual plane in addition to allowing _ - and . . No component of an attribute name may be empty thus an attribute name may neither start nor end in . . And it may not contain .. .
4,567
private void addMessageTypeReservedAttribute ( Map < String , MessageAttributeValue > messageAttributes , SQSMessage message , String value ) throws JMSException { addStringAttribute ( messageAttributes , SQSMessage . JMS_SQS_MESSAGE_TYPE , value ) ; }
Adds the message type attribute during send as part of the send message request .
4,568
private void addReplyToQueueReservedAttributes ( Map < String , MessageAttributeValue > messageAttributes , SQSMessage message ) throws JMSException { Destination replyTo = message . getJMSReplyTo ( ) ; if ( replyTo instanceof SQSQueueDestination ) { SQSQueueDestination replyToQueue = ( SQSQueueDestination ) replyTo ; ...
Adds the reply - to queue name and url attributes during send as part of the send message request if necessary
4,569
private void addCorrelationIDToQueueReservedAttributes ( Map < String , MessageAttributeValue > messageAttributes , SQSMessage message ) throws JMSException { String correlationID = message . getJMSCorrelationID ( ) ; if ( correlationID != null ) { addStringAttribute ( messageAttributes , SQSMessage . JMS_SQS_CORRELATI...
Adds the correlation ID attribute during send as part of the send message request if necessary
4,570
private void addStringAttribute ( Map < String , MessageAttributeValue > messageAttributes , String key , String value ) { MessageAttributeValue messageAttributeValue = new MessageAttributeValue ( ) ; messageAttributeValue . setDataType ( SQSMessagingClientConstants . STRING ) ; messageAttributeValue . setStringValue (...
Convenience method for adding a single string attribute .
4,571
public void send ( Message message ) throws JMSException { if ( sqsDestination == null ) { throw new UnsupportedOperationException ( "MessageProducer has to specify a destination at creation time." ) ; } sendInternal ( sqsDestination , message ) ; }
Sends a message to a destination created during the creation time of this message producer .
4,572
public void send ( Destination destination , Message message ) throws JMSException { if ( destination == null ) { throw new InvalidDestinationException ( "Destination cannot be null" ) ; } if ( destination instanceof SQSQueueDestination ) { send ( ( Queue ) destination , message ) ; } else { throw new InvalidDestinatio...
Sends a message to a queue destination .
4,573
public String readUTF ( ) throws JMSException { checkCanRead ( ) ; try { return dataIn . readUTF ( ) ; } catch ( EOFException e ) { throw new MessageEOFException ( e . getMessage ( ) ) ; } catch ( IOException e ) { throw convertExceptionToJMSException ( e ) ; } }
Reads a string that has been encoded using a UTF - 8 format from the bytes message stream
4,574
public void writeUTF ( String value ) throws JMSException { checkCanWrite ( ) ; try { dataOut . writeUTF ( value ) ; } catch ( IOException e ) { throw convertExceptionToJMSException ( e ) ; } }
Writes a string that has been encoded using a UTF - 8 format to the bytes message stream
4,575
public void writeBytes ( byte [ ] value ) throws JMSException { checkCanWrite ( ) ; try { dataOut . write ( value ) ; } catch ( IOException e ) { throw convertExceptionToJMSException ( e ) ; } }
Writes a byte array to the bytes message stream
4,576
protected void processReceivedMessages ( List < Message > messages ) { List < String > nackMessages = new ArrayList < String > ( ) ; List < MessageManager > messageManagers = new ArrayList < MessageManager > ( ) ; for ( Message message : messages ) { try { javax . jms . Message jmsMessage = convertToJMSMessage ( messag...
Converts the received message to JMS message and pushes to messages to either callback scheduler for asynchronous message delivery or to internal buffers for synchronous message delivery . Messages that was not converted to JMS message will be immediately negative acknowledged .
4,577
protected javax . jms . Message convertToJMSMessage ( Message message ) throws JMSException { MessageAttributeValue messageTypeAttribute = message . getMessageAttributes ( ) . get ( SQSMessage . JMS_SQS_MESSAGE_TYPE ) ; javax . jms . Message jmsMessage = null ; if ( messageTypeAttribute == null ) { jmsMessage = new SQS...
Convert the return SQS message into JMS message
4,578
private javax . jms . Message messageHandler ( MessageManager messageManager ) throws JMSException { if ( messageManager == null ) { return null ; } javax . jms . Message message = messageManager . getMessage ( ) ; this . messageDispatched ( ) ; acknowledger . notifyMessageReceived ( ( SQSMessage ) message ) ; return m...
Helper that notifies PrefetchThread that message is dispatched and AutoAcknowledge
4,579
public Thread newThread ( Runnable r ) { Thread t ; if ( threadGroup == null ) { t = new Thread ( r , threadBaseName + threadCounter . incrementAndGet ( ) ) ; t . setDaemon ( isDaemon ) ; } else { t = new Thread ( threadGroup , r , threadBaseName + threadCounter . incrementAndGet ( ) ) ; t . setDaemon ( isDaemon ) ; } ...
Constructs a new Thread . Initializes name daemon status and ThreadGroup if there is any .
4,580
private int indexOf ( SQSMessageIdentifier findMessage ) { int i = 0 ; for ( SQSMessageIdentifier sqsMessageIdentifier : unAckMessages ) { i ++ ; if ( sqsMessageIdentifier . equals ( findMessage ) ) { return i ; } } return - 1 ; }
Return the index of message if the message is in queue . Return - 1 if message does not exist in queue .
4,581
public void notifyMessageReceived ( SQSMessage message ) throws JMSException { SQSMessageIdentifier messageIdentifier = SQSMessageIdentifier . fromSQSMessage ( message ) ; if ( ! unAckMessages . contains ( messageIdentifier ) ) { unAckMessages . add ( messageIdentifier ) ; } }
Updates the internal queue for the consumed but not acknowledged messages if the message was not already on queue .
4,582
public void setSQSMessageId ( String sqsMessageID ) throws JMSException { this . sqsMessageID = sqsMessageID ; this . setJMSMessageID ( String . format ( SQSMessagingClientConstants . MESSAGE_ID_FORMAT , sqsMessageID ) ) ; }
Set SQS Message Id used on send .
4,583
public void setSequenceNumber ( String sequenceNumber ) throws JMSException { if ( sequenceNumber == null || sequenceNumber . isEmpty ( ) ) { properties . remove ( SQSMessagingClientConstants . JMS_SQS_SEQUENCE_NUMBER ) ; } else { properties . put ( SQSMessagingClientConstants . JMS_SQS_SEQUENCE_NUMBER , new JMSMessage...
This method sets the JMS_SQS_SEQUENCE_NUMBER property on the message . It is exposed explicitly here so that it can be invoked even on read - only message object obtained through receing a message . This support the use case of send a received message by using the same JMSMessage object .
4,584
public void notifyMessageReceived ( SQSMessage message ) throws JMSException { SQSMessageIdentifier messageIdentifier = SQSMessageIdentifier . fromSQSMessage ( message ) ; unAckMessages . put ( message . getReceiptHandle ( ) , messageIdentifier ) ; }
Updates the internal data structure for the consumed but not acknowledged message .
4,585
public long delayBeforeNextRetry ( int retriesAttempted ) { if ( retriesAttempted < 1 ) { return initialDelay ; } if ( retriesAttempted > 63 ) { return maxDelay ; } long multiplier = ( ( long ) 1 << ( retriesAttempted - 1 ) ) ; if ( multiplier > Long . MAX_VALUE / delayInterval ) { return maxDelay ; } long delay = mult...
Returns the delay before the next attempt .
4,586
public void bulkAction ( ArrayDeque < MessageManager > messageQueue , String queueUrl ) throws JMSException { List < String > receiptHandles = new ArrayList < String > ( ) ; while ( ! messageQueue . isEmpty ( ) ) { receiptHandles . add ( ( ( SQSMessage ) ( messageQueue . pollFirst ( ) . getMessage ( ) ) ) . getReceiptH...
Bulk action for negative acknowledge on the list of messages of a specific queue .
4,587
public void action ( String queueUrl , List < String > receiptHandles ) throws JMSException { if ( receiptHandles == null || receiptHandles . isEmpty ( ) ) { return ; } List < ChangeMessageVisibilityBatchRequestEntry > nackEntries = new ArrayList < ChangeMessageVisibilityBatchRequestEntry > ( receiptHandles . size ( ) ...
Action call block for negative acknowledge for the list of receipt handles . This action can be applied on multiple messages for the same queue .
4,588
public void bulkAction ( List < SQSMessageIdentifier > messageIdentifierList , int indexOfMessage ) throws JMSException { assert indexOfMessage > 0 ; assert indexOfMessage <= messageIdentifierList . size ( ) ; Map < String , List < String > > receiptHandleWithSameQueueUrl = new HashMap < String , List < String > > ( ) ...
Bulk action on list of message identifiers up to the provided index
4,589
public void setEndpoint ( String endpoint ) throws JMSException { try { amazonSQSClient . setEndpoint ( endpoint ) ; } catch ( IllegalArgumentException ase ) { JMSException jmsException = new JMSException ( ase . getMessage ( ) ) ; throw ( JMSException ) jmsException . initCause ( ase ) ; } }
Sets SQS endpoint and wraps IllegalArgumentException . Deprecated . Instead of manipulating settings of existing AmazonSQS client provide correct configuration when creating it through SQSConnectionFactory constructors .
4,590
public GetQueueUrlResult getQueueUrl ( String queueName , String queueOwnerAccountId ) throws JMSException { return getQueueUrl ( new GetQueueUrlRequest ( queueName ) . withQueueOwnerAWSAccountId ( queueOwnerAccountId ) ) ; }
Gets the queueUrl of a queue given a queue name owned by the provided accountId .
4,591
public void addPermission ( String roleName , String capability ) { Permission permission = new Permission ( ) ; permission . setRoleName ( roleName ) ; permission . setCapability ( capability ) ; this . permissions . add ( permission ) ; }
adds a permission to this module
4,592
public static void run ( ExampleProperties props ) throws IOException , FailedRequestException , ResourceNotFoundException , ResourceNotResendableException , ForbiddenUserException { System . out . println ( "example: " + OptimisticLocking . class . getName ( ) ) ; requireOptimisticLocking ( props . host , props . port...
install the transform and then write a transformed document
4,593
public static void tearDownExample ( String host , int port , String user , String password , Authentication authType ) throws FailedRequestException , ResourceNotFoundException , ResourceNotResendableException , ForbiddenUserException { DatabaseClient client = DatabaseClientFactory . newClient ( host , port , user , p...
clean up by resetting the server configuration
4,594
public static void tearDownExample ( DatabaseClient client ) { XMLDocumentManager docMgr = client . newXMLDocumentManager ( ) ; String docId = "/example/flipper.xml" ; docMgr . delete ( docId ) ; }
clean up by deleting the document that the example wrote
4,595
public static void tearDownExample ( String host , int port , String user , String password , Authentication authType ) throws ResourceNotFoundException , ForbiddenUserException , FailedRequestException { DatabaseClient client = DatabaseClientFactory . newClient ( host , port , user , password , authType ) ; XMLDocumen...
clean up by deleting the documents and query options used in the example query
4,596
public static void tearDownExample ( XMLDocumentManager docMgr , String docId , String webserviceId , String newId ) { docMgr . delete ( docId ) ; docMgr . delete ( webserviceId ) ; docMgr . delete ( newId ) ; }
clean up by deleting the documents for the example
4,597
static public ContentHandleFactory newFactory ( ) { return new ContentHandleFactory ( ) { public Class < ? > [ ] getHandledClasses ( ) { return new Class < ? > [ ] { String . class } ; } public boolean isHandled ( Class < ? > type ) { return String . class . isAssignableFrom ( type ) ; } public < C > ContentHandle < C ...
Creates a factory to create a StringHandle instance for a string .
4,598
public void processEmployee ( WriteBatcher wb , Employee employee ) { String uri = "/employees/" + employee . getEmployeeId ( ) + ".json" ; try { uriQueue . put ( uri ) ; } catch ( InterruptedException e ) { throw new RuntimeException ( e ) ; } ; sourceEmployees . put ( uri , employee ) ; }
for each Employee record retrieved from the source
4,599
protected boolean isHostUnavailableException ( Throwable throwable , Set < Throwable > path ) { if ( IOException . class . isInstance ( throwable ) && throwable . getMessage ( ) . contains ( "unexpected end of stream on" ) ) { return true ; } if ( throwable . getCause ( ) != null && ! path . contains ( throwable . getC...
appropriate exception for no response from the server