Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I getting a "Type is unknown" error in Alfresco?

Tags:

alfresco

I’m having problem while adding document with custom aspects (Alfresco 4.2e). It shows the following error:

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

Any help would be much appreciated.

These are my files:

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);

share-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>

custom-slingshot-application-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>

web-client-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-model-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>
like image 327
Arun M R Nair Avatar asked Dec 30 '14 08:12

Arun M R Nair


People also ask

How do I troubleshoot issues with alfresco?

In the alfresco.log file, note the locations of the temporary files containing the SQL statements executed during the upgrade, and make a copy of these temporary files. Submit the log file and temporary files to Alfresco Support. Use these troubleshooting tips when working with rules and actions.

How to extend SYS base in Alfresco Content Model?

If you refer to alfresco content model definitions contentModel.xml you will find that, cm:folder has default child association cm:contains for the type sys:base. So you are able to add node of type that extends sys:base. Each document added to your folder abc:Policy goes as a child.

What is the default search Type for alfresco?

The node displayed is the root node of the selected store. The default search type is set to fts-alfresco. For most administrative tasks, you can use the default search type. See Alfresco Full Text Search reference for more detail.

Can alfresco objects have more than one parent?

In Alfresco objects must have at least one parent. They cannot have zero parents because Alfresco does not support unfiling. The ability for a document to have multiple parents is actually inherent in the underlying repo--you can take advantage of that even if you aren't using CMIS.


1 Answers

It's an old ticket, but I'll answer it.

As object type you'll need to fill in the prefix of the CMIS type.

  • D: for document
  • F: for folder
  • P: for Aspect

In CMIS 1.1 you can add (in your case an Aspect) as cmis:secondaryObjectTypeIds or SECONDARY_OBJECT_TYPE_IDS and prior to 1.1. as cmis:objectTypeId or OBJECT_TYPE_ID

like image 103
Tahir Malik Avatar answered Oct 05 '22 22:10

Tahir Malik