Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.jcr.Node
- import javax.jcr.query.*
- private checkCountry(country) {
- QueryManager queryManager = session.workspace.queryManager;
- Query query = queryManager.createQuery("SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([/content/b2b/" + country + "/category]) AND [sling:resourceType] = 'bose/common/components/text'", "JCR-SQL2");
- QueryResult queryResult = query.execute();
- RowIterator rowIterator = queryResult.rows;
- while (rowIterator.hasNext()) {
- Row row = rowIterator.nextRow();
- Node fieldSetNode = row.getNode();
- if (fieldSetNode.hasProperty("text")) {
- String text = fieldSetNode.getProperty("text").value.toString();
- int start = text.indexOf("href=\"");
- int end = text.indexOf("\" target");
- if (start != -1) {
- if (end != -1) {
- text = text.substring(start + 6, end);
- } else {
- text = text.substring(start + 6);
- }
- }
- if (text.contains("parsys")) {
- println(text);
- }
- }
- }
- }
- checkCountry("fr_ca");
- checkCountry("en_gb");
- checkCountry("es_mx");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement