Created
June 10, 2016 14:49
-
-
Save yesil/e8c8c9e4f8b10809a21f0c1ad1f1c177 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.jackrabbit.oak.spi.state.NodeState | |
import org.apache.jackrabbit.oak.api.Type | |
class BlobSearch { | |
def session | |
def check(){ | |
checkChildren(session.store.root.builder().nodeState) | |
} | |
def checkChildren(nodeState, path = "/"){ | |
def iterator = nodeState.childNodeEntries.iterator() | |
while(iterator.hasNext()){ | |
def entry = iterator.next() | |
checkChildren(entry.nodeState, path + entry.name + "/") | |
} | |
def pIterator = nodeState.properties.iterator() | |
while(pIterator.hasNext()){ | |
def propertyState = pIterator.next() | |
if(propertyState.type == Type.BINARY) { | |
println path | |
def value = propertyState.getValue(Type.BINARY) | |
if (value.blobId && value.blobId.startsWith("6e")) { | |
println value.blobId | |
} | |
} | |
} | |
} | |
} | |
blobSearch = new BlobSearch(session: session) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment