idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
35,800
private String getAuthHeader ( ) { String base64ClientIdSec = DatatypeConverter . printBase64Binary ( ( oauth2Config . getClientId ( ) + ":" + oauth2Config . getClientSecret ( ) ) . getBytes ( ) ) ; return "Basic " + base64ClientIdSec ; }
Method to generate auth header based on client ID and Client Secret
35,801
public UserInfoResponse getUserInfo ( String accessToken ) throws OpenIdException { logger . debug ( "Enter OAuth2PlatformClient::getUserInfo" ) ; try { HttpRequestClient client = new HttpRequestClient ( oauth2Config . getProxyConfig ( ) ) ; Request request = new Request . RequestBuilder ( MethodType . GET , oauth2Conf...
Method to retrieve UserInfo data associated with the accessToken generated The response depends on the Scope supplied during openId
35,802
public boolean validateIDToken ( String idToken ) throws OpenIdException { logger . debug ( "Enter OAuth2PlatformClient::validateIDToken" ) ; String [ ] idTokenParts = idToken . split ( "\\." ) ; if ( idTokenParts . length < 3 ) { logger . debug ( "invalid idTokenParts length" ) ; return false ; } String idTokenHeader ...
Method to validate IDToken
35,803
private HashMap < String , JSONObject > getKeyMapFromJWKSUri ( ) throws OpenIdException { logger . debug ( "Enter OAuth2PlatformClient::getKeyMapFromJWKSUri" ) ; try { HttpRequestClient client = new HttpRequestClient ( oauth2Config . getProxyConfig ( ) ) ; Request request = new Request . RequestBuilder ( MethodType . G...
Build JWKS keymap
35,804
private PublicKey getPublicKey ( String MODULUS , String EXPONENT ) { byte [ ] nb = base64UrlDecodeToBytes ( MODULUS ) ; byte [ ] eb = base64UrlDecodeToBytes ( EXPONENT ) ; BigInteger n = new BigInteger ( 1 , nb ) ; BigInteger e = new BigInteger ( 1 , eb ) ; RSAPublicKeySpec rsaPublicKeySpec = new RSAPublicKeySpec ( n ...
Build public key
35,805
private HashMap < String , JSONObject > buildKeyMap ( String content ) throws ConnectionException { HashMap < String , JSONObject > retMap = new HashMap < String , JSONObject > ( ) ; JSONObject jwksPayload = new JSONObject ( content ) ; JSONArray keysArray = jwksPayload . getJSONArray ( "keys" ) ; for ( int i = 0 ; i <...
Build Map from response
35,806
public Expression < String > eq ( String value ) { String valueString = "'" + value + "'" ; return new Expression < String > ( this , Operation . eq , valueString ) ; }
Method to construct the equals expression for string
35,807
public Expression < String > neq ( String value ) { String valueString = "'" + value + "'" ; return new Expression < String > ( this , Operation . neq , valueString ) ; }
Method to construct the not equals expression for string
35,808
public Expression < String > lt ( String value ) { String valueString = "'" + value + "'" ; return new Expression < String > ( this , Operation . lt , valueString ) ; }
Method to construct the less than expression for string
35,809
public Expression < String > lte ( String value ) { String valueString = "'" + value + "'" ; return new Expression < String > ( this , Operation . lte , valueString ) ; }
Method to construct the less than or equals expression for string
35,810
public Expression < String > gt ( String value ) { String valueString = "'" + value + "'" ; return new Expression < String > ( this , Operation . gt , valueString ) ; }
Method to construct the greater than expression for string
35,811
public Expression < String > gte ( String value ) { String valueString = "'" + value + "'" ; return new Expression < String > ( this , Operation . gte , valueString ) ; }
Method to construct the greater than or equals expression for string
35,812
public Expression < String > in ( String [ ] value ) { String listString = "" ; Boolean firstString = true ; for ( String v : value ) { if ( firstString ) { listString = listString . concat ( "('" ) . concat ( v ) . concat ( "'" ) ; firstString = false ; } else { listString = listString . concat ( ", '" ) . concat ( v ...
Method to construct the in expression for string
35,813
public Expression < String > startsWith ( String value ) { String valueString = "'" + value + "%'" ; return new Expression < String > ( this , Operation . like , valueString ) ; }
Method to construct the like expression for string starts with
35,814
public Expression < String > endsWith ( String value ) { String valueString = "'%" + value + "'" ; return new Expression < String > ( this , Operation . like , valueString ) ; }
Method to construct the like expression for string ends with
35,815
public Expression < String > contains ( String value ) { String valueString = "'%" + value + "%'" ; return new Expression < String > ( this , Operation . like , valueString ) ; }
Method to construct the like expression for string contains
35,816
public Expression < String > between ( String startValue , String endValue ) { String valueString = "'" + startValue + "' AND '" + endValue + "'" ; return new Expression < String > ( this , Operation . between , valueString ) ; }
Method to construct the between expression for string
35,817
public String getContent ( ) throws ConnectionException { logger . debug ( "Enter Response::getContent" ) ; if ( content != null ) { logger . debug ( "content already available " ) ; return content ; } BufferedReader rd = new BufferedReader ( new InputStreamReader ( stream ) ) ; StringBuffer result = new StringBuffer (...
Returns the json content from http response
35,818
public static void setProperty ( String key , String value ) { local . get ( ) . cc . setProperty ( key , value ) ; }
Sets the property to the configuration
35,819
public static Boolean getBooleanProperty ( String key , Boolean defaultValue ) { String value = getProperty ( key ) ; if ( ( null == value ) || value . isEmpty ( ) ) { return ( null == defaultValue ) ? false : defaultValue ; } if ( "null" . equals ( value . toLowerCase ( ) ) && ( null != defaultValue ) ) { return defau...
Returns boolean value for specified property and default value
35,820
private SimpleDateFormat getDateTimeFormatter ( ) { SimpleDateFormat formatter = new SimpleDateFormat ( ) ; formatter . applyPattern ( "yyyy-MM-dd'T'HH:mm:ss" ) ; formatter . setTimeZone ( TimeZone . getTimeZone ( "GMT" ) ) ; return formatter ; }
Method to get simple date format
35,821
private String getCalendarAsString ( Calendar cal ) { SimpleDateFormat formatter = getDateTimeFormatter ( ) ; Date date = cal . getTime ( ) ; return formatter . format ( date ) . concat ( "Z" ) ; }
Method to get string value of date from Calendar
35,822
public Expression < Calendar > eq ( Calendar value ) { String valueString = "'" + getCalendarAsString ( value ) + "'" ; return new Expression < Calendar > ( this , Operation . eq , valueString ) ; }
Method to construct the equals expression for Calendar
35,823
public Expression < Calendar > neq ( Calendar value ) { String valueString = "'" + getCalendarAsString ( value ) + "'" ; return new Expression < Calendar > ( this , Operation . neq , valueString ) ; }
Method to construct the not equals expression for Calendar
35,824
public Expression < Calendar > lt ( Calendar value ) { String valueString = "'" + getCalendarAsString ( value ) + "'" ; return new Expression < Calendar > ( this , Operation . lt , valueString ) ; }
Method to construct the less than expression for calendar
35,825
public Expression < Calendar > lte ( Calendar value ) { String valueString = "'" + getCalendarAsString ( value ) + "'" ; return new Expression < Calendar > ( this , Operation . lte , valueString ) ; }
Method to construct the less than or equals expression for calendar
35,826
public Expression < java . sql . Date > lte ( java . sql . Date value ) { SimpleDateFormat formatter = getDateFormatter ( ) ; String valueString = "'" + formatter . format ( value ) + "'" ; return new Expression < java . sql . Date > ( this , Operation . lte , valueString ) ; }
Method to construct the less than or equals expression for date
35,827
public Expression < Calendar > gt ( Calendar value ) { String valueString = "'" + getCalendarAsString ( value ) + "'" ; return new Expression < Calendar > ( this , Operation . gt , valueString ) ; }
Method to construct the greater than expression for calendar
35,828
public Expression < java . util . Date > gt ( java . util . Date value ) { SimpleDateFormat formatter = getDateTimeFormatter ( ) ; String valueString = "'" + formatter . format ( value ) . concat ( "Z" ) + "'" ; return new Expression < java . util . Date > ( this , Operation . gt , valueString ) ; }
Method to construct the greater than expression for date
35,829
public Expression < Calendar > gte ( Calendar value ) { String valueString = "'" + getCalendarAsString ( value ) + "'" ; return new Expression < Calendar > ( this , Operation . gte , valueString ) ; }
Method to construct the greater than or equals expression for calendar
35,830
public Expression < Calendar > in ( Calendar [ ] value ) { String valueString = "" ; Boolean firstCalendar = true ; for ( Calendar v : value ) { if ( firstCalendar ) { valueString = valueString . concat ( "('" ) . concat ( getCalendarAsString ( v ) ) . concat ( "'" ) ; firstCalendar = false ; } else { valueString = val...
Method to construct the in expression for calendar
35,831
public Expression < java . util . Date > in ( java . util . Date [ ] value ) { SimpleDateFormat formatter = getDateTimeFormatter ( ) ; String valueString = "" ; Boolean firstCalendar = true ; for ( Date v : value ) { if ( firstCalendar ) { valueString = valueString . concat ( "('" ) . concat ( formatter . format ( v ) ...
Method to construct the in expression for date
35,832
public Expression < Calendar > between ( Calendar startValue , Calendar endValue ) { String valueString = "'" + getCalendarAsString ( startValue ) . concat ( "Z" ) + "' AND '" + getCalendarAsString ( endValue ) + "'" ; return new Expression < Calendar > ( this , Operation . between , valueString ) ; }
Method to construct the between expression for calendar
35,833
private void setResponseElements ( IntuitMessage intuitMessage , HttpURLConnection httpUrlConnection ) throws FMSException { LOG . debug ( "Response headers:" + httpUrlConnection . getHeaderFields ( ) ) ; ResponseElements responseElements = intuitMessage . getResponseElements ( ) ; responseElements . setEncodingHeader ...
Method to set the response elements by reading the values from the response
35,834
private InputStream getCopyOfResponseContent ( InputStream is ) throws FMSException { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; InputStream copyIs = null ; try { byte [ ] bbuf = new byte [ LENGTH_256 ] ; while ( true ) { int r = is . read ( bbuf ) ; if ( r < 0 ) { break ; } baos . write ( bbuf , 0 , ...
Method to create the copy of the input stream of response body . This is required while decompress the original content
35,835
private void setTimeout ( HttpURLConnection httpUrlConnection ) { String connTimeout = Config . getProperty ( Config . TIMEOUT_CONNECTION ) ; if ( StringUtils . hasText ( connTimeout ) ) { httpUrlConnection . setReadTimeout ( new Integer ( connTimeout . trim ( ) ) ) ; } String reqTimeout = Config . getProperty ( Config...
Method to set the connection and request timeouts by reading from the configuration file
35,836
public PlatformResponse disconnect ( String consumerKey , String consumerSecret , String accessToken , String accessTokenSecret ) throws ConnectionException { httpClient = new PlatformHttpClient ( consumerKey , consumerSecret , accessToken , accessTokenSecret ) ; return this . httpClient . disconnect ( ) ; }
Disconnects the user from quickbooks
35,837
public User getcurrentUser ( String consumerKey , String consumerSecret , String accessToken , String accessTokenSecret ) throws ConnectionException { httpClient = new PlatformHttpClient ( consumerKey , consumerSecret , accessToken , accessTokenSecret ) ; User user = null ; ; try { user = this . httpClient . getCurrent...
getCurrentUser the user from quickbooks
35,838
public List < String > getAppMenu ( String consumerKey , String consumerSecret , String accessToken , String accessTokenSecret ) throws ConnectionException { try { List < String > menulist ; httpClient = new PlatformHttpClient ( consumerKey , consumerSecret , accessToken , accessTokenSecret ) ; menulist = this . httpCl...
Get App Menu returns list of all the applications that are linked with the selected company
35,839
private void swapRequestInterceptor ( Class < ? extends Interceptor > target , Interceptor interceptor ) { List < Interceptor > list = this . getRequestInterceptors ( ) ; for ( Interceptor object : list ) { if ( object . getClass ( ) == target ) { list . set ( list . indexOf ( object ) , interceptor ) ; } } this . setR...
Swap one interceptor with new one
35,840
private SyncObject getSyncObject ( JsonNode jsonNode ) { String name = null ; JsonNode jn1 = null ; SyncObject syncObject = new SyncObject ( ) ; Iterator < String > ite = jsonNode . fieldNames ( ) ; while ( ite . hasNext ( ) ) { String key = ite . next ( ) ; if ( JsonResourceTypeLocator . lookupType ( key ) != null ) {...
Method to Object Intuitobject
35,841
public ECheck create ( ECheck eCheck ) throws BaseException { logger . debug ( "Enter ECheckService::create" ) ; String apiUrl = requestContext . getBaseUrl ( ) + "echecks" . replaceAll ( "\\{format\\}" , "json" ) ; logger . info ( "apiUrl - " + apiUrl ) ; TypeReference < ECheck > typeReference = new TypeReference < EC...
Method to create ECheck
35,842
public ECheck retrieve ( String eCheckId ) throws BaseException { logger . debug ( "Enter ECheckService::retrieve" ) ; if ( StringUtils . isBlank ( eCheckId ) ) { logger . error ( "IllegalArgumentException {}" , eCheckId ) ; throw new IllegalArgumentException ( "eCheckId cannot be empty or null" ) ; } String apiUrl = r...
Method to retrieve ECheck
35,843
public Refund refund ( String eCheckId , Refund refund ) throws BaseException { logger . debug ( "Enter ECheckService::refund" ) ; if ( StringUtils . isBlank ( eCheckId ) ) { logger . error ( "IllegalArgumentException {}" , eCheckId ) ; throw new IllegalArgumentException ( "eCheckId cannot be empty or null" ) ; } Strin...
Method to refund or void ECheck
35,844
private CustomFieldDefinition getCustomFieldDefinitionType ( JsonNode jn ) throws IOException { if ( jn . isArray ( ) ) { JsonNode jn1 = jn . get ( 0 ) ; String type = jn1 . get ( TYPE ) . textValue ( ) ; try { return ( CustomFieldDefinition ) Class . forName ( "com.intuit.ipp.data." + type + "CustomFieldDefinition" ) ...
Method to get the CustomFieldDefinition implementation type object
35,845
private BatchItemResponse getBatchItemResponse ( JsonNode jsonNode ) throws IOException { ObjectMapper mapper = new ObjectMapper ( ) ; SimpleModule simpleModule = new SimpleModule ( "BatchItemResponseDeserializer" , new Version ( 1 , 0 , 0 , null ) ) ; simpleModule . addDeserializer ( BatchItemResponse . class , new Ba...
Method to deserialize the BatchItemResponse object
35,846
public void execute ( List < IntuitMessage > intuitMessages ) throws FMSException { LOG . debug ( "Enter HTTPBatchClientConnectionInterceptor - batch..." ) ; RequestElements intuitRequest = getFirst ( intuitMessages ) . getRequestElements ( ) ; IntuitRetryPolicyHandler handler = getRetryHandler ( ) ; HttpClientBuilder ...
Major executor . It is not part of interface
35,847
private IntuitMessage getFirst ( List < IntuitMessage > intuitMessages ) throws FMSException { if ( intuitMessages . isEmpty ( ) ) { throw new FMSException ( "IntuitMessages list is empty. Nothing to upload." ) ; } return intuitMessages . get ( 0 ) ; }
Returns first item from the list
35,848
public SSLConnectionSocketFactory prepareClientSSL ( ) { try { String path = Config . getProperty ( Config . PROXY_KEYSTORE_PATH ) ; String pass = Config . getProperty ( Config . PROXY_KEYSTORE_PASSWORD ) ; KeyStore trustStore = null ; if ( path != null && pass != null ) { trustStore = KeyStore . getInstance ( KeyStore...
Configures proxy if this is applicable to connection
35,849
private < T extends CloseableHttpClient > HttpRequestBase prepareHttpRequest ( RequestElements intuitRequest ) throws FMSException { HttpRequestBase httpRequest = extractMethod ( intuitRequest , extractURI ( intuitRequest ) ) ; populateRequestHeaders ( httpRequest , intuitRequest . getRequestHeaders ( ) ) ; authorizeRe...
Returns httpRequest instance with configured fields
35,850
private URI extractURI ( RequestElements intuitRequest ) throws FMSException { URI uri = null ; try { uri = new URI ( intuitRequest . getRequestParameters ( ) . get ( RequestElements . REQ_PARAM_RESOURCE_URL ) ) ; } catch ( URISyntaxException e ) { throw new FMSException ( "URISyntaxException" , e ) ; } return uri ; }
Returns URI instance which will be used as a connection source
35,851
private HttpRequestBase extractMethod ( RequestElements intuitRequest , URI uri ) throws FMSException { String method = intuitRequest . getRequestParameters ( ) . get ( RequestElements . REQ_PARAM_METHOD_TYPE ) ; if ( method . equals ( MethodType . GET . toString ( ) ) ) { return new HttpGet ( uri ) ; } else if ( metho...
Returns instance of HttpGet or HttpPost type depends from request parameters
35,852
private IntuitMessage executeHttpRequest ( HttpRequestBase httpRequest , CloseableHttpClient client ) throws FMSException { CloseableHttpResponse httpResponse = null ; IntuitMessage intuitMessage = new IntuitMessage ( ) ; try { HttpHost target = new HttpHost ( httpRequest . getURI ( ) . getHost ( ) , - 1 , httpRequest ...
Executes communication with remote host
35,853
private void authorizeRequest ( Context context , HttpRequestBase httpRequest ) throws FMSException { context . getAuthorizer ( ) . authorize ( httpRequest ) ; }
Method to authorize the given HttpRequest
35,854
private IntuitRetryPolicyHandler getRetryHandler ( ) throws FMSException { IntuitRetryPolicyHandler handler = null ; String policy = Config . getProperty ( Config . RETRY_MODE ) ; if ( policy . equalsIgnoreCase ( "fixed" ) ) { String retryCountStr = Config . getProperty ( Config . RETRY_FIXED_COUNT ) ; String retryInte...
Method to get the retry handler which is used to retry to establish the HTTP connection
35,855
private void setResponseElements ( IntuitMessage intuitMessage , HttpResponse httpResponse ) throws FMSException { ResponseElements responseElements = intuitMessage . getResponseElements ( ) ; if ( httpResponse . getLastHeader ( RequestElements . HEADER_PARAM_CONTENT_ENCODING ) != null ) { responseElements . setEncodin...
Method to set the response elements by reading the values from HttpResponse
35,856
private RequestConfig setTimeout ( Context context ) { int socketTimeout = 0 ; int connectionTimeout = 0 ; if ( context . getCustomerRequestTimeout ( ) != null ) { socketTimeout = context . getCustomerRequestTimeout ( ) ; } else { String reqTimeout = Config . getProperty ( Config . TIMEOUT_REQUEST ) ; if ( StringUtils ...
Method to set the connection and request timeouts by reading from the configuration file or Context object
35,857
private HttpEntity populateEntity ( RequestElements intuitRequest ) throws FMSException { byte [ ] compressedData = intuitRequest . getCompressedData ( ) ; if ( null == compressedData ) { try { return new StringEntity ( intuitRequest . getPostString ( ) ) ; } catch ( UnsupportedEncodingException e ) { throw new FMSExce...
Creates HttpEntity depends from type of content
35,858
public static String serialize ( Object obj ) throws SerializationException { try { if ( obj != null ) { return mapper . writeValueAsString ( obj ) ; } else { return null ; } } catch ( Exception e ) { logger . error ( "SerializationException {}" , e . getMessage ( ) ) ; throw new SerializationException ( e . getMessage...
Serialize object to String
35,859
public static Object deserialize ( String json , TypeReference < ? > typeReference ) throws SerializationException { try { logger . debug ( "Json string to deserialize {} " , json ) ; return mapper . readValue ( json , typeReference ) ; } catch ( IOException e ) { logger . error ( "SerializationException {}" , e . getM...
Deserialize String to object of TypeReference
35,860
@ SuppressWarnings ( "unchecked" ) public < T extends IEntity > List < T > findAll ( T entity ) throws FMSException { String intuitQuery = "SELECT * FROM " + entity . getClass ( ) . getSimpleName ( ) ; QueryResult result = executeQuery ( intuitQuery ) ; return ( List < T > ) result . getEntities ( ) ; }
Method to retrieve all records for the given entity Note without pagination this will return only 100 records Use query API to add pagintion and obtain additional records
35,861
@ SuppressWarnings ( "unchecked" ) public < T extends IEntity > T add ( T entity ) throws FMSException { IntuitMessage intuitMessage = prepareAdd ( entity ) ; executeInterceptors ( intuitMessage ) ; return ( T ) retrieveEntity ( intuitMessage ) ; }
Method to add the given entity
35,862
@ SuppressWarnings ( "unchecked" ) public < T extends IEntity > T delete ( T entity ) throws FMSException { IntuitMessage intuitMessage = prepareDelete ( entity ) ; executeInterceptors ( intuitMessage ) ; return ( T ) retrieveEntity ( intuitMessage ) ; }
Method to delete record for the given entity
35,863
@ SuppressWarnings ( "unchecked" ) public < T extends IEntity > T update ( T entity ) throws FMSException { IntuitMessage intuitMessage = prepareUpdate ( entity ) ; executeInterceptors ( intuitMessage ) ; return ( T ) retrieveEntity ( intuitMessage ) ; }
Method to update the record of the corresponding entity
35,864
@ SuppressWarnings ( "unchecked" ) public < T extends IEntity > T updateAccountOnTxns ( T entity ) throws FMSException { IntuitMessage intuitMessage = prepareupdateAccountOnTxns ( entity ) ; executeInterceptors ( intuitMessage ) ; return ( T ) retrieveEntity ( intuitMessage ) ; }
updateAccountOnTxns used for France Locale with Minor Version > = 5 .
35,865
@ SuppressWarnings ( "unchecked" ) public < T extends IEntity > T donotUpdateAccountOnTxns ( T entity ) throws FMSException { IntuitMessage intuitMessage = preparedonotUpdateAccountOnTxns ( entity ) ; executeInterceptors ( intuitMessage ) ; return ( T ) retrieveEntity ( intuitMessage ) ; }
donotUpdateAccountOnTxns used for France Locale with Minor Version > = 5 .
35,866
@ SuppressWarnings ( "unchecked" ) private < T extends IEntity > T retrieveEntity ( IntuitMessage intuitMessage ) { T returnEntity = null ; IntuitResponse intuitResponse = ( IntuitResponse ) intuitMessage . getResponseElements ( ) . getResponse ( ) ; if ( intuitResponse != null ) { JAXBElement < ? extends IntuitEntity ...
Common method to retrieve result entity from IntuitMessage
35,867
@ SuppressWarnings ( "unchecked" ) public < T extends IEntity > T voidRequest ( T entity ) throws FMSException { IntuitMessage intuitMessage = prepareVoidRequest ( entity ) ; executeInterceptors ( intuitMessage ) ; return ( T ) retrieveEntity ( intuitMessage ) ; }
Method to cancel the operation for the corresponding entity
35,868
@ SuppressWarnings ( "unchecked" ) public < T extends IEntity > T upload ( T entity , InputStream docContent ) throws FMSException { IntuitMessage intuitMessage = prepareUpload ( entity , docContent ) ; executeInterceptors ( intuitMessage ) ; return ( T ) getReturnEntity ( intuitMessage ) ; }
Method to upload the given document content for the corresponding entity
35,869
public < T extends IEntity > List < T > upload ( List < UploadEntry > entries ) throws FMSException { List < IntuitMessage > intuitMessages = prepareUpload ( entries ) ; if ( ! intuitMessages . isEmpty ( ) ) { executeInterceptors ( intuitMessages ) ; } return getResultEntities ( intuitMessages ) ; }
Method to upload entities with their correspond binary
35,870
@ SuppressWarnings ( "unchecked" ) private < T extends IEntity > List < T > getResultEntities ( List < IntuitMessage > intuitMessages ) { List < T > resultEntities = new ArrayList < T > ( ) ; int i = 0 ; for ( IntuitMessage intuitMessage : intuitMessages ) { if ( ! isContainResponse ( intuitMessage , i ) ) { LOG . warn...
Processes list of intuitMessages and returns list of resultEntities
35,871
private List < IntuitMessage > prepareUpload ( List < UploadEntry > entries ) throws FMSException { List < IntuitMessage > intuitMessages = new ArrayList < IntuitMessage > ( ) ; String boundaryId = null ; for ( UploadEntry item : entries ) { if ( item . isEmpty ( ) ) { LOG . warn ( "UploadEntry instance (hash:" + Syste...
Creates list of IntuitMessage instances based on list of entries
35,872
private boolean isContainResponse ( IntuitMessage intuitMessage , int idx ) { List < AttachableResponse > response = ( ( IntuitResponse ) intuitMessage . getResponseElements ( ) . getResponse ( ) ) . getAttachableResponse ( ) ; if ( null == response ) { return false ; } if ( 0 >= response . size ( ) ) { return false ; ...
verifies availability of an object in response
35,873
public < T extends IEntity > T sendEmail ( T entity ) throws FMSException { return sendEmail ( entity , null ) ; }
Send entity via email using address associated with this entity in the system
35,874
@ SuppressWarnings ( "unchecked" ) public < T extends IEntity > T sendEmail ( T entity , String email ) throws FMSException { if ( ! isAvailableToEmail ( entity ) ) { throw new FMSException ( "Following entity: " + entity . getClass ( ) . getSimpleName ( ) + " cannot be send as email" ) ; } IntuitMessage intuitMessage ...
Send entity via email using specified address
35,875
public List < CDCQueryResult > executeCDCQuery ( List < ? extends IEntity > entities , String changedSince ) throws FMSException { if ( entities == null || entities . isEmpty ( ) ) { throw new FMSException ( "Entities is required." ) ; } if ( ! StringUtils . hasText ( changedSince ) ) { throw new FMSException ( "change...
Method to retrieve the list of records for the given entities whose last modified date is greater than the given changedSince date
35,876
public void executeBatch ( BatchOperation batchOperation ) throws FMSException { IntuitMessage intuitMessage = prepareBatch ( batchOperation ) ; executeInterceptors ( intuitMessage ) ; IntuitResponse intuitResponse = ( IntuitResponse ) intuitMessage . getResponseElements ( ) . getResponse ( ) ; if ( intuitResponse != n...
Method to execute the batch operation
35,877
public < T extends IEntity > void findAllAsync ( T entity , CallbackHandler callbackHandler ) throws FMSException { String query = "SELECT * FROM " + entity . getClass ( ) . getSimpleName ( ) ; executeQueryAsync ( query , callbackHandler ) ; }
Method to retrieve all records for the given entity in asynchronous fashion Note without pagination this will return only 100 records Use query API to add pagintion and obtain additional records
35,878
public < T extends IEntity > void addAsync ( T entity , CallbackHandler callbackHandler ) throws FMSException { IntuitMessage intuitMessage = prepareAdd ( entity ) ; intuitMessage . getRequestElements ( ) . setCallbackHandler ( callbackHandler ) ; executeAsyncInterceptors ( intuitMessage ) ; }
Method to add the given entity in asynchronous fashion
35,879
public < T extends IEntity > void deleteAsync ( T entity , CallbackHandler callbackHandler ) throws FMSException { IntuitMessage intuitMessage = prepareDelete ( entity ) ; intuitMessage . getRequestElements ( ) . setCallbackHandler ( callbackHandler ) ; executeAsyncInterceptors ( intuitMessage ) ; }
Method to delete record for the given entity in asynchronous fashion
35,880
public < T extends IEntity > void updateAsync ( T entity , CallbackHandler callbackHandler ) throws FMSException { IntuitMessage intuitMessage = prepareUpdate ( entity ) ; intuitMessage . getRequestElements ( ) . setCallbackHandler ( callbackHandler ) ; executeAsyncInterceptors ( intuitMessage ) ; }
Method to update the record of the corresponding entity in asynchronous fashion
35,881
public < T extends IEntity > void findByIdAsync ( T entity , CallbackHandler callbackHandler ) throws FMSException { IntuitMessage intuitMessage = prepareFindById ( entity ) ; intuitMessage . getRequestElements ( ) . setCallbackHandler ( callbackHandler ) ; executeAsyncInterceptors ( intuitMessage ) ; }
Method to find the record for the given id for the corresponding entity in asynchronous fashion
35,882
public < T extends IEntity > void uploadAsync ( T entity , InputStream docContent , CallbackHandler callbackHandler ) throws FMSException { IntuitMessage intuitMessage = prepareUpload ( entity , docContent ) ; intuitMessage . getRequestElements ( ) . setCallbackHandler ( callbackHandler ) ; executeAsyncInterceptors ( i...
Method to upload the file for the given entity in asynchronous fashion
35,883
public < T extends IEntity > void sendEmailAsync ( T entity , CallbackHandler callbackHandler ) throws FMSException { sendEmailAsync ( entity , null , callbackHandler ) ; }
Method to send the entity to default email for the given id in asynchronous fashion
35,884
public < T extends IEntity > void sendEmailAsync ( T entity , String email , CallbackHandler callbackHandler ) throws FMSException { if ( ! isAvailableToEmail ( entity ) ) { throw new FMSException ( "Following entity: " + entity . getClass ( ) . getSimpleName ( ) + " cannot send as email (Async) " ) ; } IntuitMessage i...
Method to send the entity to email for the given id in asynchronous fashion
35,885
private < T extends IEntity > IntuitMessage prepareVoidRequest ( T entity ) throws FMSException { IntuitMessage intuitMessage = new IntuitMessage ( ) ; RequestElements requestElements = intuitMessage . getRequestElements ( ) ; Map < String , String > requestParameters = requestElements . getRequestParameters ( ) ; requ...
Common method to prepare the request params for voidRequest operation for both sync and async calls
35,886
private < T extends IEntity > IntuitMessage prepareUpload ( T entity , InputStream docContent , String boundaryId ) throws FMSException { IntuitMessage intuitMessage = new IntuitMessage ( ) ; RequestElements requestElements = intuitMessage . getRequestElements ( ) ; Map < String , String > requestParameters = requestEl...
Common method to prepare the request params for upload operation for both sync and async calls
35,887
private < T extends IEntity > Object verifyEntityId ( T entity ) throws FMSException { Class < ? > objectClass = entity . getClass ( ) ; Object rid = null ; Method m ; try { m = objectClass . getMethod ( "getId" ) ; rid = m . invoke ( entity ) ; } catch ( Exception e ) { throw new FMSException ( "Unable to read the met...
Verifies that entity has getID method which can be invoked to retrieve entity id
35,888
private < T extends IEntity > IntuitMessage prepareQuery ( String query ) throws FMSException { IntuitMessage intuitMessage = new IntuitMessage ( ) ; RequestElements requestElements = intuitMessage . getRequestElements ( ) ; Map < String , String > requestParameters = requestElements . getRequestParameters ( ) ; if ( q...
Common method to prepare the request params for query operation for both sync and async calls
35,889
private < T extends IEntity > IntuitMessage prepareCDCQuery ( List < ? extends IEntity > entities , String changedSince ) throws FMSException { IntuitMessage intuitMessage = new IntuitMessage ( ) ; RequestElements requestElements = intuitMessage . getRequestElements ( ) ; Map < String , String > requestParameters = req...
Common method to prepare the request params for CDC query operation for both sync and async calls
35,890
private < T extends IEntity > IntuitMessage prepareBatch ( BatchOperation batchOperation ) throws FMSException { IntuitMessage intuitMessage = new IntuitMessage ( ) ; RequestElements requestElements = intuitMessage . getRequestElements ( ) ; Map < String , String > requestParameters = requestElements . getRequestParame...
Common method to prepare the request params for batch operation for both sync and async calls
35,891
@ SuppressWarnings ( "unchecked" ) protected < T extends IEntity > Object getSerializableObject ( T object ) throws FMSException { Class < ? > objectClass = object . getClass ( ) ; String methodName = "create" . concat ( objectClass . getSimpleName ( ) ) ; ObjectFactory objectEntity = new ObjectFactory ( ) ; Class < ? ...
Method to get the serializable object for the given entity
35,892
protected QueryResult getQueryResult ( QueryResponse queryResponse ) { QueryResult queryResult = null ; if ( queryResponse != null ) { queryResult = new QueryResult ( ) ; queryResult . setEntities ( getEntities ( queryResponse ) ) ; queryResult . setFault ( queryResponse . getFault ( ) ) ; queryResult . setMaxResults (...
Method to read the query response from QueryResponse and set into QueryResult
35,893
protected List < CDCQueryResult > getCDCQueryResult ( List < CDCResponse > cdcResponses ) { List < CDCQueryResult > cdcQueryResults = null ; if ( cdcResponses != null ) { Iterator < CDCResponse > cdcResponseItr = cdcResponses . iterator ( ) ; while ( cdcResponseItr . hasNext ( ) ) { cdcQueryResults = new ArrayList < CD...
Method to get the list of CDCQueryResult object from list of CDCResponse
35,894
protected CDCQueryResult getCDCQueryResult ( CDCResponse cdcResponse ) { CDCQueryResult cdcQueryResult = new CDCQueryResult ( ) ; List < QueryResponse > queryResponses = cdcResponse . getQueryResponse ( ) ; if ( queryResponses != null ) { Map < String , QueryResult > queryResults = new HashMap < String , QueryResult > ...
Method to construct and return the CDCQueryResult object from CDCResponse
35,895
private void populateQueryResultsInCDC ( Map < String , QueryResult > queryResults , QueryResult queryResult ) { if ( queryResult != null ) { List < ? extends IEntity > entities = queryResult . getEntities ( ) ; if ( entities != null && ! entities . isEmpty ( ) ) { IEntity entity = entities . get ( 0 ) ; String entityN...
Method to populate the QueryResults hash map by reading the key from QueryResult entities
35,896
private void populateFaultInCDC ( CDCQueryResult cdcQueryResult , QueryResult queryResult ) { if ( queryResult != null ) { Fault fault = queryResult . getFault ( ) ; if ( fault != null ) { cdcQueryResult . setFalut ( fault ) ; } } }
Method to populate the fault in CDCQueryResult if any
35,897
private void readProperties ( ) { InputStream input = null ; try { input = getClass ( ) . getClassLoader ( ) . getResourceAsStream ( PROP_FILE_NAME ) ; if ( input == null ) { logger . info ( "Unnable to find " + PROP_FILE_NAME ) ; return ; } prop . load ( input ) ; } catch ( Exception e ) { logger . info ( "exception i...
Method to read propeties file and store the data
35,898
private byte [ ] getUploadFileContent ( RequestElements requestElements ) throws FMSException { Attachable attachable = ( Attachable ) requestElements . getEntity ( ) ; InputStream docContent = requestElements . getUploadRequestElements ( ) . getDocContent ( ) ; String mime = getMime ( attachable . getFileName ( ) , "....
Method to get the file content of the upload file based on the mime type
35,899
private boolean isImageType ( String mime ) { if ( StringUtils . hasText ( mime ) ) { for ( String imageMime : IMAGE_MIMES ) { if ( mime . equalsIgnoreCase ( imageMime ) ) { return true ; } } } return false ; }
Method to validate whether the given mime is an image file