JCR SQL2 Query Samples
A collection of JCR SQL2 query examples
Nodes that have a non-empty property with name 'propName'
SELECT
p.* FROM [nt:unstructured] AS p
WHERE
ISDESCENDANTNODE('/')
// you can run this code in chrome on this link for example: https://docs.adobe.com/docs/en/aem/6-2/develop/ref/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/checkbox/index.html | |
// get textContent of child element based on selector | |
function getText(el, selector){ | |
if(!el) return; | |
var childEl = el.querySelector(selector); | |
return childEl ? childEl.textContent : "" | |
} | |
$(".propertydef").each((a,p) => |
export class EventUtil | |
{ | |
private static observable = $({}); | |
/** | |
* Subscribe to an event | |
*/ | |
public static subscribe = function(...args){ | |
EventUtil.observable.on.apply(EventUtil.observable, args); |
A collection of JCR SQL2 query examples
Nodes that have a non-empty property with name 'propName'
SELECT
p.* FROM [nt:unstructured] AS p
WHERE
ISDESCENDANTNODE('/')
# based on https://www.reddit.com/r/osx/comments/3ewn93/too_many_open_files_in_system_what_is_causing_this/ctj765h/ | |
# will print a list of comma seperated enties, each entry is in this format: <PID name>, <PID>, <Files open> | |
sudo lsof -n | perl -pe '$x = <>; while(<>) { ($cmd, $pid, $rest) = split(/\s+/); $cmds{$pid} = $cmd; $pids{$pid}++;} while( ($key, $val) = each %pids) { $pidName=$cmds{$key}; printf "$pidName,$key,$val \n" } ;' |
// in this example, we wait for jquery to become available. | |
waitFor("$",1000*60,function(){ | |
console.log('jQuery is ready to be used!'); | |
}) |
.multifield form { | |
margin: 0 auto; | |
max-width: 750px; | |
} | |
.multifield .margin-1rem { | |
margin: 1rem !important; | |
} | |
.multifield .fieldset-container { |
import javax.jcr.PropertyType | |
/** | |
* This script will find all PropertyDifinitions for a node instance from it's primaryType and mixins | |
* It will then determine if any of the current properties violate any of the PropertyDifinitions. it only checks property name and type. | |
* For example, a "dam:Asset" node with a property "test" and a property "jcr:mixinTypes" of Type Reference has two violations: | |
* 1. "test" is not on the list of allowed properties for that node type | |
* 2. "jcr:mixinTypes" must be of type "Name" | |
*/ |
def BASE_PATH = '/content/test' // CHANGE the path to search in | |
// BE CAREFUL! this may have performance implecations on large trees | |
// start with a deep tree and work your way up. | |
/* | |
* Recurses over all nodes in the subtree "basePath" | |
* and checks every property of every node for prefixes that are not registered | |
* @returns an array or unregistered prefixes |
/** | |
* Built this to filters a large array based on predicates to use with a Vuejs app I was building. | |
* It provides a declarative way to filter an array of objects whose properties are strings. | |
* But it can be adapted and improved for other types. | |
* you can see an example vuejs app that uses this method here: http://jsfiddle.net/ahmedmusallam/jruxn3bh/ | |
*/ | |
(function () { | |
/** | |
* @param {Arrray} predicates: an array of predicates |
import com.google.gson.JsonArray | |
import com.google.gson.JsonObject | |
/** | |
* This script will print a JSON array of all namespaces on current AEM instance | |
* Each JSON object in the array will be of the format: | |
* {"prefix":"The namespace prefix", "uri":"The namespace uri"} | |
* | |
*/ |