Concatenating a string to a JOLT value output - java

I using JOLT to transform and extract a URL of an object, but it's only the URL slug. Is it possible to concatenate a static string to that slug to have a full URL?
The current output is:
{
"title" : "Where is deleted user data visible, and for how long is it there?",
"externalId" : "where_is_deleted_user_data_visible__and_for_how_lo",
"summary" : "Deleted user data is stored in LP and visible for 13 months following deletion.",
"detail" : "<p>Deleted user data is stored in LP and visible for <strong>13 months following deletion.</strong></p>\n<p>Deleted agents are displayed with a '(deleted)' indicator in the Open Conversations, All Conversations, Web History lists, and the Conversation History widget.</p>\n<object type=\"application/kenticocloud\" data-type=\"item\" data-rel=\"component\" data-codename=\"n6fdd091f_fcb5_012a_8745_c1671c268e6b\"></object>\n<p>Filter by deleted agents is available in the Open Conversations, All Conversations, and web history lists.</p>\n<p>In the visitor conversation window, the name of the deleted agent will be displayed in the window header (with no indication that they have been deleted).</p>\n<p>The LP user limit '<code>collections.maxElements</code>' will not count the number of deleted users in the total.</p>\n<object type=\"application/kenticocloud\" data-type=\"item\" data-rel=\"component\" data-codename=\"n3f1dea42_ac2e_01c6_cbd6_3f802d4e8fb3\"></object>",
"url" : "faqs-data-reporting1.html"
}
And the expected output is:
{
"title" : "Where is deleted user data visible, and for how long is it there?",
"externalId" : "where_is_deleted_user_data_visible__and_for_how_lo",
"summary" : "Deleted user data is stored in LP and visible for 13 months following deletion.",
"detail" : "<p>Deleted user data is stored in LP and visible for <strong>13 months following deletion.</strong></p>\n<p>Deleted agents are displayed with a '(deleted)' indicator in the Open Conversations, All Conversations, Web History lists, and the Conversation History widget.</p>\n<object type=\"application/kenticocloud\" data-type=\"item\" data-rel=\"component\" data-codename=\"n6fdd091f_fcb5_012a_8745_c1671c268e6b\"></object>\n<p>Filter by deleted agents is available in the Open Conversations, All Conversations, and web history lists.</p>\n<p>In the visitor conversation window, the name of the deleted agent will be displayed in the window header (with no indication that they have been deleted).</p>\n<p>The LP user limit '<code>collections.maxElements</code>' will not count the number of deleted users in the total.</p>\n<object type=\"application/kenticocloud\" data-type=\"item\" data-rel=\"component\" data-codename=\"n3f1dea42_ac2e_01c6_cbd6_3f802d4e8fb3\"></object>",
"url" : "https://www.static-url.com/faqs-data-reporting1.html"
}
The JOLT Spec is:
[
{
"operation": "shift",
"spec": {
"item": {
"system": {
"name": "title",
"codename": "externalId"
},
"elements": {
"short_answer": {
"value": ["summary"]
},
"long_answer": {
"value": "detail"
}
}
},
"modular_content": {
"*": {
"elements": {
"permalink": {
"value": "url"
}
}
}
}
}
}
]
The JSON input is:
{
"item": {
"system": {
"id": "6e55g261aee-34d9-47be-8830-145ec71b564f",
"name": "Where is deleted user data visible, and for how long is it there?",
"codename": "where_is_deleted_user_data_visible__and_for_how_lo",
"language": "en-US",
"type": "faq",
"collection": "default",
"sitemap_locations": [],
"last_modified": "2022-04-11T15:32:08.0844256Z",
"workflow_step": "published"
},
"elements": {
"question": {
"type": "text",
"name": "Question",
"value": "Where is deleted user data visible, and for how long is it there?"
},
"short_answer": {
"type": "text",
"name": "Bot Teaser Answer",
"value": "Deleted user data is stored in LP and visible for 13 months following deletion."
},
"long_answer": {
"type": "rich_text",
"name": "Full Answer",
"images": {},
"links": {},
"modular_content": [
"n6fdd091f_fcb5_012a_87545_c1671c268e6b",
"n3f1dea42_ac2e_01cdf6_cbd6_3f802d4e8fb3"
],
"value": "<p>Deleted user data is stored in LP and visible for <strong>13 months following deletion.</strong></p>\n<p>Deleted agents are displayed with a '(deleted)' indicator in the Open Conversations, All Conversations, Web History lists, and the Conversation History widget.</p>\n<object type=\"application/kenticocloud\" data-type=\"item\" data-rel=\"component\" data-codename=\"n6fdd091f_fcb5_012a_8745_c1671c268e6b\"></object>\n<p>Filter by deleted agents is available in the Open Conversations, All Conversations, and web history lists.</p>\n<p>In the visitor conversation window, the name of the deleted agent will be displayed in the window header (with no indication that they have been deleted).</p>\n<p>The LP user limit '<code>collections.maxElements</code>' will not count the number of deleted users in the total.</p>\n<object type=\"application/kenticocloud\" data-type=\"item\" data-rel=\"component\" data-codename=\"n3f1dea42_ac2e_01c6_cbd6_3f802d4e8fb3\"></object>"
},
"faq_page": {
"type": "modular_content",
"name": "This FAQ item's FAQ page(s)",
"value": [
"data___reporting_9658b36"
]
},
"related_article": {
"type": "modular_content",
"name": "Related article",
"value": []
}
}
},
"modular_content": {
"data___reporting_9658b36": {
"system": {
"id": "9658bddf362-735b-47fd3c-9232-26de14835d8f",
"name": "Data & Reporting",
"codename": "data___reporting_9658b36",
"language": "en-US",
"type": "kc_faqs",
"collection": "default",
"sitemap_locations": [],
"last_modified": "2022-04-13T16:18:12.2538592Z",
"workflow_step": "published"
},
"elements": {
"pagename": {
"type": "text",
"name": "Title",
"value": "Data & Reporting"
},
"faq_items": {
"type": "modular_content",
"name": "FAQ Items",
"value": [
"how_do_i_find_chats_that_only_contain_private_mess",
"how_do_i_understand_why_a_chat_ended_",
"how_do_i_change_the_email_address_for_scheduled_re",
"how_do_i_retrieve_data_that_has_been_masked_",
"where_is_deleted_user_data_visible__and_for_how_lo"
]
},
"related_articles": {
"type": "modular_content",
"name": "Related Articles",
"value": []
},
"permalink": {
"type": "url_slug",
"name": "URL slug",
"value": "faqs-data-reporting1.html"
},
"redirects": {
"type": "text",
"name": "redirects",
"value": "faqs-data-reporting1.html"
}
}
},
"n3f1dea42_ac2e_01c6_cbd6_3f802d4e8fb3": {
"system": {
"id": "3f1dea42-ac2e-01c6-cbd6-3f802d4e8fb3",
"name": "3f1dea42-ac2e-01c6-cbd6-3f802d4e8fb3",
"codename": "n3f1dea42_ac2e_01c6_cbd6_3f802d4e8fb3",
"language": "en-US",
"type": "contentbox",
"collection": "default",
"sitemap_locations": [],
"last_modified": "2022-04-11T15:32:08.0844256Z"
},
"elements": {
"type": {
"type": "multiple_choice",
"name": "Type",
"value": [
{
"name": "Warning (orange)",
"codename": "warning"
}
]
},
"notice_text": {
"type": "rich_text",
"name": "Text",
"images": {},
"links": {},
"modular_content": [],
"value": "<p>A user who joined a chat and then was deleted won’t be reflected as deleted in the history.</p>"
}
}
},
"n6fdd091f_fcb5_012a_8745_c1671c268e6b": {
"system": {
"id": "6fdd091f-fcb5-012a-8745-c1671c268e6b",
"name": "6fdd091f-fcb5-012a-8745-c1671c268e6b",
"codename": "n6fdd091f_fcb5_012a_8745_c1671c268e6b",
"language": "en-US",
"type": "contentbox",
"collection": "default",
"sitemap_locations": [],
"last_modified": "2022-04-11T15:32:08.0844256Z"
},
"elements": {
"type": {
"type": "multiple_choice",
"name": "Type",
"value": [
{
"name": "Notice (blue)",
"codename": "notice"
}
]
},
"notice_text": {
"type": "rich_text",
"name": "Text",
"images": {},
"links": {},
"modular_content": [],
"value": "<p>Before deleting a user, ensure that the agent doesn’t own any open conversations (if so, these conversations should be transferred to the queue) and that the user is logged out of LP.</p>"
}
}
}
}
}
Any option to add the static URL link to the output?

