AnsweredAssumed Answered

Aspect doesn't work

Question asked by fabernate on Aug 11, 2012
Latest reply on Oct 30, 2012 by juxxo
Hello

this is my tomcat\shared\classes\alfresco\web-extension\share-config-custom.xml

very simple

<alfresco-config>
  
   <!– Repository Library config section –>
   <config evaluator="string-compare" condition="RepositoryLibrary" replace="true">
      <aspect name="zz:attributes">
         <title>More Attributes</title>
         <properties>
            <property name="zz:docType">
               <type>d:text</type>
            </property>
         
            <property name="zz:refId">
               <type>d:text</type>
            </property>
         </properties>
         <addable></addable>
         <visible>true</visible>
      </aspect>
   </config>
  
</alfresco-config>

and this is the code lines

public Document upload(File f, String mimeType, Folder folder) throws FileNotFoundException {
      ContentStream contentStream = new ContentStreamImpl(f.getName(), null, mimeType, new FileInputStream(f));
      Map<String, Object> properties = new HashMap<String, Object>();
      properties.put(PropertyIds.NAME, contentStream.getFileName());
      properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document, P:zz:attributes");
      properties.put("zz:docType", "CIAO");
      
      return folder.createDocument(properties, contentStream , VersioningState.MAJOR);
   }

I get the floowing exceptions:

Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException: Type 'cmis:document, P:zz:attributes' is unknown!
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:432)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.read(AbstractAtomPubService.java:554)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getTypeDefinitionInternal(AbstractAtomPubService.java:821)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.RepositoryServiceImpl.getTypeDefinition(RepositoryServiceImpl.java:80)
   at org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getTypeDefinition(RepositoryServiceImpl.java:137)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getTypeDefinition(SessionImpl.java:508)
   at org.apache.chemistry.opencmis.client.runtime.repository.ObjectFactoryImpl.convertProperties(ObjectFactoryImpl.java:294)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(SessionImpl.java:716)
   at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:88)
   at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:443)
   at com.lynxspa.util.alfresco.AFRepo.upload(AFRepo.java:107)
   at main.Main.main(Main.java:21)

Obviousely if I remove the code regarding the Aspect it works

Where am I wrong ?

Thanks

Outcomes