Hi friends, i have a question about making a xpath expression for
filtering resources by a property of type inputStream called data.
How i can do a text search... for example... this is working:
String xpath1 = "<my app path>//element(*, nt:resource)
[jcr:contains(@jcr:mimeType,'*plain*')]";
String xpath2 = "<my app path>//element(*, nt:resource)
[jcr:contains(@jcr:encoding,'*utf*')]";
But this is not working....
String xpath3 = "<my app path>//element(*, nt:resource)
[jcr:contains(@jcr:data,'*plain*')]";
The really fact is that we use some custom nodes.. let's explain the
properties definitions:
In Java Terms...
|public class*Resource*extends BaseNode {
||
/** Encoding media type. It cannot be null or empty. */
@Field(jcrName = "jcr:encoding", jcrDefaultValue = "")
private String encoding;|
|
/** Resource's MIME type. It cannot be null or empty. */
@Field(jcrName="jcr:mimeType", jcrDefaultValue = "")
private String mimeType;
/** Resource's size (bytes). */
@Field(jcrName="skl:size")
private long size;
/** Resource's content data as stream. It cannot be null. */
@Field(jcrName="jcr:data")
private InputStream data;
...
}
||@Node(jcrType = "baseNode", isAbstract = true)
public abstract class*BaseNode*{
@Field(jcrName = "name", id = true)
protected String name;
@Field(jcrName = "creationDate")
protected Date creationDate;
...
}|
And in JackRabbit Terms...
<!-- Base node type definition -->
<nodeType *name="docs:baseNode"*
isMixin="false"
hasOrderableChildNodes="false" >
<supertypes>
<supertype>nt:hierarchyNode</supertype>
</supertypes>
<propertyDefinition name="docs:name"
requiredType="String"
autoCreated="false"
mandatory="true"
onParentVersion="COPY"
protected="false"
multiple="false" />
<propertyDefinition name="docs:searchPath"
requiredType="String"
autoCreated="false"
mandatory="false"
onParentVersion="COPY"
protected="false"
multiple="false" />
<propertyDefinition name="docs:creationDate"
requiredType="Date"
autoCreated="false"
mandatory="true"
onParentVersion="COPY"
protected="false"
multiple="false" />
<propertyDefinition name="docs:lastModified"
requiredType="Date"
autoCreated="false"
mandatory="true"
onParentVersion="COPY"
protected="false"
multiple="false" />
<childNodeDefinition name="*"
defaultPrimaryType="docs:baseNode"
autoCreated="false"
mandatory="false"
onParentVersion="COPY"
protected="false"
sameNameSiblings="false">
<requiredPrimaryTypes>
<requiredPrimaryType>docs:baseNode</requiredPrimaryType>
</requiredPrimaryTypes>
</childNodeDefinition>
</nodeType>
<!-- Resource node type definition -->
<nodeType *name="skl:resource"*
isMixin="false"
hasOrderableChildNodes="false" >
<supertypes>
<supertype>docs:baseNode</supertype>
<supertype>*nt:resource*</supertype>
</supertypes>
<propertyDefinition name="skl:size"
requiredType="Long"
autoCreated="false"
mandatory="true"
onParentVersion="COPY"
protected="false"
multiple="false" />
<propertyDefinition name="skl:externalUri"
requiredType="String"
autoCreated="false"
mandatory="false"
onParentVersion="COPY"
protected="false"
multiple="false" />
</nodeType>
The point is.. how i do this query... in order to filter by jcr:data
property...
Thanks for advance, and for reading this!
Greetings.
Victor.