You can add a modify spec with concat function after the current shift transformation spec such as
{
"operation": "modify-overwrite-beta",
"spec": {
"url": "=concat('https://www.static-url.com/',#(1,&))" // first argument is static, and the second one is dynamic(directly inherited from the current value of "url") content
}
}

Related

How to retrieve user entered input in adaptive card in java

Attached the JSON of adaptive card I sent in teams.
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"text": "Publish Adaptive Card schema",
"weight": "bolder",
"size": "medium"
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "auto",
"items": [
{
"type": "Image",
"url": "https://pbs.twimg.com/profile_images/3647943215/d7f12830b3c17a5a9e4afcc370e3a37e_400x400.jpeg",
"size": "medium",
"style": "person"
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "Matt Hidinger",
"weight": "bolder",
"wrap": true
},
{
"type": "TextBlock",
"spacing": "none",
"text": "Created Tuesday, Feb 14, 2017",
"isSubtle": true,
"wrap": true
}
]
}
]
}
]
},
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"text": "Now that we have defined the main rules and features of the format, we need to produce a schema and publish it to GitHub. The schema will be the starting point of our reference documentation.",
"wrap": true
},
{
"type": "FactSet",
"facts": [
{
"title": "Board:",
"value": "Adaptive Card"
},
{
"title": "List:",
"value": "Backlog"
},
{
"title": "Assigned to:",
"value": "Matt Hidinger"
},
{
"title": "Due date:",
"value": "Not set"
}
]
}
]
}
],
"actions": [
{
"type": "Action.ShowCard",
"title": "Set due date",
"card": {
"version": "1.0",
"type": "AdaptiveCard",
"body": [
{
"type": "Input.Date",
"id": "dueDate",
"title": "Select due date"
}
],
"actions": [
{
"type": "Action.Submit",
"title": "OK"
}
]
}
},
{
"type": "Action.ShowCard",
"title": "Comment",
"card": {
"version": "1.0",
"type": "AdaptiveCard",
"body": [
{
"type": "Input.Text",
"id": "comment",
"isMultiline": true,
"placeholder": "Enter your comment"
}
],
"actions": [
{
"type": "Action.Submit",
"title": "OK"
}
]
}
},
{
"type": "Action.OpenUrl",
"title": "View",
"url": "http://adaptivecards.io"
}
]
}
After User entered values and click ok, reply from bot is "Echo:"
How can i display the entered value as reply from bot.
I have implemented this to get activity, but this method is not called when use click ok.

