jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aleshko, Oleg" <o.ales...@itransition.com>
Subject OCM and indexing
Date Sat, 25 Apr 2009 11:40:10 GMT
Hi, guys!

Can you please point me to an example of how to map binary content so that it will be indexed
with lucene.
Currently I'm trying to do it for List<Object> or byte[] field, however neither of it
works.

@Node(jcrMixinTypes = "mix:referenceable,mix:versionable,mix:lockable")
public class ContentItem1 implements Serializable {
    private String uuid;
    private String path;

    @Field(uuid = true)
    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    @Field(path = true)
    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    @Bean
    protected ContentItem1.DataContent1 dataContent;
    @Field
    protected String href;

    public DataContent1 getDataContent() {
        return dataContent;
    }

    public void setDataContent(DataContent1 dataContent) {
        this.dataContent = dataContent;
    }

    public String getHref() {
        return href;
    }

    public void setHref(String href) {
        this.href = href;
    }

    @Node(jcrType = "nt:resource")
    public static class DataContent1 {
        @Field(jcrName = "jcr:mimeType")
        private String mimeType;
        @Field(jcrName = "jcr:lastModified")
        private Calendar lastModified;
//list returned by JAXB, converter gets plain text from it and returns byte[]
//        @Collection(collectionConverter = AnyTypeCollectionConverter.class, jcrElementName
= "jcr:data")
//        protected List<Object> content;
//        public List<Object> getContent() {
//            return content;
//        }
//
//        public void setContent(List<Object> content) {
//            this.content = content;
//        }

        @Field(jcrName = "jcr:data")
        private byte[] content;

        public byte[] getContent() {
            return content;
        }

        public void setContent(byte[] content) {
            this.content = content;
        }

        public String getMimeType() {
            return mimeType;
        }

        public void setMimeType(String mimeType) {
            this.mimeType = mimeType;
        }

        public Calendar getLastModified() {
            return lastModified;
        }

        public void setLastModified(Calendar lastModified) {
            this.lastModified = lastModified;
        }

    }
}

org.apache.jackrabbit.ocm.exception.JcrMappingException: Unknown mixin type null for mapped
class class ee.bns.editorial.domain.newsml_1_2.ContentItem1$DataContent1; nested exception
is javax.jcr.nodetype.NoSuchNodeTypeException: {http://jackrabbit.apache.org/ocm}discriminator
javax.jcr.nodetype.NoSuchNodeTypeException: {http://jackrabbit.apache.org/ocm}discriminator
                at org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.getEffectiveNodeType(NodeTypeRegistry.java:1019)
                at org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.getEffectiveNodeType(NodeTypeRegistry.java:469)
                at org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl.getNodeType(NodeTypeManagerImpl.java:186)
                at org.apache.jackrabbit.core.NodeImpl.addMixin(NodeImpl.java:1023)
                at org.apache.jackrabbit.core.NodeImpl.addMixin(NodeImpl.java:2784)
                at org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterImpl.addDiscriminatorProperty(ObjectConverterImpl.java:245)
                at org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterImpl.insert(ObjectConverterImpl.java:214)
                at org.apache.jackrabbit.ocm.manager.beanconverter.impl.DefaultBeanConverterImpl.insert(DefaultBeanConverterImpl.java:53)
                at org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterImpl.insertBeanFields(ObjectConverterImpl.java:844)
                at org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterImpl.insert(ObjectConverterImpl.java:226)
                at org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterImpl.insert(ObjectConverterImpl.java:155)
                at org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl.insert(ObjectContentManagerImpl.java:406)



Thanks in advance.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message