JT UTILS

You can find all the pre-defined JT Utils when you drag and drop customfunction.

And variables.

  1. JTUtil.logSuccessEvent(String description, Long transactionId, String payload) - Method to be used for logging success event

  2. JTUtil.logFailureEvent(String description, Long transactionId, String payload) - Method to be used for logging failure event

  3. JTUtil.logWarningEvent(String description, Long transactionId, String payload) - Method to be used for logging warning event

  4. JTUtil.throwJTException(String message) - Method to throw exception

  5. InputStream streamInitial = JTUtil.getInitialPayload(Long transactionId, String payload) - Method to download the Initial Payload of the transaction

  6. Long resourceIdUploaded = JTUtil.uploadFile(InputStream stream, String extension) - Method to upload the file

  7. InputStream streamDownloaded = JTUtil.downloadFile(Long resourceId) - Method to download the file based on resourceId

  8. String value = JTUtil.getID(Long transactionId, String idName) throws JTServerException;

  9. bd1 - BusinessID1, bd2 - BusinessID2, bd3 - BusinessID3, bd4 - BusinessID4, bd5 - BusinessID5

  10. dtin - DataTypeIn, dtout - DataTypeOut, infname - InboundFileName, outfname - OutboundFileName

  11. java.sql.Connection connection = JTUtil.initializeSFDC(String username, String password, String token, String useSandbox) - method to get salesforce connection

  12. transaction = JTUtil.setBusinessIds(Transaction transaction, String businessId1, String businessId2, String businessId3, String businessId4, String businessId5) - method to set business Ids

  13. transaction = JTUtil.setDataTypesInOut(Transaction transaction, String dataTypeIn, String dataTypeOut) - method to set Source Target data types

  14. JTUtil.setGlobalData(Transaction transaction, String variable, String value) - method to set global variable

  15. String value = JTUtil.getGlobalData(Transaction transaction, String variable) - method to get the global variable

  16. String value = JTUtil.getValue(Long transactionId, String tableName, String key) - method to get the value from look up table

  17. Response res = JTUtil.putValue(Long transactionId, String tableName, String key, String value) - method to put key with value from look up table

  18. JTUtil.deleteValue(Long transactionId, String tableName, String key) - This will delete the value from lookup table.//String publishToNetsuite(Transaction transaction, String netsuiteURL, String payload, String soapAction) - method to call the external Netsuite API.

  19. JTUtil.publishToConnection(Transaction transaction, Long targetConnectionId, String payload) - method to call STC handler through the custom function with payload as "String"

  20. JTUtil.publishToConnection(Transaction transaction, Long targetConnectionId, FileInputStream payload) - method to call STC handler through the custom function with payload as "FileInputStream"

  21. String responseData = JTUtil.ediValidator(String input, long transactionId) - method to validate EDI

  22. Map<String, InputStream> unzippedInputFilesMap = JTUtil.unzipBatch(transaction) - method to unzip current transaction's batched (zipped) payload; returns file map that can be iterated over to process each file

  23. JTUtil.putInternalSqsMsg(String standardQueueUrl, String messageBody) throws JTServerException - method to send data in the sqs queue(standardQueueUrl- represents the amazon sqs queue created by JT and messageBody- data that will be sent as queue message)

  24. List internalSqsMsgs = JTUtil.getInternalSqsMsg(String standardQueueUrl, int maxNoOfMsgs) throws JTServerException - method to receive data from the sqs queue(standardQueueUrl- represents the amazon sqs queue created by JT and maxNoOfMsgs- max number of queue messages; maxNoOfMsgs value can be between 0 and 10)

  25. String resourceS3Key = JTUtil.upload(String payload) - This method will upload the payload string to S3 and return AWS S3 key.

  26. String resourceS3Key = JTUtil.upload(InputStream payload) - This method will upload the payload InputStream to S3 and return AWS S3 key.

  27. InputStream file = JTUtil.downloadFile(String resourceS3Key) - This method will return InputStream of File Data from AWS S3.

  28. String file = JTUtil.downloadFileAsString(String resourceS3Key) - This method will return the file data as String from AWS S3.

  29. transaction = JTUtil.updateIdsInTransaction(Transaction transaction) - This will update the the BusinessIds, DataTypeIn, DataTypeOut, InboundFileName, OutboundFileName and DestConnection to the transaction and return the Transaction.

  30. Integer random = JTUtil.getRandomNumber(Integer pSize) - This will return the randomNumber as Integer ,Digits size as pSize.

  31. String value = JTUtil.getLookupValue(Long transactionId, String tableName, String key) - This Will return lookup table value as string.

  32. String value = JTUtil.getLookupTableValue(String tableName, String key) - This will return Lookup table value.(get lookup table by key using user logged in (UI))

  33. String value = JTUtil.getLookupTableValue(Long transactionId, String tableName, String key) - This will return the value as string.

  34. String value = JTUtil. getLookupTableValue(String tableName, String key, String column) - This will return Lookup table inner value as string ,get lookup table by key and column using user logged in (UI)

  35. String value = JTUtil.getLookupTableValue(Long transactionId, String tableName, String key, String column) - This will return inner value of lookup Table inner value as String.

  36. String value = JTUtil. getLookupTable(Long transactionId, String tableName) - This will return the the lookupTable as String. //JTUtil.putLookupTableValueByToken(String token, String key, String col, String value) - This will store the value in inner value of LookupTable.

  37. String value = JTUtil.getLookupTableValueByToken(String token, String key) - This will return the value as String from the Lookup table on basis of key.

  38. String value = JTUtil.getLookupTableValueByToken(String token, String key, String column) - This will return the inner value as String from the lookup table on basis of key and column.

  39. JTUtil.deleteLookupTableValueByToken(String token, String key) - This will delete the lookup table value based on key.

  40. String keys = JTUtil.getAllKeysByToken(String token) - It will return all the values in lookup table as a List.

  41. JTUtil.setLookupTable(Long transactionId, String tableName, String content) - It will set value in lookup table.

  42. JTUtil.publishToNetsuite(Transaction transaction, String netsuiteURL, String payload, String soapAction) - This will publish the payload to netsuite and return string.

  43. JTUtil.callNetsuiteApi(String netsuiteURL, String payload, String soapAction, long transactionId, JSONArray jsonEventArray) - It will call the NetSuiteAPi and return string.

  44. JTUtil.publishToNetsuiteV2(Transaction transaction, String netsuiteURL, String payload, String soapAction, String nsconsumerKey, String nsconsumerSecret, String nstokenKey, String nstokenSecret, String nsrealm) - This will publish to the netSuiteV2 and return string.

  45. JTUtil.callNetsuiteApiV2(String netsuiteURL, String payload, String soapAction, long transactionId, JSONArray jsonEventArray, String nsconsumerKey, String nsconsumerSecret, String nstokenKey, String nstokenSecret, String nsrealm) - This will call the NetSuiteV2 api and return a string.

  46. String path = JTUtill.convertPDFToXML(InputStream fis) - This will convert the pdf to xml and return return the path as String

  47. String path = JTUtil.convertPDFToExcel(InputStream fis) - This will convert the pdf to excel and return the path as String.

  48. String path = JTUtil.convertExcelactiveSheetToCSV(InputStream fis, String delim, int countryCode) - This will convert excel active sheet to csv and return the path as string.

  49. String path = JTUtil.convertExcelToCSV(InputStream fis, String delim, int countryCode) - This will convert excel sheet to csv and return the path as String.

  50. JTUtil.putEvent(JSONArray jsonEventArray, Rests rest, long transactionId) - This will create the handler event from rests status.

  51. String payload = JTUtil.getAllPayload(String emailId, String key, String value) - This will return all the events for that emailID User as List.

  52. String edi = JTUtil.unescapeXMLChars(final String text) - This will unescaped XML Chars

  53. JTUtil.updateConnection(com.justransform.entity.Connection connection) - This will update the connection details.

  54. JTUtil.sendEmail(String recipients, String subject, String body) - This will send the email.

  55. List payload = JTUtil.getAllPayloadByKey(String emailId, String key, String value, String option) - This will return all the payload for the user as list.

  56. List payload = JTUtil.getAllPayloadByKey(String emailId, String key, String value) - This will return all the payload for the user as list.

  57. String status = JTUtil.callRest(Transaction transaction, String input, String cusername, String cpassword, String cPostURL, String contentType ,String cAuthToken, String authMethod, Boolean isAccessTokenInUrl) - This send the rest api request and return string.

  58. String status = JTUtil.callRestApi(Transaction transaction, String input, String cPostURL, String contentType, String cusername, String cpassword) - This send the rest api request and return string.

  59. Response response = JTUtil.sendGetRequest(Long transactionId, String url) - This send the get request and return the Response.

  60. Response response = JTUtil.sendPostRequest(Long transactionId, Object input, String url ) - This will send the post request and return the Response.

  61. Response response = JTUtil.sendDeleteRequest(Long transactionId, String url) - This will send the delete request and return the Response

  62. JTUtil.sendEmailWithAttachment(String recipients, String subject, String body, String attachmentFileName, InputStream attachmentData) - This will send email with attachments.

  63. JTUtil.incrGlobalData(Transaction transaction, String variable) - This will increase the global variable.

  64. JTUtil.createConnection(com.justransform.entity.Connection connection, String email) - This will create the new connection

  65. JTUtil.shareConnection(Long connectionId, String userEmail) - This Will share the connection with different user.

  66. JTUtil.setResponseContentType(HashMap<String, String> httpHeaders, String contentType) - This will set the content type for rest call.

  67. List payload = JTUtil.getAllPayloadFromTransactions(String emailId, Map<String,String> filterMap) - This will return all the payload for that User as List.

  68. String text = JTUtil.extractTextFromPDF(InputStream inputStream) - This method will extract text from the pdf and return it as string.

  69. String text = JTUtil.extractTextWithoutStrip(InputStream inputStream) - This method will extract text from the pdf without strip and return it as a string.

  70. JTUtil.removeSftpFiles(Long transactionId, Long connectionId, String path, Duration duration, String regexFileNamePattern) - This method will remove sftp file from the given path.

  71. Boolean onboarded = JTUtil.onBoardTenant( String userName, String domain, String emailId, String lookUpToken, String userId) - This method will on board a new Tenant to Justransform and it will return Boolean.

  72. String usernameAndPassword = JTUtil.createEnterprise( String firstName, String lastName, String userName, String domain, String emailId ) - This method will create the new enterprise and return string UserName and Password.

  73. String usernameAndPassword = JTUtil.createEnterprise( String firstName, String lastName, String userName, String domain, String emailId, UserVo adminUser,String enterpriseName, boolean checkInvitedEnterprise) - This method will create the new enterprise and return string UserName and Password.

  74. List keys = JTUtil.getLookupTableKeys(Long transactionId, String tableName, Map<String, String> valueMap) - This method will return List , all the keys of Lookup table.

  75. String result = JTUtil.getMapperResult(Long transactionId, long resourceId, String input) - This method will return mapper Result as String.

  76. Boolean isSent = JTUtil.sendFileToSftpOutbound(Long connectionId, Transaction transaction, File file) - This method will send the file to SftpOutbound and return Boolean.

  77. String fileName = JTUtil.getFileName(ConnectionVo connectionVo, Transaction transaction) - This method will return file name from conection or transaction as a String

  78. Map<String,Map<String,String>> parsedSheet = JTUtil.parseJTSheet(Long resourceId, String sheet, String keyDelimiter, int... keyCols) - This method will parse the JTSheet and return the

  79. InputStream file = JTUtil.validateCSV(InputStream file, Long resourceId) - This method will validate the CSV file return the InputStream

  80. Long resourceId = JTUtil.createValidationFrom(Long resourceId, InputStream file) - This will validate the file from the create Resource and return resource id as Long.

  81. List<Map<String,String>> data = JTUtil.extractDataFromValidation(Long resourceId, InputStream file) - This will extract Data from file and validate

  82. Object json = JTUtil.parseJsonText(String text) - This method will parse the json string and return the Object

  83. Object json = JTUtil.parseJsonStream(InputStream inputStream) - This method will parse the inputStream and return the Object.

  84. Object xml = JTUtil.parseXmlText(String text) - This method will parse the xml string and return the Object.

  85. Object xml = JTUtil.parseXmlStream(InputStream inputStream) - This method will parse the inputStream and return the Object

  86. JTUtil.addFavouriteLink(Long userId, String url, String title) - This method will add the favorite link to the dashboard of that user.

  87. JTUtil.addFavouriteLink(String email, String url, String title) - This method will add the favorite link to the dashboard of that email user.

  88. JTUtil.joinProgram(Long programId, Long userId) - This method will join program to the user

  89. JTUtil.joinProgram(Long programId, String userEmail) - This method will join program to the userEmail user.

  90. String updatedJsonStr = JTUtil.replaceJsonKeyWhiteSpace(String jsonStr, String replaceStr) - This method will replace jsonStr white space with replaceStr.