extract specific text (password strings) from a large JSON file in java without using the JSON helper classes

I have the following large JSON I receive from a specific REST call. I want to only extract the password strings (highlighted in bold). So I need the values.
ConfigPWD_USER.password, ConfigPWD_ROOT.password, instanceOwnerPassword, databaseUserPassword, fencedUserPassword in java. Guess I will have to search using string regex. Can someone help?
{
"deployment_name": "name1",
"model": {
"model": {
"description": "",
"nodes": [{
"id": "OS Node",
"ptype": "image:OS Node",
"attributes": {
<more json key value pairs>
**"ConfigPWD_USER.password": "<xor>NzozMzA=",
"ConfigPWD_ROOT.password": "<xor>NzozMzA="**
},
"type": "image:OS,
"groups": {},
"locked": []
}, {
"id": "disk for db instance",
"attributes": {
<more json key value pairs>
},
"type": "add disk:1.0.0",
"groups": {},
"locked": []
}, {
"id": "disk for database data",
"attributes": {
<more json key value pair>
},
"type": "disk:1.0.0",
"groups": {},
"locked": []
}, {
"id": "DB Server",
"startsAfter": ["disk for db instance",
"OS Node"
],
"locked": ["instanceMountPoint", "instanceMountPoint", "instanceMountPoint"],
"attributes": {
"instanceMountPoint": "${disk for db instance.MOUNT_POINT}",
<more json key value pair>
**"instanceOwnerPassword": "<xor>NzozMzA=",**
<more json key value pair>
**"fencedUserPassword": "<xor>NzozMzA=",**
},
"type": "DBLUN",
"groups": {}
}, {
"id": "bludbs",
"startsAfter": ["DB Server", "disk for database data"],
"locked": ["instanceName", "dataMountPoint", "instanceName", "dataMountPoint", "instanceName", "dataMountPoint"],
"attributes": {
<many json key value pairs>,
**"databaseUserPassword": "<xor>NzozMzA="**,
<many json key value pairs>
},s
"type": "sript:scrip1.exe",
"groups": {}
}],
"app_type": "application",
"name": "Default DB in Linux",
"patterntype": "vsys",
"links": [{
"id": "HostedOnLink_1",
"source": "disk for db instance",
"target": "OS Node",
"attributes": {},
"type": "HostedOnLink",
"groups": {}
},
{
"id": "HostedOnLink_2",
"source": "disk for database data",
"target": "OS Node",
"attributes": {},
"type": "HostedOnLink",
"groups": {}
}, {
"id": "HostedOnLink_3",
"source": "DB Server",
"target": "OS Node",
"attributes": {},
"type": "HostedOnLink",
"groups": {}
}, {
"id": "HostedOnLink_4",
"source": "bludb",
"target": "OS Node",
"attributes": {},
"type": "HostedOnLink",
"groups": {}
}
],
"locked": false,
"readonly": false,
"version": "1.0",
"patternversion": "1.2.3.0",
"mixinArgs": null
},
"layers": [{
"id": "layer",
"nodes": ["OS Node", "disk for db instance", "disk for database data", "DB Server", "bludb"]
}]
},
<more json key value pairs>,
"organizations": []
}
in groovy there is in-build groovy.json.JsonSlurper and code to find one of the values could be like this:
def json = new groovy.json.JsonSlurper().parseText('''
{
"deployment_name": "name1",
"model": {
"model": {
"description": "",
"nodes": [{
"id": "OS Node",
"ptype": "image:OS Node",
"attributes": {
"ConfigPWD_USER.password": "1<xor>NzozMzA=",
"ConfigPWD_ROOT.password": "1<xor>NzozMzA="
},
"type": "image:OS",
"groups": {},
"locked": []
}, {
"id": "disk for db instance",
"attributes": {
"ConfigPWD_USER.password": "2<xor>NzozMzA=",
"ConfigPWD_ROOT.password": "2<xor>NzozMzA="
},
"type": "add disk:1.0.0",
"groups": {},
"locked": []
}]
}
}
}
''')
json.model.model.nodes.collect{n-> n.attributes."ConfigPWD_USER.password" }

