为什么我得到一个"类型未知" Alfresco的错误?

时间:2014-12-30 08:34:59

标签: alfresco

我在使用自定义方面添加文档时遇到问题(Alfresco 4.2e)。它显示以下错误:

Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException: Type 'kb:referencable' is unknown!

非常感谢任何帮助。

这些是我的文件:

sample.java

Map<String, String> props = new HashMap<String, String>();
    props.put(PropertyIds.NAME, newDocName);
    props.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document,kb:referencable");
    props.put("kb:documentRef", "My document");
    String content = "sample=================" ;
    byte[] buf = null;
    try {
        buf = content.getBytes("UTF-8");
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    ByteArrayInputStream input = new ByteArrayInputStream(buf);
    ContentStream contentStream = session.getObjectFactory()
            .createContentStream(newDocName, buf.length,
                    "text/plain; charset=UTF-8", input);
    target.createDocument(props, contentStream, VersioningState.MAJOR);

份额-CONFIG-custom.xml

     <aspects>
     <!-- Aspects that a user can see -->
     <visible>
        <aspect name="cm:generalclassifiable" />
        <aspect name="cm:complianceable" />
        <aspect name="cm:dublincore" />
        <aspect name="cm:effectivity" />
        <aspect name="cm:summarizable" />
        <aspect name="cm:versionable" />
        <aspect name="cm:templatable" />
        <aspect name="cm:emailed" />
        <aspect name="emailserver:aliasable" />
        <aspect name="cm:taggable" />
        <aspect name="app:inlineeditable" />
        <aspect name="gd:googleEditable" />
        <aspect name="cm:geographic" />
        <aspect name="exif:exif" />
        <aspect name="audio:audio" />
        <aspect name="cm:indexControl" />
        <aspect name="dp:restrictable" />
        <aspect name="kb:referencable" />
     </visible>

     <!-- Aspects that a user can add. Same as "visible" if left empty -->
     <addable>
     </addable>

     <!-- Aspects that a user can remove. Same as "visible" if left empty -->
     <removeable>
     </removeable>
    </aspects>

自定义-弹弓应用context.xml.sample

 <bean id="webscripts.kb.resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
  <property name="resourceBundles">
     <list>
        <value>alfresco.messages.knowledgebase</value>
     </list>
  </property>
 </bean>

网络的客户端-CONFIG-custom.xml.sample

<config evaluator="aspect-name" condition="kb:referencable">
     <property-sheet>
         <show-property name="kb:documentRef"/>
    </property-sheet>
</config>
<config evaluator="string-compare" condition="Action Wizards">
    <aspects>
        <aspect name="my:docProps" />
    </aspects>
</config>

KB-model.xml

<aspects>
  <!-- Definition of new Content Aspect: Knowledge Base Document -->
  <aspect name="kb:referencable">
     <title>Knowledge Base Referencable</title>
     <properties>
        <property name="kb:documentRef">
           <type>d:text</type>
        </property>
     </properties>
  </aspect>
 </aspects>

KB-模型context.xml中

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<!-- Registration of new models -->
<bean id="extension.kb.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
    <property name="models">
        <list>
            <value>alfresco/extension/kb-model.xml</value>
        </list>
    </property>
</bean>

 <bean id="extension.kb.resourceBundle"   class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
   <property name="resourceBundles">
      <list>
         <value>alfresco.messages.knowledgebase</value>
      </list>
   </property>
</bean>
</beans>

1 个答案:

答案 0 :(得分:5)

这是一张旧票,但我会回答。

作为对象类型,您需要填写CMIS类型的前缀。

  • D:for document
  • F:用于文件夹
  • P:for Aspect

在CMIS 1.1中,您可以添加(在您的情况下为Aspect) cmis:secondaryObjectTypeIds 或SECONDARY_OBJECT_TYPE_IDS以及1.1之前。 as cmis:objectTypeId 或OBJECT_TYPE_ID