Skip to content

Commit

Permalink
33-add-script-for-value-finder
Browse files Browse the repository at this point in the history
add-script-for-value-finder
  • Loading branch information
akaash2512 authored Feb 3, 2025
1 parent e9b2cce commit e744e85
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions src/main/frontend/model/samples/value-finder.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"logLevel":"info",
"hops":[
{
"type":"runScript",
"code":"output = utils.file.txt(\"properties_containing_hardcoded_urls\");\nSQL2Query = str:join([\"SELECT * FROM [nt:base] AS node WHERE ISDESCENDANTNODE([\",args.path,\"])\"])\nif (args.resourceTypeInclude != null && args.resourceTypeInclude.trim() != ''){\n SQL2Query = str:join ([SQL2Query,\" AND node.[sling:resourceType] LIKE \\\"\",args.resourceTypeInclude,\"\\\"\"])\n}\nif (args.resourceTypeExclude != null && args.resourceTypeExclude.trim() != ''){\n SQL2Query = str:join ([SQL2Query,\" AND node.[sling:resourceType] NOT LIKE \\\"\",args.resourceTypeExclude,\"\\\"\"])\n}",
"extension":"jexl",
"putLocalsBackIntoScope":true
},
{
"type":"nodeQuery",
"query":"${SQL2Query}",
"queryType":"JCR-SQL2",
"hops":[
{
"type":"each",
"expression":"node.properties",
"hops":[
{
"type":"filterNode",
"expression":"str:contains(property.name, args.propertyName)",
"hops":[
{
"type":"declare",
"declarations":{
"joinedPropertyValue":"str:join(jcr:vals(node, property.name))"
}
},
{
"type":"filterNode",
"expression":"str:contains(joinedPropertyValue, args.propertyValue)",
"hops":[
{
"type":"runScript",
"code":"output.append(node.path);\noutput.append(\"-\");\noutput.append(property.name);\noutput.append(\":\");\noutput.append(joinedPropertyValue);\noutput.append(\"\\n\");",
"extension":"jexl",
"putLocalsBackIntoScope":true
}
]
}
]
}
],
"iterator":"property"
}
]
}
],
"parameters":[
{
"name":"path",
"defaultValue":"/content/project/de",
"type":"text",
"evaluation":"STRING"
},
{
"name":"resourceTypeInclude",
"defaultValue":"",
"type":"text",
"evaluation":"STRING"
},
{
"name":"resourceTypeExclude",
"defaultValue":"",
"type":"text",
"evaluation":"STRING"
},
{
"name":"propertyName",
"defaultValue":"textIsTrue",
"type":"text",
"evaluation":"STRING"
},
{
"name":"propertyValue",
"defaultValue":"false",
"type":"text",
"evaluation":"STRING"
}
]
}

0 comments on commit e744e85

Please sign in to comment.