How to execute mail Task process on camunda cockpit?

we have workflow that has service task attached to the box , Below template is applied to bmpn:serviceTask, Now when we deploy workflow to camunda using https://engine-rest/deployment/create , we are able to run the process but we see this error on incident tab,we are using bpmn-js node library for modeler and create workflows, where we define camunda:class, as you can see error below, Any idea how to resolve this camunda class issue ?
we are just trying to send email notification when process starts ?
New to camunda stuff any help will be appreciated.
template.js
{
"name": "Mail_Task_2",
"id": "com.camunda.example.MailTask_2",
"createdBy": "sh529u",
"users": [],
"groups": [],
"properties": [
{
"binding": {
"name": "camunda:class",
"type": "property"
},
"editable": false,
"value": "com.mycompany.MailTaskImpl",
"type": "String",
"label": "Implementation Type"
},
{
"label": "Sender",
"type": "String",
"binding": {
"type": "camunda:inputParameter",
"name": "sender"
},
"constraints": {
"notEmpty": true
}
},
{
"label": "Receivers",
"type": "String",
"binding": {
"type": "camunda:inputParameter",
"name": "receivers"
},
"constraints": {
"notEmpty": true
}
},
{
"label": "Template",
"description": "By the way, you can use freemarker templates here",
"value": "Hello ${firstName}!",
"type": "Text",
"binding": {
"type": "camunda:inputParameter",
"name": "messageBody",
"scriptFormat": "freemarker"
},
"constraints": {
"notEmpty": true
}
},
{
"label": "Result Status",
"description": "The process variable to which to assign the send result to",
"type": "String",
"value": "mailSendResult",
"binding": {
"type": "camunda:outputParameter",
"source": "${ resultStatus }"
}
},
{
"label": "Send Async?",
"type": "Boolean",
"value": true,
"binding": {
"type": "property",
"name": "camunda:asyncBefore"
}
}
],
"appliesTo": [
"bpmn:ServiceTask"
]
}
ERROR
org.camunda.bpm.engine.ProcessEngineException: ENGINE-09008 Exception while instantiating class 'com.mycompany.MailTaskImpl': ENGINE-09017 Cannot load class 'com.mycompany.MailTaskImpl': com.mycompany.MailTaskImpl
at org.camunda.bpm.engine.impl.util.EngineUtilLogger.exceptionWhileInstantiatingClass(EngineUtilLogger.java:78)