-----JTLookUtil function --------

  1. String data = JTLookupUtil.getLookupTable(String token) - This Method will return String, lookup table data.

  2. JTLookupUtil.truncateLookupTable(String token) - this method will delete all the data in Lookup Table.

  3. String data = JTLookupUtil.getLookupTableValue(String token, String key) - this method will return String, lookup table on basis of key.

  4. String data = JTLookupUtil.getLookupTableValue(String token, String key, String expression) - This method will return String, lookup table inner value on basis of key and expression.

  5. JTLookupUtil.putLookupTableValue(String token, String key, Object value) - This method will store value in lookup table on basis of key.

  6. JTLookupUtil.putLookupTableValue(String token, String key, String expression, Object value) - This method will store inner value in lookup table on basis of key and expression

  7. JTLookupUtil.deleteLookupTableValue(String token, String key) - This method will delete value from the lookup table, on the basis of key.

  8. JTLookupUtil.deleteLookupTableValue(String token, String key, String expression) - This method will delete the inner value from the lookup table, on the basis of key and expression.

  9. String data = JTLookupUtil.getLookupTableByTokenAndDateFilter(String token, String column, Date startDateUTC, Date endDateUTC) - This method will filter lookupValue by startDate and endDate

  10. String keys = JTLookupUtil.getAllKeysByToken(String token) - This method will return list of all keys from a lookup table */

PRE-DEFINED VARIABLES

  1. transaction variable is already defined and points to transaction object.

  2. resourceId - variable is already defined and points to current payload's resourceId.

  3. transactionId - variable is already defined that can be accessed as the transaction ID

  4. tempFolder variable is already defined and points to temporary folder which can be used for storing temporary files.

Last updated