How do you map Json structure having type identification inside the node

{
"task": {
"vendorConnectorId": 9901,
"operation": "query",
"objectType": "",
"attributes": {
"q": "SELECT Name FROM Asset where AccountId = '00128000005O5uPAAS'"
}
},
"httpStatusCode": 200,
"resultSet": {
"result": {
"totalSize": 1,
"records": [
{
"attributes": {
"type": "Asset",
"url": "/services/data/v34.0/sobjects/Asset/02i280000007BcpAAE"
},
"Name": "Flight To LA"
}
],
"done": true
}
},
"messages": [],
"startedTime": 1441969739375,
"endTime": 1441969750317
}
I want to map records node via polymorphic de-serialization feature of Jackson but type information is nested inside the record node(attribute node).

Precondition on data pipeline

I did some set of activities on json script. Need to add precondition on it.
how to use precondition on json script.
In precondition, i need to check the mysql db field. once flag as 'Y',
start execution else should be stop the execution.
You can use a ShellCommandPrecondition for this which will let you write a custom precondition.
{
"objects": [
{
"schedule": {
"ref": "DefaultSchedule"
},
"resourceRole": "DataPipelineDefaultResourceRole",
"role": "DataPipelineDefaultRole",
"name": "DefaultResource1",
"id": "ResourceId_dWoZ0",
"type": "Ec2Resource",
"terminateAfter": "1 Hour"
},
{
"name": "DefaultPrecondition1",
"id": "PreconditionId_yA2rV",
"type": "ShellCommandPrecondition",
"command": "<Script to check mysql field>"
},
{
"occurrences": "1",
"period": "1 Day",
"name": "RunOnce",
"id": "DefaultSchedule",
"type": "Schedule",
"startAt": "FIRST_ACTIVATION_DATE_TIME"
},
{
"failureAndRerunMode": "CASCADE",
"schedule": {
"ref": "DefaultSchedule"
},
"resourceRole": "DataPipelineDefaultResourceRole",
"role": "DataPipelineDefaultRole",
"pipelineLogUri": "s3://<mybucket>",
"scheduleType": "cron",
"name": "Default",
"id": "Default"
},
{
"schedule": {
"ref": "DefaultSchedule"
},
"name": "DefaultActivity1",
"runsOn": {
"ref": "ResourceId_dWoZ0"
},
"precondition": {
"ref": "PreconditionId_yA2rV"
},
"id": "ActivityId_gmQ0W",
"type": "ShellCommandActivity",
"command": "echo 'Hello world'"
}
],
"parameters": []
}

Categories